From f2878d15c80e2b83a7ce3793ff7d05357a7f6785 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 1 Jul 2022 12:31:28 -0700 Subject: [PATCH 001/141] Do not look for load/reference directives when there can't be any --- .../CSharp/Portable/Syntax/CompilationUnitSyntax.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs b/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs index c7093242604ea..27f672acccf2e 100644 --- a/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs +++ b/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax { @@ -19,9 +20,12 @@ public IList GetReferenceDirectives() internal IList GetReferenceDirectives(Func? filter) { + if (!this.ContainsDirectives) + return SpecializedCollections.EmptyList(); + // #r directives are always on the first token of the compilation unit. var firstToken = (SyntaxNodeOrToken)this.GetFirstToken(includeZeroWidth: true); - return firstToken.GetDirectives(filter); + return firstToken.GetDirectives(filter); } /// @@ -29,6 +33,9 @@ internal IList GetReferenceDirectives(Func public IList GetLoadDirectives() { + if (!this.ContainsDirectives) + return SpecializedCollections.EmptyList(); + // #load directives are always on the first token of the compilation unit. var firstToken = (SyntaxNodeOrToken)this.GetFirstToken(includeZeroWidth: true); return firstToken.GetDirectives(filter: null); From cdc0887bac363b18ce0c1d170b83eb307eb42dc4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 1 Jul 2022 14:07:06 -0700 Subject: [PATCH 002/141] Provide noallocation helper --- .../Portable/Syntax/CSharpSyntaxTree.cs | 2 +- .../Portable/Syntax/CompilationUnitSyntax.cs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs b/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs index 6a6b48dbe3346..bf56d8d7cec51 100644 --- a/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs +++ b/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs @@ -124,7 +124,7 @@ internal bool HasReferenceOrLoadDirectives if (Options.Kind == SourceCodeKind.Script) { var compilationUnitRoot = GetCompilationUnitRoot(); - return compilationUnitRoot.GetReferenceDirectives().Count > 0 || compilationUnitRoot.GetLoadDirectives().Count > 0; + return compilationUnitRoot.HasReferenceOrLoadDirectives(); } return false; diff --git a/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs b/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs index 27f672acccf2e..29df91c66ab3e 100644 --- a/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs +++ b/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs @@ -41,6 +41,25 @@ public IList GetLoadDirectives() return firstToken.GetDirectives(filter: null); } + internal bool HasReferenceOrLoadDirectives() + { + if (this.ContainsDirectives) + { + // #r and #load directives are always on the first token of the compilation unit. + var firstToken = this.GetFirstToken(includeZeroWidth: true); + if (firstToken.ContainsDirectives) + { + foreach (var trivia in firstToken.LeadingTrivia) + { + if (trivia.GetStructure() is ReferenceDirectiveTriviaSyntax or LoadDirectiveTriviaSyntax) + return true; + } + } + } + + return false; + } + internal Syntax.InternalSyntax.DirectiveStack GetConditionalDirectivesStack() { IEnumerable directives = this.GetDirectives(filter: IsActiveConditionalDirective); From 2c0c993505a5cdea54deeb142aa4afe9603cc5e1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 1 Jul 2022 14:19:15 -0700 Subject: [PATCH 003/141] Use in more locations --- .../CSharp/Portable/Syntax/CSharpSyntaxTree.cs | 4 ++-- .../Portable/Syntax/CompilationUnitSyntax.cs | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs b/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs index bf56d8d7cec51..0310f5a0bc92a 100644 --- a/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs +++ b/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs @@ -111,7 +111,7 @@ internal bool HasReferenceDirectives { Debug.Assert(HasCompilationUnitRoot); - return Options.Kind == SourceCodeKind.Script && GetCompilationUnitRoot().GetReferenceDirectives().Count > 0; + return Options.Kind == SourceCodeKind.Script && GetCompilationUnitRoot().HasReferenceDirectives; } } @@ -124,7 +124,7 @@ internal bool HasReferenceOrLoadDirectives if (Options.Kind == SourceCodeKind.Script) { var compilationUnitRoot = GetCompilationUnitRoot(); - return compilationUnitRoot.HasReferenceOrLoadDirectives(); + return compilationUnitRoot.HasReferenceDirectives || compilationUnitRoot.HasLoadDirectives; } return false; diff --git a/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs b/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs index 29df91c66ab3e..cb387fd8d7954 100644 --- a/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs +++ b/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs @@ -41,18 +41,28 @@ public IList GetLoadDirectives() return firstToken.GetDirectives(filter: null); } - internal bool HasReferenceOrLoadDirectives() + internal bool HasReferenceDirectives + // #r and #load directives are always on the first token of the compilation unit. + => HasFirstTokenDirective(static n => n is ReferenceDirectiveTriviaSyntax); + + internal bool HasLoadDirectives + // #r and #load directives are always on the first token of the compilation unit. + => HasFirstTokenDirective(static n => n is LoadDirectiveTriviaSyntax); + + private bool HasFirstTokenDirective(Func predicate) { if (this.ContainsDirectives) { - // #r and #load directives are always on the first token of the compilation unit. var firstToken = this.GetFirstToken(includeZeroWidth: true); if (firstToken.ContainsDirectives) { foreach (var trivia in firstToken.LeadingTrivia) { - if (trivia.GetStructure() is ReferenceDirectiveTriviaSyntax or LoadDirectiveTriviaSyntax) + if (trivia.GetStructure() is { } structure && + predicate(structure)) + { return true; + } } } } From 82f7347ba720b47f400d261d0fae795cf7e55850 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 13 Apr 2023 18:02:15 -0700 Subject: [PATCH 004/141] Use a struct for suppressions --- .../Core/Extensions/ListExtensions.cs | 19 +++++++++ .../FormattingContext.InitialContextFinder.cs | 41 +++++++++---------- .../Formatting/Context/FormattingContext.cs | 13 ++---- .../Rules/Operations/SuppressOperation.cs | 13 +++--- 4 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs index 879b628a01346..b1666ca51f4ed 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs @@ -39,6 +39,25 @@ public static void RemoveOrTransformAll(this List list, Func(this List list, Func transform, TArg arg) + where T : struct + { + RoslynDebug.AssertNotNull(list); + RoslynDebug.AssertNotNull(transform); + + var targetIndex = 0; + for (var sourceIndex = 0; sourceIndex < list.Count; sourceIndex++) + { + var newValue = transform(list[sourceIndex], arg); + if (newValue is null) + continue; + + list[targetIndex++] = newValue.Value; + } + + list.RemoveRange(targetIndex, list.Count - targetIndex); + } + /// /// Attempts to remove the first item selected by . /// diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.InitialContextFinder.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.InitialContextFinder.cs index 23175b9064188..9d260a7e57e7b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.InitialContextFinder.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.InitialContextFinder.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -152,46 +153,42 @@ private List GetInitialIndentBlockOperations(SyntaxToken s // operation has found var list = new List(); - bool predicate(SuppressOperation o) + var currentIndentationNode = startNode; + Predicate predicate = Predicate; + while (currentIndentationNode != null) { - if (o == null) + _formattingRules.AddSuppressOperations(list, currentIndentationNode); + + list.RemoveAll(predicate); + if (list.Count > 0) { - return true; + return list; } - if (!o.TextSpan.Contains(startPosition)) + currentIndentationNode = currentIndentationNode.Parent; + } + + return null; + + bool Predicate(SuppressOperation operation) + { + if (!operation.TextSpan.Contains(startPosition)) { return true; } - if (o.ContainsElasticTrivia(_tokenStream) && !o.Option.IsOn(SuppressOption.IgnoreElasticWrapping)) + if (operation.ContainsElasticTrivia(_tokenStream) && !operation.Option.IsOn(SuppressOption.IgnoreElasticWrapping)) { return true; } - if (!o.Option.IsMaskOn(mask)) + if (!operation.Option.IsMaskOn(mask)) { return true; } return false; } - - var currentIndentationNode = startNode; - while (currentIndentationNode != null) - { - _formattingRules.AddSuppressOperations(list, currentIndentationNode); - - list.RemoveAll(predicate); - if (list.Count > 0) - { - return list; - } - - currentIndentationNode = currentIndentationNode.Parent; - } - - return null; } } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.cs index df46f5c1b8a75..da97a94dff502 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.cs @@ -264,10 +264,8 @@ public void AddIndentBlockOperation(IndentBlockOperation operation) public void AddInitialSuppressOperation(SuppressOperation operation) { // don't add stuff if it is empty - if (operation == null || operation.TextSpan.IsEmpty) - { + if (operation.TextSpan.IsEmpty) return; - } var onSameLine = _tokenStream.TwoTokensOriginallyOnSameLine(operation.StartToken, operation.EndToken); AddSuppressOperation(operation, onSameLine); @@ -320,8 +318,7 @@ private void AddSuppressOperation(SuppressOperation operation, bool onSameLine) private void AddSpacingSuppressOperation(SuppressOperation operation, bool twoTokensOnSameLine) { // don't add stuff if it is empty - if (operation == null || - operation.TextSpan.IsEmpty) + if (operation.TextSpan.IsEmpty) { return; } @@ -348,8 +345,7 @@ private void AddSpacingSuppressOperation(SuppressOperation operation, bool twoTo private void AddFormattingSuppressOperation(SuppressOperation operation) { // don't add stuff if it is empty - if (operation == null || - operation.TextSpan.IsEmpty) + if (operation.TextSpan.IsEmpty) { return; } @@ -370,8 +366,7 @@ private void AddFormattingSuppressOperation(SuppressOperation operation) private void AddWrappingSuppressOperation(SuppressOperation operation, bool twoTokensOnSameLine) { // don't add stuff if it is empty - if (operation == null || - operation.TextSpan.IsEmpty) + if (operation.TextSpan.IsEmpty) { return; } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Rules/Operations/SuppressOperation.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Rules/Operations/SuppressOperation.cs index 2f9f9a5780503..be9b25b3689db 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Rules/Operations/SuppressOperation.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Rules/Operations/SuppressOperation.cs @@ -10,8 +10,13 @@ namespace Microsoft.CodeAnalysis.Formatting.Rules /// /// suppress formatting operations within the given text span /// - internal sealed class SuppressOperation + internal readonly struct SuppressOperation { + public readonly TextSpan TextSpan; + public readonly SuppressOption Option; + public readonly SyntaxToken StartToken; + public readonly SyntaxToken EndToken; + internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) { Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); @@ -25,12 +30,6 @@ internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpa this.EndToken = endToken; } - public TextSpan TextSpan { get; } - public SuppressOption Option { get; } - - public SyntaxToken StartToken { get; } - public SyntaxToken EndToken { get; } - #if DEBUG public override string ToString() => $"Suppress {TextSpan} from '{StartToken}' to '{EndToken}' with '{Option}'"; From 7623f799c9ec3990b4e4e713adac4fe18edc4b34 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 13 Apr 2023 18:08:46 -0700 Subject: [PATCH 005/141] Fix --- .../Portable/BraceCompletion/CurlyBraceCompletionService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/CSharp/Portable/BraceCompletion/CurlyBraceCompletionService.cs b/src/Features/CSharp/Portable/BraceCompletion/CurlyBraceCompletionService.cs index c6de9c86395a5..06f6dcc983191 100644 --- a/src/Features/CSharp/Portable/BraceCompletion/CurlyBraceCompletionService.cs +++ b/src/Features/CSharp/Portable/BraceCompletion/CurlyBraceCompletionService.cs @@ -89,7 +89,7 @@ protected override ImmutableArray GetBraceFormattingInde private sealed class BraceCompletionFormattingRule : BaseFormattingRule { - private static readonly Predicate s_predicate = o => o == null || o.Option.IsOn(SuppressOption.NoWrapping); + private static readonly Predicate s_predicate = o => o.Option.IsOn(SuppressOption.NoWrapping); private static readonly ImmutableArray s_instances = ImmutableArray.Create( new BraceCompletionFormattingRule(FormattingOptions2.IndentStyle.None), From 00a852b4046fed7979f901be4940a8538d01f0c4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 1 Jun 2023 11:16:43 -0700 Subject: [PATCH 006/141] Update dependencies from https://github.com/dotnet/arcade build 20230531.4 (#68410) Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 7.0.0-beta.23254.2 -> To Version 7.0.0-beta.23281.4 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/common/templates/job/job.yml | 12 ++++++++---- global.json | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 85db0a31a69a2..df76609279c76 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -13,18 +13,18 @@ - + https://github.com/dotnet/arcade - 23a23b5025d64557329b638329c136ebbc20989b + 6a71ed4ba6a70e66abe9f9bdc4009fa1de35132f https://github.com/dotnet/roslyn c1d8c6f043bc80425c6828455eb57f8a404759c6 - + https://github.com/dotnet/arcade - 23a23b5025d64557329b638329c136ebbc20989b + 6a71ed4ba6a70e66abe9f9bdc4009fa1de35132f diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 486eef770dd34..ef337eac55ecf 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -73,6 +73,10 @@ jobs: - ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}: - name: EnableRichCodeNavigation value: 'true' + # Retry signature validation up to three times, waiting 2 seconds between attempts. + # See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures + - name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY + value: 3,2000 - ${{ each variable in parameters.variables }}: # handle name-value variable syntax # example: @@ -81,7 +85,7 @@ jobs: - ${{ if ne(variable.name, '') }}: - name: ${{ variable.name }} value: ${{ variable.value }} - + # handle variable groups - ${{ if ne(variable.group, '') }}: - group: ${{ variable.group }} @@ -155,7 +159,7 @@ jobs: - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: MicroBuildCleanup@1 - displayName: Execute Microbuild cleanup tasks + displayName: Execute Microbuild cleanup tasks condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} env: @@ -223,7 +227,7 @@ jobs: displayName: Publish XUnit Test Results inputs: testResultsFormat: 'xUnit' - testResultsFiles: '*.xml' + testResultsFiles: '*.xml' searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit mergeTestResults: ${{ parameters.mergeTestResults }} @@ -234,7 +238,7 @@ jobs: displayName: Publish TRX Test Results inputs: testResultsFormat: 'VSTest' - testResultsFiles: '*.trx' + testResultsFiles: '*.trx' searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx mergeTestResults: ${{ parameters.mergeTestResults }} diff --git a/global.json b/global.json index b550ad9b21216..053b00cbec242 100644 --- a/global.json +++ b/global.json @@ -17,7 +17,7 @@ "xcopy-msbuild": "17.2.1" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23254.2", - "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23254.2" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23281.4", + "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.23281.4" } } From ae574dc36f7be6b1c9ca84e7b8f8505d60d1635c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Jun 2023 12:15:11 -0700 Subject: [PATCH 007/141] Remove internal property from data rename computes --- .../AbstractEncapsulateFieldService.cs | 4 ++-- .../AbstractUseAutoPropertyCodeFixProvider.cs | 5 +++-- .../ConflictResolver.Session.cs | 4 +++- .../Rename/ConflictEngine/ConflictResolver.cs | 12 ++++++----- .../Portable/Rename/IRemoteRenamerService.cs | 4 +--- .../Rename/LightweightRenameLocations.cs | 20 +++++++------------ .../Core/Portable/Rename/Renamer.cs | 9 +++++---- .../Rename/SymbolicRenameLocations.cs | 7 ++----- 8 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/Features/Core/Portable/EncapsulateField/AbstractEncapsulateFieldService.cs b/src/Features/Core/Portable/EncapsulateField/AbstractEncapsulateFieldService.cs index 9e2b23aa0aef3..2c05daeae1773 100644 --- a/src/Features/Core/Portable/EncapsulateField/AbstractEncapsulateFieldService.cs +++ b/src/Features/Core/Portable/EncapsulateField/AbstractEncapsulateFieldService.cs @@ -312,10 +312,10 @@ private static async Task RenameAsync( RenameFile: false); var initialLocations = await Renamer.FindRenameLocationsAsync( - solution, field, options, fallbackOptions, cancellationToken).ConfigureAwait(false); + solution, field, options, cancellationToken).ConfigureAwait(false); var resolution = await initialLocations.Filter(filter).ResolveConflictsAsync( - field, finalName, nonConflictSymbolKeys: default, cancellationToken).ConfigureAwait(false); + field, finalName, nonConflictSymbolKeys: default, fallbackOptions, cancellationToken).ConfigureAwait(false); Contract.ThrowIfFalse(resolution.IsSuccessful); diff --git a/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs b/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs index 87b7af95eb498..0979eca0cb18d 100644 --- a/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs +++ b/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs @@ -90,7 +90,7 @@ private async Task ProcessResultAsync(CodeFixContext context, Diagnost var renameOptions = new SymbolRenameOptions(); var fieldLocations = await Renamer.FindRenameLocationsAsync( - solution, fieldSymbol, renameOptions, context.Options, cancellationToken).ConfigureAwait(false); + solution, fieldSymbol, renameOptions, cancellationToken).ConfigureAwait(false); // First, create the updated property we want to replace the old property with var isWrittenToOutsideOfConstructor = IsWrittenToOutsideOfConstructorOrProperty(fieldSymbol, fieldLocations, property, cancellationToken); @@ -138,7 +138,8 @@ private async Task ProcessResultAsync(CodeFixContext context, Diagnost var resolution = await filteredLocations.ResolveConflictsAsync( fieldSymbol, propertySymbol.Name, - nonConflictSymbolKeys: ImmutableArray.Create(propertySymbol.GetSymbolKey(cancellationToken)), cancellationToken).ConfigureAwait(false); + nonConflictSymbolKeys: ImmutableArray.Create(propertySymbol.GetSymbolKey(cancellationToken)), + context.Options, cancellationToken).ConfigureAwait(false); Contract.ThrowIfFalse(resolution.IsSuccessful); diff --git a/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs b/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs index 6172053574f17..f350826154ff0 100644 --- a/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs +++ b/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs @@ -50,12 +50,14 @@ private class Session public Session( SymbolicRenameLocations renameLocationSet, + CodeCleanupOptionsProvider fallbackOptions, Location renameSymbolDeclarationLocation, string replacementText, ImmutableArray nonConflictSymbolKeys, CancellationToken cancellationToken) { _renameLocationSet = renameLocationSet; + this.FallbackOptions = fallbackOptions; _renameSymbolDeclarationLocation = renameSymbolDeclarationLocation; _originalText = renameLocationSet.Symbol.Name; _replacementText = replacementText; @@ -71,7 +73,7 @@ public Session( } private SymbolRenameOptions RenameOptions => _renameLocationSet.Options; - private CodeCleanupOptionsProvider FallbackOptions => _renameLocationSet.FallbackOptions; + private CodeCleanupOptionsProvider FallbackOptions { get; } private readonly struct ConflictLocationInfo { diff --git a/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.cs b/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.cs index 7ca65141ff900..5f6e7c346f7a6 100644 --- a/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.cs +++ b/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.cs @@ -54,6 +54,7 @@ internal static async Task ResolveLightweightConflictsAsync( LightweightRenameLocations lightweightRenameLocations, string replacementText, ImmutableArray nonConflictSymbolKeys, + CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -70,7 +71,7 @@ internal static async Task ResolveLightweightConflictsAsync( var result = await client.TryInvokeAsync( solution, (service, solutionInfo, callbackId, cancellationToken) => service.ResolveConflictsAsync(solutionInfo, callbackId, serializableSymbol, serializableLocationSet, replacementText, nonConflictSymbolKeys, cancellationToken), - callbackTarget: new RemoteOptionsProvider(solution.Services, lightweightRenameLocations.FallbackOptions), + callbackTarget: new RemoteOptionsProvider(solution.Services, fallbackOptions), cancellationToken).ConfigureAwait(false); if (result.HasValue && result.Value != null) @@ -85,7 +86,7 @@ internal static async Task ResolveLightweightConflictsAsync( return new ConflictResolution(WorkspacesResources.Failed_to_resolve_rename_conflicts); return await ResolveSymbolicLocationConflictsInCurrentProcessAsync( - heavyweightLocations, replacementText, nonConflictSymbolKeys, cancellationToken).ConfigureAwait(false); + heavyweightLocations, replacementText, nonConflictSymbolKeys, fallbackOptions, cancellationToken).ConfigureAwait(false); } /// @@ -96,6 +97,7 @@ internal static async Task ResolveSymbolicLocationConflictsI SymbolicRenameLocations renameLocations, string replacementText, ImmutableArray nonConflictSymbolKeys, + CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken) { // when someone e.g. renames a symbol from metadata through the API (IDE blocks this), we need to return @@ -107,13 +109,14 @@ internal static async Task ResolveSymbolicLocationConflictsI } var resolution = await ResolveMutableConflictsAsync( - renameLocations, renameSymbolDeclarationLocation, replacementText, nonConflictSymbolKeys, cancellationToken).ConfigureAwait(false); + renameLocations, fallbackOptions, renameSymbolDeclarationLocation, replacementText, nonConflictSymbolKeys, cancellationToken).ConfigureAwait(false); return resolution.ToConflictResolution(); } private static Task ResolveMutableConflictsAsync( SymbolicRenameLocations renameLocationSet, + CodeCleanupOptionsProvider fallbackOptions, Location renameSymbolDeclarationLocation, string replacementText, ImmutableArray nonConflictSymbolKeys, @@ -121,8 +124,7 @@ private static Task ResolveMutableConflictsAsync( { cancellationToken.ThrowIfCancellationRequested(); var session = new Session( - renameLocationSet, renameSymbolDeclarationLocation, - replacementText, nonConflictSymbolKeys, cancellationToken); + renameLocationSet, fallbackOptions, renameSymbolDeclarationLocation, replacementText, nonConflictSymbolKeys, cancellationToken); return session.ResolveConflictsAsync(); } diff --git a/src/Workspaces/Core/Portable/Rename/IRemoteRenamerService.cs b/src/Workspaces/Core/Portable/Rename/IRemoteRenamerService.cs index a99489336a6fb..e5e30cb30011a 100644 --- a/src/Workspaces/Core/Portable/Rename/IRemoteRenamerService.cs +++ b/src/Workspaces/Core/Portable/Rename/IRemoteRenamerService.cs @@ -44,7 +44,6 @@ internal interface ICallback // : IRemoteOptionsCallback ValueTask FindRenameLocationsAsync( Checksum solutionChecksum, - RemoteServiceCallbackId callbackId, SerializableSymbolAndProjectId symbolAndProjectId, SymbolRenameOptions options, CancellationToken cancellationToken); @@ -152,7 +151,7 @@ public SerializableRenameLocations Dehydrate() internal partial class SymbolicRenameLocations { internal static async Task TryRehydrateAsync( - ISymbol symbol, Solution solution, CodeCleanupOptionsProvider fallbackOptions, SerializableRenameLocations serializableLocations, CancellationToken cancellationToken) + ISymbol symbol, Solution solution, SerializableRenameLocations serializableLocations, CancellationToken cancellationToken) { Contract.ThrowIfNull(serializableLocations); @@ -171,7 +170,6 @@ internal partial class SymbolicRenameLocations symbol, solution, serializableLocations.Options, - fallbackOptions, locations, implicitLocations, referencedSymbols); diff --git a/src/Workspaces/Core/Portable/Rename/LightweightRenameLocations.cs b/src/Workspaces/Core/Portable/Rename/LightweightRenameLocations.cs index 371c530dfcea2..88cd77bef12ec 100644 --- a/src/Workspaces/Core/Portable/Rename/LightweightRenameLocations.cs +++ b/src/Workspaces/Core/Portable/Rename/LightweightRenameLocations.cs @@ -25,7 +25,6 @@ internal sealed partial class LightweightRenameLocations { public readonly Solution Solution; public readonly SymbolRenameOptions Options; - public readonly CodeCleanupOptionsProvider FallbackOptions; public readonly ImmutableArray Locations; private readonly ImmutableArray _implicitLocations; @@ -34,7 +33,6 @@ internal sealed partial class LightweightRenameLocations private LightweightRenameLocations( Solution solution, SymbolRenameOptions options, - CodeCleanupOptionsProvider fallbackOptions, ImmutableArray locations, ImmutableArray implicitLocations, ImmutableArray referencedSymbols) @@ -44,7 +42,6 @@ private LightweightRenameLocations( Contract.ThrowIfTrue(referencedSymbols.IsDefault); Solution = solution; Options = options; - FallbackOptions = fallbackOptions; Locations = locations; _implicitLocations = implicitLocations; _referencedSymbols = referencedSymbols; @@ -65,7 +62,6 @@ private LightweightRenameLocations( symbol, Solution, Options, - FallbackOptions, Locations, implicitLocations, referencedSymbols); @@ -75,7 +71,7 @@ private LightweightRenameLocations( /// Find the locations that need to be renamed. Can cross process boundaries efficiently to do this. /// public static async Task FindRenameLocationsAsync( - ISymbol symbol, Solution solution, SymbolRenameOptions options, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken) + ISymbol symbol, Solution solution, SymbolRenameOptions options, CancellationToken cancellationToken) { Contract.ThrowIfNull(solution); Contract.ThrowIfNull(symbol); @@ -91,15 +87,14 @@ public static async Task FindRenameLocationsAsync( { var result = await client.TryInvokeAsync( solution, - (service, solutionInfo, callbackId, cancellationToken) => service.FindRenameLocationsAsync(solutionInfo, callbackId, serializedSymbol, options, cancellationToken), - callbackTarget: new RemoteOptionsProvider(solution.Services, fallbackOptions), + (service, solutionInfo, cancellationToken) => service.FindRenameLocationsAsync(solutionInfo, serializedSymbol, options, cancellationToken), cancellationToken).ConfigureAwait(false); if (result.HasValue && result.Value != null) { var rehydratedLocations = await result.Value.RehydrateLocationsAsync(solution, cancellationToken).ConfigureAwait(false); return new LightweightRenameLocations( - solution, options, fallbackOptions, + solution, options, rehydratedLocations, result.Value.ImplicitLocations, result.Value.ReferencedSymbols); @@ -112,22 +107,21 @@ public static async Task FindRenameLocationsAsync( // Couldn't effectively search in OOP. Perform the search in-proc. var renameLocations = await SymbolicRenameLocations.FindLocationsInCurrentProcessAsync( - symbol, solution, options, fallbackOptions, cancellationToken).ConfigureAwait(false); + symbol, solution, options, cancellationToken).ConfigureAwait(false); return new LightweightRenameLocations( - solution, options, fallbackOptions, renameLocations.Locations, + solution, options, renameLocations.Locations, renameLocations.ImplicitLocations.SelectAsArray(loc => SerializableReferenceLocation.Dehydrate(loc, cancellationToken)), renameLocations.ReferencedSymbols.SelectAsArray(sym => SerializableSymbolAndProjectId.Dehydrate(solution, sym, cancellationToken))); } - public Task ResolveConflictsAsync(ISymbol symbol, string replacementText, ImmutableArray nonConflictSymbolKeys, CancellationToken cancellationToken) - => ConflictResolver.ResolveLightweightConflictsAsync(symbol, this, replacementText, nonConflictSymbolKeys, cancellationToken); + public Task ResolveConflictsAsync(ISymbol symbol, string replacementText, ImmutableArray nonConflictSymbolKeys, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken) + => ConflictResolver.ResolveLightweightConflictsAsync(symbol, this, replacementText, nonConflictSymbolKeys, fallbackOptions, cancellationToken); public LightweightRenameLocations Filter(Func filter) => new( this.Solution, this.Options, - this.FallbackOptions, this.Locations.WhereAsArray(loc => filter(loc.DocumentId, loc.Location.SourceSpan)), _implicitLocations.WhereAsArray(loc => filter(loc.Document, loc.Location)), _referencedSymbols); diff --git a/src/Workspaces/Core/Portable/Rename/Renamer.cs b/src/Workspaces/Core/Portable/Rename/Renamer.cs index 2fb93164df691..f764f7ce5b5d0 100644 --- a/src/Workspaces/Core/Portable/Rename/Renamer.cs +++ b/src/Workspaces/Core/Portable/Rename/Renamer.cs @@ -148,8 +148,8 @@ internal static async Task RenameDocumentAsync( } /// - internal static Task FindRenameLocationsAsync(Solution solution, ISymbol symbol, SymbolRenameOptions options, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken) - => LightweightRenameLocations.FindRenameLocationsAsync(symbol, solution, options, fallbackOptions, cancellationToken); + internal static Task FindRenameLocationsAsync(Solution solution, ISymbol symbol, SymbolRenameOptions options, CancellationToken cancellationToken) + => LightweightRenameLocations.FindRenameLocationsAsync(symbol, solution, options, cancellationToken); internal static async Task RenameSymbolAsync( Solution solution, @@ -217,8 +217,9 @@ private static async Task RenameSymbolInCurrentProcessAsync( // Since we know we're in the oop process, we know we won't need to make more OOP calls. Since this is the // rename entry-point that does the entire rename, we can directly use the heavyweight RenameLocations type, // without having to go through any intermediary LightweightTypes. - var renameLocations = await SymbolicRenameLocations.FindLocationsInCurrentProcessAsync(symbol, solution, options, cleanupOptions, cancellationToken).ConfigureAwait(false); - return await ConflictResolver.ResolveSymbolicLocationConflictsInCurrentProcessAsync(renameLocations, newName, nonConflictSymbolKeys, cancellationToken).ConfigureAwait(false); + var renameLocations = await SymbolicRenameLocations.FindLocationsInCurrentProcessAsync(symbol, solution, options, cancellationToken).ConfigureAwait(false); + return await ConflictResolver.ResolveSymbolicLocationConflictsInCurrentProcessAsync( + renameLocations, newName, nonConflictSymbolKeys, cleanupOptions, cancellationToken).ConfigureAwait(false); } } } diff --git a/src/Workspaces/Core/Portable/Rename/SymbolicRenameLocations.cs b/src/Workspaces/Core/Portable/Rename/SymbolicRenameLocations.cs index 8e5545a0bff81..8cfa60ff2fbaa 100644 --- a/src/Workspaces/Core/Portable/Rename/SymbolicRenameLocations.cs +++ b/src/Workspaces/Core/Portable/Rename/SymbolicRenameLocations.cs @@ -30,7 +30,6 @@ internal sealed partial class SymbolicRenameLocations public readonly Solution Solution; public readonly ISymbol Symbol; public readonly SymbolRenameOptions Options; - public readonly CodeCleanupOptionsProvider FallbackOptions; public readonly ImmutableArray Locations; public readonly ImmutableArray ImplicitLocations; @@ -40,7 +39,6 @@ public SymbolicRenameLocations( ISymbol symbol, Solution solution, SymbolRenameOptions options, - CodeCleanupOptionsProvider fallbackOptions, ImmutableArray locations, ImmutableArray implicitLocations, ImmutableArray referencedSymbols) @@ -53,7 +51,6 @@ public SymbolicRenameLocations( Solution = solution; Symbol = symbol; Options = options; - FallbackOptions = fallbackOptions; Locations = locations; ReferencedSymbols = referencedSymbols; ImplicitLocations = implicitLocations; @@ -63,7 +60,7 @@ public SymbolicRenameLocations( /// Attempts to find all the locations to rename. Will not cross any process boundaries to do this. /// public static async Task FindLocationsInCurrentProcessAsync( - ISymbol symbol, Solution solution, SymbolRenameOptions options, CodeCleanupOptionsProvider cleanupOptions, CancellationToken cancellationToken) + ISymbol symbol, Solution solution, SymbolRenameOptions options, CancellationToken cancellationToken) { Contract.ThrowIfNull(symbol); using (Logger.LogBlock(FunctionId.Rename_AllRenameLocations, cancellationToken)) @@ -111,7 +108,7 @@ public static async Task FindLocationsInCurrentProcessA mergedLocations.RemoveDuplicates(); return new SymbolicRenameLocations( - symbol, solution, options, cleanupOptions, + symbol, solution, options, mergedLocations.ToImmutable(), mergedImplicitLocations.ToImmutable(), mergedReferencedSymbols.ToImmutable()); From ae0316b52bdfe5cc1528b9876956ff4b06c12abf Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Jun 2023 12:21:41 -0700 Subject: [PATCH 008/141] More move --- ...InlineRenameService.InlineRenameLocationSet.cs | 15 ++++++++++++--- ...tEditorInlineRenameService.SymbolRenameInfo.cs | 4 ++-- .../AbstractUseAutoPropertyCodeFixProvider.cs | 2 +- .../Protocol/Handler/Rename/RenameHandler.cs | 5 +++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/EditorFeatures/Core/InlineRename/AbstractEditorInlineRenameService.InlineRenameLocationSet.cs b/src/EditorFeatures/Core/InlineRename/AbstractEditorInlineRenameService.InlineRenameLocationSet.cs index fc13b583fc7b3..9a52069e3b835 100644 --- a/src/EditorFeatures/Core/InlineRename/AbstractEditorInlineRenameService.InlineRenameLocationSet.cs +++ b/src/EditorFeatures/Core/InlineRename/AbstractEditorInlineRenameService.InlineRenameLocationSet.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeCleanup; using Microsoft.CodeAnalysis.Rename; using Microsoft.CodeAnalysis.Rename.ConflictEngine; @@ -17,14 +18,19 @@ internal abstract partial class AbstractEditorInlineRenameService private class InlineRenameLocationSet : IInlineRenameLocationSet { private readonly LightweightRenameLocations _renameLocationSet; + private readonly CodeCleanupOptionsProvider _fallbackOptions; private readonly SymbolInlineRenameInfo _renameInfo; public IList Locations { get; } - public InlineRenameLocationSet(SymbolInlineRenameInfo renameInfo, LightweightRenameLocations renameLocationSet) + public InlineRenameLocationSet( + SymbolInlineRenameInfo renameInfo, + LightweightRenameLocations renameLocationSet, + CodeCleanupOptionsProvider fallbackOptions) { _renameInfo = renameInfo; _renameLocationSet = renameLocationSet; + _fallbackOptions = fallbackOptions; this.Locations = renameLocationSet.Locations.Where(RenameLocation.ShouldRename) .Select(ConvertLocation) .ToImmutableArray(); @@ -36,10 +42,13 @@ private InlineRenameLocation ConvertLocation(RenameLocation location) _renameLocationSet.Solution.GetDocument(location.DocumentId), location.Location.SourceSpan); } - public async Task GetReplacementsAsync(string replacementText, SymbolRenameOptions options, CancellationToken cancellationToken) + public async Task GetReplacementsAsync( + string replacementText, + SymbolRenameOptions options, + CancellationToken cancellationToken) { var conflicts = await _renameLocationSet.ResolveConflictsAsync( - _renameInfo.RenameSymbol, _renameInfo.GetFinalSymbolName(replacementText), nonConflictSymbolKeys: default, cancellationToken).ConfigureAwait(false); + _renameInfo.RenameSymbol, _renameInfo.GetFinalSymbolName(replacementText), nonConflictSymbolKeys: default, _fallbackOptions, cancellationToken).ConfigureAwait(false); return new InlineRenameReplacementInfo(conflicts); } diff --git a/src/EditorFeatures/Core/InlineRename/AbstractEditorInlineRenameService.SymbolRenameInfo.cs b/src/EditorFeatures/Core/InlineRename/AbstractEditorInlineRenameService.SymbolRenameInfo.cs index ca68633a95ac3..f1aa077a7b607 100644 --- a/src/EditorFeatures/Core/InlineRename/AbstractEditorInlineRenameService.SymbolRenameInfo.cs +++ b/src/EditorFeatures/Core/InlineRename/AbstractEditorInlineRenameService.SymbolRenameInfo.cs @@ -139,9 +139,9 @@ public async Task FindRenameLocationsAsync(SymbolRenam { var solution = this.Document.Project.Solution; var locations = await Renamer.FindRenameLocationsAsync( - solution, this.RenameSymbol, options, _fallbackOptions, cancellationToken).ConfigureAwait(false); + solution, this.RenameSymbol, options, cancellationToken).ConfigureAwait(false); - return new InlineRenameLocationSet(this, locations); + return new InlineRenameLocationSet(this, locations, _fallbackOptions); } public bool TryOnBeforeGlobalSymbolRenamed(Workspace workspace, IEnumerable changedDocumentIDs, string replacementText) diff --git a/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs b/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs index 0979eca0cb18d..a7d4790341fbb 100644 --- a/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs +++ b/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs @@ -138,7 +138,7 @@ private async Task ProcessResultAsync(CodeFixContext context, Diagnost var resolution = await filteredLocations.ResolveConflictsAsync( fieldSymbol, propertySymbol.Name, - nonConflictSymbolKeys: ImmutableArray.Create(propertySymbol.GetSymbolKey(cancellationToken)), + nonConflictSymbolKeys: default,// nonConflictSymbolKeys: ImmutableArray.Create(propertySymbol.GetSymbolKey(cancellationToken)), context.Options, cancellationToken).ConfigureAwait(false); Contract.ThrowIfFalse(resolution.IsSuccessful); diff --git a/src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs index 4fa26ac1079d2..82cef1c639851 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Rename/RenameHandler.cs @@ -58,11 +58,12 @@ public RenameHandler(IGlobalOptionService optionsService) oldSolution, symbolicRenameInfo.Symbol, options, - _optionsService.CreateProvider(), cancellationToken).ConfigureAwait(false); var renameReplacementInfo = await renameLocationSet.ResolveConflictsAsync( - symbolicRenameInfo.Symbol, symbolicRenameInfo.GetFinalSymbolName(request.NewName), nonConflictSymbolKeys: default, cancellationToken).ConfigureAwait(false); + symbolicRenameInfo.Symbol, symbolicRenameInfo.GetFinalSymbolName(request.NewName), + nonConflictSymbolKeys: default, _optionsService.CreateProvider(), + cancellationToken).ConfigureAwait(false); if (!renameReplacementInfo.IsSuccessful || !renameReplacementInfo.ReplacementTextValid) From 9c07392c1522f6453f5bb047d9508f6dc0ead154 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Jun 2023 13:00:29 -0700 Subject: [PATCH 009/141] thread through --- src/EditorFeatures/Test2/Rename/RenameEngineResult.vb | 4 ++-- .../ServiceHub/Services/Renamer/RemoteRenamerService.cs | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/Test2/Rename/RenameEngineResult.vb b/src/EditorFeatures/Test2/Rename/RenameEngineResult.vb index 07f6f3229da64..61be5c1510d6e 100644 --- a/src/EditorFeatures/Test2/Rename/RenameEngineResult.vb +++ b/src/EditorFeatures/Test2/Rename/RenameEngineResult.vb @@ -129,9 +129,9 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename ' features that need to call each part independently and operate on the intermediary values. Dim locations = Renamer.FindRenameLocationsAsync( - solution, symbol, renameOptions, CodeActionOptions.DefaultProvider, CancellationToken.None).GetAwaiter().GetResult() + solution, symbol, renameOptions, CancellationToken.None).GetAwaiter().GetResult() - Return locations.ResolveConflictsAsync(symbol, renameTo, nonConflictSymbolKeys:=Nothing, CancellationToken.None).GetAwaiter().GetResult() + Return locations.ResolveConflictsAsync(symbol, renameTo, nonConflictSymbolKeys:=Nothing, CodeActionOptions.DefaultProvider, CancellationToken.None).GetAwaiter().GetResult() Else ' This tests that rename properly works when the entire call is remoted to OOP and the final result is ' marshaled back. diff --git a/src/Workspaces/Remote/ServiceHub/Services/Renamer/RemoteRenamerService.cs b/src/Workspaces/Remote/ServiceHub/Services/Renamer/RemoteRenamerService.cs index 2b8b9bb1e1adc..08cbd2e50ca4f 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/Renamer/RemoteRenamerService.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/Renamer/RemoteRenamerService.cs @@ -60,7 +60,6 @@ private CodeCleanupOptionsProvider GetClientOptionsProvider(RemoteServiceCallbac public ValueTask FindRenameLocationsAsync( Checksum solutionChecksum, - RemoteServiceCallbackId callbackId, SerializableSymbolAndProjectId symbolAndProjectId, SymbolRenameOptions options, CancellationToken cancellationToken) @@ -74,7 +73,7 @@ private CodeCleanupOptionsProvider GetClientOptionsProvider(RemoteServiceCallbac return null; var renameLocations = await SymbolicRenameLocations.FindLocationsInCurrentProcessAsync( - symbol, solution, options, GetClientOptionsProvider(callbackId), cancellationToken).ConfigureAwait(false); + symbol, solution, options, cancellationToken).ConfigureAwait(false); return new SerializableRenameLocations( options, @@ -100,12 +99,12 @@ private CodeCleanupOptionsProvider GetClientOptionsProvider(RemoteServiceCallbac return null; var locations = await SymbolicRenameLocations.TryRehydrateAsync( - symbol, solution, GetClientOptionsProvider(callbackId), serializableLocations, cancellationToken).ConfigureAwait(false); + symbol, solution, serializableLocations, cancellationToken).ConfigureAwait(false); if (locations is null) return null; var result = await ConflictResolver.ResolveSymbolicLocationConflictsInCurrentProcessAsync( - locations, replacementText, nonConflictSymbolKeys, cancellationToken).ConfigureAwait(false); + locations, replacementText, nonConflictSymbolKeys, GetClientOptionsProvider(callbackId), cancellationToken).ConfigureAwait(false); return await result.DehydrateAsync(cancellationToken).ConfigureAwait(false); }, cancellationToken); } From b0eb40f7c7fb202db3d48795f5752b29b14d7cda Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 22 Aug 2023 09:33:29 -0700 Subject: [PATCH 010/141] Bump NuGet version used by tests --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 4a6f2ffaba19b..67191f6d40ef1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -207,7 +207,7 @@ is expected by the NET SDK used in the Workspace.MSBuild UnitTests. In order to test against the same verion of NuGet as our configured SDK, we must set the version to be the same. --> - 6.4.0-preview.1.54 + 6.4.2-rc.1 $(NuGetCommonVersion) $(NuGetCommonVersion) $(NuGetCommonVersion) From ed53a01de2dd18a368b10ed0640ec13cfb80b1d5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 24 Aug 2023 11:58:28 -0700 Subject: [PATCH 011/141] Tweak output --- .../Source/CSharpSyntaxGenerator/SourceWriter.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index df637a9c6c49c..fe3c2d21bcbb9 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -43,26 +43,23 @@ private void WriteFileHeader() private void WriteInternal() { WriteFileHeader(); - - WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax"); - OpenBlock(); + WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;"); WriteLine(); + this.WriteGreenTypes(); this.WriteGreenVisitors(); this.WriteGreenRewriter(); this.WriteContextualGreenFactories(); this.WriteStaticGreenFactories(); - CloseBlock(); } private void WriteSyntax() { WriteFileHeader(); - WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax"); - OpenBlock(); + WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax;"); WriteLine(); + this.WriteRedTypes(); - CloseBlock(); } private void WriteMain() @@ -142,7 +139,7 @@ private void WriteGreenType(TreeType node) if (IsSeparatedNodeList(field.Type) || IsNodeList(field.Type)) { - WriteLine($"public abstract {(IsNew(field) ? "new " : "")}Microsoft.CodeAnalysis.Syntax.InternalSyntax.{field.Type} {field.Name} {{ get; }}"); + WriteLine($"public abstract {(IsNew(field) ? "new " : "")}{field.Type} {field.Name} {{ get; }}"); } else { From 691d921fded19f529f77b304d0a66823b2a84770 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 24 Aug 2023 12:16:29 -0700 Subject: [PATCH 012/141] Cleanup --- .../Syntax.xml.Internal.Generated.cs | 76067 ++++++++-------- .../Syntax.xml.Main.Generated.cs | 1 + .../Syntax.xml.Syntax.Generated.cs | 25517 +++--- .../CSharpSyntaxGenerator/SourceWriter.cs | 21 +- 4 files changed, 50803 insertions(+), 50803 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs index 14350b3cccc8e..d2e09bc2543f1 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs @@ -7,46546 +7,46545 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.Syntax.InternalSyntax; using Roslyn.Utilities; +using CoreSyntax = Microsoft.CodeAnalysis.Syntax.InternalSyntax; -namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax +namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax; + + +/// Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. +internal abstract partial class NameSyntax : TypeSyntax { + internal NameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } + internal NameSyntax(SyntaxKind kind) + : base(kind) + { + } - /// Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. - internal abstract partial class NameSyntax : TypeSyntax + protected NameSyntax(ObjectReader reader) + : base(reader) { - internal NameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + } +} - internal NameSyntax(SyntaxKind kind) - : base(kind) - { - } +/// Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. +internal abstract partial class SimpleNameSyntax : NameSyntax +{ + internal SimpleNameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - protected NameSyntax(ObjectReader reader) - : base(reader) - { - } + internal SimpleNameSyntax(SyntaxKind kind) + : base(kind) + { } - /// Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. - internal abstract partial class SimpleNameSyntax : NameSyntax + protected SimpleNameSyntax(ObjectReader reader) + : base(reader) { - internal SimpleNameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + } - internal SimpleNameSyntax(SyntaxKind kind) - : base(kind) - { - } + /// SyntaxToken representing the identifier of the simple name. + public abstract SyntaxToken Identifier { get; } +} - protected SimpleNameSyntax(ObjectReader reader) - : base(reader) - { - } +/// Class which represents the syntax node for identifier name. +internal sealed partial class IdentifierNameSyntax : SimpleNameSyntax +{ + internal readonly SyntaxToken identifier; - /// SyntaxToken representing the identifier of the simple name. - public abstract SyntaxToken Identifier { get; } + internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } - /// Class which represents the syntax node for identifier name. - internal sealed partial class IdentifierNameSyntax : SimpleNameSyntax + internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken identifier; + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + /// SyntaxToken representing the keyword for the kind of the identifier name. + public override SyntaxToken Identifier => this.identifier; + + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.identifier : null; - internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IdentifierNameSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); + + public IdentifierNameSyntax Update(SyntaxToken identifier) + { + if (identifier != this.Identifier) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + var newNode = SyntaxFactory.IdentifierName(identifier); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// SyntaxToken representing the keyword for the kind of the identifier name. - public override SyntaxToken Identifier => this.identifier; + return this; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.identifier : null; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IdentifierNameSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IdentifierNameSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IdentifierNameSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); + internal IdentifierNameSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - public IdentifierNameSyntax Update(SyntaxToken identifier) - { - if (identifier != this.Identifier) - { - var newNode = SyntaxFactory.IdentifierName(identifier); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.identifier); + } - return this; - } + static IdentifierNameSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(IdentifierNameSyntax), r => new IdentifierNameSyntax(r)); + } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IdentifierNameSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for qualified name. +internal sealed partial class QualifiedNameSyntax : NameSyntax +{ + internal readonly NameSyntax left; + internal readonly SyntaxToken dotToken; + internal readonly SimpleNameSyntax right; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IdentifierNameSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations); + internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal IdentifierNameSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } + + internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } + + /// NameSyntax node representing the name on the left side of the dot token of the qualified name. + public NameSyntax Left => this.left; + /// SyntaxToken representing the dot. + public SyntaxToken DotToken => this.dotToken; + /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. + public SimpleNameSyntax Right => this.right; - internal override void WriteTo(ObjectWriter writer) + internal override GreenNode? GetSlot(int index) + => index switch { - base.WriteTo(writer); - writer.WriteValue(this.identifier); - } + 0 => this.left, + 1 => this.dotToken, + 2 => this.right, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedNameSyntax(this, parent, position); - static IdentifierNameSyntax() + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); + + public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + { + if (left != this.Left || dotToken != this.DotToken || right != this.Right) { - ObjectBinder.RegisterTypeReader(typeof(IdentifierNameSyntax), r => new IdentifierNameSyntax(r)); + var newNode = SyntaxFactory.QualifiedName(left, dotToken, right); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; } - /// Class which represents the syntax node for qualified name. - internal sealed partial class QualifiedNameSyntax : NameSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, GetDiagnostics(), annotations); + + internal QualifiedNameSyntax(ObjectReader reader) + : base(reader) { - internal readonly NameSyntax left; - internal readonly SyntaxToken dotToken; - internal readonly SimpleNameSyntax right; + this.SlotCount = 3; + var left = (NameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(left); + this.left = left; + var dotToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + var right = (SimpleNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(right); + this.right = right; + } - internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.left); + writer.WriteValue(this.dotToken); + writer.WriteValue(this.right); + } - internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + static QualifiedNameSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(QualifiedNameSyntax), r => new QualifiedNameSyntax(r)); + } +} - internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } +/// Class which represents the syntax node for generic name. +internal sealed partial class GenericNameSyntax : SimpleNameSyntax +{ + internal readonly SyntaxToken identifier; + internal readonly TypeArgumentListSyntax typeArgumentList; - /// NameSyntax node representing the name on the left side of the dot token of the qualified name. - public NameSyntax Left => this.left; - /// SyntaxToken representing the dot. - public SyntaxToken DotToken => this.dotToken; - /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. - public SimpleNameSyntax Right => this.right; + internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(typeArgumentList); + this.typeArgumentList = typeArgumentList; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.left, - 1 => this.dotToken, - 2 => this.right, - _ => null, - }; + internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(typeArgumentList); + this.typeArgumentList = typeArgumentList; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedNameSyntax(this, parent, position); + internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(typeArgumentList); + this.typeArgumentList = typeArgumentList; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); + /// SyntaxToken representing the name of the identifier of the generic name. + public override SyntaxToken Identifier => this.identifier; + /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. + public TypeArgumentListSyntax TypeArgumentList => this.typeArgumentList; - public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + internal override GreenNode? GetSlot(int index) + => index switch { - if (left != this.Left || dotToken != this.DotToken || right != this.Right) - { - var newNode = SyntaxFactory.QualifiedName(left, dotToken, right); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.identifier, + 1 => this.typeArgumentList, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GenericNameSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); - internal QualifiedNameSyntax(ObjectReader reader) - : base(reader) + public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + { + if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList) { - this.SlotCount = 3; - var left = (NameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(left); - this.left = left; - var dotToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - var right = (SimpleNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(right); - this.right = right; + var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.left); - writer.WriteValue(this.dotToken); - writer.WriteValue(this.right); - } + return this; + } - static QualifiedNameSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(QualifiedNameSyntax), r => new QualifiedNameSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, GetDiagnostics(), annotations); + + internal GenericNameSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var typeArgumentList = (TypeArgumentListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(typeArgumentList); + this.typeArgumentList = typeArgumentList; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.identifier); + writer.WriteValue(this.typeArgumentList); } - /// Class which represents the syntax node for generic name. - internal sealed partial class GenericNameSyntax : SimpleNameSyntax + static GenericNameSyntax() { - internal readonly SyntaxToken identifier; - internal readonly TypeArgumentListSyntax typeArgumentList; + ObjectBinder.RegisterTypeReader(typeof(GenericNameSyntax), r => new GenericNameSyntax(r)); + } +} + +/// Class which represents the syntax node for type argument list. +internal sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken lessThanToken; + internal readonly GreenNode? arguments; + internal readonly SyntaxToken greaterThanToken; - internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (arguments != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(typeArgumentList); - this.typeArgumentList = typeArgumentList; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, SyntaxFactoryContext context) - : base(kind) + internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (arguments != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(typeArgumentList); - this.typeArgumentList = typeArgumentList; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) - : base(kind) + internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (arguments != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(typeArgumentList); - this.typeArgumentList = typeArgumentList; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - /// SyntaxToken representing the name of the identifier of the generic name. - public override SyntaxToken Identifier => this.identifier; - /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. - public TypeArgumentListSyntax TypeArgumentList => this.typeArgumentList; + /// SyntaxToken representing less than. + public SyntaxToken LessThanToken => this.lessThanToken; + /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. + public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + /// SyntaxToken representing greater than. + public SyntaxToken GreaterThanToken => this.greaterThanToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.identifier, - 1 => this.typeArgumentList, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.lessThanToken, + 1 => this.arguments, + 2 => this.greaterThanToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GenericNameSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeArgumentListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); - public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) { - if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList) - { - var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, GetDiagnostics(), annotations); + return this; + } - internal GenericNameSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var typeArgumentList = (TypeArgumentListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(typeArgumentList); - this.typeArgumentList = typeArgumentList; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.identifier); - writer.WriteValue(this.typeArgumentList); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, GetDiagnostics(), annotations); - static GenericNameSyntax() + internal TypeArgumentListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var lessThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + var arguments = (GreenNode?)reader.ReadValue(); + if (arguments != null) { - ObjectBinder.RegisterTypeReader(typeof(GenericNameSyntax), r => new GenericNameSyntax(r)); + AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + var greaterThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; } - /// Class which represents the syntax node for type argument list. - internal sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken lessThanToken; - internal readonly GreenNode? arguments; - internal readonly SyntaxToken greaterThanToken; - - internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } + base.WriteTo(writer); + writer.WriteValue(this.lessThanToken); + writer.WriteValue(this.arguments); + writer.WriteValue(this.greaterThanToken); + } - internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } + static TypeArgumentListSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(TypeArgumentListSyntax), r => new TypeArgumentListSyntax(r)); + } +} - internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } +/// Class which represents the syntax node for alias qualified name. +internal sealed partial class AliasQualifiedNameSyntax : NameSyntax +{ + internal readonly IdentifierNameSyntax alias; + internal readonly SyntaxToken colonColonToken; + internal readonly SimpleNameSyntax name; - /// SyntaxToken representing less than. - public SyntaxToken LessThanToken => this.lessThanToken; - /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arguments)); - /// SyntaxToken representing greater than. - public SyntaxToken GreaterThanToken => this.greaterThanToken; + internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(alias); + this.alias = alias; + this.AdjustFlagsAndWidth(colonColonToken); + this.colonColonToken = colonColonToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanToken, - 1 => this.arguments, - 2 => this.greaterThanToken, - _ => null, - }; + internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(alias); + this.alias = alias; + this.AdjustFlagsAndWidth(colonColonToken); + this.colonColonToken = colonColonToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeArgumentListSyntax(this, parent, position); + internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(alias); + this.alias = alias; + this.AdjustFlagsAndWidth(colonColonToken); + this.colonColonToken = colonColonToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); + /// IdentifierNameSyntax node representing the name of the alias + public IdentifierNameSyntax Alias => this.alias; + /// SyntaxToken representing colon colon. + public SyntaxToken ColonColonToken => this.colonColonToken; + /// SimpleNameSyntax node representing the name that is being alias qualified. + public SimpleNameSyntax Name => this.name; - public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.alias, + 1 => this.colonColonToken, + 2 => this.name, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AliasQualifiedNameSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); - internal TypeArgumentListSyntax(ObjectReader reader) - : base(reader) + public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + { + if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name) { - this.SlotCount = 3; - var lessThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - var arguments = (GreenNode?)reader.ReadValue(); - if (arguments != null) - { - AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - var greaterThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.lessThanToken); - writer.WriteValue(this.arguments); - writer.WriteValue(this.greaterThanToken); - } + return this; + } - static TypeArgumentListSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(TypeArgumentListSyntax), r => new TypeArgumentListSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, GetDiagnostics(), annotations); + + internal AliasQualifiedNameSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var alias = (IdentifierNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(alias); + this.alias = alias; + var colonColonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonColonToken); + this.colonColonToken = colonColonToken; + var name = (SimpleNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; } - /// Class which represents the syntax node for alias qualified name. - internal sealed partial class AliasQualifiedNameSyntax : NameSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly IdentifierNameSyntax alias; - internal readonly SyntaxToken colonColonToken; - internal readonly SimpleNameSyntax name; + base.WriteTo(writer); + writer.WriteValue(this.alias); + writer.WriteValue(this.colonColonToken); + writer.WriteValue(this.name); + } - internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - this.AdjustFlagsAndWidth(colonColonToken); - this.colonColonToken = colonColonToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + static AliasQualifiedNameSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(AliasQualifiedNameSyntax), r => new AliasQualifiedNameSyntax(r)); + } +} - internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - this.AdjustFlagsAndWidth(colonColonToken); - this.colonColonToken = colonColonToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } +/// Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. +internal abstract partial class TypeSyntax : ExpressionSyntax +{ + internal TypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - this.AdjustFlagsAndWidth(colonColonToken); - this.colonColonToken = colonColonToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal TypeSyntax(SyntaxKind kind) + : base(kind) + { + } - /// IdentifierNameSyntax node representing the name of the alias - public IdentifierNameSyntax Alias => this.alias; - /// SyntaxToken representing colon colon. - public SyntaxToken ColonColonToken => this.colonColonToken; - /// SimpleNameSyntax node representing the name that is being alias qualified. - public SimpleNameSyntax Name => this.name; + protected TypeSyntax(ObjectReader reader) + : base(reader) + { + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.alias, - 1 => this.colonColonToken, - 2 => this.name, - _ => null, - }; +/// Class which represents the syntax node for predefined types. +internal sealed partial class PredefinedTypeSyntax : TypeSyntax +{ + internal readonly SyntaxToken keyword; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AliasQualifiedNameSyntax(this, parent, position); + internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); + internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + } - public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) - { - if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name) - { - var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + } - return this; - } + /// SyntaxToken which represents the keyword corresponding to the predefined type. + public SyntaxToken Keyword => this.keyword; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.keyword : null; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PredefinedTypeSyntax(this, parent, position); - internal AliasQualifiedNameSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var alias = (IdentifierNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(alias); - this.alias = alias; - var colonColonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonColonToken); - this.colonColonToken = colonColonToken; - var name = (SimpleNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); - internal override void WriteTo(ObjectWriter writer) + public PredefinedTypeSyntax Update(SyntaxToken keyword) + { + if (keyword != this.Keyword) { - base.WriteTo(writer); - writer.WriteValue(this.alias); - writer.WriteValue(this.colonColonToken); - writer.WriteValue(this.name); + var newNode = SyntaxFactory.PredefinedType(keyword); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static AliasQualifiedNameSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(AliasQualifiedNameSyntax), r => new AliasQualifiedNameSyntax(r)); - } + return this; } - /// Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. - internal abstract partial class TypeSyntax : ExpressionSyntax - { - internal TypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PredefinedTypeSyntax(this.Kind, this.keyword, diagnostics, GetAnnotations()); - internal TypeSyntax(SyntaxKind kind) - : base(kind) - { - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PredefinedTypeSyntax(this.Kind, this.keyword, GetDiagnostics(), annotations); - protected TypeSyntax(ObjectReader reader) - : base(reader) - { - } + internal PredefinedTypeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.keyword); } - /// Class which represents the syntax node for predefined types. - internal sealed partial class PredefinedTypeSyntax : TypeSyntax + static PredefinedTypeSyntax() { - internal readonly SyntaxToken keyword; + ObjectBinder.RegisterTypeReader(typeof(PredefinedTypeSyntax), r => new PredefinedTypeSyntax(r)); + } +} - internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +/// Class which represents the syntax node for the array type. +internal sealed partial class ArrayTypeSyntax : TypeSyntax +{ + internal readonly TypeSyntax elementType; + internal readonly GreenNode? rankSpecifiers; + + internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + if (rankSpecifiers != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; + this.AdjustFlagsAndWidth(rankSpecifiers); + this.rankSpecifiers = rankSpecifiers; } + } - internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxFactoryContext context) - : base(kind) + internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + if (rankSpecifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; + this.AdjustFlagsAndWidth(rankSpecifiers); + this.rankSpecifiers = rankSpecifiers; } + } - internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword) - : base(kind) + internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + if (rankSpecifiers != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; + this.AdjustFlagsAndWidth(rankSpecifiers); + this.rankSpecifiers = rankSpecifiers; } + } - /// SyntaxToken which represents the keyword corresponding to the predefined type. - public SyntaxToken Keyword => this.keyword; + /// TypeSyntax node representing the type of the element of the array. + public TypeSyntax ElementType => this.elementType; + /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. + public CoreSyntax.SyntaxList RankSpecifiers => new CoreSyntax.SyntaxList(this.rankSpecifiers); - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.keyword : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.elementType, + 1 => this.rankSpecifiers, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PredefinedTypeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayTypeSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); - public PredefinedTypeSyntax Update(SyntaxToken keyword) + public ArrayTypeSyntax Update(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) + { + if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) { - if (keyword != this.Keyword) - { - var newNode = SyntaxFactory.PredefinedType(keyword); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PredefinedTypeSyntax(this.Kind, this.keyword, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PredefinedTypeSyntax(this.Kind, this.keyword, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, GetDiagnostics(), annotations); - internal PredefinedTypeSyntax(ObjectReader reader) - : base(reader) + internal ArrayTypeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var elementType = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + var rankSpecifiers = (GreenNode?)reader.ReadValue(); + if (rankSpecifiers != null) { - this.SlotCount = 1; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - } - - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.keyword); + AdjustFlagsAndWidth(rankSpecifiers); + this.rankSpecifiers = rankSpecifiers; } + } - static PredefinedTypeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(PredefinedTypeSyntax), r => new PredefinedTypeSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.elementType); + writer.WriteValue(this.rankSpecifiers); } - /// Class which represents the syntax node for the array type. - internal sealed partial class ArrayTypeSyntax : TypeSyntax + static ArrayTypeSyntax() { - internal readonly TypeSyntax elementType; - internal readonly GreenNode? rankSpecifiers; + ObjectBinder.RegisterTypeReader(typeof(ArrayTypeSyntax), r => new ArrayTypeSyntax(r)); + } +} + +internal sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? sizes; + internal readonly SyntaxToken closeBracketToken; - internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (sizes != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - if (rankSpecifiers != null) - { - this.AdjustFlagsAndWidth(rankSpecifiers); - this.rankSpecifiers = rankSpecifiers; - } + this.AdjustFlagsAndWidth(sizes); + this.sizes = sizes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, SyntaxFactoryContext context) - : base(kind) + internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (sizes != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - if (rankSpecifiers != null) - { - this.AdjustFlagsAndWidth(rankSpecifiers); - this.rankSpecifiers = rankSpecifiers; - } + this.AdjustFlagsAndWidth(sizes); + this.sizes = sizes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers) - : base(kind) + internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (sizes != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - if (rankSpecifiers != null) - { - this.AdjustFlagsAndWidth(rankSpecifiers); - this.rankSpecifiers = rankSpecifiers; - } + this.AdjustFlagsAndWidth(sizes); + this.sizes = sizes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - /// TypeSyntax node representing the type of the element of the array. - public TypeSyntax ElementType => this.elementType; - /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList RankSpecifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.rankSpecifiers); + public SyntaxToken OpenBracketToken => this.openBracketToken; + public CoreSyntax.SeparatedSyntaxList Sizes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.sizes)); + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.elementType, - 1 => this.rankSpecifiers, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.sizes, + 2 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayTypeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayRankSpecifierSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); - public ArrayTypeSyntax Update(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList rankSpecifiers) + public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) { - if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) - { - var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, diagnostics, GetAnnotations()); - internal ArrayTypeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var elementType = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - var rankSpecifiers = (GreenNode?)reader.ReadValue(); - if (rankSpecifiers != null) - { - AdjustFlagsAndWidth(rankSpecifiers); - this.rankSpecifiers = rankSpecifiers; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal ArrayRankSpecifierSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + var sizes = (GreenNode?)reader.ReadValue(); + if (sizes != null) { - base.WriteTo(writer); - writer.WriteValue(this.elementType); - writer.WriteValue(this.rankSpecifiers); + AdjustFlagsAndWidth(sizes); + this.sizes = sizes; } + var closeBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - static ArrayTypeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ArrayTypeSyntax), r => new ArrayTypeSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openBracketToken); + writer.WriteValue(this.sizes); + writer.WriteValue(this.closeBracketToken); } - internal sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode + static ArrayRankSpecifierSyntax() { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? sizes; - internal readonly SyntaxToken closeBracketToken; + ObjectBinder.RegisterTypeReader(typeof(ArrayRankSpecifierSyntax), r => new ArrayRankSpecifierSyntax(r)); + } +} - internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (sizes != null) - { - this.AdjustFlagsAndWidth(sizes); - this.sizes = sizes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } +/// Class which represents the syntax node for pointer type. +internal sealed partial class PointerTypeSyntax : TypeSyntax +{ + internal readonly TypeSyntax elementType; + internal readonly SyntaxToken asteriskToken; - internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (sizes != null) - { - this.AdjustFlagsAndWidth(sizes); - this.sizes = sizes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + } - internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (sizes != null) - { - this.AdjustFlagsAndWidth(sizes); - this.sizes = sizes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + } - public SyntaxToken OpenBracketToken => this.openBracketToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Sizes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.sizes)); - public SyntaxToken CloseBracketToken => this.closeBracketToken; + internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.sizes, - 2 => this.closeBracketToken, - _ => null, - }; + /// TypeSyntax node that represents the element type of the pointer. + public TypeSyntax ElementType => this.elementType; + /// SyntaxToken representing the asterisk. + public SyntaxToken AsteriskToken => this.asteriskToken; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayRankSpecifierSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.elementType, + 1 => this.asteriskToken, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PointerTypeSyntax(this, parent, position); - public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); - return this; + public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) + { + if (elementType != this.ElementType || asteriskToken != this.AsteriskToken) + { + var newNode = SyntaxFactory.PointerType(elementType, asteriskToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, diagnostics, GetAnnotations()); - internal ArrayRankSpecifierSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - var sizes = (GreenNode?)reader.ReadValue(); - if (sizes != null) - { - AdjustFlagsAndWidth(sizes); - this.sizes = sizes; - } - var closeBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openBracketToken); - writer.WriteValue(this.sizes); - writer.WriteValue(this.closeBracketToken); - } + internal PointerTypeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var elementType = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + var asteriskToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + } - static ArrayRankSpecifierSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ArrayRankSpecifierSyntax), r => new ArrayRankSpecifierSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.elementType); + writer.WriteValue(this.asteriskToken); } - /// Class which represents the syntax node for pointer type. - internal sealed partial class PointerTypeSyntax : TypeSyntax + static PointerTypeSyntax() { - internal readonly TypeSyntax elementType; - internal readonly SyntaxToken asteriskToken; + ObjectBinder.RegisterTypeReader(typeof(PointerTypeSyntax), r => new PointerTypeSyntax(r)); + } +} + +internal sealed partial class FunctionPointerTypeSyntax : TypeSyntax +{ + internal readonly SyntaxToken delegateKeyword; + internal readonly SyntaxToken asteriskToken; + internal readonly FunctionPointerCallingConventionSyntax? callingConvention; + internal readonly FunctionPointerParameterListSyntax parameterList; - internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + if (callingConvention != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; + this.AdjustFlagsAndWidth(callingConvention); + this.callingConvention = callingConvention; } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } - internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, SyntaxFactoryContext context) - : base(kind) + internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + if (callingConvention != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; + this.AdjustFlagsAndWidth(callingConvention); + this.callingConvention = callingConvention; } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } - internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken) - : base(kind) + internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + if (callingConvention != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; + this.AdjustFlagsAndWidth(callingConvention); + this.callingConvention = callingConvention; } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } - /// TypeSyntax node that represents the element type of the pointer. - public TypeSyntax ElementType => this.elementType; - /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => this.asteriskToken; + /// SyntaxToken representing the delegate keyword. + public SyntaxToken DelegateKeyword => this.delegateKeyword; + /// SyntaxToken representing the asterisk. + public SyntaxToken AsteriskToken => this.asteriskToken; + /// Node representing the optional calling convention. + public FunctionPointerCallingConventionSyntax? CallingConvention => this.callingConvention; + /// List of the parameter types and return type of the function pointer. + public FunctionPointerParameterListSyntax ParameterList => this.parameterList; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.elementType, - 1 => this.asteriskToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.delegateKeyword, + 1 => this.asteriskToken, + 2 => this.callingConvention, + 3 => this.parameterList, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PointerTypeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerTypeSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); - public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) + public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax callingConvention, FunctionPointerParameterListSyntax parameterList) + { + if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList) { - if (elementType != this.ElementType || asteriskToken != this.AsteriskToken) - { - var newNode = SyntaxFactory.PointerType(elementType, asteriskToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, diagnostics, GetAnnotations()); - internal PointerTypeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var elementType = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - var asteriskToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal FunctionPointerTypeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var delegateKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + var asteriskToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + var callingConvention = (FunctionPointerCallingConventionSyntax?)reader.ReadValue(); + if (callingConvention != null) { - base.WriteTo(writer); - writer.WriteValue(this.elementType); - writer.WriteValue(this.asteriskToken); + AdjustFlagsAndWidth(callingConvention); + this.callingConvention = callingConvention; } + var parameterList = (FunctionPointerParameterListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } - static PointerTypeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(PointerTypeSyntax), r => new PointerTypeSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.delegateKeyword); + writer.WriteValue(this.asteriskToken); + writer.WriteValue(this.callingConvention); + writer.WriteValue(this.parameterList); } - internal sealed partial class FunctionPointerTypeSyntax : TypeSyntax + static FunctionPointerTypeSyntax() { - internal readonly SyntaxToken delegateKeyword; - internal readonly SyntaxToken asteriskToken; - internal readonly FunctionPointerCallingConventionSyntax? callingConvention; - internal readonly FunctionPointerParameterListSyntax parameterList; + ObjectBinder.RegisterTypeReader(typeof(FunctionPointerTypeSyntax), r => new FunctionPointerTypeSyntax(r)); + } +} + +/// Function pointer parameter list syntax. +internal sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken lessThanToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken greaterThanToken; - internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; - if (callingConvention != null) - { - this.AdjustFlagsAndWidth(callingConvention); - this.callingConvention = callingConvention; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, SyntaxFactoryContext context) - : base(kind) + internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; - if (callingConvention != null) - { - this.AdjustFlagsAndWidth(callingConvention); - this.callingConvention = callingConvention; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) - : base(kind) + internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; - if (callingConvention != null) - { - this.AdjustFlagsAndWidth(callingConvention); - this.callingConvention = callingConvention; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => this.delegateKeyword; - /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => this.asteriskToken; - /// Node representing the optional calling convention. - public FunctionPointerCallingConventionSyntax? CallingConvention => this.callingConvention; - /// List of the parameter types and return type of the function pointer. - public FunctionPointerParameterListSyntax ParameterList => this.parameterList; + /// SyntaxToken representing the less than token. + public SyntaxToken LessThanToken => this.lessThanToken; + /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. + public CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// SyntaxToken representing the greater than token. + public SyntaxToken GreaterThanToken => this.greaterThanToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.delegateKeyword, - 1 => this.asteriskToken, - 2 => this.callingConvention, - 3 => this.parameterList, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.lessThanToken, + 1 => this.parameters, + 2 => this.greaterThanToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerTypeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); - public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax callingConvention, FunctionPointerParameterListSyntax parameterList) + public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) { - if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList) - { - var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations()); - internal FunctionPointerTypeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var delegateKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - var asteriskToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; - var callingConvention = (FunctionPointerCallingConventionSyntax?)reader.ReadValue(); - if (callingConvention != null) - { - AdjustFlagsAndWidth(callingConvention); - this.callingConvention = callingConvention; - } - var parameterList = (FunctionPointerParameterListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal FunctionPointerParameterListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var lessThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + var parameters = (GreenNode?)reader.ReadValue(); + if (parameters != null) { - base.WriteTo(writer); - writer.WriteValue(this.delegateKeyword); - writer.WriteValue(this.asteriskToken); - writer.WriteValue(this.callingConvention); - writer.WriteValue(this.parameterList); + AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + var greaterThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - static FunctionPointerTypeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(FunctionPointerTypeSyntax), r => new FunctionPointerTypeSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.lessThanToken); + writer.WriteValue(this.parameters); + writer.WriteValue(this.greaterThanToken); } - /// Function pointer parameter list syntax. - internal sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode + static FunctionPointerParameterListSyntax() { - internal readonly SyntaxToken lessThanToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken greaterThanToken; + ObjectBinder.RegisterTypeReader(typeof(FunctionPointerParameterListSyntax), r => new FunctionPointerParameterListSyntax(r)); + } +} + +/// Function pointer calling convention syntax. +internal sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken managedOrUnmanagedKeyword; + internal readonly FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList; - internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); + this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; + if (unmanagedCallingConventionList != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(unmanagedCallingConventionList); + this.unmanagedCallingConventionList = unmanagedCallingConventionList; } + } - internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) - : base(kind) + internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); + this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; + if (unmanagedCallingConventionList != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(unmanagedCallingConventionList); + this.unmanagedCallingConventionList = unmanagedCallingConventionList; } + } - internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) - : base(kind) + internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); + this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; + if (unmanagedCallingConventionList != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(unmanagedCallingConventionList); + this.unmanagedCallingConventionList = unmanagedCallingConventionList; } + } - /// SyntaxToken representing the less than token. - public SyntaxToken LessThanToken => this.lessThanToken; - /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); - /// SyntaxToken representing the greater than token. - public SyntaxToken GreaterThanToken => this.greaterThanToken; + /// SyntaxToken representing whether the calling convention is managed or unmanaged. + public SyntaxToken ManagedOrUnmanagedKeyword => this.managedOrUnmanagedKeyword; + /// Optional list of identifiers that will contribute to an unmanaged calling convention. + public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => this.unmanagedCallingConventionList; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanToken, - 1 => this.parameters, - 2 => this.greaterThanToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.managedOrUnmanagedKeyword, + 1 => this.unmanagedCallingConventionList, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerCallingConventionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); - public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax unmanagedCallingConventionList) + { + if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList) { - if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, diagnostics, GetAnnotations()); - internal FunctionPointerParameterListSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var lessThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - var parameters = (GreenNode?)reader.ReadValue(); - if (parameters != null) - { - AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - var greaterThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal FunctionPointerCallingConventionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var managedOrUnmanagedKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(managedOrUnmanagedKeyword); + this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; + var unmanagedCallingConventionList = (FunctionPointerUnmanagedCallingConventionListSyntax?)reader.ReadValue(); + if (unmanagedCallingConventionList != null) { - base.WriteTo(writer); - writer.WriteValue(this.lessThanToken); - writer.WriteValue(this.parameters); - writer.WriteValue(this.greaterThanToken); + AdjustFlagsAndWidth(unmanagedCallingConventionList); + this.unmanagedCallingConventionList = unmanagedCallingConventionList; } + } - static FunctionPointerParameterListSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(FunctionPointerParameterListSyntax), r => new FunctionPointerParameterListSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.managedOrUnmanagedKeyword); + writer.WriteValue(this.unmanagedCallingConventionList); } - /// Function pointer calling convention syntax. - internal sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode + static FunctionPointerCallingConventionSyntax() { - internal readonly SyntaxToken managedOrUnmanagedKeyword; - internal readonly FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList; + ObjectBinder.RegisterTypeReader(typeof(FunctionPointerCallingConventionSyntax), r => new FunctionPointerCallingConventionSyntax(r)); + } +} + +/// Function pointer calling convention syntax. +internal sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? callingConventions; + internal readonly SyntaxToken closeBracketToken; - internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (callingConventions != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); - this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; - if (unmanagedCallingConventionList != null) - { - this.AdjustFlagsAndWidth(unmanagedCallingConventionList); - this.unmanagedCallingConventionList = unmanagedCallingConventionList; - } + this.AdjustFlagsAndWidth(callingConventions); + this.callingConventions = callingConventions; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, SyntaxFactoryContext context) - : base(kind) + internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (callingConventions != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); - this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; - if (unmanagedCallingConventionList != null) - { - this.AdjustFlagsAndWidth(unmanagedCallingConventionList); - this.unmanagedCallingConventionList = unmanagedCallingConventionList; - } + this.AdjustFlagsAndWidth(callingConventions); + this.callingConventions = callingConventions; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) - : base(kind) + internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (callingConventions != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); - this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; - if (unmanagedCallingConventionList != null) - { - this.AdjustFlagsAndWidth(unmanagedCallingConventionList); - this.unmanagedCallingConventionList = unmanagedCallingConventionList; - } + this.AdjustFlagsAndWidth(callingConventions); + this.callingConventions = callingConventions; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - /// SyntaxToken representing whether the calling convention is managed or unmanaged. - public SyntaxToken ManagedOrUnmanagedKeyword => this.managedOrUnmanagedKeyword; - /// Optional list of identifiers that will contribute to an unmanaged calling convention. - public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => this.unmanagedCallingConventionList; + /// SyntaxToken representing open bracket. + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// SeparatedSyntaxList of calling convention identifiers. + public CoreSyntax.SeparatedSyntaxList CallingConventions => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.callingConventions)); + /// SyntaxToken representing close bracket. + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.managedOrUnmanagedKeyword, - 1 => this.unmanagedCallingConventionList, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.callingConventions, + 2 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerCallingConventionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax unmanagedCallingConventionList) + public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) { - if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList) - { - var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, diagnostics, GetAnnotations()); - internal FunctionPointerCallingConventionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var managedOrUnmanagedKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(managedOrUnmanagedKeyword); - this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; - var unmanagedCallingConventionList = (FunctionPointerUnmanagedCallingConventionListSyntax?)reader.ReadValue(); - if (unmanagedCallingConventionList != null) - { - AdjustFlagsAndWidth(unmanagedCallingConventionList); - this.unmanagedCallingConventionList = unmanagedCallingConventionList; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal FunctionPointerUnmanagedCallingConventionListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + var callingConventions = (GreenNode?)reader.ReadValue(); + if (callingConventions != null) { - base.WriteTo(writer); - writer.WriteValue(this.managedOrUnmanagedKeyword); - writer.WriteValue(this.unmanagedCallingConventionList); + AdjustFlagsAndWidth(callingConventions); + this.callingConventions = callingConventions; } + var closeBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - static FunctionPointerCallingConventionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(FunctionPointerCallingConventionSyntax), r => new FunctionPointerCallingConventionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openBracketToken); + writer.WriteValue(this.callingConventions); + writer.WriteValue(this.closeBracketToken); } - /// Function pointer calling convention syntax. - internal sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode + static FunctionPointerUnmanagedCallingConventionListSyntax() { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? callingConventions; - internal readonly SyntaxToken closeBracketToken; + ObjectBinder.RegisterTypeReader(typeof(FunctionPointerUnmanagedCallingConventionListSyntax), r => new FunctionPointerUnmanagedCallingConventionListSyntax(r)); + } +} - internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (callingConventions != null) - { - this.AdjustFlagsAndWidth(callingConventions); - this.callingConventions = callingConventions; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } +/// Individual function pointer unmanaged calling convention. +internal sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken name; - internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (callingConventions != null) - { - this.AdjustFlagsAndWidth(callingConventions); - this.callingConventions = callingConventions; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (callingConventions != null) - { - this.AdjustFlagsAndWidth(callingConventions); - this.callingConventions = callingConventions; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// SeparatedSyntaxList of calling convention identifiers. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList CallingConventions => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.callingConventions)); - /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => this.closeBracketToken; + internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.callingConventions, - 2 => this.closeBracketToken, - _ => null, - }; + /// SyntaxToken representing the calling convention identifier. + public SyntaxToken Name => this.name; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionListSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.name : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionSyntax(this, parent, position); - public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - return this; + public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name) + { + if (name != this.Name) + { + var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, diagnostics, GetAnnotations()); - internal FunctionPointerUnmanagedCallingConventionListSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - var callingConventions = (GreenNode?)reader.ReadValue(); - if (callingConventions != null) - { - AdjustFlagsAndWidth(callingConventions); - this.callingConventions = callingConventions; - } - var closeBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openBracketToken); - writer.WriteValue(this.callingConventions); - writer.WriteValue(this.closeBracketToken); - } + internal FunctionPointerUnmanagedCallingConventionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var name = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + } - static FunctionPointerUnmanagedCallingConventionListSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(FunctionPointerUnmanagedCallingConventionListSyntax), r => new FunctionPointerUnmanagedCallingConventionListSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.name); } - /// Individual function pointer unmanaged calling convention. - internal sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode + static FunctionPointerUnmanagedCallingConventionSyntax() { - internal readonly SyntaxToken name; + ObjectBinder.RegisterTypeReader(typeof(FunctionPointerUnmanagedCallingConventionSyntax), r => new FunctionPointerUnmanagedCallingConventionSyntax(r)); + } +} - internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(name); - this.name = name; - } +/// Class which represents the syntax node for a nullable type. +internal sealed partial class NullableTypeSyntax : TypeSyntax +{ + internal readonly TypeSyntax elementType; + internal readonly SyntaxToken questionToken; - internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + } - internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + } - /// SyntaxToken representing the calling convention identifier. - public SyntaxToken Name => this.name; + internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.name : null; + /// TypeSyntax node representing the type of the element. + public TypeSyntax ElementType => this.elementType; + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken => this.questionToken; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.elementType, + 1 => this.questionToken, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableTypeSyntax(this, parent, position); - public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name) - { - if (name != this.Name) - { - var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); - return this; + public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) + { + if (elementType != this.ElementType || questionToken != this.QuestionToken) + { + var newNode = SyntaxFactory.NullableType(elementType, questionToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, diagnostics, GetAnnotations()); - internal FunctionPointerUnmanagedCallingConventionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var name = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.name); - } + internal NullableTypeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var elementType = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + var questionToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + } - static FunctionPointerUnmanagedCallingConventionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(FunctionPointerUnmanagedCallingConventionSyntax), r => new FunctionPointerUnmanagedCallingConventionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.elementType); + writer.WriteValue(this.questionToken); } - /// Class which represents the syntax node for a nullable type. - internal sealed partial class NullableTypeSyntax : TypeSyntax + static NullableTypeSyntax() { - internal readonly TypeSyntax elementType; - internal readonly SyntaxToken questionToken; + ObjectBinder.RegisterTypeReader(typeof(NullableTypeSyntax), r => new NullableTypeSyntax(r)); + } +} + +/// Class which represents the syntax node for tuple type. +internal sealed partial class TupleTypeSyntax : TypeSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? elements; + internal readonly SyntaxToken closeParenToken; - internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (elements != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, SyntaxFactoryContext context) - : base(kind) + internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (elements != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken) - : base(kind) + internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (elements != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - /// TypeSyntax node representing the type of the element. - public TypeSyntax ElementType => this.elementType; - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => this.questionToken; + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + public CoreSyntax.SeparatedSyntaxList Elements => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.elements)); + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.elementType, - 1 => this.questionToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.elements, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableTypeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleTypeSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); - public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) + public TupleTypeSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) { - if (elementType != this.ElementType || questionToken != this.QuestionToken) - { - var newNode = SyntaxFactory.NullableType(elementType, questionToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, diagnostics, GetAnnotations()); - internal NullableTypeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var elementType = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - var questionToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal TupleTypeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var elements = (GreenNode?)reader.ReadValue(); + if (elements != null) { - base.WriteTo(writer); - writer.WriteValue(this.elementType); - writer.WriteValue(this.questionToken); + AdjustFlagsAndWidth(elements); + this.elements = elements; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - static NullableTypeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(NullableTypeSyntax), r => new NullableTypeSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.elements); + writer.WriteValue(this.closeParenToken); } - /// Class which represents the syntax node for tuple type. - internal sealed partial class TupleTypeSyntax : TypeSyntax + static TupleTypeSyntax() { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? elements; - internal readonly SyntaxToken closeParenToken; + ObjectBinder.RegisterTypeReader(typeof(TupleTypeSyntax), r => new TupleTypeSyntax(r)); + } +} + +/// Tuple type element. +internal sealed partial class TupleElementSyntax : CSharpSyntaxNode +{ + internal readonly TypeSyntax type; + internal readonly SyntaxToken? identifier; - internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + } - internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + } - internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken) - : base(kind) + internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + } - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Elements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.elements)); - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + /// Gets the type of the tuple element. + public TypeSyntax Type => this.type; + /// Gets the name of the tuple element. + public SyntaxToken? Identifier => this.identifier; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.elements, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.identifier, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleTypeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleElementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); - public TupleTypeSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) + { + if (type != this.Type || identifier != this.Identifier) { - if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TupleElement(type, identifier); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TupleElementSyntax(this.Kind, this.type, this.identifier, diagnostics, GetAnnotations()); - internal TupleTypeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var elements = (GreenNode?)reader.ReadValue(); - if (elements != null) - { - AdjustFlagsAndWidth(elements); - this.elements = elements; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TupleElementSyntax(this.Kind, this.type, this.identifier, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal TupleElementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var identifier = (SyntaxToken?)reader.ReadValue(); + if (identifier != null) { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.elements); - writer.WriteValue(this.closeParenToken); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + } - static TupleTypeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(TupleTypeSyntax), r => new TupleTypeSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.type); + writer.WriteValue(this.identifier); } - /// Tuple type element. - internal sealed partial class TupleElementSyntax : CSharpSyntaxNode + static TupleElementSyntax() { - internal readonly TypeSyntax type; - internal readonly SyntaxToken? identifier; + ObjectBinder.RegisterTypeReader(typeof(TupleElementSyntax), r => new TupleElementSyntax(r)); + } +} - internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - } +/// Class which represents a placeholder in the type argument list of an unbound generic type. +internal sealed partial class OmittedTypeArgumentSyntax : TypeSyntax +{ + internal readonly SyntaxToken omittedTypeArgumentToken; - internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - } + internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedTypeArgumentToken); + this.omittedTypeArgumentToken = omittedTypeArgumentToken; + } - internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - } + internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedTypeArgumentToken); + this.omittedTypeArgumentToken = omittedTypeArgumentToken; + } + + internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedTypeArgumentToken); + this.omittedTypeArgumentToken = omittedTypeArgumentToken; + } - /// Gets the type of the tuple element. - public TypeSyntax Type => this.type; - /// Gets the name of the tuple element. - public SyntaxToken? Identifier => this.identifier; + /// SyntaxToken representing the omitted type argument. + public SyntaxToken OmittedTypeArgumentToken => this.omittedTypeArgumentToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.identifier, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.omittedTypeArgumentToken : null; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleElementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedTypeArgumentSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); - public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) + public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken) + { + if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken) { - if (type != this.Type || identifier != this.Identifier) - { - var newNode = SyntaxFactory.TupleElement(type, identifier); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TupleElementSyntax(this.Kind, this.type, this.identifier, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TupleElementSyntax(this.Kind, this.type, this.identifier, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, diagnostics, GetAnnotations()); - internal TupleElementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var identifier = (SyntaxToken?)reader.ReadValue(); - if (identifier != null) - { - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.type); - writer.WriteValue(this.identifier); - } + internal OmittedTypeArgumentSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var omittedTypeArgumentToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(omittedTypeArgumentToken); + this.omittedTypeArgumentToken = omittedTypeArgumentToken; + } - static TupleElementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(TupleElementSyntax), r => new TupleElementSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.omittedTypeArgumentToken); } - /// Class which represents a placeholder in the type argument list of an unbound generic type. - internal sealed partial class OmittedTypeArgumentSyntax : TypeSyntax + static OmittedTypeArgumentSyntax() { - internal readonly SyntaxToken omittedTypeArgumentToken; + ObjectBinder.RegisterTypeReader(typeof(OmittedTypeArgumentSyntax), r => new OmittedTypeArgumentSyntax(r)); + } +} + +/// The ref modifier of a method's return value or a local. +internal sealed partial class RefTypeSyntax : TypeSyntax +{ + internal readonly SyntaxToken refKeyword; + internal readonly SyntaxToken? readOnlyKeyword; + internal readonly TypeSyntax type; - internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + if (readOnlyKeyword != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedTypeArgumentToken); - this.omittedTypeArgumentToken = omittedTypeArgumentToken; + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, SyntaxFactoryContext context) - : base(kind) + internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + if (readOnlyKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedTypeArgumentToken); - this.omittedTypeArgumentToken = omittedTypeArgumentToken; + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken) - : base(kind) + internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + if (readOnlyKeyword != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedTypeArgumentToken); - this.omittedTypeArgumentToken = omittedTypeArgumentToken; + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - /// SyntaxToken representing the omitted type argument. - public SyntaxToken OmittedTypeArgumentToken => this.omittedTypeArgumentToken; + public SyntaxToken RefKeyword => this.refKeyword; + /// Gets the optional "readonly" keyword. + public SyntaxToken? ReadOnlyKeyword => this.readOnlyKeyword; + public TypeSyntax Type => this.type; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.omittedTypeArgumentToken : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.refKeyword, + 1 => this.readOnlyKeyword, + 2 => this.type, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedTypeArgumentSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); - public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken) + public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + { + if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) { - if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken) - { - var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, GetDiagnostics(), annotations); + return this; + } - internal OmittedTypeArgumentSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var omittedTypeArgumentToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(omittedTypeArgumentToken); - this.omittedTypeArgumentToken = omittedTypeArgumentToken; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.omittedTypeArgumentToken); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, GetDiagnostics(), annotations); - static OmittedTypeArgumentSyntax() + internal RefTypeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var refKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + var readOnlyKeyword = (SyntaxToken?)reader.ReadValue(); + if (readOnlyKeyword != null) { - ObjectBinder.RegisterTypeReader(typeof(OmittedTypeArgumentSyntax), r => new OmittedTypeArgumentSyntax(r)); + AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; } - /// The ref modifier of a method's return value or a local. - internal sealed partial class RefTypeSyntax : TypeSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken refKeyword; - internal readonly SyntaxToken? readOnlyKeyword; - internal readonly TypeSyntax type; - - internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - } + base.WriteTo(writer); + writer.WriteValue(this.refKeyword); + writer.WriteValue(this.readOnlyKeyword); + writer.WriteValue(this.type); + } - internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - } + static RefTypeSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(RefTypeSyntax), r => new RefTypeSyntax(r)); + } +} - internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - } +/// The 'scoped' modifier of a local. +internal sealed partial class ScopedTypeSyntax : TypeSyntax +{ + internal readonly SyntaxToken scopedKeyword; + internal readonly TypeSyntax type; - public SyntaxToken RefKeyword => this.refKeyword; - /// Gets the optional "readonly" keyword. - public SyntaxToken? ReadOnlyKeyword => this.readOnlyKeyword; - public TypeSyntax Type => this.type; + internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(scopedKeyword); + this.scopedKeyword = scopedKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.refKeyword, - 1 => this.readOnlyKeyword, - 2 => this.type, - _ => null, - }; + internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(scopedKeyword); + this.scopedKeyword = scopedKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeSyntax(this, parent, position); + internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(scopedKeyword); + this.scopedKeyword = scopedKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); + public SyntaxToken ScopedKeyword => this.scopedKeyword; + public TypeSyntax Type => this.type; - public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + internal override GreenNode? GetSlot(int index) + => index switch { - if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) - { - var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.scopedKeyword, + 1 => this.type, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ScopedTypeSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); - internal RefTypeSyntax(ObjectReader reader) - : base(reader) + public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) + { + if (scopedKeyword != this.ScopedKeyword || type != this.Type) { - this.SlotCount = 3; - var refKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - var readOnlyKeyword = (SyntaxToken?)reader.ReadValue(); - if (readOnlyKeyword != null) - { - AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; + var newNode = SyntaxFactory.ScopedType(scopedKeyword, type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.refKeyword); - writer.WriteValue(this.readOnlyKeyword); - writer.WriteValue(this.type); - } + return this; + } - static RefTypeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(RefTypeSyntax), r => new RefTypeSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ScopedTypeSyntax(this.Kind, this.scopedKeyword, this.type, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ScopedTypeSyntax(this.Kind, this.scopedKeyword, this.type, GetDiagnostics(), annotations); + + internal ScopedTypeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var scopedKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(scopedKeyword); + this.scopedKeyword = scopedKeyword; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; } - /// The 'scoped' modifier of a local. - internal sealed partial class ScopedTypeSyntax : TypeSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken scopedKeyword; - internal readonly TypeSyntax type; + base.WriteTo(writer); + writer.WriteValue(this.scopedKeyword); + writer.WriteValue(this.type); + } - internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(scopedKeyword); - this.scopedKeyword = scopedKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + static ScopedTypeSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ScopedTypeSyntax), r => new ScopedTypeSyntax(r)); + } +} - internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(scopedKeyword); - this.scopedKeyword = scopedKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - } +internal abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode +{ + internal ExpressionOrPatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(scopedKeyword); - this.scopedKeyword = scopedKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + internal ExpressionOrPatternSyntax(SyntaxKind kind) + : base(kind) + { + } - public SyntaxToken ScopedKeyword => this.scopedKeyword; - public TypeSyntax Type => this.type; + protected ExpressionOrPatternSyntax(ObjectReader reader) + : base(reader) + { + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.scopedKeyword, - 1 => this.type, - _ => null, - }; +/// Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. +internal abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax +{ + internal ExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ScopedTypeSyntax(this, parent, position); + internal ExpressionSyntax(SyntaxKind kind) + : base(kind) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); + protected ExpressionSyntax(ObjectReader reader) + : base(reader) + { + } +} - public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) - { - if (scopedKeyword != this.ScopedKeyword || type != this.Type) - { - var newNode = SyntaxFactory.ScopedType(scopedKeyword, type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +/// Class which represents the syntax node for parenthesized expression. +internal sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; - return this; - } + internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ScopedTypeSyntax(this.Kind, this.scopedKeyword, this.type, diagnostics, GetAnnotations()); + internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ScopedTypeSyntax(this.Kind, this.scopedKeyword, this.type, GetDiagnostics(), annotations); + internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal ScopedTypeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var scopedKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(scopedKeyword); - this.scopedKeyword = scopedKeyword; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - } + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// ExpressionSyntax node representing the expression enclosed within the parenthesis. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override void WriteTo(ObjectWriter writer) + internal override GreenNode? GetSlot(int index) + => index switch { - base.WriteTo(writer); - writer.WriteValue(this.scopedKeyword); - writer.WriteValue(this.type); - } + 0 => this.openParenToken, + 1 => this.expression, + 2 => this.closeParenToken, + _ => null, + }; - static ScopedTypeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ScopedTypeSyntax), r => new ScopedTypeSyntax(r)); - } - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedExpressionSyntax(this, parent, position); - internal abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode - { - internal ExpressionOrPatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); - internal ExpressionOrPatternSyntax(SyntaxKind kind) - : base(kind) + public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - protected ExpressionOrPatternSyntax(ObjectReader reader) - : base(reader) - { - } + return this; } - /// Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. - internal abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax - { - internal ExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); - internal ExpressionSyntax(SyntaxKind kind) - : base(kind) - { - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); - protected ExpressionSyntax(ObjectReader reader) - : base(reader) - { - } + internal ParenthesizedExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - /// Class which represents the syntax node for parenthesized expression. - internal sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.expression); + writer.WriteValue(this.closeParenToken); + } + + static ParenthesizedExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ParenthesizedExpressionSyntax), r => new ParenthesizedExpressionSyntax(r)); + } +} + +/// Class which represents the syntax node for tuple expression. +internal sealed partial class TupleExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? arguments; + internal readonly SyntaxToken closeParenToken; - internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - : base(kind) + internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// ExpressionSyntax node representing the expression enclosed within the parenthesis. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.expression, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.arguments, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); - public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + public TupleExpressionSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { - if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); + return this; + } - internal ParenthesizedExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.expression); - writer.WriteValue(this.closeParenToken); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); - static ParenthesizedExpressionSyntax() + internal TupleExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var arguments = (GreenNode?)reader.ReadValue(); + if (arguments != null) { - ObjectBinder.RegisterTypeReader(typeof(ParenthesizedExpressionSyntax), r => new ParenthesizedExpressionSyntax(r)); + AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - /// Class which represents the syntax node for tuple expression. - internal sealed partial class TupleExpressionSyntax : ExpressionSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? arguments; - internal readonly SyntaxToken closeParenToken; - - internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.arguments); + writer.WriteValue(this.closeParenToken); + } - internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + static TupleExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(TupleExpressionSyntax), r => new TupleExpressionSyntax(r)); + } +} - internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +/// Class which represents the syntax node for prefix unary expression. +internal sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax operand; - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arguments)); - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.arguments, - 2 => this.closeParenToken, - _ => null, - }; + internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleExpressionSyntax(this, parent, position); + internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); + /// SyntaxToken representing the kind of the operator of the prefix unary expression. + public SyntaxToken OperatorToken => this.operatorToken; + /// ExpressionSyntax representing the operand of the prefix unary expression. + public ExpressionSyntax Operand => this.operand; - public TupleExpressionSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); + 0 => this.operatorToken, + 1 => this.operand, + _ => null, + }; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrefixUnaryExpressionSyntax(this, parent, position); - internal TupleExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var arguments = (GreenNode?)reader.ReadValue(); - if (arguments != null) - { - AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); - internal override void WriteTo(ObjectWriter writer) + public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand) + { + if (operatorToken != this.OperatorToken || operand != this.Operand) { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.arguments); - writer.WriteValue(this.closeParenToken); + var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind, operatorToken, operand); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static TupleExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(TupleExpressionSyntax), r => new TupleExpressionSyntax(r)); - } + return this; } - /// Class which represents the syntax node for prefix unary expression. - internal sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax operand; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, diagnostics, GetAnnotations()); - internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, GetDiagnostics(), annotations); - internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - } + internal PrefixUnaryExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var operand = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(operand); + this.operand = operand; + } - internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.operand); + } - /// SyntaxToken representing the kind of the operator of the prefix unary expression. - public SyntaxToken OperatorToken => this.operatorToken; - /// ExpressionSyntax representing the operand of the prefix unary expression. - public ExpressionSyntax Operand => this.operand; + static PrefixUnaryExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(PrefixUnaryExpressionSyntax), r => new PrefixUnaryExpressionSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorToken, - 1 => this.operand, - _ => null, - }; +/// Class which represents the syntax node for an "await" expression. +internal sealed partial class AwaitExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken awaitKeyword; + internal readonly ExpressionSyntax expression; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrefixUnaryExpressionSyntax(this, parent, position); + internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); + internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand) - { - if (operatorToken != this.OperatorToken || operand != this.Operand) - { - var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind, operatorToken, operand); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - return this; - } + /// SyntaxToken representing the kind "await" keyword. + public SyntaxToken AwaitKeyword => this.awaitKeyword; + /// ExpressionSyntax representing the operand of the "await" operator. + public ExpressionSyntax Expression => this.expression; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.awaitKeyword, + 1 => this.expression, + _ => null, + }; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AwaitExpressionSyntax(this, parent, position); - internal PrefixUnaryExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var operand = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(operand); - this.operand = operand; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); - internal override void WriteTo(ObjectWriter writer) + public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression) + { + if (awaitKeyword != this.AwaitKeyword || expression != this.Expression) { - base.WriteTo(writer); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.operand); + var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static PrefixUnaryExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(PrefixUnaryExpressionSyntax), r => new PrefixUnaryExpressionSyntax(r)); - } + return this; } - /// Class which represents the syntax node for an "await" expression. - internal sealed partial class AwaitExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken awaitKeyword; - internal readonly ExpressionSyntax expression; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, diagnostics, GetAnnotations()); - internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, GetDiagnostics(), annotations); - internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal AwaitExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var awaitKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.awaitKeyword); + writer.WriteValue(this.expression); + } - /// SyntaxToken representing the kind "await" keyword. - public SyntaxToken AwaitKeyword => this.awaitKeyword; - /// ExpressionSyntax representing the operand of the "await" operator. - public ExpressionSyntax Expression => this.expression; + static AwaitExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(AwaitExpressionSyntax), r => new AwaitExpressionSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.awaitKeyword, - 1 => this.expression, - _ => null, - }; +/// Class which represents the syntax node for postfix unary expression. +internal sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax operand; + internal readonly SyntaxToken operatorToken; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AwaitExpressionSyntax(this, parent, position); + internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); + internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + } - public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression) - { - if (awaitKeyword != this.AwaitKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + } - return this; - } + /// ExpressionSyntax representing the operand of the postfix unary expression. + public ExpressionSyntax Operand => this.operand; + /// SyntaxToken representing the kind of the operator of the postfix unary expression. + public SyntaxToken OperatorToken => this.operatorToken; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.operand, + 1 => this.operatorToken, + _ => null, + }; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PostfixUnaryExpressionSyntax(this, parent, position); - internal AwaitExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var awaitKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); - internal override void WriteTo(ObjectWriter writer) + public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken) + { + if (operand != this.Operand || operatorToken != this.OperatorToken) { - base.WriteTo(writer); - writer.WriteValue(this.awaitKeyword); - writer.WriteValue(this.expression); + var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind, operand, operatorToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static AwaitExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(AwaitExpressionSyntax), r => new AwaitExpressionSyntax(r)); - } + return this; } - /// Class which represents the syntax node for postfix unary expression. - internal sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, GetDiagnostics(), annotations); + + internal PostfixUnaryExpressionSyntax(ObjectReader reader) + : base(reader) { - internal readonly ExpressionSyntax operand; - internal readonly SyntaxToken operatorToken; + this.SlotCount = 2; + var operand = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(operand); + this.operand = operand; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + } - internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.operand); + writer.WriteValue(this.operatorToken); + } - internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - } + static PostfixUnaryExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(PostfixUnaryExpressionSyntax), r => new PostfixUnaryExpressionSyntax(r)); + } +} - internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - } +/// Class which represents the syntax node for member access expression. +internal sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken operatorToken; + internal readonly SimpleNameSyntax name; - /// ExpressionSyntax representing the operand of the postfix unary expression. - public ExpressionSyntax Operand => this.operand; - /// SyntaxToken representing the kind of the operator of the postfix unary expression. - public SyntaxToken OperatorToken => this.operatorToken; + internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operand, - 1 => this.operatorToken, - _ => null, - }; + internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PostfixUnaryExpressionSyntax(this, parent, position); + internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); + /// ExpressionSyntax node representing the object that the member belongs to. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing the kind of the operator in the member access expression. + public SyntaxToken OperatorToken => this.operatorToken; + /// SimpleNameSyntax node representing the member being accessed. + public SimpleNameSyntax Name => this.name; - public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (operand != this.Operand || operatorToken != this.OperatorToken) - { - var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind, operand, operatorToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.expression, + 1 => this.operatorToken, + 2 => this.name, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberAccessExpressionSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); - internal PostfixUnaryExpressionSyntax(ObjectReader reader) - : base(reader) + public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + { + if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name) { - this.SlotCount = 2; - var operand = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(operand); - this.operand = operand; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; + var newNode = SyntaxFactory.MemberAccessExpression(this.Kind, expression, operatorToken, name); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.operand); - writer.WriteValue(this.operatorToken); - } + return this; + } - static PostfixUnaryExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(PostfixUnaryExpressionSyntax), r => new PostfixUnaryExpressionSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, GetDiagnostics(), annotations); + + internal MemberAccessExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var name = (SimpleNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; } - /// Class which represents the syntax node for member access expression. - internal sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken operatorToken; - internal readonly SimpleNameSyntax name; + base.WriteTo(writer); + writer.WriteValue(this.expression); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.name); + } - internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } - - internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + static MemberAccessExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(MemberAccessExpressionSyntax), r => new MemberAccessExpressionSyntax(r)); + } +} - internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } +/// Class which represents the syntax node for conditional access expression. +internal sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax whenNotNull; - /// ExpressionSyntax node representing the object that the member belongs to. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing the kind of the operator in the member access expression. - public SyntaxToken OperatorToken => this.operatorToken; - /// SimpleNameSyntax node representing the member being accessed. - public SimpleNameSyntax Name => this.name; + internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(whenNotNull); + this.whenNotNull = whenNotNull; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.operatorToken, - 2 => this.name, - _ => null, - }; + internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(whenNotNull); + this.whenNotNull = whenNotNull; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberAccessExpressionSyntax(this, parent, position); + internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(whenNotNull); + this.whenNotNull = whenNotNull; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); + /// ExpressionSyntax node representing the object conditionally accessed. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing the question mark. + public SyntaxToken OperatorToken => this.operatorToken; + /// ExpressionSyntax node representing the access expression to be executed when the object is not null. + public ExpressionSyntax WhenNotNull => this.whenNotNull; - public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + internal override GreenNode? GetSlot(int index) + => index switch { - if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name) - { - var newNode = SyntaxFactory.MemberAccessExpression(this.Kind, expression, operatorToken, name); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, diagnostics, GetAnnotations()); + 0 => this.expression, + 1 => this.operatorToken, + 2 => this.whenNotNull, + _ => null, + }; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalAccessExpressionSyntax(this, parent, position); - internal MemberAccessExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var name = (SimpleNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); - internal override void WriteTo(ObjectWriter writer) + public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + { + if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull) { - base.WriteTo(writer); - writer.WriteValue(this.expression); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.name); + var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static MemberAccessExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(MemberAccessExpressionSyntax), r => new MemberAccessExpressionSyntax(r)); - } + return this; } - /// Class which represents the syntax node for conditional access expression. - internal sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax - { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax whenNotNull; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, diagnostics, GetAnnotations()); - internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(whenNotNull); - this.whenNotNull = whenNotNull; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, GetDiagnostics(), annotations); - internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(whenNotNull); - this.whenNotNull = whenNotNull; - } + internal ConditionalAccessExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var whenNotNull = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(whenNotNull); + this.whenNotNull = whenNotNull; + } - internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(whenNotNull); - this.whenNotNull = whenNotNull; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.expression); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.whenNotNull); + } - /// ExpressionSyntax node representing the object conditionally accessed. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing the question mark. - public SyntaxToken OperatorToken => this.operatorToken; - /// ExpressionSyntax node representing the access expression to be executed when the object is not null. - public ExpressionSyntax WhenNotNull => this.whenNotNull; + static ConditionalAccessExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ConditionalAccessExpressionSyntax), r => new ConditionalAccessExpressionSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.operatorToken, - 2 => this.whenNotNull, - _ => null, - }; +/// Class which represents the syntax node for member binding expression. +internal sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken operatorToken; + internal readonly SimpleNameSyntax name; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalAccessExpressionSyntax(this, parent, position); + internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); + internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) - { - if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull) - { - var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - return this; - } + /// SyntaxToken representing dot. + public SyntaxToken OperatorToken => this.operatorToken; + /// SimpleNameSyntax node representing the member being bound to. + public SimpleNameSyntax Name => this.name; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.operatorToken, + 1 => this.name, + _ => null, + }; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberBindingExpressionSyntax(this, parent, position); - internal ConditionalAccessExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var whenNotNull = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(whenNotNull); - this.whenNotNull = whenNotNull; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); - internal override void WriteTo(ObjectWriter writer) + public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name) + { + if (operatorToken != this.OperatorToken || name != this.Name) { - base.WriteTo(writer); - writer.WriteValue(this.expression); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.whenNotNull); + var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static ConditionalAccessExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ConditionalAccessExpressionSyntax), r => new ConditionalAccessExpressionSyntax(r)); - } + return this; } - /// Class which represents the syntax node for member binding expression. - internal sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken operatorToken; - internal readonly SimpleNameSyntax name; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, diagnostics, GetAnnotations()); - internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, GetDiagnostics(), annotations); - internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal MemberBindingExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var name = (SimpleNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + } - internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.name); + } - /// SyntaxToken representing dot. - public SyntaxToken OperatorToken => this.operatorToken; - /// SimpleNameSyntax node representing the member being bound to. - public SimpleNameSyntax Name => this.name; + static MemberBindingExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(MemberBindingExpressionSyntax), r => new MemberBindingExpressionSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorToken, - 1 => this.name, - _ => null, - }; +/// Class which represents the syntax node for element binding expression. +internal sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax +{ + internal readonly BracketedArgumentListSyntax argumentList; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberBindingExpressionSyntax(this, parent, position); + internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); + internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name) - { - if (operatorToken != this.OperatorToken || name != this.Name) - { - var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - return this; - } + /// BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. + public BracketedArgumentListSyntax ArgumentList => this.argumentList; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.argumentList : null; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementBindingExpressionSyntax(this, parent, position); - internal MemberBindingExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var name = (SimpleNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); - internal override void WriteTo(ObjectWriter writer) + public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList) + { + if (argumentList != this.ArgumentList) { - base.WriteTo(writer); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.name); + var newNode = SyntaxFactory.ElementBindingExpression(argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static MemberBindingExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(MemberBindingExpressionSyntax), r => new MemberBindingExpressionSyntax(r)); - } + return this; } - /// Class which represents the syntax node for element binding expression. - internal sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax - { - internal readonly BracketedArgumentListSyntax argumentList; - - internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - - internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ElementBindingExpressionSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations()); - internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ElementBindingExpressionSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations); - /// BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. - public BracketedArgumentListSyntax ArgumentList => this.argumentList; + internal ElementBindingExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var argumentList = (BracketedArgumentListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.argumentList : null; + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.argumentList); + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementBindingExpressionSyntax(this, parent, position); + static ElementBindingExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ElementBindingExpressionSyntax), r => new ElementBindingExpressionSyntax(r)); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); +/// Class which represents the syntax node for a range expression. +internal sealed partial class RangeExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax? leftOperand; + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax? rightOperand; - public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList) + internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (leftOperand != null) { - if (argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ElementBindingExpression(argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(leftOperand); + this.leftOperand = leftOperand; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ElementBindingExpressionSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ElementBindingExpressionSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations); - - internal ElementBindingExpressionSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (rightOperand != null) { - this.SlotCount = 1; - var argumentList = (BracketedArgumentListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(rightOperand); + this.rightOperand = rightOperand; } + } - internal override void WriteTo(ObjectWriter writer) + internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (leftOperand != null) { - base.WriteTo(writer); - writer.WriteValue(this.argumentList); + this.AdjustFlagsAndWidth(leftOperand); + this.leftOperand = leftOperand; } - - static ElementBindingExpressionSyntax() + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (rightOperand != null) { - ObjectBinder.RegisterTypeReader(typeof(ElementBindingExpressionSyntax), r => new ElementBindingExpressionSyntax(r)); + this.AdjustFlagsAndWidth(rightOperand); + this.rightOperand = rightOperand; } } - /// Class which represents the syntax node for a range expression. - internal sealed partial class RangeExpressionSyntax : ExpressionSyntax + internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) + : base(kind) { - internal readonly ExpressionSyntax? leftOperand; - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax? rightOperand; - - internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - if (leftOperand != null) - { - this.AdjustFlagsAndWidth(leftOperand); - this.leftOperand = leftOperand; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (rightOperand != null) - { - this.AdjustFlagsAndWidth(rightOperand); - this.rightOperand = rightOperand; - } - } - - internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, SyntaxFactoryContext context) - : base(kind) + this.SlotCount = 3; + if (leftOperand != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (leftOperand != null) - { - this.AdjustFlagsAndWidth(leftOperand); - this.leftOperand = leftOperand; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (rightOperand != null) - { - this.AdjustFlagsAndWidth(rightOperand); - this.rightOperand = rightOperand; - } + this.AdjustFlagsAndWidth(leftOperand); + this.leftOperand = leftOperand; } - - internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) - : base(kind) + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (rightOperand != null) { - this.SlotCount = 3; - if (leftOperand != null) - { - this.AdjustFlagsAndWidth(leftOperand); - this.leftOperand = leftOperand; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (rightOperand != null) - { - this.AdjustFlagsAndWidth(rightOperand); - this.rightOperand = rightOperand; - } + this.AdjustFlagsAndWidth(rightOperand); + this.rightOperand = rightOperand; } + } - /// ExpressionSyntax node representing the expression on the left of the range operator. - public ExpressionSyntax? LeftOperand => this.leftOperand; - /// SyntaxToken representing the operator of the range expression. - public SyntaxToken OperatorToken => this.operatorToken; - /// ExpressionSyntax node representing the expression on the right of the range operator. - public ExpressionSyntax? RightOperand => this.rightOperand; + /// ExpressionSyntax node representing the expression on the left of the range operator. + public ExpressionSyntax? LeftOperand => this.leftOperand; + /// SyntaxToken representing the operator of the range expression. + public SyntaxToken OperatorToken => this.operatorToken; + /// ExpressionSyntax node representing the expression on the right of the range operator. + public ExpressionSyntax? RightOperand => this.rightOperand; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.leftOperand, - 1 => this.operatorToken, - 2 => this.rightOperand, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.leftOperand, + 1 => this.operatorToken, + 2 => this.rightOperand, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RangeExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RangeExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); - public RangeExpressionSyntax Update(ExpressionSyntax leftOperand, SyntaxToken operatorToken, ExpressionSyntax rightOperand) + public RangeExpressionSyntax Update(ExpressionSyntax leftOperand, SyntaxToken operatorToken, ExpressionSyntax rightOperand) + { + if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand) { - if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand) - { - var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, diagnostics, GetAnnotations()); - internal RangeExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var leftOperand = (ExpressionSyntax?)reader.ReadValue(); - if (leftOperand != null) - { - AdjustFlagsAndWidth(leftOperand); - this.leftOperand = leftOperand; - } - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var rightOperand = (ExpressionSyntax?)reader.ReadValue(); - if (rightOperand != null) - { - AdjustFlagsAndWidth(rightOperand); - this.rightOperand = rightOperand; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal RangeExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var leftOperand = (ExpressionSyntax?)reader.ReadValue(); + if (leftOperand != null) { - base.WriteTo(writer); - writer.WriteValue(this.leftOperand); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.rightOperand); + AdjustFlagsAndWidth(leftOperand); + this.leftOperand = leftOperand; } - - static RangeExpressionSyntax() + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var rightOperand = (ExpressionSyntax?)reader.ReadValue(); + if (rightOperand != null) { - ObjectBinder.RegisterTypeReader(typeof(RangeExpressionSyntax), r => new RangeExpressionSyntax(r)); + AdjustFlagsAndWidth(rightOperand); + this.rightOperand = rightOperand; } } - /// Class which represents the syntax node for implicit element access expression. - internal sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly BracketedArgumentListSyntax argumentList; + base.WriteTo(writer); + writer.WriteValue(this.leftOperand); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.rightOperand); + } - internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + static RangeExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(RangeExpressionSyntax), r => new RangeExpressionSyntax(r)); + } +} - internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } +/// Class which represents the syntax node for implicit element access expression. +internal sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax +{ + internal readonly BracketedArgumentListSyntax argumentList; - internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - /// BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. - public BracketedArgumentListSyntax ArgumentList => this.argumentList; + internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.argumentList : null; + internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitElementAccessSyntax(this, parent, position); + /// BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. + public BracketedArgumentListSyntax ArgumentList => this.argumentList; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.argumentList : null; - public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList) - { - if (argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ImplicitElementAccess(argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitElementAccessSyntax(this, parent, position); - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); + + public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList) + { + if (argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.ImplicitElementAccess(argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ImplicitElementAccessSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ImplicitElementAccessSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ImplicitElementAccessSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations()); - internal ImplicitElementAccessSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var argumentList = (BracketedArgumentListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ImplicitElementAccessSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.argumentList); - } + internal ImplicitElementAccessSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var argumentList = (BracketedArgumentListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - static ImplicitElementAccessSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ImplicitElementAccessSyntax), r => new ImplicitElementAccessSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.argumentList); } - /// Class which represents an expression that has a binary operator. - internal sealed partial class BinaryExpressionSyntax : ExpressionSyntax + static ImplicitElementAccessSyntax() { - internal readonly ExpressionSyntax left; - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax right; + ObjectBinder.RegisterTypeReader(typeof(ImplicitElementAccessSyntax), r => new ImplicitElementAccessSyntax(r)); + } +} - internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } +/// Class which represents an expression that has a binary operator. +internal sealed partial class BinaryExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax left; + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax right; - internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - /// ExpressionSyntax node representing the expression on the left of the binary operator. - public ExpressionSyntax Left => this.left; - /// SyntaxToken representing the operator of the binary expression. - public SyntaxToken OperatorToken => this.operatorToken; - /// ExpressionSyntax node representing the expression on the right of the binary operator. - public ExpressionSyntax Right => this.right; + internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.left, - 1 => this.operatorToken, - 2 => this.right, - _ => null, - }; + /// ExpressionSyntax node representing the expression on the left of the binary operator. + public ExpressionSyntax Left => this.left; + /// SyntaxToken representing the operator of the binary expression. + public SyntaxToken OperatorToken => this.operatorToken; + /// ExpressionSyntax node representing the expression on the right of the binary operator. + public ExpressionSyntax Right => this.right; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.left, + 1 => this.operatorToken, + 2 => this.right, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); - public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.BinaryExpression(this.Kind, left, operatorToken, right); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.BinaryExpression(this.Kind, left, operatorToken, right); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); - internal BinaryExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var left = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(left); - this.left = left; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var right = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(right); - this.right = right; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.left); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.right); - } + internal BinaryExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var left = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(left); + this.left = left; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var right = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(right); + this.right = right; + } - static BinaryExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(BinaryExpressionSyntax), r => new BinaryExpressionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.left); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.right); } - /// Class which represents an expression that has an assignment operator. - internal sealed partial class AssignmentExpressionSyntax : ExpressionSyntax + static BinaryExpressionSyntax() { - internal readonly ExpressionSyntax left; - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax right; + ObjectBinder.RegisterTypeReader(typeof(BinaryExpressionSyntax), r => new BinaryExpressionSyntax(r)); + } +} - internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } +/// Class which represents an expression that has an assignment operator. +internal sealed partial class AssignmentExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax left; + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax right; - internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - /// ExpressionSyntax node representing the expression on the left of the assignment operator. - public ExpressionSyntax Left => this.left; - /// SyntaxToken representing the operator of the assignment expression. - public SyntaxToken OperatorToken => this.operatorToken; - /// ExpressionSyntax node representing the expression on the right of the assignment operator. - public ExpressionSyntax Right => this.right; + internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.left, - 1 => this.operatorToken, - 2 => this.right, - _ => null, - }; + /// ExpressionSyntax node representing the expression on the left of the assignment operator. + public ExpressionSyntax Left => this.left; + /// SyntaxToken representing the operator of the assignment expression. + public SyntaxToken OperatorToken => this.operatorToken; + /// ExpressionSyntax node representing the expression on the right of the assignment operator. + public ExpressionSyntax Right => this.right; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.left, + 1 => this.operatorToken, + 2 => this.right, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AssignmentExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AssignmentExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); - public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.AssignmentExpression(this.Kind, left, operatorToken, right); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AssignmentExpression(this.Kind, left, operatorToken, right); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); - internal AssignmentExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var left = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(left); - this.left = left; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var right = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(right); - this.right = right; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.left); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.right); - } + internal AssignmentExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var left = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(left); + this.left = left; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var right = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(right); + this.right = right; + } - static AssignmentExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(AssignmentExpressionSyntax), r => new AssignmentExpressionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.left); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.right); } - /// Class which represents the syntax node for conditional expression. - internal sealed partial class ConditionalExpressionSyntax : ExpressionSyntax + static AssignmentExpressionSyntax() { - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken questionToken; - internal readonly ExpressionSyntax whenTrue; - internal readonly SyntaxToken colonToken; - internal readonly ExpressionSyntax whenFalse; + ObjectBinder.RegisterTypeReader(typeof(AssignmentExpressionSyntax), r => new AssignmentExpressionSyntax(r)); + } +} - internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - this.AdjustFlagsAndWidth(whenTrue); - this.whenTrue = whenTrue; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(whenFalse); - this.whenFalse = whenFalse; - } +/// Class which represents the syntax node for conditional expression. +internal sealed partial class ConditionalExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken questionToken; + internal readonly ExpressionSyntax whenTrue; + internal readonly SyntaxToken colonToken; + internal readonly ExpressionSyntax whenFalse; + + internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + this.AdjustFlagsAndWidth(whenTrue); + this.whenTrue = whenTrue; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenFalse); + this.whenFalse = whenFalse; + } + + internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + this.AdjustFlagsAndWidth(whenTrue); + this.whenTrue = whenTrue; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenFalse); + this.whenFalse = whenFalse; + } + + internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + this.AdjustFlagsAndWidth(whenTrue); + this.whenTrue = whenTrue; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenFalse); + this.whenFalse = whenFalse; + } + + /// ExpressionSyntax node representing the condition of the conditional expression. + public ExpressionSyntax Condition => this.condition; + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken => this.questionToken; + /// ExpressionSyntax node representing the expression to be executed when the condition is true. + public ExpressionSyntax WhenTrue => this.whenTrue; + /// SyntaxToken representing the colon. + public SyntaxToken ColonToken => this.colonToken; + /// ExpressionSyntax node representing the expression to be executed when the condition is false. + public ExpressionSyntax WhenFalse => this.whenFalse; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.condition, + 1 => this.questionToken, + 2 => this.whenTrue, + 3 => this.colonToken, + 4 => this.whenFalse, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); + + public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + { + if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse) + { + var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, GetDiagnostics(), annotations); + + internal ConditionalExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var condition = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(condition); + this.condition = condition; + var questionToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + var whenTrue = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(whenTrue); + this.whenTrue = whenTrue; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + var whenFalse = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(whenFalse); + this.whenFalse = whenFalse; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.condition); + writer.WriteValue(this.questionToken); + writer.WriteValue(this.whenTrue); + writer.WriteValue(this.colonToken); + writer.WriteValue(this.whenFalse); + } - internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - this.AdjustFlagsAndWidth(whenTrue); - this.whenTrue = whenTrue; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(whenFalse); - this.whenFalse = whenFalse; - } + static ConditionalExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ConditionalExpressionSyntax), r => new ConditionalExpressionSyntax(r)); + } +} - internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - this.AdjustFlagsAndWidth(whenTrue); - this.whenTrue = whenTrue; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(whenFalse); - this.whenFalse = whenFalse; - } - - /// ExpressionSyntax node representing the condition of the conditional expression. - public ExpressionSyntax Condition => this.condition; - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => this.questionToken; - /// ExpressionSyntax node representing the expression to be executed when the condition is true. - public ExpressionSyntax WhenTrue => this.whenTrue; - /// SyntaxToken representing the colon. - public SyntaxToken ColonToken => this.colonToken; - /// ExpressionSyntax node representing the expression to be executed when the condition is false. - public ExpressionSyntax WhenFalse => this.whenFalse; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.condition, - 1 => this.questionToken, - 2 => this.whenTrue, - 3 => this.colonToken, - 4 => this.whenFalse, - _ => null, - }; +/// Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. +internal abstract partial class InstanceExpressionSyntax : ExpressionSyntax +{ + internal InstanceExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } + + internal InstanceExpressionSyntax(SyntaxKind kind) + : base(kind) + { + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalExpressionSyntax(this, parent, position); + protected InstanceExpressionSyntax(ObjectReader reader) + : base(reader) + { + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); +/// Class which represents the syntax node for a this expression. +internal sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax +{ + internal readonly SyntaxToken token; - public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) - { - if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse) - { - var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - return this; - } + internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, diagnostics, GetAnnotations()); + internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, GetDiagnostics(), annotations); + /// SyntaxToken representing the this keyword. + public SyntaxToken Token => this.token; - internal ConditionalExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var condition = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(condition); - this.condition = condition; - var questionToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - var whenTrue = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(whenTrue); - this.whenTrue = whenTrue; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - var whenFalse = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(whenFalse); - this.whenFalse = whenFalse; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.token : null; - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.condition); - writer.WriteValue(this.questionToken); - writer.WriteValue(this.whenTrue); - writer.WriteValue(this.colonToken); - writer.WriteValue(this.whenFalse); - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThisExpressionSyntax(this, parent, position); - static ConditionalExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ConditionalExpressionSyntax), r => new ConditionalExpressionSyntax(r)); - } - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); - /// Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. - internal abstract partial class InstanceExpressionSyntax : ExpressionSyntax + public ThisExpressionSyntax Update(SyntaxToken token) { - internal InstanceExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (token != this.Token) { + var newNode = SyntaxFactory.ThisExpression(token); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal InstanceExpressionSyntax(SyntaxKind kind) - : base(kind) - { - } + return this; + } - protected InstanceExpressionSyntax(ObjectReader reader) - : base(reader) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ThisExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ThisExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); + + internal ThisExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var token = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(token); + this.token = token; } - /// Class which represents the syntax node for a this expression. - internal sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken token; + base.WriteTo(writer); + writer.WriteValue(this.token); + } - internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + static ThisExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ThisExpressionSyntax), r => new ThisExpressionSyntax(r)); + } +} - internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } +/// Class which represents the syntax node for a base expression. +internal sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax +{ + internal readonly SyntaxToken token; - internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } + + internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } + + internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - /// SyntaxToken representing the this keyword. - public SyntaxToken Token => this.token; + /// SyntaxToken representing the base keyword. + public SyntaxToken Token => this.token; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.token : null; + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.token : null; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThisExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); - public ThisExpressionSyntax Update(SyntaxToken token) + public BaseExpressionSyntax Update(SyntaxToken token) + { + if (token != this.Token) { - if (token != this.Token) - { - var newNode = SyntaxFactory.ThisExpression(token); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.BaseExpression(token); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ThisExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ThisExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BaseExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); - internal ThisExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var token = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(token); - this.token = token; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BaseExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.token); - } + internal BaseExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var token = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(token); + this.token = token; + } - static ThisExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ThisExpressionSyntax), r => new ThisExpressionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.token); } - /// Class which represents the syntax node for a base expression. - internal sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax + static BaseExpressionSyntax() { - internal readonly SyntaxToken token; + ObjectBinder.RegisterTypeReader(typeof(BaseExpressionSyntax), r => new BaseExpressionSyntax(r)); + } +} - internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } +/// Class which represents the syntax node for a literal expression. +internal sealed partial class LiteralExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken token; - internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - /// SyntaxToken representing the base keyword. - public SyntaxToken Token => this.token; + internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.token : null; + /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. + public SyntaxToken Token => this.token; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseExpressionSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.token : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LiteralExpressionSyntax(this, parent, position); - public BaseExpressionSyntax Update(SyntaxToken token) - { - if (token != this.Token) - { - var newNode = SyntaxFactory.BaseExpression(token); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); - return this; + public LiteralExpressionSyntax Update(SyntaxToken token) + { + if (token != this.Token) + { + var newNode = SyntaxFactory.LiteralExpression(this.Kind, token); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BaseExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BaseExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LiteralExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); - internal BaseExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var token = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(token); - this.token = token; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LiteralExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.token); - } + internal LiteralExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var token = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(token); + this.token = token; + } - static BaseExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(BaseExpressionSyntax), r => new BaseExpressionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.token); + } + + static LiteralExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(LiteralExpressionSyntax), r => new LiteralExpressionSyntax(r)); + } +} + +/// Class which represents the syntax node for MakeRef expression. +internal sealed partial class MakeRefExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + + internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - /// Class which represents the syntax node for a literal expression. - internal sealed partial class LiteralExpressionSyntax : ExpressionSyntax + internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + : base(kind) { - internal readonly SyntaxToken token; + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + /// SyntaxToken representing the MakeRefKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Argument of the primary function. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.expression, + 3 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MakeRefExpressionSyntax(this, parent, position); - internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); + + public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; + var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. - public SyntaxToken Token => this.token; + return this; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.token : null; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LiteralExpressionSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); + internal MakeRefExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public LiteralExpressionSyntax Update(SyntaxToken token) - { - if (token != this.Token) - { - var newNode = SyntaxFactory.LiteralExpression(this.Kind, token); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.keyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.expression); + writer.WriteValue(this.closeParenToken); + } - return this; - } + static MakeRefExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(MakeRefExpressionSyntax), r => new MakeRefExpressionSyntax(r)); + } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LiteralExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for RefType expression. +internal sealed partial class RefTypeExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + + internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LiteralExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); + internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal LiteralExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var token = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(token); - this.token = token; - } + /// SyntaxToken representing the RefTypeKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Argument of the primary function. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override void WriteTo(ObjectWriter writer) + internal override GreenNode? GetSlot(int index) + => index switch { - base.WriteTo(writer); - writer.WriteValue(this.token); - } + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.expression, + 3 => this.closeParenToken, + _ => null, + }; - static LiteralExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(LiteralExpressionSyntax), r => new LiteralExpressionSyntax(r)); - } - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeExpressionSyntax(this, parent, position); - /// Class which represents the syntax node for MakeRef expression. - internal sealed partial class MakeRefExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); - internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + return this; + } - internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); - /// SyntaxToken representing the MakeRefKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Argument of the primary function. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.expression, - 3 => this.closeParenToken, - _ => null, - }; + internal RefTypeExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MakeRefExpressionSyntax(this, parent, position); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.keyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.expression); + writer.WriteValue(this.closeParenToken); + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); + static RefTypeExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(RefTypeExpressionSyntax), r => new RefTypeExpressionSyntax(r)); + } +} - public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +/// Class which represents the syntax node for RefValue expression. +internal sealed partial class RefValueExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken comma; + internal readonly TypeSyntax type; + internal readonly SyntaxToken closeParenToken; + + internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(comma); + this.comma = comma; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(comma); + this.comma = comma; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 6; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(comma); + this.comma = comma; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + /// SyntaxToken representing the RefValueKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Typed reference expression. + public ExpressionSyntax Expression => this.expression; + /// Comma separating the arguments. + public SyntaxToken Comma => this.comma; + /// The type of the value. + public TypeSyntax Type => this.type; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.expression, + 3 => this.comma, + 4 => this.type, + 5 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefValueExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); + + public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, GetDiagnostics(), annotations); + + internal RefValueExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 6; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var comma = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(comma); + this.comma = comma; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.keyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.expression); + writer.WriteValue(this.comma); + writer.WriteValue(this.type); + writer.WriteValue(this.closeParenToken); + } + + static RefValueExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(RefValueExpressionSyntax), r => new RefValueExpressionSyntax(r)); + } +} - return this; - } +/// Class which represents the syntax node for Checked or Unchecked expression. +internal sealed partial class CheckedExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + + internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); + internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); + /// SyntaxToken representing the checked or unchecked keyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Argument of the primary function. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal MakeRefExpressionSyntax(ObjectReader reader) - : base(reader) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.expression, + 3 => this.closeParenToken, + _ => null, + }; - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.keyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.expression); - writer.WriteValue(this.closeParenToken); - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); - static MakeRefExpressionSyntax() + public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { - ObjectBinder.RegisterTypeReader(typeof(MakeRefExpressionSyntax), r => new MakeRefExpressionSyntax(r)); + var newNode = SyntaxFactory.CheckedExpression(this.Kind, keyword, openParenToken, expression, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; } - /// Class which represents the syntax node for RefType expression. - internal sealed partial class RefTypeExpressionSyntax : ExpressionSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); + + internal CheckedExpressionSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; + this.SlotCount = 4; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.keyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.expression); + writer.WriteValue(this.closeParenToken); + } - internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + static CheckedExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(CheckedExpressionSyntax), r => new CheckedExpressionSyntax(r)); + } +} - internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +/// Class which represents the syntax node for Default expression. +internal sealed partial class DefaultExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken closeParenToken; + + internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - /// SyntaxToken representing the RefTypeKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Argument of the primary function. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.expression, - 3 => this.closeParenToken, - _ => null, - }; + /// SyntaxToken representing the DefaultKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Argument of the primary function. + public TypeSyntax Type => this.type; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.type, + 3 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); - public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); - internal RefTypeExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.keyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.expression); - writer.WriteValue(this.closeParenToken); - } + internal DefaultExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - static RefTypeExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(RefTypeExpressionSyntax), r => new RefTypeExpressionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.keyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.type); + writer.WriteValue(this.closeParenToken); } - /// Class which represents the syntax node for RefValue expression. - internal sealed partial class RefValueExpressionSyntax : ExpressionSyntax + static DefaultExpressionSyntax() { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken comma; - internal readonly TypeSyntax type; - internal readonly SyntaxToken closeParenToken; + ObjectBinder.RegisterTypeReader(typeof(DefaultExpressionSyntax), r => new DefaultExpressionSyntax(r)); + } +} - internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 6; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(comma); - this.comma = comma; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +/// Class which represents the syntax node for TypeOf expression. +internal sealed partial class TypeOfExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken closeParenToken; + + internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + /// SyntaxToken representing the TypeOfKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// The expression to return type of. + public TypeSyntax Type => this.type; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 6; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(comma); - this.comma = comma; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.type, + 3 => this.closeParenToken, + _ => null, + }; - internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeOfExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); + + public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) { - this.SlotCount = 6; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(comma); - this.comma = comma; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// SyntaxToken representing the RefValueKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Typed reference expression. - public ExpressionSyntax Expression => this.expression; - /// Comma separating the arguments. - public SyntaxToken Comma => this.comma; - /// The type of the value. - public TypeSyntax Type => this.type; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.expression, - 3 => this.comma, - 4 => this.type, - 5 => this.closeParenToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefValueExpressionSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); - public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal TypeOfExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - return this; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.keyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.type); + writer.WriteValue(this.closeParenToken); + } + + static TypeOfExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(TypeOfExpressionSyntax), r => new TypeOfExpressionSyntax(r)); + } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for SizeOf expression. +internal sealed partial class SizeOfExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken closeParenToken; + + internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, GetDiagnostics(), annotations); + internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal RefValueExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 6; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var comma = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(comma); - this.comma = comma; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + /// SyntaxToken representing the SizeOfKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Argument of the primary function. + public TypeSyntax Type => this.type; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override void WriteTo(ObjectWriter writer) + internal override GreenNode? GetSlot(int index) + => index switch { - base.WriteTo(writer); - writer.WriteValue(this.keyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.expression); - writer.WriteValue(this.comma); - writer.WriteValue(this.type); - writer.WriteValue(this.closeParenToken); - } + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.type, + 3 => this.closeParenToken, + _ => null, + }; - static RefValueExpressionSyntax() + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SizeOfExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); + + public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) { - ObjectBinder.RegisterTypeReader(typeof(RefValueExpressionSyntax), r => new RefValueExpressionSyntax(r)); + var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; } - /// Class which represents the syntax node for Checked or Unchecked expression. - internal sealed partial class CheckedExpressionSyntax : ExpressionSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); + + internal SizeOfExpressionSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; + this.SlotCount = 4; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.keyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.type); + writer.WriteValue(this.closeParenToken); + } - internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + static SizeOfExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(SizeOfExpressionSyntax), r => new SizeOfExpressionSyntax(r)); + } +} - internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +/// Class which represents the syntax node for invocation expression. +internal sealed partial class InvocationExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly ArgumentListSyntax argumentList; - /// SyntaxToken representing the checked or unchecked keyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Argument of the primary function. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.expression, - 3 => this.closeParenToken, - _ => null, - }; + internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedExpressionSyntax(this, parent, position); + internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); + /// ExpressionSyntax node representing the expression part of the invocation. + public ExpressionSyntax Expression => this.expression; + /// ArgumentListSyntax node representing the list of arguments of the invocation expression. + public ArgumentListSyntax ArgumentList => this.argumentList; - public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CheckedExpression(this.Kind, keyword, openParenToken, expression, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.expression, + 1 => this.argumentList, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InvocationExpressionSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); - internal CheckedExpressionSyntax(ObjectReader reader) - : base(reader) + public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList) + { + if (expression != this.Expression || argumentList != this.ArgumentList) { - this.SlotCount = 4; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + var newNode = SyntaxFactory.InvocationExpression(expression, argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.keyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.expression); - writer.WriteValue(this.closeParenToken); - } + return this; + } - static CheckedExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(CheckedExpressionSyntax), r => new CheckedExpressionSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations); + + internal InvocationExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var argumentList = (ArgumentListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.expression); + writer.WriteValue(this.argumentList); } - /// Class which represents the syntax node for Default expression. - internal sealed partial class DefaultExpressionSyntax : ExpressionSyntax + static InvocationExpressionSyntax() { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken closeParenToken; + ObjectBinder.RegisterTypeReader(typeof(InvocationExpressionSyntax), r => new InvocationExpressionSyntax(r)); + } +} - internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +/// Class which represents the syntax node for element access expression. +internal sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly BracketedArgumentListSyntax argumentList; + + internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + + internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + + /// ExpressionSyntax node representing the expression which is accessing the element. + public ExpressionSyntax Expression => this.expression; + /// BracketedArgumentListSyntax node representing the list of arguments of the element access expression. + public BracketedArgumentListSyntax ArgumentList => this.argumentList; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + 0 => this.expression, + 1 => this.argumentList, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementAccessExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); - internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - : base(kind) + public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) + { + if (expression != this.Expression || argumentList != this.ArgumentList) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// SyntaxToken representing the DefaultKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Argument of the primary function. - public TypeSyntax Type => this.type; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.type, - 3 => this.closeParenToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultExpressionSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); + internal ElementAccessExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var argumentList = (BracketedArgumentListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.expression); + writer.WriteValue(this.argumentList); + } - return this; - } + static ElementAccessExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ElementAccessExpressionSyntax), r => new ElementAccessExpressionSyntax(r)); + } +} + +/// Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. +internal abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode +{ + internal BaseArgumentListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + internal BaseArgumentListSyntax(SyntaxKind kind) + : base(kind) + { + } + + protected BaseArgumentListSyntax(ObjectReader reader) + : base(reader) + { + } + + /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. + public abstract CoreSyntax.SeparatedSyntaxList Arguments { get; } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); +/// Class which represents the syntax node for the list of arguments. +internal sealed partial class ArgumentListSyntax : BaseArgumentListSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? arguments; + internal readonly SyntaxToken closeParenToken; - internal DefaultExpressionSyntax(ObjectReader reader) - : base(reader) + internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SlotCount = 4; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override void WriteTo(ObjectWriter writer) + internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - base.WriteTo(writer); - writer.WriteValue(this.keyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.type); - writer.WriteValue(this.closeParenToken); + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - static DefaultExpressionSyntax() + internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - ObjectBinder.RegisterTypeReader(typeof(DefaultExpressionSyntax), r => new DefaultExpressionSyntax(r)); + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - /// Class which represents the syntax node for TypeOf expression. - internal sealed partial class TypeOfExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken closeParenToken; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public override CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + 0 => this.openParenToken, + 1 => this.arguments, + 2 => this.closeParenToken, + _ => null, + }; - internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentListSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); - internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - : base(kind) + public ArgumentListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// SyntaxToken representing the TypeOfKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// The expression to return type of. - public TypeSyntax Type => this.type; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.type, - 3 => this.closeParenToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeOfExpressionSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); - public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + internal ArgumentListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var arguments = (GreenNode?)reader.ReadValue(); + if (arguments != null) { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.arguments); + writer.WriteValue(this.closeParenToken); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + static ArgumentListSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ArgumentListSyntax), r => new ArgumentListSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); +/// Class which represents the syntax node for bracketed argument list. +internal sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? arguments; + internal readonly SyntaxToken closeBracketToken; - internal TypeOfExpressionSyntax(ObjectReader reader) - : base(reader) + internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (arguments != null) { - this.SlotCount = 4; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal override void WriteTo(ObjectWriter writer) + internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (arguments != null) { - base.WriteTo(writer); - writer.WriteValue(this.keyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.type); - writer.WriteValue(this.closeParenToken); + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - static TypeOfExpressionSyntax() + internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (arguments != null) { - ObjectBinder.RegisterTypeReader(typeof(TypeOfExpressionSyntax), r => new TypeOfExpressionSyntax(r)); + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; } - /// Class which represents the syntax node for SizeOf expression. - internal sealed partial class SizeOfExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken closeParenToken; + /// SyntaxToken representing open bracket. + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public override CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + /// SyntaxToken representing close bracket. + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + 0 => this.openBracketToken, + 1 => this.arguments, + 2 => this.closeBracketToken, + _ => null, + }; - internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedArgumentListSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); - internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - : base(kind) + public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// SyntaxToken representing the SizeOfKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Argument of the primary function. - public TypeSyntax Type => this.type; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.type, - 3 => this.closeParenToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SizeOfExpressionSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, GetDiagnostics(), annotations); - public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + internal BracketedArgumentListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + var arguments = (GreenNode?)reader.ReadValue(); + if (arguments != null) { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + var closeBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openBracketToken); + writer.WriteValue(this.arguments); + writer.WriteValue(this.closeBracketToken); + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); + static BracketedArgumentListSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(BracketedArgumentListSyntax), r => new BracketedArgumentListSyntax(r)); + } +} - internal SizeOfExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +/// Class which represents the syntax node for argument. +internal sealed partial class ArgumentSyntax : CSharpSyntaxNode +{ + internal readonly NameColonSyntax? nameColon; + internal readonly SyntaxToken? refKindKeyword; + internal readonly ExpressionSyntax expression; - internal override void WriteTo(ObjectWriter writer) + internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (nameColon != null) { - base.WriteTo(writer); - writer.WriteValue(this.keyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.type); - writer.WriteValue(this.closeParenToken); + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } - - static SizeOfExpressionSyntax() + if (refKindKeyword != null) { - ObjectBinder.RegisterTypeReader(typeof(SizeOfExpressionSyntax), r => new SizeOfExpressionSyntax(r)); + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - /// Class which represents the syntax node for invocation expression. - internal sealed partial class InvocationExpressionSyntax : ExpressionSyntax + internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) { - internal readonly ExpressionSyntax expression; - internal readonly ArgumentListSyntax argumentList; - - internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + if (nameColon != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } - - internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) + if (refKindKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList) - : base(kind) + internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 3; + if (nameColon != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; + } + if (refKindKeyword != null) + { + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - /// ExpressionSyntax node representing the expression part of the invocation. - public ExpressionSyntax Expression => this.expression; - /// ArgumentListSyntax node representing the list of arguments of the invocation expression. - public ArgumentListSyntax ArgumentList => this.argumentList; + /// NameColonSyntax node representing the optional name arguments. + public NameColonSyntax? NameColon => this.nameColon; + /// SyntaxToken representing the optional ref or out keyword. + public SyntaxToken? RefKindKeyword => this.refKindKeyword; + /// ExpressionSyntax node representing the argument. + public ExpressionSyntax Expression => this.expression; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.argumentList, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.nameColon, + 1 => this.refKindKeyword, + 2 => this.expression, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InvocationExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); - public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList) + public ArgumentSyntax Update(NameColonSyntax nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) + { + if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) { - if (expression != this.Expression || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.InvocationExpression(expression, argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, diagnostics, GetAnnotations()); - internal InvocationExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var argumentList = (ArgumentListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal ArgumentSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var nameColon = (NameColonSyntax?)reader.ReadValue(); + if (nameColon != null) { - base.WriteTo(writer); - writer.WriteValue(this.expression); - writer.WriteValue(this.argumentList); + AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } - - static InvocationExpressionSyntax() + var refKindKeyword = (SyntaxToken?)reader.ReadValue(); + if (refKindKeyword != null) { - ObjectBinder.RegisterTypeReader(typeof(InvocationExpressionSyntax), r => new InvocationExpressionSyntax(r)); + AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; } - /// Class which represents the syntax node for element access expression. - internal sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly ExpressionSyntax expression; - internal readonly BracketedArgumentListSyntax argumentList; + base.WriteTo(writer); + writer.WriteValue(this.nameColon); + writer.WriteValue(this.refKindKeyword); + writer.WriteValue(this.expression); + } - internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + static ArgumentSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ArgumentSyntax), r => new ArgumentSyntax(r)); + } +} - internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } +internal abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode +{ + internal BaseExpressionColonSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal BaseExpressionColonSyntax(SyntaxKind kind) + : base(kind) + { + } - /// ExpressionSyntax node representing the expression which is accessing the element. - public ExpressionSyntax Expression => this.expression; - /// BracketedArgumentListSyntax node representing the list of arguments of the element access expression. - public BracketedArgumentListSyntax ArgumentList => this.argumentList; + protected BaseExpressionColonSyntax(ObjectReader reader) + : base(reader) + { + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.argumentList, - _ => null, - }; + public abstract ExpressionSyntax Expression { get; } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementAccessExpressionSyntax(this, parent, position); + public abstract SyntaxToken ColonToken { get; } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); +internal sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken colonToken; - public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - { - if (expression != this.Expression || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - return this; - } + internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations()); + internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations); + public override ExpressionSyntax Expression => this.expression; + public override SyntaxToken ColonToken => this.colonToken; - internal ElementAccessExpressionSyntax(ObjectReader reader) - : base(reader) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var argumentList = (BracketedArgumentListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + 0 => this.expression, + 1 => this.colonToken, + _ => null, + }; - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.expression); - writer.WriteValue(this.argumentList); - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionColonSyntax(this, parent, position); - static ElementAccessExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ElementAccessExpressionSyntax), r => new ElementAccessExpressionSyntax(r)); - } - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); - /// Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. - internal abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode + public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken) { - internal BaseArgumentListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (expression != this.Expression || colonToken != this.ColonToken) { + var newNode = SyntaxFactory.ExpressionColon(expression, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal BaseArgumentListSyntax(SyntaxKind kind) - : base(kind) - { - } + return this; + } - protected BaseArgumentListSyntax(ObjectReader reader) - : base(reader) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, diagnostics, GetAnnotations()); - /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments { get; } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, GetDiagnostics(), annotations); - /// Class which represents the syntax node for the list of arguments. - internal sealed partial class ArgumentListSyntax : BaseArgumentListSyntax + internal ExpressionColonSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? arguments; - internal readonly SyntaxToken closeParenToken; + this.SlotCount = 2; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.expression); + writer.WriteValue(this.colonToken); + } - internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + static ExpressionColonSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ExpressionColonSyntax), r => new ExpressionColonSyntax(r)); + } +} - internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +/// Class which represents the syntax node for name colon syntax. +internal sealed partial class NameColonSyntax : BaseExpressionColonSyntax +{ + internal readonly IdentifierNameSyntax name; + internal readonly SyntaxToken colonToken; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arguments)); - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.arguments, - 2 => this.closeParenToken, - _ => null, - }; + internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentListSyntax(this, parent, position); + internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); + /// IdentifierNameSyntax representing the identifier name. + public IdentifierNameSyntax Name => this.name; + /// SyntaxToken representing colon. + public override SyntaxToken ColonToken => this.colonToken; - public ArgumentListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.name, + 1 => this.colonToken, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameColonSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); - internal ArgumentListSyntax(ObjectReader reader) - : base(reader) + public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken) + { + if (name != this.Name || colonToken != this.ColonToken) { - this.SlotCount = 3; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var arguments = (GreenNode?)reader.ReadValue(); - if (arguments != null) - { - AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + var newNode = SyntaxFactory.NameColon(name, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.arguments); - writer.WriteValue(this.closeParenToken); - } + return this; + } - static ArgumentListSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ArgumentListSyntax), r => new ArgumentListSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NameColonSyntax(this.Kind, this.name, this.colonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NameColonSyntax(this.Kind, this.name, this.colonToken, GetDiagnostics(), annotations); + + internal NameColonSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var name = (IdentifierNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; } - /// Class which represents the syntax node for bracketed argument list. - internal sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? arguments; - internal readonly SyntaxToken closeBracketToken; + base.WriteTo(writer); + writer.WriteValue(this.name); + writer.WriteValue(this.colonToken); + } - internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + static NameColonSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(NameColonSyntax), r => new NameColonSyntax(r)); + } +} - internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } +/// Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. +internal sealed partial class DeclarationExpressionSyntax : ExpressionSyntax +{ + internal readonly TypeSyntax type; + internal readonly VariableDesignationSyntax designation; - internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } - - /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arguments)); - /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => this.closeBracketToken; + internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.arguments, - 2 => this.closeBracketToken, - _ => null, - }; + internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedArgumentListSyntax(this, parent, position); + internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); + public TypeSyntax Type => this.type; + /// Declaration representing the variable declared in an out parameter or deconstruction. + public VariableDesignationSyntax Designation => this.designation; - public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.type, + 1 => this.designation, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationExpressionSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); - internal BracketedArgumentListSyntax(ObjectReader reader) - : base(reader) + public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + { + if (type != this.Type || designation != this.Designation) { - this.SlotCount = 3; - var openBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - var arguments = (GreenNode?)reader.ReadValue(); - if (arguments != null) - { - AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - var closeBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + var newNode = SyntaxFactory.DeclarationExpression(type, designation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openBracketToken); - writer.WriteValue(this.arguments); - writer.WriteValue(this.closeBracketToken); - } + return this; + } - static BracketedArgumentListSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(BracketedArgumentListSyntax), r => new BracketedArgumentListSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations); + + internal DeclarationExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var designation = (VariableDesignationSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(designation); + this.designation = designation; } - /// Class which represents the syntax node for argument. - internal sealed partial class ArgumentSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal readonly NameColonSyntax? nameColon; - internal readonly SyntaxToken? refKindKeyword; - internal readonly ExpressionSyntax expression; + base.WriteTo(writer); + writer.WriteValue(this.type); + writer.WriteValue(this.designation); + } - internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + static DeclarationExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(DeclarationExpressionSyntax), r => new DeclarationExpressionSyntax(r)); + } +} + +/// Class which represents the syntax node for cast expression. +internal sealed partial class CastExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken closeParenToken; + internal readonly ExpressionSyntax expression; + + internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// TypeSyntax node representing the type to which the expression is being cast. + public TypeSyntax Type => this.type; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + /// ExpressionSyntax node representing the expression that is being casted. + public ExpressionSyntax Expression => this.expression; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + 0 => this.openParenToken, + 1 => this.type, + 2 => this.closeParenToken, + 3 => this.expression, + _ => null, + }; - internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CastExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); + + public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + { + if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression) { - this.SlotCount = 3; - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// NameColonSyntax node representing the optional name arguments. - public NameColonSyntax? NameColon => this.nameColon; - /// SyntaxToken representing the optional ref or out keyword. - public SyntaxToken? RefKindKeyword => this.refKindKeyword; - /// ExpressionSyntax node representing the argument. - public ExpressionSyntax Expression => this.expression; + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, diagnostics, GetAnnotations()); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.nameColon, - 1 => this.refKindKeyword, - 2 => this.expression, - _ => null, - }; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, GetDiagnostics(), annotations); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentSyntax(this, parent, position); + internal CastExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.type); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.expression); + } - public ArgumentSyntax Update(NameColonSyntax nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) - { - if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + static CastExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(CastExpressionSyntax), r => new CastExpressionSyntax(r)); + } +} - return this; - } +/// Provides the base class from which the classes that represent anonymous function expressions are derived. +internal abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax +{ + internal AnonymousFunctionExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } + + internal AnonymousFunctionExpressionSyntax(SyntaxKind kind) + : base(kind) + { + } + + protected AnonymousFunctionExpressionSyntax(ObjectReader reader) + : base(reader) + { + } + + public abstract CoreSyntax.SyntaxList Modifiers { get; } + + /// + /// BlockSyntax node representing the body of the anonymous function. + /// Only one of Block or ExpressionBody will be non-null. + /// + public abstract BlockSyntax? Block { get; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, diagnostics, GetAnnotations()); + /// + /// ExpressionSyntax node representing the body of the anonymous function. + /// Only one of Block or ExpressionBody will be non-null. + /// + public abstract ExpressionSyntax? ExpressionBody { get; } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, GetDiagnostics(), annotations); +/// Class which represents the syntax node for anonymous method expression. +internal sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax +{ + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken delegateKeyword; + internal readonly ParameterListSyntax? parameterList; + internal readonly BlockSyntax block; + internal readonly ExpressionSyntax? expressionBody; - internal ArgumentSyntax(ObjectReader reader) - : base(reader) + internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (modifiers != null) { - this.SlotCount = 3; - var nameColon = (NameColonSyntax?)reader.ReadValue(); - if (nameColon != null) - { - AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - var refKindKeyword = (SyntaxToken?)reader.ReadValue(); - if (refKindKeyword != null) - { - AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal override void WriteTo(ObjectWriter writer) + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + if (parameterList != null) { - base.WriteTo(writer); - writer.WriteValue(this.nameColon); - writer.WriteValue(this.refKindKeyword); - writer.WriteValue(this.expression); + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; } - - static ArgumentSyntax() + this.AdjustFlagsAndWidth(block); + this.block = block; + if (expressionBody != null) { - ObjectBinder.RegisterTypeReader(typeof(ArgumentSyntax), r => new ArgumentSyntax(r)); + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } } - internal abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode + internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) + : base(kind) { - internal BaseExpressionColonSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal BaseExpressionColonSyntax(SyntaxKind kind) - : base(kind) + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + if (parameterList != null) { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; } - - protected BaseExpressionColonSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(block); + this.block = block; + if (expressionBody != null) { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - public abstract ExpressionSyntax Expression { get; } - - public abstract SyntaxToken ColonToken { get; } } - internal sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax + internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + : base(kind) { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken colonToken; - - internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + if (modifiers != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + if (parameterList != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; } - - internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken) - : base(kind) + this.AdjustFlagsAndWidth(block); + this.block = block; + if (expressionBody != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } + } - public override ExpressionSyntax Expression => this.expression; - public override SyntaxToken ColonToken => this.colonToken; + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// SyntaxToken representing the delegate keyword. + public SyntaxToken DelegateKeyword => this.delegateKeyword; + /// List of parameters of the anonymous method expression, or null if there no parameters are specified. + public ParameterListSyntax? ParameterList => this.parameterList; + /// + /// BlockSyntax node representing the body of the anonymous function. + /// This will never be null. + /// + public override BlockSyntax Block => this.block; + /// + /// Inherited from AnonymousFunctionExpressionSyntax, but not used for + /// AnonymousMethodExpressionSyntax. This will always be null. + /// + public override ExpressionSyntax? ExpressionBody => this.expressionBody; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.colonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.modifiers, + 1 => this.delegateKeyword, + 2 => this.parameterList, + 3 => this.block, + 4 => this.expressionBody, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionColonSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousMethodExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); - public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken) + public AnonymousMethodExpressionSyntax Update(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax parameterList, BlockSyntax block, ExpressionSyntax expressionBody) + { + if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) { - if (expression != this.Expression || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.ExpressionColon(expression, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, GetDiagnostics(), annotations); - internal ExpressionColonSyntax(ObjectReader reader) - : base(reader) + internal AnonymousMethodExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - this.SlotCount = 2; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal override void WriteTo(ObjectWriter writer) + var delegateKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + var parameterList = (ParameterListSyntax?)reader.ReadValue(); + if (parameterList != null) { - base.WriteTo(writer); - writer.WriteValue(this.expression); - writer.WriteValue(this.colonToken); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; } - - static ExpressionColonSyntax() + var block = (BlockSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(block); + this.block = block; + var expressionBody = (ExpressionSyntax?)reader.ReadValue(); + if (expressionBody != null) { - ObjectBinder.RegisterTypeReader(typeof(ExpressionColonSyntax), r => new ExpressionColonSyntax(r)); + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } } - /// Class which represents the syntax node for name colon syntax. - internal sealed partial class NameColonSyntax : BaseExpressionColonSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly IdentifierNameSyntax name; - internal readonly SyntaxToken colonToken; + base.WriteTo(writer); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.delegateKeyword); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.block); + writer.WriteValue(this.expressionBody); + } - internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } + static AnonymousMethodExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(AnonymousMethodExpressionSyntax), r => new AnonymousMethodExpressionSyntax(r)); + } +} - internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } +/// Provides the base class from which the classes that represent lambda expressions are derived. +internal abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax +{ + internal LambdaExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } + internal LambdaExpressionSyntax(SyntaxKind kind) + : base(kind) + { + } - /// IdentifierNameSyntax representing the identifier name. - public IdentifierNameSyntax Name => this.name; - /// SyntaxToken representing colon. - public override SyntaxToken ColonToken => this.colonToken; + protected LambdaExpressionSyntax(ObjectReader reader) + : base(reader) + { + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.colonToken, - _ => null, - }; + public abstract CoreSyntax.SyntaxList AttributeLists { get; } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameColonSyntax(this, parent, position); + /// SyntaxToken representing equals greater than. + public abstract SyntaxToken ArrowToken { get; } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); +/// Class which represents the syntax node for a simple lambda expression. +internal sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly ParameterSyntax parameter; + internal readonly SyntaxToken arrowToken; + internal readonly BlockSyntax? block; + internal readonly ExpressionSyntax? expressionBody; - public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken) + internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) { - if (name != this.Name || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.NameColon(name, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NameColonSyntax(this.Kind, this.name, this.colonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NameColonSyntax(this.Kind, this.name, this.colonToken, GetDiagnostics(), annotations); - - internal NameColonSyntax(ObjectReader reader) - : base(reader) + if (modifiers != null) { - this.SlotCount = 2; - var name = (IdentifierNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal override void WriteTo(ObjectWriter writer) + this.AdjustFlagsAndWidth(parameter); + this.parameter = parameter; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) { - base.WriteTo(writer); - writer.WriteValue(this.name); - writer.WriteValue(this.colonToken); + this.AdjustFlagsAndWidth(block); + this.block = block; } - - static NameColonSyntax() + if (expressionBody != null) { - ObjectBinder.RegisterTypeReader(typeof(NameColonSyntax), r => new NameColonSyntax(r)); + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } } - /// Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. - internal sealed partial class DeclarationExpressionSyntax : ExpressionSyntax + internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) + : base(kind) { - internal readonly TypeSyntax type; - internal readonly VariableDesignationSyntax designation; - - internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) - : base(kind) + this.AdjustFlagsAndWidth(parameter); + this.parameter = parameter; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(block); + this.block = block; } - - public TypeSyntax Type => this.type; - /// Declaration representing the variable declared in an out parameter or deconstruction. - public VariableDesignationSyntax Designation => this.designation; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.designation, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationExpressionSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); - - public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + if (expressionBody != null) { - if (type != this.Type || designation != this.Designation) - { - var newNode = SyntaxFactory.DeclarationExpression(type, designation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations); - - internal DeclarationExpressionSyntax(ObjectReader reader) - : base(reader) + internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + : base(kind) + { + this.SlotCount = 6; + if (attributeLists != null) { - this.SlotCount = 2; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var designation = (VariableDesignationSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.type); - writer.WriteValue(this.designation); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static DeclarationExpressionSyntax() + this.AdjustFlagsAndWidth(parameter); + this.parameter = parameter; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) + { + this.AdjustFlagsAndWidth(block); + this.block = block; + } + if (expressionBody != null) { - ObjectBinder.RegisterTypeReader(typeof(DeclarationExpressionSyntax), r => new DeclarationExpressionSyntax(r)); + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } } - /// Class which represents the syntax node for cast expression. - internal sealed partial class CastExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken closeParenToken; - internal readonly ExpressionSyntax expression; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// ParameterSyntax node representing the parameter of the lambda expression. + public ParameterSyntax Parameter => this.parameter; + /// SyntaxToken representing equals greater than. + public override SyntaxToken ArrowToken => this.arrowToken; + /// + /// BlockSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override BlockSyntax? Block => this.block; + /// + /// ExpressionSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override ExpressionSyntax? ExpressionBody => this.expressionBody; - internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.parameter, + 3 => this.arrowToken, + 4 => this.block, + 5 => this.expressionBody, + _ => null, + }; - internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleLambdaExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); - internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) - : base(kind) + public SimpleLambdaExpressionSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// TypeSyntax node representing the type to which the expression is being cast. - public TypeSyntax Type => this.type; - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; - /// ExpressionSyntax node representing the expression that is being casted. - public ExpressionSyntax Expression => this.expression; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.type, - 2 => this.closeParenToken, - 3 => this.expression, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CastExpressionSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations); - public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + internal SimpleLambdaExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 6; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression) - { - var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, GetDiagnostics(), annotations); - - internal CastExpressionSyntax(ObjectReader reader) - : base(reader) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - this.SlotCount = 4; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal override void WriteTo(ObjectWriter writer) + var parameter = (ParameterSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameter); + this.parameter = parameter; + var arrowToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + var block = (BlockSyntax?)reader.ReadValue(); + if (block != null) { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.type); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.expression); + AdjustFlagsAndWidth(block); + this.block = block; } - - static CastExpressionSyntax() + var expressionBody = (ExpressionSyntax?)reader.ReadValue(); + if (expressionBody != null) { - ObjectBinder.RegisterTypeReader(typeof(CastExpressionSyntax), r => new CastExpressionSyntax(r)); + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } } - /// Provides the base class from which the classes that represent anonymous function expressions are derived. - internal abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax + internal override void WriteTo(ObjectWriter writer) { - internal AnonymousFunctionExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.parameter); + writer.WriteValue(this.arrowToken); + writer.WriteValue(this.block); + writer.WriteValue(this.expressionBody); + } + + static SimpleLambdaExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(SimpleLambdaExpressionSyntax), r => new SimpleLambdaExpressionSyntax(r)); + } +} + +internal sealed partial class RefExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken refKeyword; + internal readonly ExpressionSyntax expression; + + internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + public SyntaxToken RefKeyword => this.refKeyword; + public ExpressionSyntax Expression => this.expression; - internal AnonymousFunctionExpressionSyntax(SyntaxKind kind) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - } + 0 => this.refKeyword, + 1 => this.expression, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefExpressionSyntax(this, parent, position); - protected AnonymousFunctionExpressionSyntax(ObjectReader reader) - : base(reader) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); + + public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression) + { + if (refKeyword != this.RefKeyword || expression != this.Expression) { + var newNode = SyntaxFactory.RefExpression(refKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers { get; } + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, diagnostics, GetAnnotations()); - /// - /// BlockSyntax node representing the body of the anonymous function. - /// Only one of Block or ExpressionBody will be non-null. - /// - public abstract BlockSyntax? Block { get; } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, GetDiagnostics(), annotations); - /// - /// ExpressionSyntax node representing the body of the anonymous function. - /// Only one of Block or ExpressionBody will be non-null. - /// - public abstract ExpressionSyntax? ExpressionBody { get; } + internal RefExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var refKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.refKeyword); + writer.WriteValue(this.expression); } - /// Class which represents the syntax node for anonymous method expression. - internal sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax + static RefExpressionSyntax() { - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken delegateKeyword; - internal readonly ParameterListSyntax? parameterList; - internal readonly BlockSyntax block; - internal readonly ExpressionSyntax? expressionBody; + ObjectBinder.RegisterTypeReader(typeof(RefExpressionSyntax), r => new RefExpressionSyntax(r)); + } +} + +/// Class which represents the syntax node for parenthesized lambda expression. +internal sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax? returnType; + internal readonly ParameterListSyntax parameterList; + internal readonly SyntaxToken arrowToken; + internal readonly BlockSyntax? block; + internal readonly ExpressionSyntax? expressionBody; - internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 7; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + if (returnType != null) + { + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) { - this.SlotCount = 5; - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } this.AdjustFlagsAndWidth(block); this.block = block; - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + } - internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) - : base(kind) + internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 7; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + if (returnType != null) + { + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } this.AdjustFlagsAndWidth(block); this.block = block; - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + } - internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) - : base(kind) + internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + : base(kind) + { + this.SlotCount = 7; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + if (returnType != null) + { + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) { - this.SlotCount = 5; - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } this.AdjustFlagsAndWidth(block); this.block = block; - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => this.delegateKeyword; - /// List of parameters of the anonymous method expression, or null if there no parameters are specified. - public ParameterListSyntax? ParameterList => this.parameterList; - /// - /// BlockSyntax node representing the body of the anonymous function. - /// This will never be null. - /// - public override BlockSyntax Block => this.block; - /// - /// Inherited from AnonymousFunctionExpressionSyntax, but not used for - /// AnonymousMethodExpressionSyntax. This will always be null. - /// - public override ExpressionSyntax? ExpressionBody => this.expressionBody; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.modifiers, - 1 => this.delegateKeyword, - 2 => this.parameterList, - 3 => this.block, - 4 => this.expressionBody, - _ => null, - }; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public TypeSyntax? ReturnType => this.returnType; + /// ParameterListSyntax node representing the list of parameters for the lambda expression. + public ParameterListSyntax ParameterList => this.parameterList; + /// SyntaxToken representing equals greater than. + public override SyntaxToken ArrowToken => this.arrowToken; + /// + /// BlockSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override BlockSyntax? Block => this.block; + /// + /// ExpressionSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override ExpressionSyntax? ExpressionBody => this.expressionBody; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.returnType, + 3 => this.parameterList, + 4 => this.arrowToken, + 5 => this.block, + 6 => this.expressionBody, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousMethodExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedLambdaExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); - public AnonymousMethodExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax parameterList, BlockSyntax block, ExpressionSyntax expressionBody) + public ParenthesizedLambdaExpressionSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) { - if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations); - internal AnonymousMethodExpressionSyntax(ObjectReader reader) - : base(reader) + internal ParenthesizedLambdaExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 7; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var returnType = (TypeSyntax?)reader.ReadValue(); + if (returnType != null) + { + AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + } + var parameterList = (ParameterListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + var arrowToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + var block = (BlockSyntax?)reader.ReadValue(); + if (block != null) { - this.SlotCount = 5; - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var delegateKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - var parameterList = (ParameterListSyntax?)reader.ReadValue(); - if (parameterList != null) - { - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - var block = (BlockSyntax)reader.ReadValue(); AdjustFlagsAndWidth(block); this.block = block; - var expressionBody = (ExpressionSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } } - - internal override void WriteTo(ObjectWriter writer) + var expressionBody = (ExpressionSyntax?)reader.ReadValue(); + if (expressionBody != null) { - base.WriteTo(writer); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.delegateKeyword); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.block); - writer.WriteValue(this.expressionBody); + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } + } - static AnonymousMethodExpressionSyntax() + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.returnType); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.arrowToken); + writer.WriteValue(this.block); + writer.WriteValue(this.expressionBody); + } + + static ParenthesizedLambdaExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ParenthesizedLambdaExpressionSyntax), r => new ParenthesizedLambdaExpressionSyntax(r)); + } +} + +/// Class which represents the syntax node for initializer expression. +internal sealed partial class InitializerExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? expressions; + internal readonly SyntaxToken closeBraceToken; + + internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (expressions != null) { - ObjectBinder.RegisterTypeReader(typeof(AnonymousMethodExpressionSyntax), r => new AnonymousMethodExpressionSyntax(r)); + this.AdjustFlagsAndWidth(expressions); + this.expressions = expressions; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - /// Provides the base class from which the classes that represent lambda expressions are derived. - internal abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax + internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) { - internal LambdaExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (expressions != null) { + this.AdjustFlagsAndWidth(expressions); + this.expressions = expressions; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal LambdaExpressionSyntax(SyntaxKind kind) - : base(kind) + internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (expressions != null) { + this.AdjustFlagsAndWidth(expressions); + this.expressions = expressions; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + + /// SyntaxToken representing the open brace. + public SyntaxToken OpenBraceToken => this.openBraceToken; + /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. + public CoreSyntax.SeparatedSyntaxList Expressions => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.expressions)); + /// SyntaxToken representing the close brace. + public SyntaxToken CloseBraceToken => this.closeBraceToken; - protected LambdaExpressionSyntax(ObjectReader reader) - : base(reader) + internal override GreenNode? GetSlot(int index) + => index switch { - } + 0 => this.openBraceToken, + 1 => this.expressions, + 2 => this.closeBraceToken, + _ => null, + }; - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists { get; } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InitializerExpressionSyntax(this, parent, position); - /// SyntaxToken representing equals greater than. - public abstract SyntaxToken ArrowToken { get; } - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); - /// Class which represents the syntax node for a simple lambda expression. - internal sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax + public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly ParameterSyntax parameter; - internal readonly SyntaxToken arrowToken; - internal readonly BlockSyntax? block; - internal readonly ExpressionSyntax? expressionBody; - - internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(parameter); - this.parameter = parameter; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } + var newNode = SyntaxFactory.InitializerExpression(this.Kind, openBraceToken, expressions, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(parameter); - this.parameter = parameter; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - } + return this; + } - internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - : base(kind) + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, GetDiagnostics(), annotations); + + internal InitializerExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + var expressions = (GreenNode?)reader.ReadValue(); + if (expressions != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(parameter); - this.parameter = parameter; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } + AdjustFlagsAndWidth(expressions); + this.expressions = expressions; } + var closeBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// ParameterSyntax node representing the parameter of the lambda expression. - public ParameterSyntax Parameter => this.parameter; - /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => this.arrowToken; - /// - /// BlockSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override BlockSyntax? Block => this.block; - /// - /// ExpressionSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override ExpressionSyntax? ExpressionBody => this.expressionBody; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.parameter, - 3 => this.arrowToken, - 4 => this.block, - 5 => this.expressionBody, - _ => null, - }; + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.expressions); + writer.WriteValue(this.closeBraceToken); + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleLambdaExpressionSyntax(this, parent, position); + static InitializerExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(InitializerExpressionSyntax), r => new InitializerExpressionSyntax(r)); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); +internal abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax +{ + internal BaseObjectCreationExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public SimpleLambdaExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal BaseObjectCreationExpressionSyntax(SyntaxKind kind) + : base(kind) + { + } - return this; - } + protected BaseObjectCreationExpressionSyntax(ObjectReader reader) + : base(reader) + { + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations()); + /// SyntaxToken representing the new keyword. + public abstract SyntaxToken NewKeyword { get; } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations); + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public abstract ArgumentListSyntax? ArgumentList { get; } - internal SimpleLambdaExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 6; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var parameter = (ParameterSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameter); - this.parameter = parameter; - var arrowToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - var block = (BlockSyntax?)reader.ReadValue(); - if (block != null) - { - AdjustFlagsAndWidth(block); - this.block = block; - } - var expressionBody = (ExpressionSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - } + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public abstract InitializerExpressionSyntax? Initializer { get; } +} - internal override void WriteTo(ObjectWriter writer) +/// Class which represents the syntax node for implicit object creation expression. +internal sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly ArgumentListSyntax argumentList; + internal readonly InitializerExpressionSyntax? initializer; + + internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + if (initializer != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.parameter); - writer.WriteValue(this.arrowToken); - writer.WriteValue(this.block); - writer.WriteValue(this.expressionBody); + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - static SimpleLambdaExpressionSyntax() + internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + if (initializer != null) { - ObjectBinder.RegisterTypeReader(typeof(SimpleLambdaExpressionSyntax), r => new SimpleLambdaExpressionSyntax(r)); + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } } - internal sealed partial class RefExpressionSyntax : ExpressionSyntax + internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + : base(kind) { - internal readonly SyntaxToken refKeyword; - internal readonly ExpressionSyntax expression; - - internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + if (initializer != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } + + /// SyntaxToken representing the new keyword. + public override SyntaxToken NewKeyword => this.newKeyword; + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public override ArgumentListSyntax ArgumentList => this.argumentList; + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public override InitializerExpressionSyntax? Initializer => this.initializer; - internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + 0 => this.newKeyword, + 1 => this.argumentList, + 2 => this.initializer, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitObjectCreationExpressionSyntax(this, parent, position); - internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); + + public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken RefKeyword => this.refKeyword; - public ExpressionSyntax Expression => this.expression; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.refKeyword, - 1 => this.expression, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefExpressionSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, GetDiagnostics(), annotations); - public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression) + internal ImplicitObjectCreationExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var newKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + var argumentList = (ArgumentListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + var initializer = (InitializerExpressionSyntax?)reader.ReadValue(); + if (initializer != null) { - if (refKeyword != this.RefKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.RefExpression(refKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.newKeyword); + writer.WriteValue(this.argumentList); + writer.WriteValue(this.initializer); + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, GetDiagnostics(), annotations); + static ImplicitObjectCreationExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ImplicitObjectCreationExpressionSyntax), r => new ImplicitObjectCreationExpressionSyntax(r)); + } +} - internal RefExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var refKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } +/// Class which represents the syntax node for object creation expression. +internal sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly TypeSyntax type; + internal readonly ArgumentListSyntax? argumentList; + internal readonly InitializerExpressionSyntax? initializer; - internal override void WriteTo(ObjectWriter writer) + internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (argumentList != null) { - base.WriteTo(writer); - writer.WriteValue(this.refKeyword); - writer.WriteValue(this.expression); + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - - static RefExpressionSyntax() + if (initializer != null) { - ObjectBinder.RegisterTypeReader(typeof(RefExpressionSyntax), r => new RefExpressionSyntax(r)); + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } } - /// Class which represents the syntax node for parenthesized lambda expression. - internal sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax + internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax? returnType; - internal readonly ParameterListSyntax parameterList; - internal readonly SyntaxToken arrowToken; - internal readonly BlockSyntax? block; - internal readonly ExpressionSyntax? expressionBody; - - internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (argumentList != null) { - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (returnType != null) - { - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - - internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) - : base(kind) + if (initializer != null) { - this.SetFactoryContext(context); - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (returnType != null) - { - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - : base(kind) + internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (argumentList != null) { - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (returnType != null) - { - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public TypeSyntax? ReturnType => this.returnType; - /// ParameterListSyntax node representing the list of parameters for the lambda expression. - public ParameterListSyntax ParameterList => this.parameterList; - /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => this.arrowToken; - /// - /// BlockSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override BlockSyntax? Block => this.block; - /// - /// ExpressionSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override ExpressionSyntax? ExpressionBody => this.expressionBody; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.returnType, - 3 => this.parameterList, - 4 => this.arrowToken, - 5 => this.block, - 6 => this.expressionBody, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedLambdaExpressionSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); - - public ParenthesizedLambdaExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) + if (initializer != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations); + /// SyntaxToken representing the new keyword. + public override SyntaxToken NewKeyword => this.newKeyword; + /// TypeSyntax representing the type of the object being created. + public TypeSyntax Type => this.type; + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public override ArgumentListSyntax? ArgumentList => this.argumentList; + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public override InitializerExpressionSyntax? Initializer => this.initializer; - internal ParenthesizedLambdaExpressionSyntax(ObjectReader reader) - : base(reader) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 7; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var returnType = (TypeSyntax?)reader.ReadValue(); - if (returnType != null) - { - AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - } - var parameterList = (ParameterListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - var arrowToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - var block = (BlockSyntax?)reader.ReadValue(); - if (block != null) - { - AdjustFlagsAndWidth(block); - this.block = block; - } - var expressionBody = (ExpressionSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - } + 0 => this.newKeyword, + 1 => this.type, + 2 => this.argumentList, + 3 => this.initializer, + _ => null, + }; - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.returnType); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.arrowToken); - writer.WriteValue(this.block); - writer.WriteValue(this.expressionBody); - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ObjectCreationExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); - static ParenthesizedLambdaExpressionSyntax() + public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) { - ObjectBinder.RegisterTypeReader(typeof(ParenthesizedLambdaExpressionSyntax), r => new ParenthesizedLambdaExpressionSyntax(r)); + var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; } - /// Class which represents the syntax node for initializer expression. - internal sealed partial class InitializerExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? expressions; - internal readonly SyntaxToken closeBraceToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, diagnostics, GetAnnotations()); - internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (expressions != null) - { - this.AdjustFlagsAndWidth(expressions); - this.expressions = expressions; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, GetDiagnostics(), annotations); - internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + internal ObjectCreationExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var newKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var argumentList = (ArgumentListSyntax?)reader.ReadValue(); + if (argumentList != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (expressions != null) - { - this.AdjustFlagsAndWidth(expressions); - this.expressions = expressions; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - - internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken) - : base(kind) + var initializer = (InitializerExpressionSyntax?)reader.ReadValue(); + if (initializer != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (expressions != null) - { - this.AdjustFlagsAndWidth(expressions); - this.expressions = expressions; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => this.openBraceToken; - /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Expressions => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.expressions)); - /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => this.closeBraceToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBraceToken, - 1 => this.expressions, - 2 => this.closeBraceToken, - _ => null, - }; + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.newKeyword); + writer.WriteValue(this.type); + writer.WriteValue(this.argumentList); + writer.WriteValue(this.initializer); + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InitializerExpressionSyntax(this, parent, position); + static ObjectCreationExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ObjectCreationExpressionSyntax), r => new ObjectCreationExpressionSyntax(r)); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); +internal sealed partial class WithExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken withKeyword; + internal readonly InitializerExpressionSyntax initializer; - public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) - { - if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.InitializerExpression(this.Kind, openBraceToken, expressions, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(withKeyword); + this.withKeyword = withKeyword; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - return this; - } + internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(withKeyword); + this.withKeyword = withKeyword; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, diagnostics, GetAnnotations()); + internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(withKeyword); + this.withKeyword = withKeyword; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, GetDiagnostics(), annotations); + public ExpressionSyntax Expression => this.expression; + public SyntaxToken WithKeyword => this.withKeyword; + /// InitializerExpressionSyntax representing the initializer expression for the with expression. + public InitializerExpressionSyntax Initializer => this.initializer; - internal InitializerExpressionSyntax(ObjectReader reader) - : base(reader) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - var openBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - var expressions = (GreenNode?)reader.ReadValue(); - if (expressions != null) - { - AdjustFlagsAndWidth(expressions); - this.expressions = expressions; - } - var closeBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + 0 => this.expression, + 1 => this.withKeyword, + 2 => this.initializer, + _ => null, + }; - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.expressions); - writer.WriteValue(this.closeBraceToken); - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WithExpressionSyntax(this, parent, position); - static InitializerExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(InitializerExpressionSyntax), r => new InitializerExpressionSyntax(r)); - } - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); - internal abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax + public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) { - internal BaseObjectCreationExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer) { + var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal BaseObjectCreationExpressionSyntax(SyntaxKind kind) - : base(kind) - { - } + return this; + } - protected BaseObjectCreationExpressionSyntax(ObjectReader reader) - : base(reader) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, diagnostics, GetAnnotations()); - /// SyntaxToken representing the new keyword. - public abstract SyntaxToken NewKeyword { get; } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, GetDiagnostics(), annotations); - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public abstract ArgumentListSyntax? ArgumentList { get; } + internal WithExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var withKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(withKeyword); + this.withKeyword = withKeyword; + var initializer = (InitializerExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public abstract InitializerExpressionSyntax? Initializer { get; } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.expression); + writer.WriteValue(this.withKeyword); + writer.WriteValue(this.initializer); } - /// Class which represents the syntax node for implicit object creation expression. - internal sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax + static WithExpressionSyntax() { - internal readonly SyntaxToken newKeyword; - internal readonly ArgumentListSyntax argumentList; - internal readonly InitializerExpressionSyntax? initializer; + ObjectBinder.RegisterTypeReader(typeof(WithExpressionSyntax), r => new WithExpressionSyntax(r)); + } +} + +internal sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode +{ + internal readonly NameEqualsSyntax? nameEquals; + internal readonly ExpressionSyntax expression; - internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (nameEquals != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) - : base(kind) + internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + if (nameEquals != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) - : base(kind) + internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + if (nameEquals != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => this.newKeyword; - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public override ArgumentListSyntax ArgumentList => this.argumentList; - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public override InitializerExpressionSyntax? Initializer => this.initializer; + /// NameEqualsSyntax representing the optional name of the member being initialized. + public NameEqualsSyntax? NameEquals => this.nameEquals; + /// ExpressionSyntax representing the value the member is initialized with. + public ExpressionSyntax Expression => this.expression; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.argumentList, - 2 => this.initializer, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.nameEquals, + 1 => this.expression, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitObjectCreationExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectMemberDeclaratorSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); - public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer) + public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax nameEquals, ExpressionSyntax expression) + { + if (nameEquals != this.NameEquals || expression != this.Expression) { - if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, diagnostics, GetAnnotations()); - internal ImplicitObjectCreationExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var newKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - var argumentList = (ArgumentListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - var initializer = (InitializerExpressionSyntax?)reader.ReadValue(); - if (initializer != null) - { - AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal AnonymousObjectMemberDeclaratorSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var nameEquals = (NameEqualsSyntax?)reader.ReadValue(); + if (nameEquals != null) { - base.WriteTo(writer); - writer.WriteValue(this.newKeyword); - writer.WriteValue(this.argumentList); - writer.WriteValue(this.initializer); + AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; } + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - static ImplicitObjectCreationExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ImplicitObjectCreationExpressionSyntax), r => new ImplicitObjectCreationExpressionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.nameEquals); + writer.WriteValue(this.expression); } - /// Class which represents the syntax node for object creation expression. - internal sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax + static AnonymousObjectMemberDeclaratorSyntax() { - internal readonly SyntaxToken newKeyword; - internal readonly TypeSyntax type; - internal readonly ArgumentListSyntax? argumentList; - internal readonly InitializerExpressionSyntax? initializer; + ObjectBinder.RegisterTypeReader(typeof(AnonymousObjectMemberDeclaratorSyntax), r => new AnonymousObjectMemberDeclaratorSyntax(r)); + } +} + +/// Class which represents the syntax node for anonymous object creation expression. +internal sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? initializers; + internal readonly SyntaxToken closeBraceToken; - internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (initializers != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) - : base(kind) + internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (initializers != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) - : base(kind) + internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (initializers != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => this.newKeyword; - /// TypeSyntax representing the type of the object being created. - public TypeSyntax Type => this.type; - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public override ArgumentListSyntax? ArgumentList => this.argumentList; - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public override InitializerExpressionSyntax? Initializer => this.initializer; + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => this.newKeyword; + /// SyntaxToken representing the open brace. + public SyntaxToken OpenBraceToken => this.openBraceToken; + /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. + public CoreSyntax.SeparatedSyntaxList Initializers => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.initializers)); + /// SyntaxToken representing the close brace. + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.type, - 2 => this.argumentList, - 3 => this.initializer, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.newKeyword, + 1 => this.openBraceToken, + 2 => this.initializers, + 3 => this.closeBraceToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ObjectCreationExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectCreationExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); - public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer) + public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + { + if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) { - if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, diagnostics, GetAnnotations()); - internal ObjectCreationExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var newKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var argumentList = (ArgumentListSyntax?)reader.ReadValue(); - if (argumentList != null) - { - AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - var initializer = (InitializerExpressionSyntax?)reader.ReadValue(); - if (initializer != null) - { - AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal AnonymousObjectCreationExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var newKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + var openBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + var initializers = (GreenNode?)reader.ReadValue(); + if (initializers != null) { - base.WriteTo(writer); - writer.WriteValue(this.newKeyword); - writer.WriteValue(this.type); - writer.WriteValue(this.argumentList); - writer.WriteValue(this.initializer); + AdjustFlagsAndWidth(initializers); + this.initializers = initializers; } + var closeBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - static ObjectCreationExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ObjectCreationExpressionSyntax), r => new ObjectCreationExpressionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.newKeyword); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.initializers); + writer.WriteValue(this.closeBraceToken); } - internal sealed partial class WithExpressionSyntax : ExpressionSyntax + static AnonymousObjectCreationExpressionSyntax() { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken withKeyword; - internal readonly InitializerExpressionSyntax initializer; + ObjectBinder.RegisterTypeReader(typeof(AnonymousObjectCreationExpressionSyntax), r => new AnonymousObjectCreationExpressionSyntax(r)); + } +} + +/// Class which represents the syntax node for array creation expression. +internal sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly ArrayTypeSyntax type; + internal readonly InitializerExpressionSyntax? initializer; - internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(withKeyword); - this.withKeyword = withKeyword; this.AdjustFlagsAndWidth(initializer); this.initializer = initializer; } + } - internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) - : base(kind) + internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(withKeyword); - this.withKeyword = withKeyword; this.AdjustFlagsAndWidth(initializer); this.initializer = initializer; } + } - internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) - : base(kind) + internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(withKeyword); - this.withKeyword = withKeyword; this.AdjustFlagsAndWidth(initializer); this.initializer = initializer; } + } - public ExpressionSyntax Expression => this.expression; - public SyntaxToken WithKeyword => this.withKeyword; - /// InitializerExpressionSyntax representing the initializer expression for the with expression. - public InitializerExpressionSyntax Initializer => this.initializer; + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => this.newKeyword; + /// ArrayTypeSyntax node representing the type of the array. + public ArrayTypeSyntax Type => this.type; + /// InitializerExpressionSyntax node representing the initializer of the array creation expression. + public InitializerExpressionSyntax? Initializer => this.initializer; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.withKeyword, - 2 => this.initializer, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.newKeyword, + 1 => this.type, + 2 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WithExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayCreationExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); - public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer) { - if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer) - { - var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, GetDiagnostics(), annotations); - internal WithExpressionSyntax(ObjectReader reader) - : base(reader) + internal ArrayCreationExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var newKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + var type = (ArrayTypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var initializer = (InitializerExpressionSyntax?)reader.ReadValue(); + if (initializer != null) { - this.SlotCount = 3; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var withKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(withKeyword); - this.withKeyword = withKeyword; - var initializer = (InitializerExpressionSyntax)reader.ReadValue(); AdjustFlagsAndWidth(initializer); this.initializer = initializer; } + } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.expression); - writer.WriteValue(this.withKeyword); - writer.WriteValue(this.initializer); - } - - static WithExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(WithExpressionSyntax), r => new WithExpressionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.newKeyword); + writer.WriteValue(this.type); + writer.WriteValue(this.initializer); } - internal sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode + static ArrayCreationExpressionSyntax() { - internal readonly NameEqualsSyntax? nameEquals; - internal readonly ExpressionSyntax expression; + ObjectBinder.RegisterTypeReader(typeof(ArrayCreationExpressionSyntax), r => new ArrayCreationExpressionSyntax(r)); + } +} - internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +/// Class which represents the syntax node for implicit array creation expression. +internal sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? commas; + internal readonly SyntaxToken closeBracketToken; + internal readonly InitializerExpressionSyntax initializer; + + internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (commas != null) { - this.SlotCount = 2; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(commas); + this.commas = commas; } - - internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + + internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (commas != null) + { + this.AdjustFlagsAndWidth(commas); + this.commas = commas; } - - internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression) - : base(kind) + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + + internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (commas != null) { - this.SlotCount = 2; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(commas); + this.commas = commas; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - /// NameEqualsSyntax representing the optional name of the member being initialized. - public NameEqualsSyntax? NameEquals => this.nameEquals; - /// ExpressionSyntax representing the value the member is initialized with. - public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => this.newKeyword; + /// SyntaxToken representing the open bracket. + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. + public CoreSyntax.SyntaxList Commas => new CoreSyntax.SyntaxList(this.commas); + /// SyntaxToken representing the close bracket. + public SyntaxToken CloseBracketToken => this.closeBracketToken; + /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. + public InitializerExpressionSyntax Initializer => this.initializer; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.nameEquals, - 1 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.newKeyword, + 1 => this.openBracketToken, + 2 => this.commas, + 3 => this.closeBracketToken, + 4 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectMemberDeclaratorSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitArrayCreationExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); - public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax nameEquals, ExpressionSyntax expression) + public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) { - if (nameEquals != this.NameEquals || expression != this.Expression) - { - var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations()); - internal AnonymousObjectMemberDeclaratorSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var nameEquals = (NameEqualsSyntax?)reader.ReadValue(); - if (nameEquals != null) - { - AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal ImplicitArrayCreationExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var newKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + var openBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + var commas = (GreenNode?)reader.ReadValue(); + if (commas != null) { - base.WriteTo(writer); - writer.WriteValue(this.nameEquals); - writer.WriteValue(this.expression); + AdjustFlagsAndWidth(commas); + this.commas = commas; } + var closeBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + var initializer = (InitializerExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - static AnonymousObjectMemberDeclaratorSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(AnonymousObjectMemberDeclaratorSyntax), r => new AnonymousObjectMemberDeclaratorSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.newKeyword); + writer.WriteValue(this.openBracketToken); + writer.WriteValue(this.commas); + writer.WriteValue(this.closeBracketToken); + writer.WriteValue(this.initializer); } - /// Class which represents the syntax node for anonymous object creation expression. - internal sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax + static ImplicitArrayCreationExpressionSyntax() { - internal readonly SyntaxToken newKeyword; - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? initializers; - internal readonly SyntaxToken closeBraceToken; + ObjectBinder.RegisterTypeReader(typeof(ImplicitArrayCreationExpressionSyntax), r => new ImplicitArrayCreationExpressionSyntax(r)); + } +} + +/// Class which represents the syntax node for stackalloc array creation expression. +internal sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken stackAllocKeyword; + internal readonly TypeSyntax type; + internal readonly InitializerExpressionSyntax? initializer; - internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken) - : base(kind) + internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => this.newKeyword; - /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => this.openBraceToken; - /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Initializers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.initializers)); - /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => this.closeBraceToken; + /// SyntaxToken representing the stackalloc keyword. + public SyntaxToken StackAllocKeyword => this.stackAllocKeyword; + /// TypeSyntax node representing the type of the stackalloc array. + public TypeSyntax Type => this.type; + /// InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. + public InitializerExpressionSyntax? Initializer => this.initializer; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.openBraceToken, - 2 => this.initializers, - 3 => this.closeBraceToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.stackAllocKeyword, + 1 => this.type, + 2 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectCreationExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StackAllocArrayCreationExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); - public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax initializer) + { + if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer) { - if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, GetDiagnostics(), annotations); + return this; + } - internal AnonymousObjectCreationExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var newKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - var openBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - var initializers = (GreenNode?)reader.ReadValue(); - if (initializers != null) - { - AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - var closeBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.newKeyword); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.initializers); - writer.WriteValue(this.closeBraceToken); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, GetDiagnostics(), annotations); - static AnonymousObjectCreationExpressionSyntax() + internal StackAllocArrayCreationExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var stackAllocKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var initializer = (InitializerExpressionSyntax?)reader.ReadValue(); + if (initializer != null) { - ObjectBinder.RegisterTypeReader(typeof(AnonymousObjectCreationExpressionSyntax), r => new AnonymousObjectCreationExpressionSyntax(r)); + AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } } - /// Class which represents the syntax node for array creation expression. - internal sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken newKeyword; - internal readonly ArrayTypeSyntax type; - internal readonly InitializerExpressionSyntax? initializer; + base.WriteTo(writer); + writer.WriteValue(this.stackAllocKeyword); + writer.WriteValue(this.type); + writer.WriteValue(this.initializer); + } - internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + static StackAllocArrayCreationExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(StackAllocArrayCreationExpressionSyntax), r => new StackAllocArrayCreationExpressionSyntax(r)); + } +} - internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } +/// Class which represents the syntax node for implicit stackalloc array creation expression. +internal sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken stackAllocKeyword; + internal readonly SyntaxToken openBracketToken; + internal readonly SyntaxToken closeBracketToken; + internal readonly InitializerExpressionSyntax initializer; + + internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + + internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => this.newKeyword; - /// ArrayTypeSyntax node representing the type of the array. - public ArrayTypeSyntax Type => this.type; - /// InitializerExpressionSyntax node representing the initializer of the array creation expression. - public InitializerExpressionSyntax? Initializer => this.initializer; + /// SyntaxToken representing the stackalloc keyword. + public SyntaxToken StackAllocKeyword => this.stackAllocKeyword; + /// SyntaxToken representing the open bracket. + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// SyntaxToken representing the close bracket. + public SyntaxToken CloseBracketToken => this.closeBracketToken; + /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. + public InitializerExpressionSyntax Initializer => this.initializer; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.type, - 2 => this.initializer, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.stackAllocKeyword, + 1 => this.openBracketToken, + 2 => this.closeBracketToken, + 3 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayCreationExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitStackAllocArrayCreationExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); - public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax initializer) + public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { + if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) { - if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations()); - internal ArrayCreationExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var newKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - var type = (ArrayTypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var initializer = (InitializerExpressionSyntax?)reader.ReadValue(); - if (initializer != null) - { - AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.newKeyword); - writer.WriteValue(this.type); - writer.WriteValue(this.initializer); - } + internal ImplicitStackAllocArrayCreationExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var stackAllocKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + var openBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + var closeBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + var initializer = (InitializerExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - static ArrayCreationExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ArrayCreationExpressionSyntax), r => new ArrayCreationExpressionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.stackAllocKeyword); + writer.WriteValue(this.openBracketToken); + writer.WriteValue(this.closeBracketToken); + writer.WriteValue(this.initializer); } - /// Class which represents the syntax node for implicit array creation expression. - internal sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax + static ImplicitStackAllocArrayCreationExpressionSyntax() { - internal readonly SyntaxToken newKeyword; - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? commas; - internal readonly SyntaxToken closeBracketToken; - internal readonly InitializerExpressionSyntax initializer; + ObjectBinder.RegisterTypeReader(typeof(ImplicitStackAllocArrayCreationExpressionSyntax), r => new ImplicitStackAllocArrayCreationExpressionSyntax(r)); + } +} - internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class CollectionExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? elements; + internal readonly SyntaxToken closeBracketToken; + + internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (elements != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (commas != null) - { - this.AdjustFlagsAndWidth(commas); - this.commas = commas; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) - : base(kind) + internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (elements != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (commas != null) - { - this.AdjustFlagsAndWidth(commas); - this.commas = commas; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - : base(kind) + internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (elements != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (commas != null) - { - this.AdjustFlagsAndWidth(commas); - this.commas = commas; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => this.newKeyword; - /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Commas => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.commas); - /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => this.closeBracketToken; - /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. - public InitializerExpressionSyntax Initializer => this.initializer; + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. + public CoreSyntax.SeparatedSyntaxList Elements => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.elements)); + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.openBracketToken, - 2 => this.commas, - 3 => this.closeBracketToken, - 4 => this.initializer, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.elements, + 2 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitArrayCreationExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CollectionExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); - public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) { - if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations); + return this; + } - internal ImplicitArrayCreationExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var newKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - var openBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - var commas = (GreenNode?)reader.ReadValue(); - if (commas != null) - { - AdjustFlagsAndWidth(commas); - this.commas = commas; - } - var closeBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - var initializer = (InitializerExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CollectionExpressionSyntax(this.Kind, this.openBracketToken, this.elements, this.closeBracketToken, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.newKeyword); - writer.WriteValue(this.openBracketToken); - writer.WriteValue(this.commas); - writer.WriteValue(this.closeBracketToken); - writer.WriteValue(this.initializer); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CollectionExpressionSyntax(this.Kind, this.openBracketToken, this.elements, this.closeBracketToken, GetDiagnostics(), annotations); - static ImplicitArrayCreationExpressionSyntax() + internal CollectionExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + var elements = (GreenNode?)reader.ReadValue(); + if (elements != null) { - ObjectBinder.RegisterTypeReader(typeof(ImplicitArrayCreationExpressionSyntax), r => new ImplicitArrayCreationExpressionSyntax(r)); + AdjustFlagsAndWidth(elements); + this.elements = elements; } + var closeBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; } - /// Class which represents the syntax node for stackalloc array creation expression. - internal sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken stackAllocKeyword; - internal readonly TypeSyntax type; - internal readonly InitializerExpressionSyntax? initializer; + base.WriteTo(writer); + writer.WriteValue(this.openBracketToken); + writer.WriteValue(this.elements); + writer.WriteValue(this.closeBracketToken); + } - internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + static CollectionExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(CollectionExpressionSyntax), r => new CollectionExpressionSyntax(r)); + } +} - internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } +internal abstract partial class CollectionElementSyntax : CSharpSyntaxNode +{ + internal CollectionElementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + internal CollectionElementSyntax(SyntaxKind kind) + : base(kind) + { + } - /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => this.stackAllocKeyword; - /// TypeSyntax node representing the type of the stackalloc array. - public TypeSyntax Type => this.type; - /// InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. - public InitializerExpressionSyntax? Initializer => this.initializer; + protected CollectionElementSyntax(ObjectReader reader) + : base(reader) + { + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.stackAllocKeyword, - 1 => this.type, - 2 => this.initializer, - _ => null, - }; +internal sealed partial class ExpressionElementSyntax : CollectionElementSyntax +{ + internal readonly ExpressionSyntax expression; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StackAllocArrayCreationExpressionSyntax(this, parent, position); + internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); + internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax initializer) - { - if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer) - { - var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - return this; - } + public ExpressionSyntax Expression => this.expression; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.expression : null; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionElementSyntax(this, parent, position); - internal StackAllocArrayCreationExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var stackAllocKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var initializer = (InitializerExpressionSyntax?)reader.ReadValue(); - if (initializer != null) - { - AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); - internal override void WriteTo(ObjectWriter writer) + public ExpressionElementSyntax Update(ExpressionSyntax expression) + { + if (expression != this.Expression) { - base.WriteTo(writer); - writer.WriteValue(this.stackAllocKeyword); - writer.WriteValue(this.type); - writer.WriteValue(this.initializer); + var newNode = SyntaxFactory.ExpressionElement(expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static StackAllocArrayCreationExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(StackAllocArrayCreationExpressionSyntax), r => new StackAllocArrayCreationExpressionSyntax(r)); - } + return this; } - /// Class which represents the syntax node for implicit stackalloc array creation expression. - internal sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken stackAllocKeyword; - internal readonly SyntaxToken openBracketToken; - internal readonly SyntaxToken closeBracketToken; - internal readonly InitializerExpressionSyntax initializer; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ExpressionElementSyntax(this.Kind, this.expression, diagnostics, GetAnnotations()); - internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ExpressionElementSyntax(this.Kind, this.expression, GetDiagnostics(), annotations); - internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + internal ExpressionElementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.expression); + } - /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => this.stackAllocKeyword; - /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => this.closeBracketToken; - /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. - public InitializerExpressionSyntax Initializer => this.initializer; + static ExpressionElementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ExpressionElementSyntax), r => new ExpressionElementSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.stackAllocKeyword, - 1 => this.openBracketToken, - 2 => this.closeBracketToken, - 3 => this.initializer, - _ => null, - }; +internal sealed partial class SpreadElementSyntax : CollectionElementSyntax +{ + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax expression; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitStackAllocArrayCreationExpressionSyntax(this, parent, position); + internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); + internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { - if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - return this; - } + public SyntaxToken OperatorToken => this.operatorToken; + public ExpressionSyntax Expression => this.expression; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.operatorToken, + 1 => this.expression, + _ => null, + }; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SpreadElementSyntax(this, parent, position); - internal ImplicitStackAllocArrayCreationExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var stackAllocKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - var openBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - var closeBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - var initializer = (InitializerExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); - internal override void WriteTo(ObjectWriter writer) + public SpreadElementSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + { + if (operatorToken != this.OperatorToken || expression != this.Expression) { - base.WriteTo(writer); - writer.WriteValue(this.stackAllocKeyword); - writer.WriteValue(this.openBracketToken); - writer.WriteValue(this.closeBracketToken); - writer.WriteValue(this.initializer); + var newNode = SyntaxFactory.SpreadElement(operatorToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static ImplicitStackAllocArrayCreationExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ImplicitStackAllocArrayCreationExpressionSyntax), r => new ImplicitStackAllocArrayCreationExpressionSyntax(r)); - } + return this; } - internal sealed partial class CollectionExpressionSyntax : ExpressionSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SpreadElementSyntax(this.Kind, this.operatorToken, this.expression, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SpreadElementSyntax(this.Kind, this.operatorToken, this.expression, GetDiagnostics(), annotations); + + internal SpreadElementSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? elements; - internal readonly SyntaxToken closeBracketToken; + this.SlotCount = 2; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.expression); + } - internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + static SpreadElementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(SpreadElementSyntax), r => new SpreadElementSyntax(r)); + } +} - internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } +internal abstract partial class QueryClauseSyntax : CSharpSyntaxNode +{ + internal QueryClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Elements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.elements)); - public SyntaxToken CloseBracketToken => this.closeBracketToken; + internal QueryClauseSyntax(SyntaxKind kind) + : base(kind) + { + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.elements, - 2 => this.closeBracketToken, - _ => null, - }; + protected QueryClauseSyntax(ObjectReader reader) + : base(reader) + { + } +} - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CollectionExpressionSyntax(this, parent, position); +internal abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode +{ + internal SelectOrGroupClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); + internal SelectOrGroupClauseSyntax(SyntaxKind kind) + : base(kind) + { + } - public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + protected SelectOrGroupClauseSyntax(ObjectReader reader) + : base(reader) + { + } +} - return this; - } +internal sealed partial class QueryExpressionSyntax : ExpressionSyntax +{ + internal readonly FromClauseSyntax fromClause; + internal readonly QueryBodySyntax body; + + internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(fromClause); + this.fromClause = fromClause; + this.AdjustFlagsAndWidth(body); + this.body = body; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CollectionExpressionSyntax(this.Kind, this.openBracketToken, this.elements, this.closeBracketToken, diagnostics, GetAnnotations()); + internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(fromClause); + this.fromClause = fromClause; + this.AdjustFlagsAndWidth(body); + this.body = body; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CollectionExpressionSyntax(this.Kind, this.openBracketToken, this.elements, this.closeBracketToken, GetDiagnostics(), annotations); + internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(fromClause); + this.fromClause = fromClause; + this.AdjustFlagsAndWidth(body); + this.body = body; + } - internal CollectionExpressionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - var elements = (GreenNode?)reader.ReadValue(); - if (elements != null) - { - AdjustFlagsAndWidth(elements); - this.elements = elements; - } - var closeBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + public FromClauseSyntax FromClause => this.fromClause; + public QueryBodySyntax Body => this.body; - internal override void WriteTo(ObjectWriter writer) + internal override GreenNode? GetSlot(int index) + => index switch { - base.WriteTo(writer); - writer.WriteValue(this.openBracketToken); - writer.WriteValue(this.elements); - writer.WriteValue(this.closeBracketToken); - } + 0 => this.fromClause, + 1 => this.body, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); - static CollectionExpressionSyntax() + public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body) + { + if (fromClause != this.FromClause || body != this.Body) { - ObjectBinder.RegisterTypeReader(typeof(CollectionExpressionSyntax), r => new CollectionExpressionSyntax(r)); + var newNode = SyntaxFactory.QueryExpression(fromClause, body); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, GetDiagnostics(), annotations); + + internal QueryExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var fromClause = (FromClauseSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(fromClause); + this.fromClause = fromClause; + var body = (QueryBodySyntax)reader.ReadValue(); + AdjustFlagsAndWidth(body); + this.body = body; } - internal abstract partial class CollectionElementSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal CollectionElementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + base.WriteTo(writer); + writer.WriteValue(this.fromClause); + writer.WriteValue(this.body); + } + + static QueryExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(QueryExpressionSyntax), r => new QueryExpressionSyntax(r)); + } +} + +internal sealed partial class QueryBodySyntax : CSharpSyntaxNode +{ + internal readonly GreenNode? clauses; + internal readonly SelectOrGroupClauseSyntax selectOrGroup; + internal readonly QueryContinuationSyntax? continuation; - internal CollectionElementSyntax(SyntaxKind kind) - : base(kind) + internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (clauses != null) { + this.AdjustFlagsAndWidth(clauses); + this.clauses = clauses; } - - protected CollectionElementSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(selectOrGroup); + this.selectOrGroup = selectOrGroup; + if (continuation != null) { + this.AdjustFlagsAndWidth(continuation); + this.continuation = continuation; } } - internal sealed partial class ExpressionElementSyntax : CollectionElementSyntax + internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, SyntaxFactoryContext context) + : base(kind) { - internal readonly ExpressionSyntax expression; - - internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + if (clauses != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(clauses); + this.clauses = clauses; } - - internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(selectOrGroup); + this.selectOrGroup = selectOrGroup; + if (continuation != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(continuation); + this.continuation = continuation; } + } - internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression) - : base(kind) + internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + : base(kind) + { + this.SlotCount = 3; + if (clauses != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(clauses); + this.clauses = clauses; } + this.AdjustFlagsAndWidth(selectOrGroup); + this.selectOrGroup = selectOrGroup; + if (continuation != null) + { + this.AdjustFlagsAndWidth(continuation); + this.continuation = continuation; + } + } - public ExpressionSyntax Expression => this.expression; + public CoreSyntax.SyntaxList Clauses => new CoreSyntax.SyntaxList(this.clauses); + public SelectOrGroupClauseSyntax SelectOrGroup => this.selectOrGroup; + public QueryContinuationSyntax? Continuation => this.continuation; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.expression : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.clauses, + 1 => this.selectOrGroup, + 2 => this.continuation, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionElementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryBodySyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); - public ExpressionElementSyntax Update(ExpressionSyntax expression) + public QueryBodySyntax Update(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax continuation) + { + if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) { - if (expression != this.Expression) - { - var newNode = SyntaxFactory.ExpressionElement(expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ExpressionElementSyntax(this.Kind, this.expression, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ExpressionElementSyntax(this.Kind, this.expression, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, diagnostics, GetAnnotations()); - internal ExpressionElementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal QueryBodySyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var clauses = (GreenNode?)reader.ReadValue(); + if (clauses != null) { - base.WriteTo(writer); - writer.WriteValue(this.expression); + AdjustFlagsAndWidth(clauses); + this.clauses = clauses; } - - static ExpressionElementSyntax() + var selectOrGroup = (SelectOrGroupClauseSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(selectOrGroup); + this.selectOrGroup = selectOrGroup; + var continuation = (QueryContinuationSyntax?)reader.ReadValue(); + if (continuation != null) { - ObjectBinder.RegisterTypeReader(typeof(ExpressionElementSyntax), r => new ExpressionElementSyntax(r)); + AdjustFlagsAndWidth(continuation); + this.continuation = continuation; } } - internal sealed partial class SpreadElementSyntax : CollectionElementSyntax + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.clauses); + writer.WriteValue(this.selectOrGroup); + writer.WriteValue(this.continuation); + } + + static QueryBodySyntax() { - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax expression; + ObjectBinder.RegisterTypeReader(typeof(QueryBodySyntax), r => new QueryBodySyntax(r)); + } +} - internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class FromClauseSyntax : QueryClauseSyntax +{ + internal readonly SyntaxToken fromKeyword; + internal readonly TypeSyntax? type; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken inKeyword; + internal readonly ExpressionSyntax expression; + + internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(fromKeyword); + this.fromKeyword = fromKeyword; + if (type != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(type); + this.type = type; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(fromKeyword); + this.fromKeyword = fromKeyword; + if (type != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(type); + this.type = type; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) - : base(kind) + internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(fromKeyword); + this.fromKeyword = fromKeyword; + if (type != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(type); + this.type = type; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public SyntaxToken OperatorToken => this.operatorToken; - public ExpressionSyntax Expression => this.expression; + public SyntaxToken FromKeyword => this.fromKeyword; + public TypeSyntax? Type => this.type; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public SyntaxToken InKeyword => this.inKeyword; + public ExpressionSyntax Expression => this.expression; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorToken, - 1 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.fromKeyword, + 1 => this.type, + 2 => this.identifier, + 3 => this.inKeyword, + 4 => this.expression, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SpreadElementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FromClauseSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); - public SpreadElementSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + { + if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression) { - if (operatorToken != this.OperatorToken || expression != this.Expression) - { - var newNode = SyntaxFactory.SpreadElement(operatorToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SpreadElementSyntax(this.Kind, this.operatorToken, this.expression, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SpreadElementSyntax(this.Kind, this.operatorToken, this.expression, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, diagnostics, GetAnnotations()); - internal SpreadElementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal FromClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var fromKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(fromKeyword); + this.fromKeyword = fromKeyword; + var type = (TypeSyntax?)reader.ReadValue(); + if (type != null) { - base.WriteTo(writer); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.expression); + AdjustFlagsAndWidth(type); + this.type = type; } + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var inKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - static SpreadElementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(SpreadElementSyntax), r => new SpreadElementSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.fromKeyword); + writer.WriteValue(this.type); + writer.WriteValue(this.identifier); + writer.WriteValue(this.inKeyword); + writer.WriteValue(this.expression); } - internal abstract partial class QueryClauseSyntax : CSharpSyntaxNode + static FromClauseSyntax() { - internal QueryClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + ObjectBinder.RegisterTypeReader(typeof(FromClauseSyntax), r => new FromClauseSyntax(r)); + } +} - internal QueryClauseSyntax(SyntaxKind kind) - : base(kind) - { - } +internal sealed partial class LetClauseSyntax : QueryClauseSyntax +{ + internal readonly SyntaxToken letKeyword; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken equalsToken; + internal readonly ExpressionSyntax expression; + + internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(letKeyword); + this.letKeyword = letKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - protected QueryClauseSyntax(ObjectReader reader) - : base(reader) - { - } + internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(letKeyword); + this.letKeyword = letKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - internal abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode + internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + : base(kind) { - internal SelectOrGroupClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + this.SlotCount = 4; + this.AdjustFlagsAndWidth(letKeyword); + this.letKeyword = letKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal SelectOrGroupClauseSyntax(SyntaxKind kind) - : base(kind) - { - } + public SyntaxToken LetKeyword => this.letKeyword; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public SyntaxToken EqualsToken => this.equalsToken; + public ExpressionSyntax Expression => this.expression; - protected SelectOrGroupClauseSyntax(ObjectReader reader) - : base(reader) + internal override GreenNode? GetSlot(int index) + => index switch { - } - } + 0 => this.letKeyword, + 1 => this.identifier, + 2 => this.equalsToken, + 3 => this.expression, + _ => null, + }; - internal sealed partial class QueryExpressionSyntax : ExpressionSyntax - { - internal readonly FromClauseSyntax fromClause; - internal readonly QueryBodySyntax body; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LetClauseSyntax(this, parent, position); - internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(fromClause); - this.fromClause = fromClause; - this.AdjustFlagsAndWidth(body); - this.body = body; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); - internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, SyntaxFactoryContext context) - : base(kind) + public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + { + if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(fromClause); - this.fromClause = fromClause; - this.AdjustFlagsAndWidth(body); - this.body = body; + var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(fromClause); - this.fromClause = fromClause; - this.AdjustFlagsAndWidth(body); - this.body = body; - } + return this; + } - public FromClauseSyntax FromClause => this.fromClause; - public QueryBodySyntax Body => this.body; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, diagnostics, GetAnnotations()); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.fromClause, - 1 => this.body, - _ => null, - }; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, GetDiagnostics(), annotations); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryExpressionSyntax(this, parent, position); + internal LetClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var letKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(letKeyword); + this.letKeyword = letKeyword; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var equalsToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.letKeyword); + writer.WriteValue(this.identifier); + writer.WriteValue(this.equalsToken); + writer.WriteValue(this.expression); + } - public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body) - { - if (fromClause != this.FromClause || body != this.Body) - { - var newNode = SyntaxFactory.QueryExpression(fromClause, body); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + static LetClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(LetClauseSyntax), r => new LetClauseSyntax(r)); + } +} - return this; +internal sealed partial class JoinClauseSyntax : QueryClauseSyntax +{ + internal readonly SyntaxToken joinKeyword; + internal readonly TypeSyntax? type; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken inKeyword; + internal readonly ExpressionSyntax inExpression; + internal readonly SyntaxToken onKeyword; + internal readonly ExpressionSyntax leftExpression; + internal readonly SyntaxToken equalsKeyword; + internal readonly ExpressionSyntax rightExpression; + internal readonly JoinIntoClauseSyntax? into; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 10; + this.AdjustFlagsAndWidth(joinKeyword); + this.joinKeyword = joinKeyword; + if (type != null) + { + this.AdjustFlagsAndWidth(type); + this.type = type; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, GetDiagnostics(), annotations); - - internal QueryExpressionSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(inExpression); + this.inExpression = inExpression; + this.AdjustFlagsAndWidth(onKeyword); + this.onKeyword = onKeyword; + this.AdjustFlagsAndWidth(leftExpression); + this.leftExpression = leftExpression; + this.AdjustFlagsAndWidth(equalsKeyword); + this.equalsKeyword = equalsKeyword; + this.AdjustFlagsAndWidth(rightExpression); + this.rightExpression = rightExpression; + if (into != null) { - this.SlotCount = 2; - var fromClause = (FromClauseSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(fromClause); - this.fromClause = fromClause; - var body = (QueryBodySyntax)reader.ReadValue(); - AdjustFlagsAndWidth(body); - this.body = body; + this.AdjustFlagsAndWidth(into); + this.into = into; } + } - internal override void WriteTo(ObjectWriter writer) + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 10; + this.AdjustFlagsAndWidth(joinKeyword); + this.joinKeyword = joinKeyword; + if (type != null) { - base.WriteTo(writer); - writer.WriteValue(this.fromClause); - writer.WriteValue(this.body); + this.AdjustFlagsAndWidth(type); + this.type = type; } - - static QueryExpressionSyntax() + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(inExpression); + this.inExpression = inExpression; + this.AdjustFlagsAndWidth(onKeyword); + this.onKeyword = onKeyword; + this.AdjustFlagsAndWidth(leftExpression); + this.leftExpression = leftExpression; + this.AdjustFlagsAndWidth(equalsKeyword); + this.equalsKeyword = equalsKeyword; + this.AdjustFlagsAndWidth(rightExpression); + this.rightExpression = rightExpression; + if (into != null) { - ObjectBinder.RegisterTypeReader(typeof(QueryExpressionSyntax), r => new QueryExpressionSyntax(r)); + this.AdjustFlagsAndWidth(into); + this.into = into; } } - internal sealed partial class QueryBodySyntax : CSharpSyntaxNode + internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + : base(kind) { - internal readonly GreenNode? clauses; - internal readonly SelectOrGroupClauseSyntax selectOrGroup; - internal readonly QueryContinuationSyntax? continuation; - - internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 10; + this.AdjustFlagsAndWidth(joinKeyword); + this.joinKeyword = joinKeyword; + if (type != null) { - this.SlotCount = 3; - if (clauses != null) - { - this.AdjustFlagsAndWidth(clauses); - this.clauses = clauses; - } - this.AdjustFlagsAndWidth(selectOrGroup); - this.selectOrGroup = selectOrGroup; - if (continuation != null) - { - this.AdjustFlagsAndWidth(continuation); - this.continuation = continuation; - } + this.AdjustFlagsAndWidth(type); + this.type = type; } - - internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(inExpression); + this.inExpression = inExpression; + this.AdjustFlagsAndWidth(onKeyword); + this.onKeyword = onKeyword; + this.AdjustFlagsAndWidth(leftExpression); + this.leftExpression = leftExpression; + this.AdjustFlagsAndWidth(equalsKeyword); + this.equalsKeyword = equalsKeyword; + this.AdjustFlagsAndWidth(rightExpression); + this.rightExpression = rightExpression; + if (into != null) + { + this.AdjustFlagsAndWidth(into); + this.into = into; + } + } + + public SyntaxToken JoinKeyword => this.joinKeyword; + public TypeSyntax? Type => this.type; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public SyntaxToken InKeyword => this.inKeyword; + public ExpressionSyntax InExpression => this.inExpression; + public SyntaxToken OnKeyword => this.onKeyword; + public ExpressionSyntax LeftExpression => this.leftExpression; + public SyntaxToken EqualsKeyword => this.equalsKeyword; + public ExpressionSyntax RightExpression => this.rightExpression; + public JoinIntoClauseSyntax? Into => this.into; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.joinKeyword, + 1 => this.type, + 2 => this.identifier, + 3 => this.inKeyword, + 4 => this.inExpression, + 5 => this.onKeyword, + 6 => this.leftExpression, + 7 => this.equalsKeyword, + 8 => this.rightExpression, + 9 => this.into, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinClauseSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); + + public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax into) + { + if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into) + { + var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, GetDiagnostics(), annotations); + + internal JoinClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 10; + var joinKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(joinKeyword); + this.joinKeyword = joinKeyword; + var type = (TypeSyntax?)reader.ReadValue(); + if (type != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (clauses != null) - { - this.AdjustFlagsAndWidth(clauses); - this.clauses = clauses; - } - this.AdjustFlagsAndWidth(selectOrGroup); - this.selectOrGroup = selectOrGroup; - if (continuation != null) - { - this.AdjustFlagsAndWidth(continuation); - this.continuation = continuation; - } + AdjustFlagsAndWidth(type); + this.type = type; } + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var inKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + var inExpression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(inExpression); + this.inExpression = inExpression; + var onKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(onKeyword); + this.onKeyword = onKeyword; + var leftExpression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(leftExpression); + this.leftExpression = leftExpression; + var equalsKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(equalsKeyword); + this.equalsKeyword = equalsKeyword; + var rightExpression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(rightExpression); + this.rightExpression = rightExpression; + var into = (JoinIntoClauseSyntax?)reader.ReadValue(); + if (into != null) + { + AdjustFlagsAndWidth(into); + this.into = into; + } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.joinKeyword); + writer.WriteValue(this.type); + writer.WriteValue(this.identifier); + writer.WriteValue(this.inKeyword); + writer.WriteValue(this.inExpression); + writer.WriteValue(this.onKeyword); + writer.WriteValue(this.leftExpression); + writer.WriteValue(this.equalsKeyword); + writer.WriteValue(this.rightExpression); + writer.WriteValue(this.into); + } + + static JoinClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(JoinClauseSyntax), r => new JoinClauseSyntax(r)); + } +} - internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) - : base(kind) - { - this.SlotCount = 3; - if (clauses != null) - { - this.AdjustFlagsAndWidth(clauses); - this.clauses = clauses; - } - this.AdjustFlagsAndWidth(selectOrGroup); - this.selectOrGroup = selectOrGroup; - if (continuation != null) - { - this.AdjustFlagsAndWidth(continuation); - this.continuation = continuation; - } - } +internal sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken intoKeyword; + internal readonly SyntaxToken identifier; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Clauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.clauses); - public SelectOrGroupClauseSyntax SelectOrGroup => this.selectOrGroup; - public QueryContinuationSyntax? Continuation => this.continuation; + internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.clauses, - 1 => this.selectOrGroup, - 2 => this.continuation, - _ => null, - }; + internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryBodySyntax(this, parent, position); + internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); + public SyntaxToken IntoKeyword => this.intoKeyword; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; - public QueryBodySyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax continuation) + internal override GreenNode? GetSlot(int index) + => index switch { - if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) - { - var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.intoKeyword, + 1 => this.identifier, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinIntoClauseSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); - internal QueryBodySyntax(ObjectReader reader) - : base(reader) + public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier) + { + if (intoKeyword != this.IntoKeyword || identifier != this.Identifier) { - this.SlotCount = 3; - var clauses = (GreenNode?)reader.ReadValue(); - if (clauses != null) - { - AdjustFlagsAndWidth(clauses); - this.clauses = clauses; - } - var selectOrGroup = (SelectOrGroupClauseSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(selectOrGroup); - this.selectOrGroup = selectOrGroup; - var continuation = (QueryContinuationSyntax?)reader.ReadValue(); - if (continuation != null) - { - AdjustFlagsAndWidth(continuation); - this.continuation = continuation; - } + var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.clauses); - writer.WriteValue(this.selectOrGroup); - writer.WriteValue(this.continuation); - } - - static QueryBodySyntax() - { - ObjectBinder.RegisterTypeReader(typeof(QueryBodySyntax), r => new QueryBodySyntax(r)); - } + return this; } - internal sealed partial class FromClauseSyntax : QueryClauseSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, GetDiagnostics(), annotations); + + internal JoinIntoClauseSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken fromKeyword; - internal readonly TypeSyntax? type; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken inKeyword; - internal readonly ExpressionSyntax expression; + this.SlotCount = 2; + var intoKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(fromKeyword); - this.fromKeyword = fromKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.intoKeyword); + writer.WriteValue(this.identifier); + } - internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(fromKeyword); - this.fromKeyword = fromKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + static JoinIntoClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(JoinIntoClauseSyntax), r => new JoinIntoClauseSyntax(r)); + } +} - internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(fromKeyword); - this.fromKeyword = fromKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } +internal sealed partial class WhereClauseSyntax : QueryClauseSyntax +{ + internal readonly SyntaxToken whereKeyword; + internal readonly ExpressionSyntax condition; - public SyntaxToken FromKeyword => this.fromKeyword; - public TypeSyntax? Type => this.type; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public SyntaxToken InKeyword => this.inKeyword; - public ExpressionSyntax Expression => this.expression; + internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.fromKeyword, - 1 => this.type, - 2 => this.identifier, - 3 => this.inKeyword, - 4 => this.expression, - _ => null, - }; + internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FromClauseSyntax(this, parent, position); + internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); + public SyntaxToken WhereKeyword => this.whereKeyword; + public ExpressionSyntax Condition => this.condition; - public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + internal override GreenNode? GetSlot(int index) + => index switch { - if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.whereKeyword, + 1 => this.condition, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhereClauseSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); - internal FromClauseSyntax(ObjectReader reader) - : base(reader) + public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition) + { + if (whereKeyword != this.WhereKeyword || condition != this.Condition) { - this.SlotCount = 5; - var fromKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(fromKeyword); - this.fromKeyword = fromKeyword; - var type = (TypeSyntax?)reader.ReadValue(); - if (type != null) - { - AdjustFlagsAndWidth(type); - this.type = type; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var inKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; + var newNode = SyntaxFactory.WhereClause(whereKeyword, condition); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.fromKeyword); - writer.WriteValue(this.type); - writer.WriteValue(this.identifier); - writer.WriteValue(this.inKeyword); - writer.WriteValue(this.expression); - } + return this; + } - static FromClauseSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(FromClauseSyntax), r => new FromClauseSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, GetDiagnostics(), annotations); + + internal WhereClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var whereKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + var condition = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(condition); + this.condition = condition; } - internal sealed partial class LetClauseSyntax : QueryClauseSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken letKeyword; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken equalsToken; - internal readonly ExpressionSyntax expression; + base.WriteTo(writer); + writer.WriteValue(this.whereKeyword); + writer.WriteValue(this.condition); + } + + static WhereClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(WhereClauseSyntax), r => new WhereClauseSyntax(r)); + } +} + +internal sealed partial class OrderByClauseSyntax : QueryClauseSyntax +{ + internal readonly SyntaxToken orderByKeyword; + internal readonly GreenNode? orderings; - internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(orderByKeyword); + this.orderByKeyword = orderByKeyword; + if (orderings != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(letKeyword); - this.letKeyword = letKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(orderings); + this.orderings = orderings; } + } - internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(orderByKeyword); + this.orderByKeyword = orderByKeyword; + if (orderings != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(letKeyword); - this.letKeyword = letKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(orderings); + this.orderings = orderings; } + } - internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) - : base(kind) + internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(orderByKeyword); + this.orderByKeyword = orderByKeyword; + if (orderings != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(letKeyword); - this.letKeyword = letKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(orderings); + this.orderings = orderings; } + } - public SyntaxToken LetKeyword => this.letKeyword; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public SyntaxToken EqualsToken => this.equalsToken; - public ExpressionSyntax Expression => this.expression; + public SyntaxToken OrderByKeyword => this.orderByKeyword; + public CoreSyntax.SeparatedSyntaxList Orderings => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.orderings)); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.letKeyword, - 1 => this.identifier, - 2 => this.equalsToken, - 3 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.orderByKeyword, + 1 => this.orderings, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LetClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderByClauseSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); - public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) + { + if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) { - if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression) - { - var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, diagnostics, GetAnnotations()); - internal LetClauseSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var letKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(letKeyword); - this.letKeyword = letKeyword; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var equalsToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal OrderByClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var orderByKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(orderByKeyword); + this.orderByKeyword = orderByKeyword; + var orderings = (GreenNode?)reader.ReadValue(); + if (orderings != null) { - base.WriteTo(writer); - writer.WriteValue(this.letKeyword); - writer.WriteValue(this.identifier); - writer.WriteValue(this.equalsToken); - writer.WriteValue(this.expression); + AdjustFlagsAndWidth(orderings); + this.orderings = orderings; } + } - static LetClauseSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(LetClauseSyntax), r => new LetClauseSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.orderByKeyword); + writer.WriteValue(this.orderings); } - internal sealed partial class JoinClauseSyntax : QueryClauseSyntax + static OrderByClauseSyntax() { - internal readonly SyntaxToken joinKeyword; - internal readonly TypeSyntax? type; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken inKeyword; - internal readonly ExpressionSyntax inExpression; - internal readonly SyntaxToken onKeyword; - internal readonly ExpressionSyntax leftExpression; - internal readonly SyntaxToken equalsKeyword; - internal readonly ExpressionSyntax rightExpression; - internal readonly JoinIntoClauseSyntax? into; + ObjectBinder.RegisterTypeReader(typeof(OrderByClauseSyntax), r => new OrderByClauseSyntax(r)); + } +} + +internal sealed partial class OrderingSyntax : CSharpSyntaxNode +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken? ascendingOrDescendingKeyword; - internal 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) - : base(kind, diagnostics, annotations) + internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (ascendingOrDescendingKeyword != null) { - this.SlotCount = 10; - this.AdjustFlagsAndWidth(joinKeyword); - this.joinKeyword = joinKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(inExpression); - this.inExpression = inExpression; - this.AdjustFlagsAndWidth(onKeyword); - this.onKeyword = onKeyword; - this.AdjustFlagsAndWidth(leftExpression); - this.leftExpression = leftExpression; - this.AdjustFlagsAndWidth(equalsKeyword); - this.equalsKeyword = equalsKeyword; - this.AdjustFlagsAndWidth(rightExpression); - this.rightExpression = rightExpression; - if (into != null) - { - this.AdjustFlagsAndWidth(into); - this.into = into; - } + this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); + this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; } + } - internal 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) - : base(kind) + internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (ascendingOrDescendingKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 10; - this.AdjustFlagsAndWidth(joinKeyword); - this.joinKeyword = joinKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(inExpression); - this.inExpression = inExpression; - this.AdjustFlagsAndWidth(onKeyword); - this.onKeyword = onKeyword; - this.AdjustFlagsAndWidth(leftExpression); - this.leftExpression = leftExpression; - this.AdjustFlagsAndWidth(equalsKeyword); - this.equalsKeyword = equalsKeyword; - this.AdjustFlagsAndWidth(rightExpression); - this.rightExpression = rightExpression; - if (into != null) - { - this.AdjustFlagsAndWidth(into); - this.into = into; - } + this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); + this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; } + } - internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) - : base(kind) + internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (ascendingOrDescendingKeyword != null) { - this.SlotCount = 10; - this.AdjustFlagsAndWidth(joinKeyword); - this.joinKeyword = joinKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(inExpression); - this.inExpression = inExpression; - this.AdjustFlagsAndWidth(onKeyword); - this.onKeyword = onKeyword; - this.AdjustFlagsAndWidth(leftExpression); - this.leftExpression = leftExpression; - this.AdjustFlagsAndWidth(equalsKeyword); - this.equalsKeyword = equalsKeyword; - this.AdjustFlagsAndWidth(rightExpression); - this.rightExpression = rightExpression; - if (into != null) - { - this.AdjustFlagsAndWidth(into); - this.into = into; - } + this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); + this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; } + } - public SyntaxToken JoinKeyword => this.joinKeyword; - public TypeSyntax? Type => this.type; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public SyntaxToken InKeyword => this.inKeyword; - public ExpressionSyntax InExpression => this.inExpression; - public SyntaxToken OnKeyword => this.onKeyword; - public ExpressionSyntax LeftExpression => this.leftExpression; - public SyntaxToken EqualsKeyword => this.equalsKeyword; - public ExpressionSyntax RightExpression => this.rightExpression; - public JoinIntoClauseSyntax? Into => this.into; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.joinKeyword, - 1 => this.type, - 2 => this.identifier, - 3 => this.inKeyword, - 4 => this.inExpression, - 5 => this.onKeyword, - 6 => this.leftExpression, - 7 => this.equalsKeyword, - 8 => this.rightExpression, - 9 => this.into, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinClauseSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); - - public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax into) - { - if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into) - { - var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public ExpressionSyntax Expression => this.expression; + public SyntaxToken? AscendingOrDescendingKeyword => this.ascendingOrDescendingKeyword; - return this; - } + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.expression, + 1 => this.ascendingOrDescendingKeyword, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderingSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); - internal JoinClauseSyntax(ObjectReader reader) - : base(reader) + public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) + { + if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword) { - this.SlotCount = 10; - var joinKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(joinKeyword); - this.joinKeyword = joinKeyword; - var type = (TypeSyntax?)reader.ReadValue(); - if (type != null) - { - AdjustFlagsAndWidth(type); - this.type = type; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var inKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - var inExpression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(inExpression); - this.inExpression = inExpression; - var onKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(onKeyword); - this.onKeyword = onKeyword; - var leftExpression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(leftExpression); - this.leftExpression = leftExpression; - var equalsKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(equalsKeyword); - this.equalsKeyword = equalsKeyword; - var rightExpression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(rightExpression); - this.rightExpression = rightExpression; - var into = (JoinIntoClauseSyntax?)reader.ReadValue(); - if (into != null) - { - AdjustFlagsAndWidth(into); - this.into = into; - } + var newNode = SyntaxFactory.Ordering(this.Kind, expression, ascendingOrDescendingKeyword); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.joinKeyword); - writer.WriteValue(this.type); - writer.WriteValue(this.identifier); - writer.WriteValue(this.inKeyword); - writer.WriteValue(this.inExpression); - writer.WriteValue(this.onKeyword); - writer.WriteValue(this.leftExpression); - writer.WriteValue(this.equalsKeyword); - writer.WriteValue(this.rightExpression); - writer.WriteValue(this.into); - } + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, GetDiagnostics(), annotations); - static JoinClauseSyntax() + internal OrderingSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var ascendingOrDescendingKeyword = (SyntaxToken?)reader.ReadValue(); + if (ascendingOrDescendingKeyword != null) { - ObjectBinder.RegisterTypeReader(typeof(JoinClauseSyntax), r => new JoinClauseSyntax(r)); + AdjustFlagsAndWidth(ascendingOrDescendingKeyword); + this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; } } - internal sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken intoKeyword; - internal readonly SyntaxToken identifier; + base.WriteTo(writer); + writer.WriteValue(this.expression); + writer.WriteValue(this.ascendingOrDescendingKeyword); + } - internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + static OrderingSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(OrderingSyntax), r => new OrderingSyntax(r)); + } +} + +internal sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax +{ + internal readonly SyntaxToken selectKeyword; + internal readonly ExpressionSyntax expression; + + internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(selectKeyword); + this.selectKeyword = selectKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(selectKeyword); + this.selectKeyword = selectKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(selectKeyword); + this.selectKeyword = selectKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, SyntaxFactoryContext context) - : base(kind) + public SyntaxToken SelectKeyword => this.selectKeyword; + public ExpressionSyntax Expression => this.expression; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + 0 => this.selectKeyword, + 1 => this.expression, + _ => null, + }; - internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SelectClauseSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); + + public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression) + { + if (selectKeyword != this.SelectKeyword || expression != this.Expression) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + var newNode = SyntaxFactory.SelectClause(selectKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken IntoKeyword => this.intoKeyword; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.intoKeyword, - 1 => this.identifier, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinIntoClauseSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, GetDiagnostics(), annotations); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); + internal SelectClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var selectKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(selectKeyword); + this.selectKeyword = selectKeyword; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier) - { - if (intoKeyword != this.IntoKeyword || identifier != this.Identifier) - { - var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.selectKeyword); + writer.WriteValue(this.expression); + } - return this; - } + static SelectClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(SelectClauseSyntax), r => new SelectClauseSyntax(r)); + } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, diagnostics, GetAnnotations()); +internal sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax +{ + internal readonly SyntaxToken groupKeyword; + internal readonly ExpressionSyntax groupExpression; + internal readonly SyntaxToken byKeyword; + internal readonly ExpressionSyntax byExpression; + + internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(groupKeyword); + this.groupKeyword = groupKeyword; + this.AdjustFlagsAndWidth(groupExpression); + this.groupExpression = groupExpression; + this.AdjustFlagsAndWidth(byKeyword); + this.byKeyword = byKeyword; + this.AdjustFlagsAndWidth(byExpression); + this.byExpression = byExpression; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, GetDiagnostics(), annotations); + internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(groupKeyword); + this.groupKeyword = groupKeyword; + this.AdjustFlagsAndWidth(groupExpression); + this.groupExpression = groupExpression; + this.AdjustFlagsAndWidth(byKeyword); + this.byKeyword = byKeyword; + this.AdjustFlagsAndWidth(byExpression); + this.byExpression = byExpression; + } - internal JoinIntoClauseSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var intoKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(groupKeyword); + this.groupKeyword = groupKeyword; + this.AdjustFlagsAndWidth(groupExpression); + this.groupExpression = groupExpression; + this.AdjustFlagsAndWidth(byKeyword); + this.byKeyword = byKeyword; + this.AdjustFlagsAndWidth(byExpression); + this.byExpression = byExpression; + } - internal override void WriteTo(ObjectWriter writer) + public SyntaxToken GroupKeyword => this.groupKeyword; + public ExpressionSyntax GroupExpression => this.groupExpression; + public SyntaxToken ByKeyword => this.byKeyword; + public ExpressionSyntax ByExpression => this.byExpression; + + internal override GreenNode? GetSlot(int index) + => index switch { - base.WriteTo(writer); - writer.WriteValue(this.intoKeyword); - writer.WriteValue(this.identifier); - } + 0 => this.groupKeyword, + 1 => this.groupExpression, + 2 => this.byKeyword, + 3 => this.byExpression, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GroupClauseSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); - static JoinIntoClauseSyntax() + public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + { + if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression) { - ObjectBinder.RegisterTypeReader(typeof(JoinIntoClauseSyntax), r => new JoinIntoClauseSyntax(r)); + var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; } - internal sealed partial class WhereClauseSyntax : QueryClauseSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, GetDiagnostics(), annotations); + + internal GroupClauseSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken whereKeyword; - internal readonly ExpressionSyntax condition; + this.SlotCount = 4; + var groupKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(groupKeyword); + this.groupKeyword = groupKeyword; + var groupExpression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(groupExpression); + this.groupExpression = groupExpression; + var byKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(byKeyword); + this.byKeyword = byKeyword; + var byExpression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(byExpression); + this.byExpression = byExpression; + } - internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.groupKeyword); + writer.WriteValue(this.groupExpression); + writer.WriteValue(this.byKeyword); + writer.WriteValue(this.byExpression); + } - internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } + static GroupClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(GroupClauseSyntax), r => new GroupClauseSyntax(r)); + } +} - internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } +internal sealed partial class QueryContinuationSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken intoKeyword; + internal readonly SyntaxToken identifier; + internal readonly QueryBodySyntax body; - public SyntaxToken WhereKeyword => this.whereKeyword; - public ExpressionSyntax Condition => this.condition; + internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(body); + this.body = body; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.whereKeyword, - 1 => this.condition, - _ => null, - }; + internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(body); + this.body = body; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhereClauseSyntax(this, parent, position); + internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(body); + this.body = body; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); + public SyntaxToken IntoKeyword => this.intoKeyword; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public QueryBodySyntax Body => this.body; - public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition) + internal override GreenNode? GetSlot(int index) + => index switch { - if (whereKeyword != this.WhereKeyword || condition != this.Condition) - { - var newNode = SyntaxFactory.WhereClause(whereKeyword, condition); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.intoKeyword, + 1 => this.identifier, + 2 => this.body, + _ => null, + }; - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryContinuationSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); - internal WhereClauseSyntax(ObjectReader reader) - : base(reader) + public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + { + if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body) { - this.SlotCount = 2; - var whereKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - var condition = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(condition); - this.condition = condition; + var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.whereKeyword); - writer.WriteValue(this.condition); - } + return this; + } - static WhereClauseSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(WhereClauseSyntax), r => new WhereClauseSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, GetDiagnostics(), annotations); + + internal QueryContinuationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var intoKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var body = (QueryBodySyntax)reader.ReadValue(); + AdjustFlagsAndWidth(body); + this.body = body; } - internal sealed partial class OrderByClauseSyntax : QueryClauseSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken orderByKeyword; - internal readonly GreenNode? orderings; + base.WriteTo(writer); + writer.WriteValue(this.intoKeyword); + writer.WriteValue(this.identifier); + writer.WriteValue(this.body); + } - internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(orderByKeyword); - this.orderByKeyword = orderByKeyword; - if (orderings != null) - { - this.AdjustFlagsAndWidth(orderings); - this.orderings = orderings; - } - } + static QueryContinuationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(QueryContinuationSyntax), r => new QueryContinuationSyntax(r)); + } +} - internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(orderByKeyword); - this.orderByKeyword = orderByKeyword; - if (orderings != null) - { - this.AdjustFlagsAndWidth(orderings); - this.orderings = orderings; - } - } +/// Class which represents a placeholder in an array size list. +internal sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken omittedArraySizeExpressionToken; - internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(orderByKeyword); - this.orderByKeyword = orderByKeyword; - if (orderings != null) - { - this.AdjustFlagsAndWidth(orderings); - this.orderings = orderings; - } - } + internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); + this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; + } - public SyntaxToken OrderByKeyword => this.orderByKeyword; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Orderings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.orderings)); + internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); + this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.orderByKeyword, - 1 => this.orderings, - _ => null, - }; + internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); + this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderByClauseSyntax(this, parent, position); + /// SyntaxToken representing the omitted array size expression. + public SyntaxToken OmittedArraySizeExpressionToken => this.omittedArraySizeExpressionToken; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.omittedArraySizeExpressionToken : null; - public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList orderings) - { - if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) - { - var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedArraySizeExpressionSyntax(this, parent, position); - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); + + public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken) + { + if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken) + { + var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, diagnostics, GetAnnotations()); - internal OrderByClauseSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var orderByKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(orderByKeyword); - this.orderByKeyword = orderByKeyword; - var orderings = (GreenNode?)reader.ReadValue(); - if (orderings != null) - { - AdjustFlagsAndWidth(orderings); - this.orderings = orderings; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.orderByKeyword); - writer.WriteValue(this.orderings); - } + internal OmittedArraySizeExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var omittedArraySizeExpressionToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(omittedArraySizeExpressionToken); + this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; + } - static OrderByClauseSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(OrderByClauseSyntax), r => new OrderByClauseSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.omittedArraySizeExpressionToken); } - internal sealed partial class OrderingSyntax : CSharpSyntaxNode + static OmittedArraySizeExpressionSyntax() { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken? ascendingOrDescendingKeyword; + ObjectBinder.RegisterTypeReader(typeof(OmittedArraySizeExpressionSyntax), r => new OmittedArraySizeExpressionSyntax(r)); + } +} + +internal sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken stringStartToken; + internal readonly GreenNode? contents; + internal readonly SyntaxToken stringEndToken; - internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stringStartToken); + this.stringStartToken = stringStartToken; + if (contents != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (ascendingOrDescendingKeyword != null) - { - this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); - this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; - } + this.AdjustFlagsAndWidth(contents); + this.contents = contents; } + this.AdjustFlagsAndWidth(stringEndToken); + this.stringEndToken = stringEndToken; + } - internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, SyntaxFactoryContext context) - : base(kind) + internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stringStartToken); + this.stringStartToken = stringStartToken; + if (contents != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (ascendingOrDescendingKeyword != null) - { - this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); - this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; - } + this.AdjustFlagsAndWidth(contents); + this.contents = contents; } + this.AdjustFlagsAndWidth(stringEndToken); + this.stringEndToken = stringEndToken; + } - internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) - : base(kind) + internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stringStartToken); + this.stringStartToken = stringStartToken; + if (contents != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (ascendingOrDescendingKeyword != null) - { - this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); - this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; - } + this.AdjustFlagsAndWidth(contents); + this.contents = contents; } + this.AdjustFlagsAndWidth(stringEndToken); + this.stringEndToken = stringEndToken; + } - public ExpressionSyntax Expression => this.expression; - public SyntaxToken? AscendingOrDescendingKeyword => this.ascendingOrDescendingKeyword; + /// The first part of an interpolated string, $" or $@" or $""" + public SyntaxToken StringStartToken => this.stringStartToken; + /// List of parts of the interpolated string, each one is either a literal part or an interpolation. + public CoreSyntax.SyntaxList Contents => new CoreSyntax.SyntaxList(this.contents); + /// The closing quote of the interpolated string. + public SyntaxToken StringEndToken => this.stringEndToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.ascendingOrDescendingKeyword, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.stringStartToken, + 1 => this.contents, + 2 => this.stringEndToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderingSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); - public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) + public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) + { + if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) { - if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword) - { - var newNode = SyntaxFactory.Ordering(this.Kind, expression, ascendingOrDescendingKeyword); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, diagnostics, GetAnnotations()); - internal OrderingSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var ascendingOrDescendingKeyword = (SyntaxToken?)reader.ReadValue(); - if (ascendingOrDescendingKeyword != null) - { - AdjustFlagsAndWidth(ascendingOrDescendingKeyword); - this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal InterpolatedStringExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var stringStartToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(stringStartToken); + this.stringStartToken = stringStartToken; + var contents = (GreenNode?)reader.ReadValue(); + if (contents != null) { - base.WriteTo(writer); - writer.WriteValue(this.expression); - writer.WriteValue(this.ascendingOrDescendingKeyword); + AdjustFlagsAndWidth(contents); + this.contents = contents; } + var stringEndToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(stringEndToken); + this.stringEndToken = stringEndToken; + } - static OrderingSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(OrderingSyntax), r => new OrderingSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.stringStartToken); + writer.WriteValue(this.contents); + writer.WriteValue(this.stringEndToken); + } + + static InterpolatedStringExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(InterpolatedStringExpressionSyntax), r => new InterpolatedStringExpressionSyntax(r)); } +} + +/// Class which represents a simple pattern-matching expression using the "is" keyword. +internal sealed partial class IsPatternExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken isKeyword; + internal readonly PatternSyntax pattern; - internal sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax + internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal readonly SyntaxToken selectKeyword; - internal readonly ExpressionSyntax expression; + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(isKeyword); + this.isKeyword = isKeyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(selectKeyword); - this.selectKeyword = selectKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(isKeyword); + this.isKeyword = isKeyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } + + internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(isKeyword); + this.isKeyword = isKeyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } + + /// ExpressionSyntax node representing the expression on the left of the "is" operator. + public ExpressionSyntax Expression => this.expression; + public SyntaxToken IsKeyword => this.isKeyword; + /// PatternSyntax node representing the pattern on the right of the "is" operator. + public PatternSyntax Pattern => this.pattern; - internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(selectKeyword); - this.selectKeyword = selectKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + 0 => this.expression, + 1 => this.isKeyword, + 2 => this.pattern, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IsPatternExpressionSyntax(this, parent, position); - internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); + + public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + { + if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(selectKeyword); - this.selectKeyword = selectKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken SelectKeyword => this.selectKeyword; - public ExpressionSyntax Expression => this.expression; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.selectKeyword, - 1 => this.expression, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SelectClauseSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, GetDiagnostics(), annotations); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); + internal IsPatternExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var isKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(isKeyword); + this.isKeyword = isKeyword; + var pattern = (PatternSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression) - { - if (selectKeyword != this.SelectKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.SelectClause(selectKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.expression); + writer.WriteValue(this.isKeyword); + writer.WriteValue(this.pattern); + } - return this; - } + static IsPatternExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(IsPatternExpressionSyntax), r => new IsPatternExpressionSyntax(r)); + } +} + +internal sealed partial class ThrowExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken throwKeyword; + internal readonly ExpressionSyntax expression; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, diagnostics, GetAnnotations()); + internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, GetDiagnostics(), annotations); + internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal SelectClauseSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var selectKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(selectKeyword); - this.selectKeyword = selectKeyword; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + public SyntaxToken ThrowKeyword => this.throwKeyword; + public ExpressionSyntax Expression => this.expression; - internal override void WriteTo(ObjectWriter writer) + internal override GreenNode? GetSlot(int index) + => index switch { - base.WriteTo(writer); - writer.WriteValue(this.selectKeyword); - writer.WriteValue(this.expression); - } + 0 => this.throwKeyword, + 1 => this.expression, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowExpressionSyntax(this, parent, position); - static SelectClauseSyntax() + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); + + public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression) + { + if (throwKeyword != this.ThrowKeyword || expression != this.Expression) { - ObjectBinder.RegisterTypeReader(typeof(SelectClauseSyntax), r => new SelectClauseSyntax(r)); + var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; } - internal sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, GetDiagnostics(), annotations); + + internal ThrowExpressionSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken groupKeyword; - internal readonly ExpressionSyntax groupExpression; - internal readonly SyntaxToken byKeyword; - internal readonly ExpressionSyntax byExpression; + this.SlotCount = 2; + var throwKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(groupKeyword); - this.groupKeyword = groupKeyword; - this.AdjustFlagsAndWidth(groupExpression); - this.groupExpression = groupExpression; - this.AdjustFlagsAndWidth(byKeyword); - this.byKeyword = byKeyword; - this.AdjustFlagsAndWidth(byExpression); - this.byExpression = byExpression; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.throwKeyword); + writer.WriteValue(this.expression); + } - internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(groupKeyword); - this.groupKeyword = groupKeyword; - this.AdjustFlagsAndWidth(groupExpression); - this.groupExpression = groupExpression; - this.AdjustFlagsAndWidth(byKeyword); - this.byKeyword = byKeyword; - this.AdjustFlagsAndWidth(byExpression); - this.byExpression = byExpression; - } + static ThrowExpressionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ThrowExpressionSyntax), r => new ThrowExpressionSyntax(r)); + } +} - internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(groupKeyword); - this.groupKeyword = groupKeyword; - this.AdjustFlagsAndWidth(groupExpression); - this.groupExpression = groupExpression; - this.AdjustFlagsAndWidth(byKeyword); - this.byKeyword = byKeyword; - this.AdjustFlagsAndWidth(byExpression); - this.byExpression = byExpression; - } +internal sealed partial class WhenClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken whenKeyword; + internal readonly ExpressionSyntax condition; - public SyntaxToken GroupKeyword => this.groupKeyword; - public ExpressionSyntax GroupExpression => this.groupExpression; - public SyntaxToken ByKeyword => this.byKeyword; - public ExpressionSyntax ByExpression => this.byExpression; + internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.groupKeyword, - 1 => this.groupExpression, - 2 => this.byKeyword, - 3 => this.byExpression, - _ => null, - }; + internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GroupClauseSyntax(this, parent, position); + internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); + public SyntaxToken WhenKeyword => this.whenKeyword; + public ExpressionSyntax Condition => this.condition; - public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + internal override GreenNode? GetSlot(int index) + => index switch { - if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression) - { - var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.whenKeyword, + 1 => this.condition, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhenClauseSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); - internal GroupClauseSyntax(ObjectReader reader) - : base(reader) + public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition) + { + if (whenKeyword != this.WhenKeyword || condition != this.Condition) { - this.SlotCount = 4; - var groupKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(groupKeyword); - this.groupKeyword = groupKeyword; - var groupExpression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(groupExpression); - this.groupExpression = groupExpression; - var byKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(byKeyword); - this.byKeyword = byKeyword; - var byExpression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(byExpression); - this.byExpression = byExpression; + var newNode = SyntaxFactory.WhenClause(whenKeyword, condition); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.groupKeyword); - writer.WriteValue(this.groupExpression); - writer.WriteValue(this.byKeyword); - writer.WriteValue(this.byExpression); - } + return this; + } - static GroupClauseSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(GroupClauseSyntax), r => new GroupClauseSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, GetDiagnostics(), annotations); + + internal WhenClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var whenKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + var condition = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(condition); + this.condition = condition; } - internal sealed partial class QueryContinuationSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken intoKeyword; - internal readonly SyntaxToken identifier; - internal readonly QueryBodySyntax body; + base.WriteTo(writer); + writer.WriteValue(this.whenKeyword); + writer.WriteValue(this.condition); + } - internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(body); - this.body = body; - } + static WhenClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(WhenClauseSyntax), r => new WhenClauseSyntax(r)); + } +} - internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(body); - this.body = body; - } +internal abstract partial class PatternSyntax : ExpressionOrPatternSyntax +{ + internal PatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(body); - this.body = body; - } + internal PatternSyntax(SyntaxKind kind) + : base(kind) + { + } - public SyntaxToken IntoKeyword => this.intoKeyword; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public QueryBodySyntax Body => this.body; + protected PatternSyntax(ObjectReader reader) + : base(reader) + { + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.intoKeyword, - 1 => this.identifier, - 2 => this.body, - _ => null, - }; +internal sealed partial class DiscardPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken underscoreToken; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryContinuationSyntax(this, parent, position); + internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); + internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) - { - if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body) - { - var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - return this; - } + public SyntaxToken UnderscoreToken => this.underscoreToken; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.underscoreToken : null; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardPatternSyntax(this, parent, position); - internal QueryContinuationSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var intoKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var body = (QueryBodySyntax)reader.ReadValue(); - AdjustFlagsAndWidth(body); - this.body = body; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); - internal override void WriteTo(ObjectWriter writer) + public DiscardPatternSyntax Update(SyntaxToken underscoreToken) + { + if (underscoreToken != this.UnderscoreToken) { - base.WriteTo(writer); - writer.WriteValue(this.intoKeyword); - writer.WriteValue(this.identifier); - writer.WriteValue(this.body); + var newNode = SyntaxFactory.DiscardPattern(underscoreToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static QueryContinuationSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(QueryContinuationSyntax), r => new QueryContinuationSyntax(r)); - } + return this; } - /// Class which represents a placeholder in an array size list. - internal sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DiscardPatternSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DiscardPatternSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations); + + internal DiscardPatternSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken omittedArraySizeExpressionToken; + this.SlotCount = 1; + var underscoreToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); - this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.underscoreToken); + } - internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); - this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; - } + static DiscardPatternSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(DiscardPatternSyntax), r => new DiscardPatternSyntax(r)); + } +} - internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); - this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; - } +internal sealed partial class DeclarationPatternSyntax : PatternSyntax +{ + internal readonly TypeSyntax type; + internal readonly VariableDesignationSyntax designation; - /// SyntaxToken representing the omitted array size expression. - public SyntaxToken OmittedArraySizeExpressionToken => this.omittedArraySizeExpressionToken; + internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.omittedArraySizeExpressionToken : null; + internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedArraySizeExpressionSyntax(this, parent, position); + internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); + public TypeSyntax Type => this.type; + public VariableDesignationSyntax Designation => this.designation; - public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken) - { - var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.type, + 1 => this.designation, + _ => null, + }; - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationPatternSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); - internal OmittedArraySizeExpressionSyntax(ObjectReader reader) - : base(reader) + public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + { + if (type != this.Type || designation != this.Designation) { - this.SlotCount = 1; - var omittedArraySizeExpressionToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(omittedArraySizeExpressionToken); - this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; + var newNode = SyntaxFactory.DeclarationPattern(type, designation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.omittedArraySizeExpressionToken); - } + return this; + } - static OmittedArraySizeExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(OmittedArraySizeExpressionSyntax), r => new OmittedArraySizeExpressionSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DeclarationPatternSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DeclarationPatternSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations); + + internal DeclarationPatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var designation = (VariableDesignationSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(designation); + this.designation = designation; } - internal sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken stringStartToken; - internal readonly GreenNode? contents; - internal readonly SyntaxToken stringEndToken; + base.WriteTo(writer); + writer.WriteValue(this.type); + writer.WriteValue(this.designation); + } - internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stringStartToken); - this.stringStartToken = stringStartToken; - if (contents != null) - { - this.AdjustFlagsAndWidth(contents); - this.contents = contents; - } - this.AdjustFlagsAndWidth(stringEndToken); - this.stringEndToken = stringEndToken; - } - - internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stringStartToken); - this.stringStartToken = stringStartToken; - if (contents != null) - { - this.AdjustFlagsAndWidth(contents); - this.contents = contents; - } - this.AdjustFlagsAndWidth(stringEndToken); - this.stringEndToken = stringEndToken; - } + static DeclarationPatternSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(DeclarationPatternSyntax), r => new DeclarationPatternSyntax(r)); + } +} - internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stringStartToken); - this.stringStartToken = stringStartToken; - if (contents != null) - { - this.AdjustFlagsAndWidth(contents); - this.contents = contents; - } - this.AdjustFlagsAndWidth(stringEndToken); - this.stringEndToken = stringEndToken; - } +internal sealed partial class VarPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken varKeyword; + internal readonly VariableDesignationSyntax designation; - /// The first part of an interpolated string, $" or $@" or $""" - public SyntaxToken StringStartToken => this.stringStartToken; - /// List of parts of the interpolated string, each one is either a literal part or an interpolation. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Contents => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.contents); - /// The closing quote of the interpolated string. - public SyntaxToken StringEndToken => this.stringEndToken; + internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(varKeyword); + this.varKeyword = varKeyword; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.stringStartToken, - 1 => this.contents, - 2 => this.stringEndToken, - _ => null, - }; + internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(varKeyword); + this.varKeyword = varKeyword; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringExpressionSyntax(this, parent, position); + internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(varKeyword); + this.varKeyword = varKeyword; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); + public SyntaxToken VarKeyword => this.varKeyword; + public VariableDesignationSyntax Designation => this.designation; - public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList contents, SyntaxToken stringEndToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) - { - var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.varKeyword, + 1 => this.designation, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VarPatternSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); - internal InterpolatedStringExpressionSyntax(ObjectReader reader) - : base(reader) + public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation) + { + if (varKeyword != this.VarKeyword || designation != this.Designation) { - this.SlotCount = 3; - var stringStartToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(stringStartToken); - this.stringStartToken = stringStartToken; - var contents = (GreenNode?)reader.ReadValue(); - if (contents != null) - { - AdjustFlagsAndWidth(contents); - this.contents = contents; - } - var stringEndToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(stringEndToken); - this.stringEndToken = stringEndToken; + var newNode = SyntaxFactory.VarPattern(varKeyword, designation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.stringStartToken); - writer.WriteValue(this.contents); - writer.WriteValue(this.stringEndToken); - } + return this; + } - static InterpolatedStringExpressionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(InterpolatedStringExpressionSyntax), r => new InterpolatedStringExpressionSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, GetDiagnostics(), annotations); + + internal VarPatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var varKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(varKeyword); + this.varKeyword = varKeyword; + var designation = (VariableDesignationSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(designation); + this.designation = designation; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.varKeyword); + writer.WriteValue(this.designation); } - /// Class which represents a simple pattern-matching expression using the "is" keyword. - internal sealed partial class IsPatternExpressionSyntax : ExpressionSyntax + static VarPatternSyntax() { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken isKeyword; - internal readonly PatternSyntax pattern; + ObjectBinder.RegisterTypeReader(typeof(VarPatternSyntax), r => new VarPatternSyntax(r)); + } +} - internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class RecursivePatternSyntax : PatternSyntax +{ + internal readonly TypeSyntax? type; + internal readonly PositionalPatternClauseSyntax? positionalPatternClause; + internal readonly PropertyPatternClauseSyntax? propertyPatternClause; + internal readonly VariableDesignationSyntax? designation; + + internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (type != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(isKeyword); - this.isKeyword = isKeyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; + this.AdjustFlagsAndWidth(type); + this.type = type; } - - internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, SyntaxFactoryContext context) - : base(kind) + if (positionalPatternClause != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(isKeyword); - this.isKeyword = isKeyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; + this.AdjustFlagsAndWidth(positionalPatternClause); + this.positionalPatternClause = positionalPatternClause; } - - internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) - : base(kind) + if (propertyPatternClause != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(isKeyword); - this.isKeyword = isKeyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; + this.AdjustFlagsAndWidth(propertyPatternClause); + this.propertyPatternClause = propertyPatternClause; } - - /// ExpressionSyntax node representing the expression on the left of the "is" operator. - public ExpressionSyntax Expression => this.expression; - public SyntaxToken IsKeyword => this.isKeyword; - /// PatternSyntax node representing the pattern on the right of the "is" operator. - public PatternSyntax Pattern => this.pattern; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.isKeyword, - 2 => this.pattern, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IsPatternExpressionSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); - - public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + if (designation != null) { - if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern) - { - var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, GetDiagnostics(), annotations); - - internal IsPatternExpressionSyntax(ObjectReader reader) - : base(reader) + internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + if (type != null) { - this.SlotCount = 3; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var isKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(isKeyword); - this.isKeyword = isKeyword; - var pattern = (PatternSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(pattern); - this.pattern = pattern; + this.AdjustFlagsAndWidth(type); + this.type = type; } - - internal override void WriteTo(ObjectWriter writer) + if (positionalPatternClause != null) { - base.WriteTo(writer); - writer.WriteValue(this.expression); - writer.WriteValue(this.isKeyword); - writer.WriteValue(this.pattern); + this.AdjustFlagsAndWidth(positionalPatternClause); + this.positionalPatternClause = positionalPatternClause; } - - static IsPatternExpressionSyntax() + if (propertyPatternClause != null) + { + this.AdjustFlagsAndWidth(propertyPatternClause); + this.propertyPatternClause = propertyPatternClause; + } + if (designation != null) { - ObjectBinder.RegisterTypeReader(typeof(IsPatternExpressionSyntax), r => new IsPatternExpressionSyntax(r)); + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } } - internal sealed partial class ThrowExpressionSyntax : ExpressionSyntax + internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) + : base(kind) { - internal readonly SyntaxToken throwKeyword; - internal readonly ExpressionSyntax expression; - - internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 4; + if (type != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(type); + this.type = type; } - - internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + if (positionalPatternClause != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(positionalPatternClause); + this.positionalPatternClause = positionalPatternClause; } - - internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression) - : base(kind) + if (propertyPatternClause != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(propertyPatternClause); + this.propertyPatternClause = propertyPatternClause; + } + if (designation != null) + { + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } + } - public SyntaxToken ThrowKeyword => this.throwKeyword; - public ExpressionSyntax Expression => this.expression; + public TypeSyntax? Type => this.type; + public PositionalPatternClauseSyntax? PositionalPatternClause => this.positionalPatternClause; + public PropertyPatternClauseSyntax? PropertyPatternClause => this.propertyPatternClause; + public VariableDesignationSyntax? Designation => this.designation; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.throwKeyword, - 1 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.positionalPatternClause, + 2 => this.propertyPatternClause, + 3 => this.designation, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecursivePatternSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); - public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression) + public RecursivePatternSyntax Update(TypeSyntax type, PositionalPatternClauseSyntax positionalPatternClause, PropertyPatternClauseSyntax propertyPatternClause, VariableDesignationSyntax designation) + { + if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation) { - if (throwKeyword != this.ThrowKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, GetDiagnostics(), annotations); - internal ThrowExpressionSyntax(ObjectReader reader) - : base(reader) + internal RecursivePatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var type = (TypeSyntax?)reader.ReadValue(); + if (type != null) { - this.SlotCount = 2; - var throwKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; + AdjustFlagsAndWidth(type); + this.type = type; } - - internal override void WriteTo(ObjectWriter writer) + var positionalPatternClause = (PositionalPatternClauseSyntax?)reader.ReadValue(); + if (positionalPatternClause != null) { - base.WriteTo(writer); - writer.WriteValue(this.throwKeyword); - writer.WriteValue(this.expression); + AdjustFlagsAndWidth(positionalPatternClause); + this.positionalPatternClause = positionalPatternClause; } - - static ThrowExpressionSyntax() + var propertyPatternClause = (PropertyPatternClauseSyntax?)reader.ReadValue(); + if (propertyPatternClause != null) + { + AdjustFlagsAndWidth(propertyPatternClause); + this.propertyPatternClause = propertyPatternClause; + } + var designation = (VariableDesignationSyntax?)reader.ReadValue(); + if (designation != null) { - ObjectBinder.RegisterTypeReader(typeof(ThrowExpressionSyntax), r => new ThrowExpressionSyntax(r)); + AdjustFlagsAndWidth(designation); + this.designation = designation; } } - internal sealed partial class WhenClauseSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.type); + writer.WriteValue(this.positionalPatternClause); + writer.WriteValue(this.propertyPatternClause); + writer.WriteValue(this.designation); + } + + static RecursivePatternSyntax() { - internal readonly SyntaxToken whenKeyword; - internal readonly ExpressionSyntax condition; + ObjectBinder.RegisterTypeReader(typeof(RecursivePatternSyntax), r => new RecursivePatternSyntax(r)); + } +} + +internal sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? subpatterns; + internal readonly SyntaxToken closeParenToken; - internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (subpatterns != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) - : base(kind) + internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (subpatterns != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition) - : base(kind) + internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (subpatterns != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public SyntaxToken WhenKeyword => this.whenKeyword; - public ExpressionSyntax Condition => this.condition; + public SyntaxToken OpenParenToken => this.openParenToken; + public CoreSyntax.SeparatedSyntaxList Subpatterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.subpatterns)); + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.whenKeyword, - 1 => this.condition, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.subpatterns, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhenClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PositionalPatternClauseSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); - public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition) + public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) { - if (whenKeyword != this.WhenKeyword || condition != this.Condition) - { - var newNode = SyntaxFactory.WhenClause(whenKeyword, condition); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, diagnostics, GetAnnotations()); - internal WhenClauseSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var whenKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - var condition = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(condition); - this.condition = condition; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal PositionalPatternClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var subpatterns = (GreenNode?)reader.ReadValue(); + if (subpatterns != null) { - base.WriteTo(writer); - writer.WriteValue(this.whenKeyword); - writer.WriteValue(this.condition); + AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - static WhenClauseSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(WhenClauseSyntax), r => new WhenClauseSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.subpatterns); + writer.WriteValue(this.closeParenToken); } - internal abstract partial class PatternSyntax : ExpressionOrPatternSyntax + static PositionalPatternClauseSyntax() { - internal PatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + ObjectBinder.RegisterTypeReader(typeof(PositionalPatternClauseSyntax), r => new PositionalPatternClauseSyntax(r)); + } +} - internal PatternSyntax(SyntaxKind kind) - : base(kind) - { - } +internal sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? subpatterns; + internal readonly SyntaxToken closeBraceToken; - protected PatternSyntax(ObjectReader reader) - : base(reader) + internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (subpatterns != null) { + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - internal sealed partial class DiscardPatternSyntax : PatternSyntax + internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken underscoreToken; - - internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; - } - - internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) - : base(kind) + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (subpatterns != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken) - : base(kind) + internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (subpatterns != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - public SyntaxToken UnderscoreToken => this.underscoreToken; + public SyntaxToken OpenBraceToken => this.openBraceToken; + public CoreSyntax.SeparatedSyntaxList Subpatterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.subpatterns)); + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.underscoreToken : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBraceToken, + 1 => this.subpatterns, + 2 => this.closeBraceToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardPatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyPatternClauseSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); - public DiscardPatternSyntax Update(SyntaxToken underscoreToken) + public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) { - if (underscoreToken != this.UnderscoreToken) - { - var newNode = SyntaxFactory.DiscardPattern(underscoreToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DiscardPatternSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DiscardPatternSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, diagnostics, GetAnnotations()); - internal DiscardPatternSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var underscoreToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal PropertyPatternClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + var subpatterns = (GreenNode?)reader.ReadValue(); + if (subpatterns != null) { - base.WriteTo(writer); - writer.WriteValue(this.underscoreToken); + AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + var closeBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - static DiscardPatternSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(DiscardPatternSyntax), r => new DiscardPatternSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.subpatterns); + writer.WriteValue(this.closeBraceToken); } - internal sealed partial class DeclarationPatternSyntax : PatternSyntax + static PropertyPatternClauseSyntax() { - internal readonly TypeSyntax type; - internal readonly VariableDesignationSyntax designation; + ObjectBinder.RegisterTypeReader(typeof(PropertyPatternClauseSyntax), r => new PropertyPatternClauseSyntax(r)); + } +} + +internal sealed partial class SubpatternSyntax : CSharpSyntaxNode +{ + internal readonly BaseExpressionColonSyntax? expressionColon; + internal readonly PatternSyntax pattern; - internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (expressionColon != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(expressionColon); + this.expressionColon = expressionColon; } + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) - : base(kind) + internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + if (expressionColon != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(expressionColon); + this.expressionColon = expressionColon; } + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) - : base(kind) + internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) + : base(kind) + { + this.SlotCount = 2; + if (expressionColon != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(expressionColon); + this.expressionColon = expressionColon; } + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - public TypeSyntax Type => this.type; - public VariableDesignationSyntax Designation => this.designation; + public BaseExpressionColonSyntax? ExpressionColon => this.expressionColon; + public PatternSyntax Pattern => this.pattern; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.designation, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.expressionColon, + 1 => this.pattern, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationPatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SubpatternSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); - public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + public SubpatternSyntax Update(BaseExpressionColonSyntax expressionColon, PatternSyntax pattern) + { + if (expressionColon != this.ExpressionColon || pattern != this.Pattern) { - if (type != this.Type || designation != this.Designation) - { - var newNode = SyntaxFactory.DeclarationPattern(type, designation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Subpattern(expressionColon, pattern); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DeclarationPatternSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DeclarationPatternSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, diagnostics, GetAnnotations()); - internal DeclarationPatternSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var designation = (VariableDesignationSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(designation); - this.designation = designation; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal SubpatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var expressionColon = (BaseExpressionColonSyntax?)reader.ReadValue(); + if (expressionColon != null) { - base.WriteTo(writer); - writer.WriteValue(this.type); - writer.WriteValue(this.designation); + AdjustFlagsAndWidth(expressionColon); + this.expressionColon = expressionColon; } + var pattern = (PatternSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - static DeclarationPatternSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(DeclarationPatternSyntax), r => new DeclarationPatternSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.expressionColon); + writer.WriteValue(this.pattern); } - internal sealed partial class VarPatternSyntax : PatternSyntax + static SubpatternSyntax() { - internal readonly SyntaxToken varKeyword; - internal readonly VariableDesignationSyntax designation; + ObjectBinder.RegisterTypeReader(typeof(SubpatternSyntax), r => new SubpatternSyntax(r)); + } +} - internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(varKeyword); - this.varKeyword = varKeyword; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } +internal sealed partial class ConstantPatternSyntax : PatternSyntax +{ + internal readonly ExpressionSyntax expression; - internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(varKeyword); - this.varKeyword = varKeyword; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } + internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(varKeyword); - this.varKeyword = varKeyword; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } + internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public SyntaxToken VarKeyword => this.varKeyword; - public VariableDesignationSyntax Designation => this.designation; + /// ExpressionSyntax node representing the constant expression. + public ExpressionSyntax Expression => this.expression; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.varKeyword, - 1 => this.designation, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.expression : null; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VarPatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstantPatternSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); - public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation) + public ConstantPatternSyntax Update(ExpressionSyntax expression) + { + if (expression != this.Expression) { - if (varKeyword != this.VarKeyword || designation != this.Designation) - { - var newNode = SyntaxFactory.VarPattern(varKeyword, designation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ConstantPattern(expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConstantPatternSyntax(this.Kind, this.expression, diagnostics, GetAnnotations()); - internal VarPatternSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var varKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(varKeyword); - this.varKeyword = varKeyword; - var designation = (VariableDesignationSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(designation); - this.designation = designation; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConstantPatternSyntax(this.Kind, this.expression, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.varKeyword); - writer.WriteValue(this.designation); - } + internal ConstantPatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - static VarPatternSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(VarPatternSyntax), r => new VarPatternSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.expression); } - internal sealed partial class RecursivePatternSyntax : PatternSyntax + static ConstantPatternSyntax() { - internal readonly TypeSyntax? type; - internal readonly PositionalPatternClauseSyntax? positionalPatternClause; - internal readonly PropertyPatternClauseSyntax? propertyPatternClause; - internal readonly VariableDesignationSyntax? designation; + ObjectBinder.RegisterTypeReader(typeof(ConstantPatternSyntax), r => new ConstantPatternSyntax(r)); + } +} - internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - if (positionalPatternClause != null) - { - this.AdjustFlagsAndWidth(positionalPatternClause); - this.positionalPatternClause = positionalPatternClause; - } - if (propertyPatternClause != null) - { - this.AdjustFlagsAndWidth(propertyPatternClause); - this.propertyPatternClause = propertyPatternClause; - } - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } +internal sealed partial class ParenthesizedPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly PatternSyntax pattern; + internal readonly SyntaxToken closeParenToken; - internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - if (positionalPatternClause != null) - { - this.AdjustFlagsAndWidth(positionalPatternClause); - this.positionalPatternClause = positionalPatternClause; - } - if (propertyPatternClause != null) - { - this.AdjustFlagsAndWidth(propertyPatternClause); - this.propertyPatternClause = propertyPatternClause; - } - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } + internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) - : base(kind) - { - this.SlotCount = 4; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - if (positionalPatternClause != null) - { - this.AdjustFlagsAndWidth(positionalPatternClause); - this.positionalPatternClause = positionalPatternClause; - } - if (propertyPatternClause != null) - { - this.AdjustFlagsAndWidth(propertyPatternClause); - this.propertyPatternClause = propertyPatternClause; - } - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } + internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public TypeSyntax? Type => this.type; - public PositionalPatternClauseSyntax? PositionalPatternClause => this.positionalPatternClause; - public PropertyPatternClauseSyntax? PropertyPatternClause => this.propertyPatternClause; - public VariableDesignationSyntax? Designation => this.designation; + internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.positionalPatternClause, - 2 => this.propertyPatternClause, - 3 => this.designation, - _ => null, - }; + public SyntaxToken OpenParenToken => this.openParenToken; + public PatternSyntax Pattern => this.pattern; + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecursivePatternSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.pattern, + 2 => this.closeParenToken, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedPatternSyntax(this, parent, position); - public RecursivePatternSyntax Update(TypeSyntax type, PositionalPatternClauseSyntax positionalPatternClause, PropertyPatternClauseSyntax propertyPatternClause, VariableDesignationSyntax designation) - { - if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation) - { - var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); - return this; + public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, diagnostics, GetAnnotations()); - internal RecursivePatternSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var type = (TypeSyntax?)reader.ReadValue(); - if (type != null) - { - AdjustFlagsAndWidth(type); - this.type = type; - } - var positionalPatternClause = (PositionalPatternClauseSyntax?)reader.ReadValue(); - if (positionalPatternClause != null) - { - AdjustFlagsAndWidth(positionalPatternClause); - this.positionalPatternClause = positionalPatternClause; - } - var propertyPatternClause = (PropertyPatternClauseSyntax?)reader.ReadValue(); - if (propertyPatternClause != null) - { - AdjustFlagsAndWidth(propertyPatternClause); - this.propertyPatternClause = propertyPatternClause; - } - var designation = (VariableDesignationSyntax?)reader.ReadValue(); - if (designation != null) - { - AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.type); - writer.WriteValue(this.positionalPatternClause); - writer.WriteValue(this.propertyPatternClause); - writer.WriteValue(this.designation); - } + internal ParenthesizedPatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var pattern = (PatternSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - static RecursivePatternSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(RecursivePatternSyntax), r => new RecursivePatternSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.pattern); + writer.WriteValue(this.closeParenToken); } - internal sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode + static ParenthesizedPatternSyntax() { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? subpatterns; - internal readonly SyntaxToken closeParenToken; + ObjectBinder.RegisterTypeReader(typeof(ParenthesizedPatternSyntax), r => new ParenthesizedPatternSyntax(r)); + } +} - internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +internal sealed partial class RelationalPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax expression; - internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public SyntaxToken OpenParenToken => this.openParenToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Subpatterns => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.subpatterns)); - public SyntaxToken CloseParenToken => this.closeParenToken; + internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.subpatterns, - 2 => this.closeParenToken, - _ => null, - }; + /// SyntaxToken representing the operator of the relational pattern. + public SyntaxToken OperatorToken => this.operatorToken; + public ExpressionSyntax Expression => this.expression; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PositionalPatternClauseSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.operatorToken, + 1 => this.expression, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RelationalPatternSyntax(this, parent, position); - public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); - return this; + public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + { + if (operatorToken != this.OperatorToken || expression != this.Expression) + { + var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, diagnostics, GetAnnotations()); - internal PositionalPatternClauseSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var subpatterns = (GreenNode?)reader.ReadValue(); - if (subpatterns != null) - { - AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.subpatterns); - writer.WriteValue(this.closeParenToken); - } + internal RelationalPatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - static PositionalPatternClauseSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(PositionalPatternClauseSyntax), r => new PositionalPatternClauseSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.expression); } - internal sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode + static RelationalPatternSyntax() { - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? subpatterns; - internal readonly SyntaxToken closeBraceToken; + ObjectBinder.RegisterTypeReader(typeof(RelationalPatternSyntax), r => new RelationalPatternSyntax(r)); + } +} - internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } +internal sealed partial class TypePatternSyntax : PatternSyntax +{ + internal readonly TypeSyntax type; - internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - public SyntaxToken OpenBraceToken => this.openBraceToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Subpatterns => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.subpatterns)); - public SyntaxToken CloseBraceToken => this.closeBraceToken; + internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBraceToken, - 1 => this.subpatterns, - 2 => this.closeBraceToken, - _ => null, - }; + /// The type for the type pattern. + public TypeSyntax Type => this.type; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyPatternClauseSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypePatternSyntax(this, parent, position); - public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) - { - if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); - return this; + public TypePatternSyntax Update(TypeSyntax type) + { + if (type != this.Type) + { + var newNode = SyntaxFactory.TypePattern(type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypePatternSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - internal PropertyPatternClauseSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - var subpatterns = (GreenNode?)reader.ReadValue(); - if (subpatterns != null) - { - AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - var closeBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypePatternSyntax(this.Kind, this.type, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.subpatterns); - writer.WriteValue(this.closeBraceToken); - } + internal TypePatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + } - static PropertyPatternClauseSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(PropertyPatternClauseSyntax), r => new PropertyPatternClauseSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.type); } - internal sealed partial class SubpatternSyntax : CSharpSyntaxNode + static TypePatternSyntax() { - internal readonly BaseExpressionColonSyntax? expressionColon; - internal readonly PatternSyntax pattern; + ObjectBinder.RegisterTypeReader(typeof(TypePatternSyntax), r => new TypePatternSyntax(r)); + } +} - internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - if (expressionColon != null) - { - this.AdjustFlagsAndWidth(expressionColon); - this.expressionColon = expressionColon; - } - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } +internal sealed partial class BinaryPatternSyntax : PatternSyntax +{ + internal readonly PatternSyntax left; + internal readonly SyntaxToken operatorToken; + internal readonly PatternSyntax right; - internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (expressionColon != null) - { - this.AdjustFlagsAndWidth(expressionColon); - this.expressionColon = expressionColon; - } - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) - : base(kind) - { - this.SlotCount = 2; - if (expressionColon != null) - { - this.AdjustFlagsAndWidth(expressionColon); - this.expressionColon = expressionColon; - } - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - public BaseExpressionColonSyntax? ExpressionColon => this.expressionColon; - public PatternSyntax Pattern => this.pattern; + internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expressionColon, - 1 => this.pattern, - _ => null, - }; + public PatternSyntax Left => this.left; + public SyntaxToken OperatorToken => this.operatorToken; + public PatternSyntax Right => this.right; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SubpatternSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.left, + 1 => this.operatorToken, + 2 => this.right, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryPatternSyntax(this, parent, position); - public SubpatternSyntax Update(BaseExpressionColonSyntax expressionColon, PatternSyntax pattern) - { - if (expressionColon != this.ExpressionColon || pattern != this.Pattern) - { - var newNode = SyntaxFactory.Subpattern(expressionColon, pattern); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); - return this; + public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + { + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + { + var newNode = SyntaxFactory.BinaryPattern(this.Kind, left, operatorToken, right); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); - internal SubpatternSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var expressionColon = (BaseExpressionColonSyntax?)reader.ReadValue(); - if (expressionColon != null) - { - AdjustFlagsAndWidth(expressionColon); - this.expressionColon = expressionColon; - } - var pattern = (PatternSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.expressionColon); - writer.WriteValue(this.pattern); - } + internal BinaryPatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var left = (PatternSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(left); + this.left = left; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var right = (PatternSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(right); + this.right = right; + } - static SubpatternSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(SubpatternSyntax), r => new SubpatternSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.left); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.right); } - internal sealed partial class ConstantPatternSyntax : PatternSyntax + static BinaryPatternSyntax() { - internal readonly ExpressionSyntax expression; + ObjectBinder.RegisterTypeReader(typeof(BinaryPatternSyntax), r => new BinaryPatternSyntax(r)); + } +} - internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } +internal sealed partial class UnaryPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken operatorToken; + internal readonly PatternSyntax pattern; - internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - /// ExpressionSyntax node representing the constant expression. - public ExpressionSyntax Expression => this.expression; + internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.expression : null; + public SyntaxToken OperatorToken => this.operatorToken; + public PatternSyntax Pattern => this.pattern; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstantPatternSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.operatorToken, + 1 => this.pattern, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnaryPatternSyntax(this, parent, position); - public ConstantPatternSyntax Update(ExpressionSyntax expression) - { - if (expression != this.Expression) - { - var newNode = SyntaxFactory.ConstantPattern(expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); - return this; + public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern) + { + if (operatorToken != this.OperatorToken || pattern != this.Pattern) + { + var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConstantPatternSyntax(this.Kind, this.expression, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConstantPatternSyntax(this.Kind, this.expression, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, diagnostics, GetAnnotations()); - internal ConstantPatternSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, GetDiagnostics(), annotations); + + internal UnaryPatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var pattern = (PatternSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.pattern); + } - internal override void WriteTo(ObjectWriter writer) + static UnaryPatternSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(UnaryPatternSyntax), r => new UnaryPatternSyntax(r)); + } +} + +internal sealed partial class ListPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? patterns; + internal readonly SyntaxToken closeBracketToken; + internal readonly VariableDesignationSyntax? designation; + + internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (patterns != null) { - base.WriteTo(writer); - writer.WriteValue(this.expression); + this.AdjustFlagsAndWidth(patterns); + this.patterns = patterns; } - - static ConstantPatternSyntax() + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + if (designation != null) { - ObjectBinder.RegisterTypeReader(typeof(ConstantPatternSyntax), r => new ConstantPatternSyntax(r)); + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } } - internal sealed partial class ParenthesizedPatternSyntax : PatternSyntax + internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly PatternSyntax pattern; - internal readonly SyntaxToken closeParenToken; - - internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (patterns != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(patterns); + this.patterns = patterns; } - - internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + if (designation != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } + } - internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) - : base(kind) + internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (patterns != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(patterns); + this.patterns = patterns; + } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + if (designation != null) + { + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } + } - public SyntaxToken OpenParenToken => this.openParenToken; - public PatternSyntax Pattern => this.pattern; - public SyntaxToken CloseParenToken => this.closeParenToken; + public SyntaxToken OpenBracketToken => this.openBracketToken; + public CoreSyntax.SeparatedSyntaxList Patterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.patterns)); + public SyntaxToken CloseBracketToken => this.closeBracketToken; + public VariableDesignationSyntax? Designation => this.designation; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.pattern, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.patterns, + 2 => this.closeBracketToken, + 3 => this.designation, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedPatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ListPatternSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); - public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + public ListPatternSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax designation) + { + if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) { - if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ListPattern(openBracketToken, patterns, closeBracketToken, designation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ListPatternSyntax(this.Kind, this.openBracketToken, this.patterns, this.closeBracketToken, this.designation, diagnostics, GetAnnotations()); - internal ParenthesizedPatternSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var pattern = (PatternSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ListPatternSyntax(this.Kind, this.openBracketToken, this.patterns, this.closeBracketToken, this.designation, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal ListPatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var openBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + var patterns = (GreenNode?)reader.ReadValue(); + if (patterns != null) { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.pattern); - writer.WriteValue(this.closeParenToken); + AdjustFlagsAndWidth(patterns); + this.patterns = patterns; } - - static ParenthesizedPatternSyntax() + var closeBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + var designation = (VariableDesignationSyntax?)reader.ReadValue(); + if (designation != null) { - ObjectBinder.RegisterTypeReader(typeof(ParenthesizedPatternSyntax), r => new ParenthesizedPatternSyntax(r)); + AdjustFlagsAndWidth(designation); + this.designation = designation; } } - internal sealed partial class RelationalPatternSyntax : PatternSyntax + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openBracketToken); + writer.WriteValue(this.patterns); + writer.WriteValue(this.closeBracketToken); + writer.WriteValue(this.designation); + } + + static ListPatternSyntax() { - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax expression; + ObjectBinder.RegisterTypeReader(typeof(ListPatternSyntax), r => new ListPatternSyntax(r)); + } +} + +internal sealed partial class SlicePatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken dotDotToken; + internal readonly PatternSyntax? pattern; - internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(dotDotToken); + this.dotDotToken = dotDotToken; + if (pattern != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; } + } - internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(dotDotToken); + this.dotDotToken = dotDotToken; + if (pattern != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; } + } - internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) - : base(kind) + internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(dotDotToken); + this.dotDotToken = dotDotToken; + if (pattern != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; } + } - /// SyntaxToken representing the operator of the relational pattern. - public SyntaxToken OperatorToken => this.operatorToken; - public ExpressionSyntax Expression => this.expression; + public SyntaxToken DotDotToken => this.dotDotToken; + public PatternSyntax? Pattern => this.pattern; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorToken, - 1 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.dotDotToken, + 1 => this.pattern, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RelationalPatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SlicePatternSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); - public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax pattern) + { + if (dotDotToken != this.DotDotToken || pattern != this.Pattern) { - if (operatorToken != this.OperatorToken || expression != this.Expression) - { - var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.SlicePattern(dotDotToken, pattern); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, GetDiagnostics(), annotations); + return this; + } - internal RelationalPatternSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SlicePatternSyntax(this.Kind, this.dotDotToken, this.pattern, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.expression); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SlicePatternSyntax(this.Kind, this.dotDotToken, this.pattern, GetDiagnostics(), annotations); - static RelationalPatternSyntax() + internal SlicePatternSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var dotDotToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(dotDotToken); + this.dotDotToken = dotDotToken; + var pattern = (PatternSyntax?)reader.ReadValue(); + if (pattern != null) { - ObjectBinder.RegisterTypeReader(typeof(RelationalPatternSyntax), r => new RelationalPatternSyntax(r)); + AdjustFlagsAndWidth(pattern); + this.pattern = pattern; } } - internal sealed partial class TypePatternSyntax : PatternSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly TypeSyntax type; + base.WriteTo(writer); + writer.WriteValue(this.dotDotToken); + writer.WriteValue(this.pattern); + } - internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + static SlicePatternSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(SlicePatternSyntax), r => new SlicePatternSyntax(r)); + } +} - internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } +internal abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode +{ + internal InterpolatedStringContentSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + internal InterpolatedStringContentSyntax(SyntaxKind kind) + : base(kind) + { + } - /// The type for the type pattern. - public TypeSyntax Type => this.type; + protected InterpolatedStringContentSyntax(ObjectReader reader) + : base(reader) + { + } +} - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.type : null; +internal sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax +{ + internal readonly SyntaxToken textToken; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypePatternSyntax(this, parent, position); + internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(textToken); + this.textToken = textToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); + internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(textToken); + this.textToken = textToken; + } - public TypePatternSyntax Update(TypeSyntax type) - { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypePattern(type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(textToken); + this.textToken = textToken; + } - return this; - } + /// The text contents of a part of the interpolated string. + public SyntaxToken TextToken => this.textToken; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypePatternSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.textToken : null; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypePatternSyntax(this.Kind, this.type, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringTextSyntax(this, parent, position); - internal TypePatternSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); - internal override void WriteTo(ObjectWriter writer) + public InterpolatedStringTextSyntax Update(SyntaxToken textToken) + { + if (textToken != this.TextToken) { - base.WriteTo(writer); - writer.WriteValue(this.type); + var newNode = SyntaxFactory.InterpolatedStringText(textToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static TypePatternSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(TypePatternSyntax), r => new TypePatternSyntax(r)); - } + return this; } - internal sealed partial class BinaryPatternSyntax : PatternSyntax - { - internal readonly PatternSyntax left; - internal readonly SyntaxToken operatorToken; - internal readonly PatternSyntax right; - - internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } - - internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterpolatedStringTextSyntax(this.Kind, this.textToken, diagnostics, GetAnnotations()); - internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterpolatedStringTextSyntax(this.Kind, this.textToken, GetDiagnostics(), annotations); - public PatternSyntax Left => this.left; - public SyntaxToken OperatorToken => this.operatorToken; - public PatternSyntax Right => this.right; + internal InterpolatedStringTextSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var textToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(textToken); + this.textToken = textToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.left, - 1 => this.operatorToken, - 2 => this.right, - _ => null, - }; + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.textToken); + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryPatternSyntax(this, parent, position); + static InterpolatedStringTextSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(InterpolatedStringTextSyntax), r => new InterpolatedStringTextSyntax(r)); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); +internal sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax +{ + internal readonly SyntaxToken openBraceToken; + internal readonly ExpressionSyntax expression; + internal readonly InterpolationAlignmentClauseSyntax? alignmentClause; + internal readonly InterpolationFormatClauseSyntax? formatClause; + internal readonly SyntaxToken closeBraceToken; - public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (alignmentClause != null) { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.BinaryPattern(this.Kind, left, operatorToken, right); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(alignmentClause); + this.alignmentClause = alignmentClause; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); - - internal BinaryPatternSyntax(ObjectReader reader) - : base(reader) + if (formatClause != null) { - this.SlotCount = 3; - var left = (PatternSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(left); - this.left = left; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var right = (PatternSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(right); - this.right = right; + this.AdjustFlagsAndWidth(formatClause); + this.formatClause = formatClause; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal override void WriteTo(ObjectWriter writer) + internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (alignmentClause != null) { - base.WriteTo(writer); - writer.WriteValue(this.left); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.right); + this.AdjustFlagsAndWidth(alignmentClause); + this.alignmentClause = alignmentClause; } - - static BinaryPatternSyntax() + if (formatClause != null) { - ObjectBinder.RegisterTypeReader(typeof(BinaryPatternSyntax), r => new BinaryPatternSyntax(r)); + this.AdjustFlagsAndWidth(formatClause); + this.formatClause = formatClause; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - internal sealed partial class UnaryPatternSyntax : PatternSyntax + internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + : base(kind) { - internal readonly SyntaxToken operatorToken; - internal readonly PatternSyntax pattern; - - internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } - - internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, SyntaxFactoryContext context) - : base(kind) + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (alignmentClause != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; + this.AdjustFlagsAndWidth(alignmentClause); + this.alignmentClause = alignmentClause; } - - internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern) - : base(kind) + if (formatClause != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; + this.AdjustFlagsAndWidth(formatClause); + this.formatClause = formatClause; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - public SyntaxToken OperatorToken => this.operatorToken; - public PatternSyntax Pattern => this.pattern; + /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). + public SyntaxToken OpenBraceToken => this.openBraceToken; + public ExpressionSyntax Expression => this.expression; + public InterpolationAlignmentClauseSyntax? AlignmentClause => this.alignmentClause; + public InterpolationFormatClauseSyntax? FormatClause => this.formatClause; + /// + /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). + /// + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorToken, - 1 => this.pattern, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBraceToken, + 1 => this.expression, + 2 => this.alignmentClause, + 3 => this.formatClause, + 4 => this.closeBraceToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnaryPatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); - public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern) + public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken) { - if (operatorToken != this.OperatorToken || pattern != this.Pattern) - { - var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, diagnostics, GetAnnotations()); - internal UnaryPatternSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var pattern = (PatternSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal InterpolationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var openBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var alignmentClause = (InterpolationAlignmentClauseSyntax?)reader.ReadValue(); + if (alignmentClause != null) { - base.WriteTo(writer); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.pattern); + AdjustFlagsAndWidth(alignmentClause); + this.alignmentClause = alignmentClause; } - - static UnaryPatternSyntax() + var formatClause = (InterpolationFormatClauseSyntax?)reader.ReadValue(); + if (formatClause != null) { - ObjectBinder.RegisterTypeReader(typeof(UnaryPatternSyntax), r => new UnaryPatternSyntax(r)); + AdjustFlagsAndWidth(formatClause); + this.formatClause = formatClause; } + var closeBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - internal sealed partial class ListPatternSyntax : PatternSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? patterns; - internal readonly SyntaxToken closeBracketToken; - internal readonly VariableDesignationSyntax? designation; - - internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (patterns != null) - { - this.AdjustFlagsAndWidth(patterns); - this.patterns = patterns; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } + base.WriteTo(writer); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.expression); + writer.WriteValue(this.alignmentClause); + writer.WriteValue(this.formatClause); + writer.WriteValue(this.closeBraceToken); + } - internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (patterns != null) - { - this.AdjustFlagsAndWidth(patterns); - this.patterns = patterns; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } + static InterpolationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(InterpolationSyntax), r => new InterpolationSyntax(r)); + } +} - internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (patterns != null) - { - this.AdjustFlagsAndWidth(patterns); - this.patterns = patterns; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } +internal sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken commaToken; + internal readonly ExpressionSyntax value; - public SyntaxToken OpenBracketToken => this.openBracketToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Patterns => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.patterns)); - public SyntaxToken CloseBracketToken => this.closeBracketToken; - public VariableDesignationSyntax? Designation => this.designation; + internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(value); + this.value = value; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.patterns, - 2 => this.closeBracketToken, - 3 => this.designation, - _ => null, - }; + internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(value); + this.value = value; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ListPatternSyntax(this, parent, position); + internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(value); + this.value = value; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); + public SyntaxToken CommaToken => this.commaToken; + public ExpressionSyntax Value => this.value; - public ListPatternSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax designation) + internal override GreenNode? GetSlot(int index) + => index switch { - if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) - { - var newNode = SyntaxFactory.ListPattern(openBracketToken, patterns, closeBracketToken, designation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.commaToken, + 1 => this.value, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ListPatternSyntax(this.Kind, this.openBracketToken, this.patterns, this.closeBracketToken, this.designation, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationAlignmentClauseSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ListPatternSyntax(this.Kind, this.openBracketToken, this.patterns, this.closeBracketToken, this.designation, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); - internal ListPatternSyntax(ObjectReader reader) - : base(reader) + public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value) + { + if (commaToken != this.CommaToken || value != this.Value) { - this.SlotCount = 4; - var openBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - var patterns = (GreenNode?)reader.ReadValue(); - if (patterns != null) - { - AdjustFlagsAndWidth(patterns); - this.patterns = patterns; - } - var closeBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - var designation = (VariableDesignationSyntax?)reader.ReadValue(); - if (designation != null) - { - AdjustFlagsAndWidth(designation); - this.designation = designation; - } + var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openBracketToken); - writer.WriteValue(this.patterns); - writer.WriteValue(this.closeBracketToken); - writer.WriteValue(this.designation); - } + return this; + } - static ListPatternSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ListPatternSyntax), r => new ListPatternSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, GetDiagnostics(), annotations); + + internal InterpolationAlignmentClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var commaToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + var value = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(value); + this.value = value; } - internal sealed partial class SlicePatternSyntax : PatternSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken dotDotToken; - internal readonly PatternSyntax? pattern; + base.WriteTo(writer); + writer.WriteValue(this.commaToken); + writer.WriteValue(this.value); + } - internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(dotDotToken); - this.dotDotToken = dotDotToken; - if (pattern != null) - { - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } - } + static InterpolationAlignmentClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(InterpolationAlignmentClauseSyntax), r => new InterpolationAlignmentClauseSyntax(r)); + } +} + +internal sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken colonToken; + internal readonly SyntaxToken formatStringToken; + + internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(formatStringToken); + this.formatStringToken = formatStringToken; + } + + internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(formatStringToken); + this.formatStringToken = formatStringToken; + } + + internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(formatStringToken); + this.formatStringToken = formatStringToken; + } - internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, SyntaxFactoryContext context) - : base(kind) + public SyntaxToken ColonToken => this.colonToken; + /// The text contents of the format specifier for an interpolation. + public SyntaxToken FormatStringToken => this.formatStringToken; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(dotDotToken); - this.dotDotToken = dotDotToken; - if (pattern != null) - { - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } - } + 0 => this.colonToken, + 1 => this.formatStringToken, + _ => null, + }; - internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationFormatClauseSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); + + public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken) + { + if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(dotDotToken); - this.dotDotToken = dotDotToken; - if (pattern != null) - { - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken DotDotToken => this.dotDotToken; - public PatternSyntax? Pattern => this.pattern; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.dotDotToken, - 1 => this.pattern, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SlicePatternSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, GetDiagnostics(), annotations); - public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax pattern) - { - if (dotDotToken != this.DotDotToken || pattern != this.Pattern) - { - var newNode = SyntaxFactory.SlicePattern(dotDotToken, pattern); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal InterpolationFormatClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + var formatStringToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(formatStringToken); + this.formatStringToken = formatStringToken; + } - return this; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.colonToken); + writer.WriteValue(this.formatStringToken); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SlicePatternSyntax(this.Kind, this.dotDotToken, this.pattern, diagnostics, GetAnnotations()); + static InterpolationFormatClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(InterpolationFormatClauseSyntax), r => new InterpolationFormatClauseSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SlicePatternSyntax(this.Kind, this.dotDotToken, this.pattern, GetDiagnostics(), annotations); +internal sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly StatementSyntax statement; - internal SlicePatternSyntax(ObjectReader reader) - : base(reader) + internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 2; - var dotDotToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(dotDotToken); - this.dotDotToken = dotDotToken; - var pattern = (PatternSyntax?)reader.ReadValue(); - if (pattern != null) - { - AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.dotDotToken); - writer.WriteValue(this.pattern); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - static SlicePatternSyntax() + internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) { - ObjectBinder.RegisterTypeReader(typeof(SlicePatternSyntax), r => new SlicePatternSyntax(r)); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode + internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement) + : base(kind) { - internal InterpolatedStringContentSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal InterpolatedStringContentSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - protected InterpolatedStringContentSyntax(ObjectReader reader) - : base(reader) + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch { - } - } + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.statement, + _ => null, + }; - internal sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax - { - internal readonly SyntaxToken textToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GlobalStatementSyntax(this, parent, position); - internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); + + public GlobalStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(textToken); - this.textToken = textToken; + var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, SyntaxFactoryContext context) - : base(kind) + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, GetDiagnostics(), annotations); + + internal GlobalStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(textToken); - this.textToken = textToken; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken) - : base(kind) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(textToken); - this.textToken = textToken; + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + } - /// The text contents of a part of the interpolated string. - public SyntaxToken TextToken => this.textToken; - - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.textToken : null; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringTextSyntax(this, parent, position); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.statement); + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); + static GlobalStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(GlobalStatementSyntax), r => new GlobalStatementSyntax(r)); + } +} - public InterpolatedStringTextSyntax Update(SyntaxToken textToken) - { - if (textToken != this.TextToken) - { - var newNode = SyntaxFactory.InterpolatedStringText(textToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +/// Represents the base class for all statements syntax classes. +internal abstract partial class StatementSyntax : CSharpSyntaxNode +{ + internal StatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - return this; - } + internal StatementSyntax(SyntaxKind kind) + : base(kind) + { + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterpolatedStringTextSyntax(this.Kind, this.textToken, diagnostics, GetAnnotations()); + protected StatementSyntax(ObjectReader reader) + : base(reader) + { + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterpolatedStringTextSyntax(this.Kind, this.textToken, GetDiagnostics(), annotations); + public abstract CoreSyntax.SyntaxList AttributeLists { get; } +} - internal InterpolatedStringTextSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var textToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(textToken); - this.textToken = textToken; - } +internal sealed partial class BlockSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? statements; + internal readonly SyntaxToken closeBraceToken; - internal override void WriteTo(ObjectWriter writer) + internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.textToken); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static InterpolatedStringTextSyntax() + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (statements != null) { - ObjectBinder.RegisterTypeReader(typeof(InterpolatedStringTextSyntax), r => new InterpolatedStringTextSyntax(r)); + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - internal sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax + internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openBraceToken; - internal readonly ExpressionSyntax expression; - internal readonly InterpolationAlignmentClauseSyntax? alignmentClause; - internal readonly InterpolationFormatClauseSyntax? formatClause; - internal readonly SyntaxToken closeBraceToken; - - internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (alignmentClause != null) - { - this.AdjustFlagsAndWidth(alignmentClause); - this.alignmentClause = alignmentClause; - } - if (formatClause != null) - { - this.AdjustFlagsAndWidth(formatClause); - this.formatClause = formatClause; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (statements != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (alignmentClause != null) - { - this.AdjustFlagsAndWidth(alignmentClause); - this.alignmentClause = alignmentClause; - } - if (formatClause != null) - { - this.AdjustFlagsAndWidth(formatClause); - this.formatClause = formatClause; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) - : base(kind) + internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (alignmentClause != null) - { - this.AdjustFlagsAndWidth(alignmentClause); - this.alignmentClause = alignmentClause; - } - if (formatClause != null) - { - this.AdjustFlagsAndWidth(formatClause); - this.formatClause = formatClause; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (statements != null) + { + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). - public SyntaxToken OpenBraceToken => this.openBraceToken; - public ExpressionSyntax Expression => this.expression; - public InterpolationAlignmentClauseSyntax? AlignmentClause => this.alignmentClause; - public InterpolationFormatClauseSyntax? FormatClause => this.formatClause; - /// - /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). - /// - public SyntaxToken CloseBraceToken => this.closeBraceToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken OpenBraceToken => this.openBraceToken; + public CoreSyntax.SyntaxList Statements => new CoreSyntax.SyntaxList(this.statements); + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBraceToken, - 1 => this.expression, - 2 => this.alignmentClause, - 3 => this.formatClause, - 4 => this.closeBraceToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.openBraceToken, + 2 => this.statements, + 3 => this.closeBraceToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BlockSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); - public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken) + public BlockSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + { + if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) { - if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, diagnostics, GetAnnotations()); - internal InterpolationSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var openBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var alignmentClause = (InterpolationAlignmentClauseSyntax?)reader.ReadValue(); - if (alignmentClause != null) - { - AdjustFlagsAndWidth(alignmentClause); - this.alignmentClause = alignmentClause; - } - var formatClause = (InterpolationFormatClauseSyntax?)reader.ReadValue(); - if (formatClause != null) - { - AdjustFlagsAndWidth(formatClause); - this.formatClause = formatClause; - } - var closeBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal BlockSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.expression); - writer.WriteValue(this.alignmentClause); - writer.WriteValue(this.formatClause); - writer.WriteValue(this.closeBraceToken); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static InterpolationSyntax() + var openBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + var statements = (GreenNode?)reader.ReadValue(); + if (statements != null) { - ObjectBinder.RegisterTypeReader(typeof(InterpolationSyntax), r => new InterpolationSyntax(r)); + AdjustFlagsAndWidth(statements); + this.statements = statements; } + var closeBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.statements); + writer.WriteValue(this.closeBraceToken); } - internal sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode + static BlockSyntax() { - internal readonly SyntaxToken commaToken; - internal readonly ExpressionSyntax value; + ObjectBinder.RegisterTypeReader(typeof(BlockSyntax), r => new BlockSyntax(r)); + } +} + +internal sealed partial class LocalFunctionStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax returnType; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax parameterList; + internal readonly GreenNode? constraintClauses; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 10; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(value); - this.value = value; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(value); - this.value = value; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value) - : base(kind) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(value); - this.value = value; + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; } - - public SyntaxToken CommaToken => this.commaToken; - public ExpressionSyntax Value => this.value; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.commaToken, - 1 => this.value, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationAlignmentClauseSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); - - public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value) + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) { - if (commaToken != this.CommaToken || value != this.Value) - { - var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, GetDiagnostics(), annotations); - - internal InterpolationAlignmentClauseSyntax(ObjectReader reader) - : base(reader) + if (body != null) { - this.SlotCount = 2; - var commaToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - var value = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(value); - this.value = value; + this.AdjustFlagsAndWidth(body); + this.body = body; } - - internal override void WriteTo(ObjectWriter writer) + if (expressionBody != null) { - base.WriteTo(writer); - writer.WriteValue(this.commaToken); - writer.WriteValue(this.value); + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - static InterpolationAlignmentClauseSyntax() + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(InterpolationAlignmentClauseSyntax), r => new InterpolationAlignmentClauseSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - internal sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode + internal 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) + : base(kind) { - internal readonly SyntaxToken colonToken; - internal readonly SyntaxToken formatStringToken; - - internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 10; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(formatStringToken); - this.formatStringToken = formatStringToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(formatStringToken); - this.formatStringToken = formatStringToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken) - : base(kind) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(formatStringToken); - this.formatStringToken = formatStringToken; + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; } - - public SyntaxToken ColonToken => this.colonToken; - /// The text contents of the format specifier for an interpolation. - public SyntaxToken FormatStringToken => this.formatStringToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.colonToken, - 1 => this.formatStringToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationFormatClauseSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); - - public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken) + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) { - if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken) - { - var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, GetDiagnostics(), annotations); - - internal InterpolationFormatClauseSyntax(ObjectReader reader) - : base(reader) + if (body != null) { - this.SlotCount = 2; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - var formatStringToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(formatStringToken); - this.formatStringToken = formatStringToken; + this.AdjustFlagsAndWidth(body); + this.body = body; } - - internal override void WriteTo(ObjectWriter writer) + if (expressionBody != null) { - base.WriteTo(writer); - writer.WriteValue(this.colonToken); - writer.WriteValue(this.formatStringToken); + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - static InterpolationFormatClauseSyntax() + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(InterpolationFormatClauseSyntax), r => new InterpolationFormatClauseSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - internal sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax + internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly StatementSyntax statement; - - internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 10; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement) - : base(kind) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public StatementSyntax Statement => this.statement; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public TypeSyntax ReturnType => this.returnType; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public ParameterListSyntax ParameterList => this.parameterList; + public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public BlockSyntax? Body => this.body; + public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.statement, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.returnType, + 3 => this.identifier, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.constraintClauses, + 7 => this.body, + 8 => this.expressionBody, + 9 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GlobalStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalFunctionStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); - public GlobalStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, StatementSyntax statement) + public LocalFunctionStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) - { - var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); - internal GlobalStatementSyntax(ObjectReader reader) - : base(reader) + internal LocalFunctionStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 10; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 3; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.statement); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static GlobalStatementSyntax() + var returnType = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); + if (typeParameterList != null) { - ObjectBinder.RegisterTypeReader(typeof(GlobalStatementSyntax), r => new GlobalStatementSyntax(r)); + AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; } - } - - /// Represents the base class for all statements syntax classes. - internal abstract partial class StatementSyntax : CSharpSyntaxNode - { - internal StatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + var parameterList = (ParameterListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + var constraintClauses = (GreenNode?)reader.ReadValue(); + if (constraintClauses != null) { + AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; } - - internal StatementSyntax(SyntaxKind kind) - : base(kind) + var body = (BlockSyntax?)reader.ReadValue(); + if (body != null) { + AdjustFlagsAndWidth(body); + this.body = body; } - - protected StatementSyntax(ObjectReader reader) - : base(reader) + var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); + if (expressionBody != null) { + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists { get; } - } - - internal sealed partial class BlockSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? statements; - internal readonly SyntaxToken closeBraceToken; - - internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.returnType); + writer.WriteValue(this.identifier); + writer.WriteValue(this.typeParameterList); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.constraintClauses); + writer.WriteValue(this.body); + writer.WriteValue(this.expressionBody); + writer.WriteValue(this.semicolonToken); + } + + static LocalFunctionStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(LocalFunctionStatementSyntax), r => new LocalFunctionStatementSyntax(r)); + } +} + +internal sealed partial class LocalDeclarationStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken? awaitKeyword; + internal readonly SyntaxToken? usingKeyword; + internal readonly GreenNode? modifiers; + internal readonly VariableDeclarationSyntax declaration; + internal readonly SyntaxToken semicolonToken; - internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken) - : base(kind) + if (awaitKeyword != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } - - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken OpenBraceToken => this.openBraceToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Statements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.statements); - public SyntaxToken CloseBraceToken => this.closeBraceToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.openBraceToken, - 2 => this.statements, - 3 => this.closeBraceToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BlockSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); - - public BlockSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + if (usingKeyword != null) { - if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, GetDiagnostics(), annotations); - - internal BlockSyntax(ObjectReader reader) - : base(reader) + if (modifiers != null) { - this.SlotCount = 4; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var openBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - var statements = (GreenNode?)reader.ReadValue(); - if (statements != null) - { - AdjustFlagsAndWidth(statements); - this.statements = statements; - } - var closeBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal override void WriteTo(ObjectWriter writer) + internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.statements); - writer.WriteValue(this.closeBraceToken); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static BlockSyntax() + if (awaitKeyword != null) + { + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + if (usingKeyword != null) + { + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + } + if (modifiers != null) { - ObjectBinder.RegisterTypeReader(typeof(BlockSyntax), r => new BlockSyntax(r)); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class LocalFunctionStatementSyntax : StatementSyntax + internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax returnType; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax parameterList; - internal readonly GreenNode? constraintClauses; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SlotCount = 6; + if (attributeLists != null) { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (awaitKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } - - internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - : base(kind) + if (usingKeyword != null) { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public TypeSyntax ReturnType => this.returnType; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public ParameterListSyntax ParameterList => this.parameterList; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); - public BlockSyntax? Body => this.body; - public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.returnType, - 3 => this.identifier, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.constraintClauses, - 7 => this.body, - 8 => this.expressionBody, - 9 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalFunctionStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); - - public LocalFunctionStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken? AwaitKeyword => this.awaitKeyword; + public SyntaxToken? UsingKeyword => this.usingKeyword; + /// Gets the modifier list. + public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public VariableDeclarationSyntax Declaration => this.declaration; + public SyntaxToken SemicolonToken => this.semicolonToken; - return this; - } + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.awaitKeyword, + 2 => this.usingKeyword, + 3 => this.modifiers, + 4 => this.declaration, + 5 => this.semicolonToken, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalDeclarationStatementSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); - internal LocalFunctionStatementSyntax(ObjectReader reader) - : base(reader) + public LocalDeclarationStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { - this.SlotCount = 10; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var returnType = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); - if (typeParameterList != null) - { - AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - var parameterList = (ParameterListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - var constraintClauses = (GreenNode?)reader.ReadValue(); - if (constraintClauses != null) - { - AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - var body = (BlockSyntax?)reader.ReadValue(); - if (body != null) - { - AdjustFlagsAndWidth(body); - this.body = body; - } - var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); + + internal LocalDeclarationStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 6; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.returnType); - writer.WriteValue(this.identifier); - writer.WriteValue(this.typeParameterList); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.constraintClauses); - writer.WriteValue(this.body); - writer.WriteValue(this.expressionBody); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static LocalFunctionStatementSyntax() + var awaitKeyword = (SyntaxToken?)reader.ReadValue(); + if (awaitKeyword != null) { - ObjectBinder.RegisterTypeReader(typeof(LocalFunctionStatementSyntax), r => new LocalFunctionStatementSyntax(r)); + AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + var usingKeyword = (SyntaxToken?)reader.ReadValue(); + if (usingKeyword != null) + { + AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + } + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + var declaration = (VariableDeclarationSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class LocalDeclarationStatementSyntax : StatementSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken? awaitKeyword; - internal readonly SyntaxToken? usingKeyword; - internal readonly GreenNode? modifiers; - internal readonly VariableDeclarationSyntax declaration; - internal readonly SyntaxToken semicolonToken; + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.awaitKeyword); + writer.WriteValue(this.usingKeyword); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.declaration); + writer.WriteValue(this.semicolonToken); + } + + static LocalDeclarationStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(LocalDeclarationStatementSyntax), r => new LocalDeclarationStatementSyntax(r)); + } +} + +internal sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode +{ + internal readonly TypeSyntax type; + internal readonly GreenNode? variables; - internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (variables != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - if (usingKeyword != null) - { - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + } - internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (variables != null) { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - if (usingKeyword != null) - { - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + } - internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - : base(kind) + internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (variables != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - if (usingKeyword != null) - { - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken? AwaitKeyword => this.awaitKeyword; - public SyntaxToken? UsingKeyword => this.usingKeyword; - /// Gets the modifier list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public VariableDeclarationSyntax Declaration => this.declaration; - public SyntaxToken SemicolonToken => this.semicolonToken; + public TypeSyntax Type => this.type; + public CoreSyntax.SeparatedSyntaxList Variables => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.variables)); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.awaitKeyword, - 2 => this.usingKeyword, - 3 => this.modifiers, - 4 => this.declaration, - 5 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.variables, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalDeclarationStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); - public LocalDeclarationStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public VariableDeclarationSyntax Update(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) + { + if (type != this.Type || variables != this.Variables) { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.VariableDeclaration(type, variables); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new VariableDeclarationSyntax(this.Kind, this.type, this.variables, diagnostics, GetAnnotations()); - internal LocalDeclarationStatementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 6; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var awaitKeyword = (SyntaxToken?)reader.ReadValue(); - if (awaitKeyword != null) - { - AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - var usingKeyword = (SyntaxToken?)reader.ReadValue(); - if (usingKeyword != null) - { - AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var declaration = (VariableDeclarationSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new VariableDeclarationSyntax(this.Kind, this.type, this.variables, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal VariableDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var variables = (GreenNode?)reader.ReadValue(); + if (variables != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.awaitKeyword); - writer.WriteValue(this.usingKeyword); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.declaration); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(variables); + this.variables = variables; } + } - static LocalDeclarationStatementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(LocalDeclarationStatementSyntax), r => new LocalDeclarationStatementSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.type); + writer.WriteValue(this.variables); } - internal sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode + static VariableDeclarationSyntax() { - internal readonly TypeSyntax type; - internal readonly GreenNode? variables; + ObjectBinder.RegisterTypeReader(typeof(VariableDeclarationSyntax), r => new VariableDeclarationSyntax(r)); + } +} + +internal sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken identifier; + internal readonly BracketedArgumentListSyntax? argumentList; + internal readonly EqualsValueClauseSyntax? initializer; - internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (argumentList != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, SyntaxFactoryContext context) - : base(kind) + internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (argumentList != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables) - : base(kind) + internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (argumentList != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - public TypeSyntax Type => this.type; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Variables => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.variables)); + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public BracketedArgumentListSyntax? ArgumentList => this.argumentList; + public EqualsValueClauseSyntax? Initializer => this.initializer; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.variables, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.identifier, + 1 => this.argumentList, + 2 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclarationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclaratorSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); - public VariableDeclarationSyntax Update(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables) + public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax argumentList, EqualsValueClauseSyntax initializer) + { + if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer) { - if (type != this.Type || variables != this.Variables) - { - var newNode = SyntaxFactory.VariableDeclaration(type, variables); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new VariableDeclarationSyntax(this.Kind, this.type, this.variables, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new VariableDeclarationSyntax(this.Kind, this.type, this.variables, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, diagnostics, GetAnnotations()); - internal VariableDeclarationSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var variables = (GreenNode?)reader.ReadValue(); - if (variables != null) - { - AdjustFlagsAndWidth(variables); - this.variables = variables; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal VariableDeclaratorSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var argumentList = (BracketedArgumentListSyntax?)reader.ReadValue(); + if (argumentList != null) { - base.WriteTo(writer); - writer.WriteValue(this.type); - writer.WriteValue(this.variables); + AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - - static VariableDeclarationSyntax() + var initializer = (EqualsValueClauseSyntax?)reader.ReadValue(); + if (initializer != null) { - ObjectBinder.RegisterTypeReader(typeof(VariableDeclarationSyntax), r => new VariableDeclarationSyntax(r)); + AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } } - internal sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken identifier; - internal readonly BracketedArgumentListSyntax? argumentList; - internal readonly EqualsValueClauseSyntax? initializer; + base.WriteTo(writer); + writer.WriteValue(this.identifier); + writer.WriteValue(this.argumentList); + writer.WriteValue(this.initializer); + } - internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + static VariableDeclaratorSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(VariableDeclaratorSyntax), r => new VariableDeclaratorSyntax(r)); + } +} + +internal sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken equalsToken; + internal readonly ExpressionSyntax value; + + internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(value); + this.value = value; + } + + internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(value); + this.value = value; + } + + internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(value); + this.value = value; + } + + public SyntaxToken EqualsToken => this.equalsToken; + public ExpressionSyntax Value => this.value; - internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + 0 => this.equalsToken, + 1 => this.value, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EqualsValueClauseSyntax(this, parent, position); - internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); + + public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value) + { + if (equalsToken != this.EqualsToken || value != this.Value) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public BracketedArgumentListSyntax? ArgumentList => this.argumentList; - public EqualsValueClauseSyntax? Initializer => this.initializer; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.identifier, - 1 => this.argumentList, - 2 => this.initializer, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclaratorSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, GetDiagnostics(), annotations); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); + internal EqualsValueClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var equalsToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + var value = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(value); + this.value = value; + } - public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax argumentList, EqualsValueClauseSyntax initializer) - { - if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.equalsToken); + writer.WriteValue(this.value); + } - return this; - } + static EqualsValueClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(EqualsValueClauseSyntax), r => new EqualsValueClauseSyntax(r)); + } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, diagnostics, GetAnnotations()); +internal abstract partial class VariableDesignationSyntax : CSharpSyntaxNode +{ + internal VariableDesignationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, GetDiagnostics(), annotations); + internal VariableDesignationSyntax(SyntaxKind kind) + : base(kind) + { + } - internal VariableDeclaratorSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var argumentList = (BracketedArgumentListSyntax?)reader.ReadValue(); - if (argumentList != null) - { - AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - var initializer = (EqualsValueClauseSyntax?)reader.ReadValue(); - if (initializer != null) - { - AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + protected VariableDesignationSyntax(ObjectReader reader) + : base(reader) + { + } +} - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.identifier); - writer.WriteValue(this.argumentList); - writer.WriteValue(this.initializer); - } +internal sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax +{ + internal readonly SyntaxToken identifier; - static VariableDeclaratorSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(VariableDeclaratorSyntax), r => new VariableDeclaratorSyntax(r)); - } + internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } - internal sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode + internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken equalsToken; - internal readonly ExpressionSyntax value; + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(value); - this.value = value; - } + internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(value); - this.value = value; - } + public SyntaxToken Identifier => this.identifier; - internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.identifier : null; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SingleVariableDesignationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); + + public SingleVariableDesignationSyntax Update(SyntaxToken identifier) + { + if (identifier != this.Identifier) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(value); - this.value = value; + var newNode = SyntaxFactory.SingleVariableDesignation(identifier); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken EqualsToken => this.equalsToken; - public ExpressionSyntax Value => this.value; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.equalsToken, - 1 => this.value, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EqualsValueClauseSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SingleVariableDesignationSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SingleVariableDesignationSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations); - public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value) - { - if (equalsToken != this.EqualsToken || value != this.Value) - { - var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal SingleVariableDesignationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - return this; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.identifier); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, diagnostics, GetAnnotations()); + static SingleVariableDesignationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(SingleVariableDesignationSyntax), r => new SingleVariableDesignationSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, GetDiagnostics(), annotations); +internal sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax +{ + internal readonly SyntaxToken underscoreToken; - internal EqualsValueClauseSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var equalsToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - var value = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(value); - this.value = value; - } + internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.equalsToken); - writer.WriteValue(this.value); - } + internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - static EqualsValueClauseSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(EqualsValueClauseSyntax), r => new EqualsValueClauseSyntax(r)); - } + internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; } - internal abstract partial class VariableDesignationSyntax : CSharpSyntaxNode + public SyntaxToken UnderscoreToken => this.underscoreToken; + + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.underscoreToken : null; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardDesignationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); + + public DiscardDesignationSyntax Update(SyntaxToken underscoreToken) { - internal VariableDesignationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (underscoreToken != this.UnderscoreToken) { + var newNode = SyntaxFactory.DiscardDesignation(underscoreToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal VariableDesignationSyntax(SyntaxKind kind) - : base(kind) - { - } + return this; + } - protected VariableDesignationSyntax(ObjectReader reader) - : base(reader) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DiscardDesignationSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DiscardDesignationSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations); + + internal DiscardDesignationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var underscoreToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.underscoreToken); } - internal sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax + static DiscardDesignationSyntax() { - internal readonly SyntaxToken identifier; + ObjectBinder.RegisterTypeReader(typeof(DiscardDesignationSyntax), r => new DiscardDesignationSyntax(r)); + } +} + +internal sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? variables; + internal readonly SyntaxToken closeParenToken; - internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (variables != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) - : base(kind) + internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (variables != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier) - : base(kind) + internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (variables != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public SyntaxToken Identifier => this.identifier; + public SyntaxToken OpenParenToken => this.openParenToken; + public CoreSyntax.SeparatedSyntaxList Variables => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.variables)); + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.identifier : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.variables, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SingleVariableDesignationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedVariableDesignationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); - public SingleVariableDesignationSyntax Update(SyntaxToken identifier) + public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) { - if (identifier != this.Identifier) - { - var newNode = SyntaxFactory.SingleVariableDesignation(identifier); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SingleVariableDesignationSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SingleVariableDesignationSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, diagnostics, GetAnnotations()); - internal SingleVariableDesignationSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal ParenthesizedVariableDesignationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var variables = (GreenNode?)reader.ReadValue(); + if (variables != null) { - base.WriteTo(writer); - writer.WriteValue(this.identifier); + AdjustFlagsAndWidth(variables); + this.variables = variables; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - static SingleVariableDesignationSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(SingleVariableDesignationSyntax), r => new SingleVariableDesignationSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.variables); + writer.WriteValue(this.closeParenToken); } - internal sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax + static ParenthesizedVariableDesignationSyntax() { - internal readonly SyntaxToken underscoreToken; + ObjectBinder.RegisterTypeReader(typeof(ParenthesizedVariableDesignationSyntax), r => new ParenthesizedVariableDesignationSyntax(r)); + } +} + +internal sealed partial class ExpressionStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken semicolonToken; - internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) - : base(kind) + internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken) - : base(kind) + internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public SyntaxToken UnderscoreToken => this.underscoreToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public ExpressionSyntax Expression => this.expression; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.underscoreToken : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.expression, + 2 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardDesignationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); - public DiscardDesignationSyntax Update(SyntaxToken underscoreToken) + public ExpressionStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) { - if (underscoreToken != this.UnderscoreToken) - { - var newNode = SyntaxFactory.DiscardDesignation(underscoreToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DiscardDesignationSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DiscardDesignationSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, GetDiagnostics(), annotations); - internal DiscardDesignationSyntax(ObjectReader reader) - : base(reader) + internal ExpressionStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 1; - var underscoreToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.expression); + writer.WriteValue(this.semicolonToken); + } + + static ExpressionStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ExpressionStatementSyntax), r => new ExpressionStatementSyntax(r)); + } +} + +internal sealed partial class EmptyStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken semicolonToken; - internal override void WriteTo(ObjectWriter writer) + internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.underscoreToken); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - static DiscardDesignationSyntax() + internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + if (attributeLists != null) { - ObjectBinder.RegisterTypeReader(typeof(DiscardDesignationSyntax), r => new DiscardDesignationSyntax(r)); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax + internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? variables; - internal readonly SyntaxToken closeParenToken; + this.SlotCount = 2; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + 0 => this.attributeLists, + 1 => this.semicolonToken, + _ => null, + }; - internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EmptyStatementSyntax(this, parent, position); - internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); + + public EmptyStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken OpenParenToken => this.openParenToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Variables => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.variables)); - public SyntaxToken CloseParenToken => this.closeParenToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.variables, - 2 => this.closeParenToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedVariableDesignationSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, GetDiagnostics(), annotations); - public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + internal EmptyStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.semicolonToken); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, diagnostics, GetAnnotations()); + static EmptyStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(EmptyStatementSyntax), r => new EmptyStatementSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, GetDiagnostics(), annotations); +/// Represents a labeled statement syntax. +internal sealed partial class LabeledStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken colonToken; + internal readonly StatementSyntax statement; - internal ParenthesizedVariableDesignationSyntax(ObjectReader reader) - : base(reader) + internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 3; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var variables = (GreenNode?)reader.ReadValue(); - if (variables != null) - { - AdjustFlagsAndWidth(variables); - this.variables = variables; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal override void WriteTo(ObjectWriter writer) + internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.variables); - writer.WriteValue(this.closeParenToken); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - static ParenthesizedVariableDesignationSyntax() + internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 4; + if (attributeLists != null) { - ObjectBinder.RegisterTypeReader(typeof(ParenthesizedVariableDesignationSyntax), r => new ParenthesizedVariableDesignationSyntax(r)); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class ExpressionStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + /// Gets a SyntaxToken that represents the colon following the statement's label. + public SyntaxToken ColonToken => this.colonToken; + public StatementSyntax Statement => this.statement; - internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + 0 => this.attributeLists, + 1 => this.identifier, + 2 => this.colonToken, + 3 => this.statement, + _ => null, + }; - internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LabeledStatementSyntax(this, parent, position); - internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); + + public LabeledStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public ExpressionSyntax Expression => this.expression; - public SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.expression, - 2 => this.semicolonToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionStatementSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, GetDiagnostics(), annotations); - public ExpressionStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + internal LabeledStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.identifier); + writer.WriteValue(this.colonToken); + writer.WriteValue(this.statement); + } + + static LabeledStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(LabeledStatementSyntax), r => new LabeledStatementSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, GetDiagnostics(), annotations); +/// +/// Represents a goto statement syntax +/// +internal sealed partial class GotoStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken gotoKeyword; + internal readonly SyntaxToken? caseOrDefaultKeyword; + internal readonly ExpressionSyntax? expression; + internal readonly SyntaxToken semicolonToken; - internal ExpressionStatementSyntax(ObjectReader reader) - : base(reader) + internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 3; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(gotoKeyword); + this.gotoKeyword = gotoKeyword; + if (caseOrDefaultKeyword != null) + { + this.AdjustFlagsAndWidth(caseOrDefaultKeyword); + this.caseOrDefaultKeyword = caseOrDefaultKeyword; + } + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); this.expression = expression; - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal override void WriteTo(ObjectWriter writer) + internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.expression); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static ExpressionStatementSyntax() + this.AdjustFlagsAndWidth(gotoKeyword); + this.gotoKeyword = gotoKeyword; + if (caseOrDefaultKeyword != null) + { + this.AdjustFlagsAndWidth(caseOrDefaultKeyword); + this.caseOrDefaultKeyword = caseOrDefaultKeyword; + } + if (expression != null) { - ObjectBinder.RegisterTypeReader(typeof(ExpressionStatementSyntax), r => new ExpressionStatementSyntax(r)); + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class EmptyStatementSyntax : StatementSyntax + internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken semicolonToken; - - internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 2; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(gotoKeyword); + this.gotoKeyword = gotoKeyword; + if (caseOrDefaultKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(caseOrDefaultKeyword); + this.caseOrDefaultKeyword = caseOrDefaultKeyword; } - - internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken) - : base(kind) + if (expression != null) { - this.SlotCount = 2; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// + /// Gets a SyntaxToken that represents the goto keyword. + /// + public SyntaxToken GotoKeyword => this.gotoKeyword; + /// + /// Gets a SyntaxToken that represents the case or default keywords if any exists. + /// + public SyntaxToken? CaseOrDefaultKeyword => this.caseOrDefaultKeyword; + /// + /// Gets a constant expression for a goto case statement. + /// + public ExpressionSyntax? Expression => this.expression; + /// + /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. + /// + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.gotoKeyword, + 2 => this.caseOrDefaultKeyword, + 3 => this.expression, + 4 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EmptyStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GotoStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); - public EmptyStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + public GotoStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.GotoStatement(this.Kind, attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); - internal EmptyStatementSyntax(ObjectReader reader) - : base(reader) + internal GotoStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 2; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + var gotoKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(gotoKeyword); + this.gotoKeyword = gotoKeyword; + var caseOrDefaultKeyword = (SyntaxToken?)reader.ReadValue(); + if (caseOrDefaultKeyword != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(caseOrDefaultKeyword); + this.caseOrDefaultKeyword = caseOrDefaultKeyword; } - - static EmptyStatementSyntax() + var expression = (ExpressionSyntax?)reader.ReadValue(); + if (expression != null) { - ObjectBinder.RegisterTypeReader(typeof(EmptyStatementSyntax), r => new EmptyStatementSyntax(r)); + AdjustFlagsAndWidth(expression); + this.expression = expression; } + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - /// Represents a labeled statement syntax. - internal sealed partial class LabeledStatementSyntax : StatementSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken colonToken; - internal readonly StatementSyntax statement; + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.gotoKeyword); + writer.WriteValue(this.caseOrDefaultKeyword); + writer.WriteValue(this.expression); + writer.WriteValue(this.semicolonToken); + } + + static GotoStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(GotoStatementSyntax), r => new GotoStatementSyntax(r)); + } +} + +internal sealed partial class BreakStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken breakKeyword; + internal readonly SyntaxToken semicolonToken; - internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(breakKeyword); + this.breakKeyword = breakKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(breakKeyword); + this.breakKeyword = breakKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) - : base(kind) + internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(breakKeyword); + this.breakKeyword = breakKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - /// Gets a SyntaxToken that represents the colon following the statement's label. - public SyntaxToken ColonToken => this.colonToken; - public StatementSyntax Statement => this.statement; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken BreakKeyword => this.breakKeyword; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.identifier, - 2 => this.colonToken, - 3 => this.statement, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.breakKeyword, + 2 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LabeledStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BreakStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); - public LabeledStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + public BreakStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) - { - var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, diagnostics, GetAnnotations()); - internal LabeledStatementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal BreakStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.identifier); - writer.WriteValue(this.colonToken); - writer.WriteValue(this.statement); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + var breakKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(breakKeyword); + this.breakKeyword = breakKeyword; + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - static LabeledStatementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(LabeledStatementSyntax), r => new LabeledStatementSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.breakKeyword); + writer.WriteValue(this.semicolonToken); } - /// - /// Represents a goto statement syntax - /// - internal sealed partial class GotoStatementSyntax : StatementSyntax + static BreakStatementSyntax() { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken gotoKeyword; - internal readonly SyntaxToken? caseOrDefaultKeyword; - internal readonly ExpressionSyntax? expression; - internal readonly SyntaxToken semicolonToken; + ObjectBinder.RegisterTypeReader(typeof(BreakStatementSyntax), r => new BreakStatementSyntax(r)); + } +} + +internal sealed partial class ContinueStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken continueKeyword; + internal readonly SyntaxToken semicolonToken; - internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(gotoKeyword); - this.gotoKeyword = gotoKeyword; - if (caseOrDefaultKeyword != null) - { - this.AdjustFlagsAndWidth(caseOrDefaultKeyword); - this.caseOrDefaultKeyword = caseOrDefaultKeyword; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(continueKeyword); + this.continueKeyword = continueKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(gotoKeyword); - this.gotoKeyword = gotoKeyword; - if (caseOrDefaultKeyword != null) - { - this.AdjustFlagsAndWidth(caseOrDefaultKeyword); - this.caseOrDefaultKeyword = caseOrDefaultKeyword; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(continueKeyword); + this.continueKeyword = continueKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - : base(kind) + internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(gotoKeyword); - this.gotoKeyword = gotoKeyword; - if (caseOrDefaultKeyword != null) - { - this.AdjustFlagsAndWidth(caseOrDefaultKeyword); - this.caseOrDefaultKeyword = caseOrDefaultKeyword; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(continueKeyword); + this.continueKeyword = continueKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - /// - /// Gets a SyntaxToken that represents the goto keyword. - /// - public SyntaxToken GotoKeyword => this.gotoKeyword; - /// - /// Gets a SyntaxToken that represents the case or default keywords if any exists. - /// - public SyntaxToken? CaseOrDefaultKeyword => this.caseOrDefaultKeyword; - /// - /// Gets a constant expression for a goto case statement. - /// - public ExpressionSyntax? Expression => this.expression; - /// - /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. - /// - public SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.gotoKeyword, - 2 => this.caseOrDefaultKeyword, - 3 => this.expression, - 4 => this.semicolonToken, - _ => null, - }; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken ContinueKeyword => this.continueKeyword; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GotoStatementSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.continueKeyword, + 2 => this.semicolonToken, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ContinueStatementSyntax(this, parent, position); - public GotoStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.GotoStatement(this.Kind, attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); - return this; + public ContinueStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, diagnostics, GetAnnotations()); - internal GotoStatementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var gotoKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(gotoKeyword); - this.gotoKeyword = gotoKeyword; - var caseOrDefaultKeyword = (SyntaxToken?)reader.ReadValue(); - if (caseOrDefaultKeyword != null) - { - AdjustFlagsAndWidth(caseOrDefaultKeyword); - this.caseOrDefaultKeyword = caseOrDefaultKeyword; - } - var expression = (ExpressionSyntax?)reader.ReadValue(); - if (expression != null) - { - AdjustFlagsAndWidth(expression); - this.expression = expression; - } - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal ContinueStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.gotoKeyword); - writer.WriteValue(this.caseOrDefaultKeyword); - writer.WriteValue(this.expression); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + var continueKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(continueKeyword); + this.continueKeyword = continueKeyword; + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - static GotoStatementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(GotoStatementSyntax), r => new GotoStatementSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.continueKeyword); + writer.WriteValue(this.semicolonToken); } - internal sealed partial class BreakStatementSyntax : StatementSyntax + static ContinueStatementSyntax() { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken breakKeyword; - internal readonly SyntaxToken semicolonToken; + ObjectBinder.RegisterTypeReader(typeof(ContinueStatementSyntax), r => new ContinueStatementSyntax(r)); + } +} - internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class ReturnStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken returnKeyword; + internal readonly ExpressionSyntax? expression; + internal readonly SyntaxToken semicolonToken; + + internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(breakKeyword); - this.breakKeyword = breakKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(returnKeyword); + this.returnKeyword = returnKeyword; + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(breakKeyword); - this.breakKeyword = breakKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(returnKeyword); + this.returnKeyword = returnKeyword; + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) - : base(kind) + internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(breakKeyword); - this.breakKeyword = breakKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(returnKeyword); + this.returnKeyword = returnKeyword; + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken BreakKeyword => this.breakKeyword; - public SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken ReturnKeyword => this.returnKeyword; + public ExpressionSyntax? Expression => this.expression; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.breakKeyword, - 2 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.returnKeyword, + 2 => this.expression, + 3 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BreakStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReturnStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); - public BreakStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + public ReturnStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - internal BreakStatementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var breakKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(breakKeyword); - this.breakKeyword = breakKeyword; - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal ReturnStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.breakKeyword); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static BreakStatementSyntax() + var returnKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(returnKeyword); + this.returnKeyword = returnKeyword; + var expression = (ExpressionSyntax?)reader.ReadValue(); + if (expression != null) { - ObjectBinder.RegisterTypeReader(typeof(BreakStatementSyntax), r => new BreakStatementSyntax(r)); + AdjustFlagsAndWidth(expression); + this.expression = expression; } + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class ContinueStatementSyntax : StatementSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken continueKeyword; - internal readonly SyntaxToken semicolonToken; + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.returnKeyword); + writer.WriteValue(this.expression); + writer.WriteValue(this.semicolonToken); + } - internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(continueKeyword); - this.continueKeyword = continueKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + static ReturnStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ReturnStatementSyntax), r => new ReturnStatementSyntax(r)); + } +} + +internal sealed partial class ThrowStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken throwKeyword; + internal readonly ExpressionSyntax? expression; + internal readonly SyntaxToken semicolonToken; - internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(continueKeyword); - this.continueKeyword = continueKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) - : base(kind) + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + if (expression != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(continueKeyword); - this.continueKeyword = continueKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken ContinueKeyword => this.continueKeyword; - public SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.continueKeyword, - 2 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ContinueStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); - - public ContinueStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, GetDiagnostics(), annotations); - - internal ContinueStatementSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + if (expression != null) { - this.SlotCount = 3; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var continueKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(continueKeyword); - this.continueKeyword = continueKeyword; - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal override void WriteTo(ObjectWriter writer) + internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 4; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.continueKeyword); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static ContinueStatementSyntax() + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + if (expression != null) { - ObjectBinder.RegisterTypeReader(typeof(ContinueStatementSyntax), r => new ContinueStatementSyntax(r)); + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class ReturnStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken returnKeyword; - internal readonly ExpressionSyntax? expression; - internal readonly SyntaxToken semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken ThrowKeyword => this.throwKeyword; + public ExpressionSyntax? Expression => this.expression; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(returnKeyword); - this.returnKeyword = returnKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + 0 => this.attributeLists, + 1 => this.throwKeyword, + 2 => this.expression, + 3 => this.semicolonToken, + _ => null, + }; - internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(returnKeyword); - this.returnKeyword = returnKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); - internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - : base(kind) + public ThrowStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(returnKeyword); - this.returnKeyword = returnKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken ReturnKeyword => this.returnKeyword; - public ExpressionSyntax? Expression => this.expression; - public SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.returnKeyword, - 2 => this.expression, - 3 => this.semicolonToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReturnStatementSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); - public ReturnStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + internal ThrowStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var throwKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + var expression = (ExpressionSyntax?)reader.ReadValue(); + if (expression != null) + { + AdjustFlagsAndWidth(expression); + this.expression = expression; } + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.throwKeyword); + writer.WriteValue(this.expression); + writer.WriteValue(this.semicolonToken); + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); + static ThrowStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ThrowStatementSyntax), r => new ThrowStatementSyntax(r)); + } +} - internal ReturnStatementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var returnKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(returnKeyword); - this.returnKeyword = returnKeyword; - var expression = (ExpressionSyntax?)reader.ReadValue(); - if (expression != null) - { - AdjustFlagsAndWidth(expression); - this.expression = expression; - } - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } +internal sealed partial class YieldStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken yieldKeyword; + internal readonly SyntaxToken returnOrBreakKeyword; + internal readonly ExpressionSyntax? expression; + internal readonly SyntaxToken semicolonToken; - internal override void WriteTo(ObjectWriter writer) + internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.returnKeyword); - writer.WriteValue(this.expression); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static ReturnStatementSyntax() + this.AdjustFlagsAndWidth(yieldKeyword); + this.yieldKeyword = yieldKeyword; + this.AdjustFlagsAndWidth(returnOrBreakKeyword); + this.returnOrBreakKeyword = returnOrBreakKeyword; + if (expression != null) { - ObjectBinder.RegisterTypeReader(typeof(ReturnStatementSyntax), r => new ReturnStatementSyntax(r)); + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class ThrowStatementSyntax : StatementSyntax + internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken throwKeyword; - internal readonly ExpressionSyntax? expression; - internal readonly SyntaxToken semicolonToken; - - internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(yieldKeyword); + this.yieldKeyword = yieldKeyword; + this.AdjustFlagsAndWidth(returnOrBreakKeyword); + this.returnOrBreakKeyword = returnOrBreakKeyword; + if (expression != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - : base(kind) + internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(yieldKeyword); + this.yieldKeyword = yieldKeyword; + this.AdjustFlagsAndWidth(returnOrBreakKeyword); + this.returnOrBreakKeyword = returnOrBreakKeyword; + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken ThrowKeyword => this.throwKeyword; - public ExpressionSyntax? Expression => this.expression; - public SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken YieldKeyword => this.yieldKeyword; + public SyntaxToken ReturnOrBreakKeyword => this.returnOrBreakKeyword; + public ExpressionSyntax? Expression => this.expression; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.throwKeyword, - 2 => this.expression, - 3 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.yieldKeyword, + 2 => this.returnOrBreakKeyword, + 3 => this.expression, + 4 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.YieldStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); - public ThrowStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + public YieldStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.YieldStatement(this.Kind, attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - internal ThrowStatementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var throwKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - var expression = (ExpressionSyntax?)reader.ReadValue(); - if (expression != null) - { - AdjustFlagsAndWidth(expression); - this.expression = expression; - } - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal YieldStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.throwKeyword); - writer.WriteValue(this.expression); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static ThrowStatementSyntax() + var yieldKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(yieldKeyword); + this.yieldKeyword = yieldKeyword; + var returnOrBreakKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(returnOrBreakKeyword); + this.returnOrBreakKeyword = returnOrBreakKeyword; + var expression = (ExpressionSyntax?)reader.ReadValue(); + if (expression != null) { - ObjectBinder.RegisterTypeReader(typeof(ThrowStatementSyntax), r => new ThrowStatementSyntax(r)); + AdjustFlagsAndWidth(expression); + this.expression = expression; } + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class YieldStatementSyntax : StatementSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken yieldKeyword; - internal readonly SyntaxToken returnOrBreakKeyword; - internal readonly ExpressionSyntax? expression; - internal readonly SyntaxToken semicolonToken; + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.yieldKeyword); + writer.WriteValue(this.returnOrBreakKeyword); + writer.WriteValue(this.expression); + writer.WriteValue(this.semicolonToken); + } - internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(yieldKeyword); - this.yieldKeyword = yieldKeyword; - this.AdjustFlagsAndWidth(returnOrBreakKeyword); - this.returnOrBreakKeyword = returnOrBreakKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + static YieldStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(YieldStatementSyntax), r => new YieldStatementSyntax(r)); + } +} - internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(yieldKeyword); - this.yieldKeyword = yieldKeyword; - this.AdjustFlagsAndWidth(returnOrBreakKeyword); - this.returnOrBreakKeyword = returnOrBreakKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } +internal sealed partial class WhileStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken whileKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + + internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - : base(kind) - { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(yieldKeyword); - this.yieldKeyword = yieldKeyword; - this.AdjustFlagsAndWidth(returnOrBreakKeyword); - this.returnOrBreakKeyword = returnOrBreakKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken WhileKeyword => this.whileKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public ExpressionSyntax Condition => this.condition; + public SyntaxToken CloseParenToken => this.closeParenToken; + public StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.whileKeyword, + 2 => this.openParenToken, + 3 => this.condition, + 4 => this.closeParenToken, + 5 => this.statement, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhileStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); + + public WhileStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken YieldKeyword => this.yieldKeyword; - public SyntaxToken ReturnOrBreakKeyword => this.returnOrBreakKeyword; - public ExpressionSyntax? Expression => this.expression; - public SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.yieldKeyword, - 2 => this.returnOrBreakKeyword, - 3 => this.expression, - 4 => this.semicolonToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.YieldStatementSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, GetDiagnostics(), annotations); - public YieldStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + internal WhileStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 6; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.YieldStatement(this.Kind, attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + var whileKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var condition = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(condition); + this.condition = condition; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.whileKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.condition); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.statement); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); + static WhileStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(WhileStatementSyntax), r => new WhileStatementSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); +internal sealed partial class DoStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken doKeyword; + internal readonly StatementSyntax statement; + internal readonly SyntaxToken whileKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken closeParenToken; + internal readonly SyntaxToken semicolonToken; + + internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(doKeyword); + this.doKeyword = doKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(doKeyword); + this.doKeyword = doKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(doKeyword); + this.doKeyword = doKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken DoKeyword => this.doKeyword; + public StatementSyntax Statement => this.statement; + public SyntaxToken WhileKeyword => this.whileKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public ExpressionSyntax Condition => this.condition; + public SyntaxToken CloseParenToken => this.closeParenToken; + public SyntaxToken SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.doKeyword, + 2 => this.statement, + 3 => this.whileKeyword, + 4 => this.openParenToken, + 5 => this.condition, + 6 => this.closeParenToken, + 7 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DoStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); + + public DoStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, GetDiagnostics(), annotations); + + internal DoStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 8; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var doKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(doKeyword); + this.doKeyword = doKeyword; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + var whileKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var condition = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(condition); + this.condition = condition; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.doKeyword); + writer.WriteValue(this.statement); + writer.WriteValue(this.whileKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.condition); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.semicolonToken); + } + + static DoStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(DoStatementSyntax), r => new DoStatementSyntax(r)); + } +} - internal YieldStatementSyntax(ObjectReader reader) - : base(reader) +internal sealed partial class ForStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken forKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly VariableDeclarationSyntax? declaration; + internal readonly GreenNode? initializers; + internal readonly SyntaxToken firstSemicolonToken; + internal readonly ExpressionSyntax? condition; + internal readonly SyntaxToken secondSemicolonToken; + internal readonly GreenNode? incrementors; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 11; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(forKeyword); + this.forKeyword = forKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) { - this.SlotCount = 5; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var yieldKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(yieldKeyword); - this.yieldKeyword = yieldKeyword; - var returnOrBreakKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(returnOrBreakKeyword); - this.returnOrBreakKeyword = returnOrBreakKeyword; - var expression = (ExpressionSyntax?)reader.ReadValue(); - if (expression != null) - { - AdjustFlagsAndWidth(expression); - this.expression = expression; - } - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } - - internal override void WriteTo(ObjectWriter writer) + if (initializers != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.yieldKeyword); - writer.WriteValue(this.returnOrBreakKeyword); - writer.WriteValue(this.expression); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; } - - static YieldStatementSyntax() + this.AdjustFlagsAndWidth(firstSemicolonToken); + this.firstSemicolonToken = firstSemicolonToken; + if (condition != null) { - ObjectBinder.RegisterTypeReader(typeof(YieldStatementSyntax), r => new YieldStatementSyntax(r)); + this.AdjustFlagsAndWidth(condition); + this.condition = condition; } + this.AdjustFlagsAndWidth(secondSemicolonToken); + this.secondSemicolonToken = secondSemicolonToken; + if (incrementors != null) + { + this.AdjustFlagsAndWidth(incrementors); + this.incrementors = incrementors; + } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class WhileStatementSyntax : StatementSyntax + internal 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) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken whileKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - - internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(forKeyword); + this.forKeyword = forKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) + { + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + } + if (initializers != null) + { + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; + } + this.AdjustFlagsAndWidth(firstSemicolonToken); + this.firstSemicolonToken = firstSemicolonToken; + if (condition != null) { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; this.AdjustFlagsAndWidth(condition); this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; } + this.AdjustFlagsAndWidth(secondSemicolonToken); + this.secondSemicolonToken = secondSemicolonToken; + if (incrementors != null) + { + this.AdjustFlagsAndWidth(incrementors); + this.incrementors = incrementors; + } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + internal 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) + : base(kind) + { + this.SlotCount = 11; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(forKeyword); + this.forKeyword = forKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) + { + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + } + if (initializers != null) + { + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; + } + this.AdjustFlagsAndWidth(firstSemicolonToken); + this.firstSemicolonToken = firstSemicolonToken; + if (condition != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; this.AdjustFlagsAndWidth(condition); this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; } + this.AdjustFlagsAndWidth(secondSemicolonToken); + this.secondSemicolonToken = secondSemicolonToken; + if (incrementors != null) + { + this.AdjustFlagsAndWidth(incrementors); + this.incrementors = incrementors; + } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken WhileKeyword => this.whileKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public ExpressionSyntax Condition => this.condition; - public SyntaxToken CloseParenToken => this.closeParenToken; - public StatementSyntax Statement => this.statement; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken ForKeyword => this.forKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public VariableDeclarationSyntax? Declaration => this.declaration; + public CoreSyntax.SeparatedSyntaxList Initializers => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.initializers)); + public SyntaxToken FirstSemicolonToken => this.firstSemicolonToken; + public ExpressionSyntax? Condition => this.condition; + public SyntaxToken SecondSemicolonToken => this.secondSemicolonToken; + public CoreSyntax.SeparatedSyntaxList Incrementors => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.incrementors)); + public SyntaxToken CloseParenToken => this.closeParenToken; + public StatementSyntax Statement => this.statement; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.whileKeyword, - 2 => this.openParenToken, - 3 => this.condition, - 4 => this.closeParenToken, - 5 => this.statement, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.forKeyword, + 2 => this.openParenToken, + 3 => this.declaration, + 4 => this.initializers, + 5 => this.firstSemicolonToken, + 6 => this.condition, + 7 => this.secondSemicolonToken, + 8 => this.incrementors, + 9 => this.closeParenToken, + 10 => this.statement, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhileStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); - public WhileStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + public ForStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) { - if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, GetDiagnostics(), annotations); - internal WhileStatementSyntax(ObjectReader reader) - : base(reader) + internal ForStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 11; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var forKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(forKeyword); + this.forKeyword = forKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var declaration = (VariableDeclarationSyntax?)reader.ReadValue(); + if (declaration != null) + { + AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + } + var initializers = (GreenNode?)reader.ReadValue(); + if (initializers != null) + { + AdjustFlagsAndWidth(initializers); + this.initializers = initializers; + } + var firstSemicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(firstSemicolonToken); + this.firstSemicolonToken = firstSemicolonToken; + var condition = (ExpressionSyntax?)reader.ReadValue(); + if (condition != null) { - this.SlotCount = 6; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var whileKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var condition = (ExpressionSyntax)reader.ReadValue(); AdjustFlagsAndWidth(condition); this.condition = condition; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; } - - internal override void WriteTo(ObjectWriter writer) + var secondSemicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(secondSemicolonToken); + this.secondSemicolonToken = secondSemicolonToken; + var incrementors = (GreenNode?)reader.ReadValue(); + if (incrementors != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.whileKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.condition); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.statement); + AdjustFlagsAndWidth(incrementors); + this.incrementors = incrementors; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + } - static WhileStatementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(WhileStatementSyntax), r => new WhileStatementSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.forKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.declaration); + writer.WriteValue(this.initializers); + writer.WriteValue(this.firstSemicolonToken); + writer.WriteValue(this.condition); + writer.WriteValue(this.secondSemicolonToken); + writer.WriteValue(this.incrementors); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.statement); } - internal sealed partial class DoStatementSyntax : StatementSyntax + static ForStatementSyntax() { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken doKeyword; - internal readonly StatementSyntax statement; - internal readonly SyntaxToken whileKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken closeParenToken; - internal readonly SyntaxToken semicolonToken; + ObjectBinder.RegisterTypeReader(typeof(ForStatementSyntax), r => new ForStatementSyntax(r)); + } +} - internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(doKeyword); - this.doKeyword = doKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } +internal abstract partial class CommonForEachStatementSyntax : StatementSyntax +{ + internal CommonForEachStatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(doKeyword); - this.doKeyword = doKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal CommonForEachStatementSyntax(SyntaxKind kind) + : base(kind) + { + } - internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) - : base(kind) - { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(doKeyword); - this.doKeyword = doKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + protected CommonForEachStatementSyntax(ObjectReader reader) + : base(reader) + { + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken DoKeyword => this.doKeyword; - public StatementSyntax Statement => this.statement; - public SyntaxToken WhileKeyword => this.whileKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public ExpressionSyntax Condition => this.condition; - public SyntaxToken CloseParenToken => this.closeParenToken; - public SyntaxToken SemicolonToken => this.semicolonToken; + public abstract SyntaxToken? AwaitKeyword { get; } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.doKeyword, - 2 => this.statement, - 3 => this.whileKeyword, - 4 => this.openParenToken, - 5 => this.condition, - 6 => this.closeParenToken, - 7 => this.semicolonToken, - _ => null, - }; + public abstract SyntaxToken ForEachKeyword { get; } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DoStatementSyntax(this, parent, position); + public abstract SyntaxToken OpenParenToken { get; } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); + public abstract SyntaxToken InKeyword { get; } - public DoStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public abstract ExpressionSyntax Expression { get; } - return this; - } + public abstract SyntaxToken CloseParenToken { get; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, diagnostics, GetAnnotations()); + public abstract StatementSyntax Statement { get; } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, GetDiagnostics(), annotations); +internal sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken? awaitKeyword; + internal readonly SyntaxToken forEachKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken inKeyword; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; - internal DoStatementSyntax(ObjectReader reader) - : base(reader) + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 10; + if (attributeLists != null) { - this.SlotCount = 8; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var doKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(doKeyword); - this.doKeyword = doKeyword; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; - var whileKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var condition = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(condition); - this.condition = condition; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + if (awaitKeyword != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.doKeyword); - writer.WriteValue(this.statement); - writer.WriteValue(this.whileKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.condition); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - static DoStatementSyntax() + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 10; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (awaitKeyword != null) { - ObjectBinder.RegisterTypeReader(typeof(DoStatementSyntax), r => new DoStatementSyntax(r)); + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class ForStatementSyntax : StatementSyntax + internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken forKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly VariableDeclarationSyntax? declaration; - internal readonly GreenNode? initializers; - internal readonly SyntaxToken firstSemicolonToken; - internal readonly ExpressionSyntax? condition; - internal readonly SyntaxToken secondSemicolonToken; - internal readonly GreenNode? incrementors; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - - internal 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) - : base(kind, diagnostics, annotations) + this.SlotCount = 10; + if (attributeLists != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(forKeyword); - this.forKeyword = forKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(firstSemicolonToken); - this.firstSemicolonToken = firstSemicolonToken; - if (condition != null) - { - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } - this.AdjustFlagsAndWidth(secondSemicolonToken); - this.secondSemicolonToken = secondSemicolonToken; - if (incrementors != null) - { - this.AdjustFlagsAndWidth(incrementors); - this.incrementors = incrementors; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (awaitKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(forKeyword); - this.forKeyword = forKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(firstSemicolonToken); - this.firstSemicolonToken = firstSemicolonToken; - if (condition != null) - { - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } - this.AdjustFlagsAndWidth(secondSemicolonToken); - this.secondSemicolonToken = secondSemicolonToken; - if (incrementors != null) - { - this.AdjustFlagsAndWidth(incrementors); - this.incrementors = incrementors; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } - - internal 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) - : base(kind) + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override SyntaxToken? AwaitKeyword => this.awaitKeyword; + public override SyntaxToken ForEachKeyword => this.forEachKeyword; + public override SyntaxToken OpenParenToken => this.openParenToken; + public TypeSyntax Type => this.type; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public override SyntaxToken InKeyword => this.inKeyword; + public override ExpressionSyntax Expression => this.expression; + public override SyntaxToken CloseParenToken => this.closeParenToken; + public override StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.awaitKeyword, + 2 => this.forEachKeyword, + 3 => this.openParenToken, + 4 => this.type, + 5 => this.identifier, + 6 => this.inKeyword, + 7 => this.expression, + 8 => this.closeParenToken, + 9 => this.statement, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); + + public ForEachStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + + internal ForEachStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 10; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var awaitKeyword = (SyntaxToken?)reader.ReadValue(); + if (awaitKeyword != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(forKeyword); - this.forKeyword = forKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(firstSemicolonToken); - this.firstSemicolonToken = firstSemicolonToken; - if (condition != null) - { - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } - this.AdjustFlagsAndWidth(secondSemicolonToken); - this.secondSemicolonToken = secondSemicolonToken; - if (incrementors != null) - { - this.AdjustFlagsAndWidth(incrementors); - this.incrementors = incrementors; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } - - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken ForKeyword => this.forKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public VariableDeclarationSyntax? Declaration => this.declaration; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Initializers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.initializers)); - public SyntaxToken FirstSemicolonToken => this.firstSemicolonToken; - public ExpressionSyntax? Condition => this.condition; - public SyntaxToken SecondSemicolonToken => this.secondSemicolonToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Incrementors => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.incrementors)); - public SyntaxToken CloseParenToken => this.closeParenToken; - public StatementSyntax Statement => this.statement; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.forKeyword, - 2 => this.openParenToken, - 3 => this.declaration, - 4 => this.initializers, - 5 => this.firstSemicolonToken, - 6 => this.condition, - 7 => this.secondSemicolonToken, - 8 => this.incrementors, - 9 => this.closeParenToken, - 10 => this.statement, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); - - public ForStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } + var forEachKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var inKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.awaitKeyword); + writer.WriteValue(this.forEachKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.type); + writer.WriteValue(this.identifier); + writer.WriteValue(this.inKeyword); + writer.WriteValue(this.expression); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.statement); + } + + static ForEachStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ForEachStatementSyntax), r => new ForEachStatementSyntax(r)); + } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, GetDiagnostics(), annotations); +internal sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken? awaitKeyword; + internal readonly SyntaxToken forEachKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax variable; + internal readonly SyntaxToken inKeyword; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; - internal ForStatementSyntax(ObjectReader reader) - : base(reader) + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 11; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var forKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(forKeyword); - this.forKeyword = forKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var declaration = (VariableDeclarationSyntax?)reader.ReadValue(); - if (declaration != null) - { - AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - var initializers = (GreenNode?)reader.ReadValue(); - if (initializers != null) - { - AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - var firstSemicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(firstSemicolonToken); - this.firstSemicolonToken = firstSemicolonToken; - var condition = (ExpressionSyntax?)reader.ReadValue(); - if (condition != null) - { - AdjustFlagsAndWidth(condition); - this.condition = condition; - } - var secondSemicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(secondSemicolonToken); - this.secondSemicolonToken = secondSemicolonToken; - var incrementors = (GreenNode?)reader.ReadValue(); - if (incrementors != null) - { - AdjustFlagsAndWidth(incrementors); - this.incrementors = incrementors; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + if (awaitKeyword != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.forKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.declaration); - writer.WriteValue(this.initializers); - writer.WriteValue(this.firstSemicolonToken); - writer.WriteValue(this.condition); - writer.WriteValue(this.secondSemicolonToken); - writer.WriteValue(this.incrementors); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.statement); + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(variable); + this.variable = variable; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - static ForStatementSyntax() + internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 9; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (awaitKeyword != null) { - ObjectBinder.RegisterTypeReader(typeof(ForStatementSyntax), r => new ForStatementSyntax(r)); + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(variable); + this.variable = variable; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal abstract partial class CommonForEachStatementSyntax : StatementSyntax + internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) { - internal CommonForEachStatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 9; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal CommonForEachStatementSyntax(SyntaxKind kind) - : base(kind) + if (awaitKeyword != null) { + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(variable); + this.variable = variable; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override SyntaxToken? AwaitKeyword => this.awaitKeyword; + public override SyntaxToken ForEachKeyword => this.forEachKeyword; + public override SyntaxToken OpenParenToken => this.openParenToken; + /// + /// The variable(s) of the loop. In correct code this is a tuple + /// literal, declaration expression with a tuple designator, or + /// a discard syntax in the form of a simple identifier. In broken + /// code it could be something else. + /// + public ExpressionSyntax Variable => this.variable; + public override SyntaxToken InKeyword => this.inKeyword; + public override ExpressionSyntax Expression => this.expression; + public override SyntaxToken CloseParenToken => this.closeParenToken; + public override StatementSyntax Statement => this.statement; - protected CommonForEachStatementSyntax(ObjectReader reader) - : base(reader) + internal override GreenNode? GetSlot(int index) + => index switch { - } + 0 => this.attributeLists, + 1 => this.awaitKeyword, + 2 => this.forEachKeyword, + 3 => this.openParenToken, + 4 => this.variable, + 5 => this.inKeyword, + 6 => this.expression, + 7 => this.closeParenToken, + 8 => this.statement, + _ => null, + }; - public abstract SyntaxToken? AwaitKeyword { get; } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachVariableStatementSyntax(this, parent, position); - public abstract SyntaxToken ForEachKeyword { get; } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); - public abstract SyntaxToken OpenParenToken { get; } - - public abstract SyntaxToken InKeyword { get; } + public ForEachVariableStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public abstract ExpressionSyntax Expression { get; } + return this; + } - public abstract SyntaxToken CloseParenToken { get; } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - public abstract StatementSyntax Statement { get; } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); - internal sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax + internal ForEachVariableStatementSyntax(ObjectReader reader) + : base(reader) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken? awaitKeyword; - internal readonly SyntaxToken forEachKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken inKeyword; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - - internal 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) - : base(kind, diagnostics, annotations) + this.SlotCount = 9; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + var awaitKeyword = (SyntaxToken?)reader.ReadValue(); + if (awaitKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } + var forEachKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var variable = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(variable); + this.variable = variable; + var inKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.awaitKeyword); + writer.WriteValue(this.forEachKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.variable); + writer.WriteValue(this.inKeyword); + writer.WriteValue(this.expression); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.statement); + } + + static ForEachVariableStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ForEachVariableStatementSyntax), r => new ForEachVariableStatementSyntax(r)); + } +} - internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) - { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } - - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override SyntaxToken? AwaitKeyword => this.awaitKeyword; - public override SyntaxToken ForEachKeyword => this.forEachKeyword; - public override SyntaxToken OpenParenToken => this.openParenToken; - public TypeSyntax Type => this.type; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public override SyntaxToken InKeyword => this.inKeyword; - public override ExpressionSyntax Expression => this.expression; - public override SyntaxToken CloseParenToken => this.closeParenToken; - public override StatementSyntax Statement => this.statement; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.awaitKeyword, - 2 => this.forEachKeyword, - 3 => this.openParenToken, - 4 => this.type, - 5 => this.identifier, - 6 => this.inKeyword, - 7 => this.expression, - 8 => this.closeParenToken, - 9 => this.statement, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); - - public ForEachStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +internal sealed partial class UsingStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken? awaitKeyword; + internal readonly SyntaxToken usingKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly VariableDeclarationSyntax? declaration; + internal readonly ExpressionSyntax? expression; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; - return this; + internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); - - internal ForEachStatementSyntax(ObjectReader reader) - : base(reader) + if (awaitKeyword != null) { - this.SlotCount = 10; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var awaitKeyword = (SyntaxToken?)reader.ReadValue(); - if (awaitKeyword != null) - { - AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - var forEachKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var inKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } - - internal override void WriteTo(ObjectWriter writer) + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.awaitKeyword); - writer.WriteValue(this.forEachKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.type); - writer.WriteValue(this.identifier); - writer.WriteValue(this.inKeyword); - writer.WriteValue(this.expression); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.statement); + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } - - static ForEachStatementSyntax() + if (expression != null) { - ObjectBinder.RegisterTypeReader(typeof(ForEachStatementSyntax), r => new ForEachStatementSyntax(r)); + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax + internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken? awaitKeyword; - internal readonly SyntaxToken forEachKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax variable; - internal readonly SyntaxToken inKeyword; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - - internal 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) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (awaitKeyword != null) + { + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) + { + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + } + if (expression != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(variable); - this.variable = variable; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; this.AdjustFlagsAndWidth(expression); this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (awaitKeyword != null) + { + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) + { + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + } + if (expression != null) { - this.SetFactoryContext(context); - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(variable); - this.variable = variable; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; this.AdjustFlagsAndWidth(expression); this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken? AwaitKeyword => this.awaitKeyword; + public SyntaxToken UsingKeyword => this.usingKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public VariableDeclarationSyntax? Declaration => this.declaration; + public ExpressionSyntax? Expression => this.expression; + public SyntaxToken CloseParenToken => this.closeParenToken; + public StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(variable); - this.variable = variable; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } - - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override SyntaxToken? AwaitKeyword => this.awaitKeyword; - public override SyntaxToken ForEachKeyword => this.forEachKeyword; - public override SyntaxToken OpenParenToken => this.openParenToken; - /// - /// The variable(s) of the loop. In correct code this is a tuple - /// literal, declaration expression with a tuple designator, or - /// a discard syntax in the form of a simple identifier. In broken - /// code it could be something else. - /// - public ExpressionSyntax Variable => this.variable; - public override SyntaxToken InKeyword => this.inKeyword; - public override ExpressionSyntax Expression => this.expression; - public override SyntaxToken CloseParenToken => this.closeParenToken; - public override StatementSyntax Statement => this.statement; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.awaitKeyword, - 2 => this.forEachKeyword, - 3 => this.openParenToken, - 4 => this.variable, - 5 => this.inKeyword, - 6 => this.expression, - 7 => this.closeParenToken, - 8 => this.statement, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachVariableStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); - - public ForEachVariableStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.attributeLists, + 1 => this.awaitKeyword, + 2 => this.usingKeyword, + 3 => this.openParenToken, + 4 => this.declaration, + 5 => this.expression, + 6 => this.closeParenToken, + 7 => this.statement, + _ => null, + }; - return this; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); + + public UsingStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); - internal ForEachVariableStatementSyntax(ObjectReader reader) - : base(reader) + internal UsingStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 8; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var awaitKeyword = (SyntaxToken?)reader.ReadValue(); + if (awaitKeyword != null) + { + AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + var usingKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var declaration = (VariableDeclarationSyntax?)reader.ReadValue(); + if (declaration != null) + { + AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + } + var expression = (ExpressionSyntax?)reader.ReadValue(); + if (expression != null) { - this.SlotCount = 9; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var awaitKeyword = (SyntaxToken?)reader.ReadValue(); - if (awaitKeyword != null) - { - AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - var forEachKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var variable = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(variable); - this.variable = variable; - var inKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - var expression = (ExpressionSyntax)reader.ReadValue(); AdjustFlagsAndWidth(expression); this.expression = expression; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.awaitKeyword); - writer.WriteValue(this.forEachKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.variable); - writer.WriteValue(this.inKeyword); - writer.WriteValue(this.expression); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.statement); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.awaitKeyword); + writer.WriteValue(this.usingKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.declaration); + writer.WriteValue(this.expression); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.statement); + } + + static UsingStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(UsingStatementSyntax), r => new UsingStatementSyntax(r)); + } +} + +internal sealed partial class FixedStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken fixedKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly VariableDeclarationSyntax declaration; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + + internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(fixedKeyword); + this.fixedKeyword = fixedKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(fixedKeyword); + this.fixedKeyword = fixedKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(fixedKeyword); + this.fixedKeyword = fixedKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken FixedKeyword => this.fixedKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public VariableDeclarationSyntax Declaration => this.declaration; + public SyntaxToken CloseParenToken => this.closeParenToken; + public StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.fixedKeyword, + 2 => this.openParenToken, + 3 => this.declaration, + 4 => this.closeParenToken, + 5 => this.statement, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FixedStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); + + public FixedStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static ForEachVariableStatementSyntax() + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + + internal FixedStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 6; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - ObjectBinder.RegisterTypeReader(typeof(ForEachVariableStatementSyntax), r => new ForEachVariableStatementSyntax(r)); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + var fixedKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(fixedKeyword); + this.fixedKeyword = fixedKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var declaration = (VariableDeclarationSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.fixedKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.declaration); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.statement); } - internal sealed partial class UsingStatementSyntax : StatementSyntax + static FixedStatementSyntax() { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken? awaitKeyword; - internal readonly SyntaxToken usingKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly VariableDeclarationSyntax? declaration; - internal readonly ExpressionSyntax? expression; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; + ObjectBinder.RegisterTypeReader(typeof(FixedStatementSyntax), r => new FixedStatementSyntax(r)); + } +} - internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class CheckedStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken keyword; + internal readonly BlockSyntax block; + + internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken? AwaitKeyword => this.awaitKeyword; - public SyntaxToken UsingKeyword => this.usingKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public VariableDeclarationSyntax? Declaration => this.declaration; - public ExpressionSyntax? Expression => this.expression; - public SyntaxToken CloseParenToken => this.closeParenToken; - public StatementSyntax Statement => this.statement; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken Keyword => this.keyword; + public BlockSyntax Block => this.block; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.awaitKeyword, - 2 => this.usingKeyword, - 3 => this.openParenToken, - 4 => this.declaration, - 5 => this.expression, - 6 => this.closeParenToken, - 7 => this.statement, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.keyword, + 2 => this.block, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); - public UsingStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public CheckedStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + { + if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CheckedStatement(this.Kind, attributeLists, keyword, block); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, GetDiagnostics(), annotations); - internal UsingStatementSyntax(ObjectReader reader) - : base(reader) + internal CheckedStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 8; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var awaitKeyword = (SyntaxToken?)reader.ReadValue(); - if (awaitKeyword != null) - { - AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - var usingKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var declaration = (VariableDeclarationSyntax?)reader.ReadValue(); - if (declaration != null) - { - AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - var expression = (ExpressionSyntax?)reader.ReadValue(); - if (expression != null) - { - AdjustFlagsAndWidth(expression); - this.expression = expression; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var block = (BlockSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(block); + this.block = block; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.keyword); + writer.WriteValue(this.block); + } + + static CheckedStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(CheckedStatementSyntax), r => new CheckedStatementSyntax(r)); + } +} + +internal sealed partial class UnsafeStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken unsafeKeyword; + internal readonly BlockSyntax block; - internal override void WriteTo(ObjectWriter writer) + internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.awaitKeyword); - writer.WriteValue(this.usingKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.declaration); - writer.WriteValue(this.expression); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.statement); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - static UsingStatementSyntax() + internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - ObjectBinder.RegisterTypeReader(typeof(UsingStatementSyntax), r => new UsingStatementSyntax(r)); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; } - internal sealed partial class FixedStatementSyntax : StatementSyntax + internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken fixedKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly VariableDeclarationSyntax declaration; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; + this.SlotCount = 3; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken UnsafeKeyword => this.unsafeKeyword; + public BlockSyntax Block => this.block; - internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(fixedKeyword); - this.fixedKeyword = fixedKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } + 0 => this.attributeLists, + 1 => this.unsafeKeyword, + 2 => this.block, + _ => null, + }; - internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(fixedKeyword); - this.fixedKeyword = fixedKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnsafeStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); - internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + public UnsafeStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + { + if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(fixedKeyword); - this.fixedKeyword = fixedKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken FixedKeyword => this.fixedKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public VariableDeclarationSyntax Declaration => this.declaration; - public SyntaxToken CloseParenToken => this.closeParenToken; - public StatementSyntax Statement => this.statement; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.fixedKeyword, - 2 => this.openParenToken, - 3 => this.declaration, - 4 => this.closeParenToken, - 5 => this.statement, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FixedStatementSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, GetDiagnostics(), annotations); - public FixedStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + internal UnsafeStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var unsafeKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + var block = (BlockSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(block); + this.block = block; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.unsafeKeyword); + writer.WriteValue(this.block); + } + + static UnsafeStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(UnsafeStatementSyntax), r => new UnsafeStatementSyntax(r)); + } +} + +internal sealed partial class LockStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken lockKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + + internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(lockKeyword); + this.lockKeyword = lockKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - return this; + internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(lockKeyword); + this.lockKeyword = lockKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(lockKeyword); + this.lockKeyword = lockKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken LockKeyword => this.lockKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public ExpressionSyntax Expression => this.expression; + public SyntaxToken CloseParenToken => this.closeParenToken; + public StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.lockKeyword, + 2 => this.openParenToken, + 3 => this.expression, + 4 => this.closeParenToken, + 5 => this.statement, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LockStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); + + public LockStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); - internal FixedStatementSyntax(ObjectReader reader) - : base(reader) + internal LockStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 6; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 6; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var fixedKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(fixedKeyword); - this.fixedKeyword = fixedKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var declaration = (VariableDeclarationSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + var lockKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(lockKeyword); + this.lockKeyword = lockKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.lockKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.expression); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.statement); + } + + static LockStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(LockStatementSyntax), r => new LockStatementSyntax(r)); + } +} + +/// +/// Represents an if statement syntax. +/// +internal sealed partial class IfStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken ifKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + internal readonly ElseClauseSyntax? @else; - internal override void WriteTo(ObjectWriter writer) + internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 7; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.fixedKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.declaration); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.statement); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static FixedStatementSyntax() + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + if (@else != null) { - ObjectBinder.RegisterTypeReader(typeof(FixedStatementSyntax), r => new FixedStatementSyntax(r)); + this.AdjustFlagsAndWidth(@else); + this.@else = @else; } } - internal sealed partial class CheckedStatementSyntax : StatementSyntax + internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken keyword; - internal readonly BlockSyntax block; - - internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 7; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + if (@else != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(@else); + this.@else = @else; } + } - internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block) - : base(kind) + internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + : base(kind) + { + this.SlotCount = 7; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + if (@else != null) + { + this.AdjustFlagsAndWidth(@else); + this.@else = @else; } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken Keyword => this.keyword; - public BlockSyntax Block => this.block; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// + /// Gets a SyntaxToken that represents the if keyword. + /// + public SyntaxToken IfKeyword => this.ifKeyword; + /// + /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. + /// + public SyntaxToken OpenParenToken => this.openParenToken; + /// + /// Gets an ExpressionSyntax that represents the condition of the if statement. + /// + public ExpressionSyntax Condition => this.condition; + /// + /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. + /// + public SyntaxToken CloseParenToken => this.closeParenToken; + /// + /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. + /// + public StatementSyntax Statement => this.statement; + /// + /// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. + /// + public ElseClauseSyntax? Else => this.@else; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.keyword, - 2 => this.block, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.ifKeyword, + 2 => this.openParenToken, + 3 => this.condition, + 4 => this.closeParenToken, + 5 => this.statement, + 6 => this.@else, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); - public CheckedStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + public IfStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax @else) + { + if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) { - if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) - { - var newNode = SyntaxFactory.CheckedStatement(this.Kind, attributeLists, keyword, block); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, diagnostics, GetAnnotations()); - internal CheckedStatementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var block = (BlockSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(block); - this.block = block; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal IfStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 7; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.keyword); - writer.WriteValue(this.block); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static CheckedStatementSyntax() + var ifKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var condition = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(condition); + this.condition = condition; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + var @else = (ElseClauseSyntax?)reader.ReadValue(); + if (@else != null) { - ObjectBinder.RegisterTypeReader(typeof(CheckedStatementSyntax), r => new CheckedStatementSyntax(r)); + AdjustFlagsAndWidth(@else); + this.@else = @else; } } - internal sealed partial class UnsafeStatementSyntax : StatementSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken unsafeKeyword; - internal readonly BlockSyntax block; - - internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - } + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.ifKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.condition); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.statement); + writer.WriteValue(this.@else); + } - internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - } + static IfStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(IfStatementSyntax), r => new IfStatementSyntax(r)); + } +} - internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) - : base(kind) - { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - } +/// Represents an else statement syntax. +internal sealed partial class ElseClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken elseKeyword; + internal readonly StatementSyntax statement; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken UnsafeKeyword => this.unsafeKeyword; - public BlockSyntax Block => this.block; + internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.unsafeKeyword, - 2 => this.block, - _ => null, - }; + internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnsafeStatementSyntax(this, parent, position); + internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); + /// + /// Gets a syntax token + /// + public SyntaxToken ElseKeyword => this.elseKeyword; + public StatementSyntax Statement => this.statement; - public UnsafeStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + internal override GreenNode? GetSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) - { - var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.elseKeyword, + 1 => this.statement, + _ => null, + }; - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseClauseSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); - internal UnsafeStatementSyntax(ObjectReader reader) - : base(reader) + public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement) + { + if (elseKeyword != this.ElseKeyword || statement != this.Statement) { - this.SlotCount = 3; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var unsafeKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - var block = (BlockSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(block); - this.block = block; + var newNode = SyntaxFactory.ElseClause(elseKeyword, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.unsafeKeyword); - writer.WriteValue(this.block); - } + return this; + } - static UnsafeStatementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(UnsafeStatementSyntax), r => new UnsafeStatementSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, GetDiagnostics(), annotations); + + internal ElseClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var elseKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + var statement = (StatementSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.elseKeyword); + writer.WriteValue(this.statement); } - internal sealed partial class LockStatementSyntax : StatementSyntax + static ElseClauseSyntax() { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken lockKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; + ObjectBinder.RegisterTypeReader(typeof(ElseClauseSyntax), r => new ElseClauseSyntax(r)); + } +} + +/// Represents a switch statement syntax. +internal sealed partial class SwitchStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken switchKeyword; + internal readonly SyntaxToken? openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken? closeParenToken; + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? sections; + internal readonly SyntaxToken closeBraceToken; - internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + if (openParenToken != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(lockKeyword); - this.lockKeyword = lockKeyword; this.AdjustFlagsAndWidth(openParenToken); this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (closeParenToken != null) + { this.AdjustFlagsAndWidth(closeParenToken); this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; } + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (sections != null) + { + this.AdjustFlagsAndWidth(sections); + this.sections = sections; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + if (openParenToken != null) { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(lockKeyword); - this.lockKeyword = lockKeyword; this.AdjustFlagsAndWidth(openParenToken); this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (closeParenToken != null) + { this.AdjustFlagsAndWidth(closeParenToken); this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; } + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (sections != null) + { + this.AdjustFlagsAndWidth(sections); + this.sections = sections; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + if (openParenToken != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(lockKeyword); - this.lockKeyword = lockKeyword; this.AdjustFlagsAndWidth(openParenToken); this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (closeParenToken != null) + { this.AdjustFlagsAndWidth(closeParenToken); this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; } + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (sections != null) + { + this.AdjustFlagsAndWidth(sections); + this.sections = sections; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken LockKeyword => this.lockKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public ExpressionSyntax Expression => this.expression; - public SyntaxToken CloseParenToken => this.closeParenToken; - public StatementSyntax Statement => this.statement; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// + /// Gets a SyntaxToken that represents the switch keyword. + /// + public SyntaxToken SwitchKeyword => this.switchKeyword; + /// + /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. + /// + public SyntaxToken? OpenParenToken => this.openParenToken; + /// + /// Gets an ExpressionSyntax representing the expression of the switch statement. + /// + public ExpressionSyntax Expression => this.expression; + /// + /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. + /// + public SyntaxToken? CloseParenToken => this.closeParenToken; + /// + /// Gets a SyntaxToken that represents the open braces preceding the switch sections. + /// + public SyntaxToken OpenBraceToken => this.openBraceToken; + /// + /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. + /// + public CoreSyntax.SyntaxList Sections => new CoreSyntax.SyntaxList(this.sections); + /// + /// Gets a SyntaxToken that represents the open braces following the switch sections. + /// + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.lockKeyword, - 2 => this.openParenToken, - 3 => this.expression, - 4 => this.closeParenToken, - 5 => this.statement, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.switchKeyword, + 2 => this.openParenToken, + 3 => this.expression, + 4 => this.closeParenToken, + 5 => this.openBraceToken, + 6 => this.sections, + 7 => this.closeBraceToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LockStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); - public LockStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public SwitchStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + { + if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) { - if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, GetDiagnostics(), annotations); - internal LockStatementSyntax(ObjectReader reader) - : base(reader) + internal SwitchStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 8; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var switchKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + var openParenToken = (SyntaxToken?)reader.ReadValue(); + if (openParenToken != null) { - this.SlotCount = 6; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var lockKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(lockKeyword); - this.lockKeyword = lockKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); AdjustFlagsAndWidth(openParenToken); this.openParenToken = openParenToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var closeParenToken = (SyntaxToken)reader.ReadValue(); + } + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + var closeParenToken = (SyntaxToken?)reader.ReadValue(); + if (closeParenToken != null) + { AdjustFlagsAndWidth(closeParenToken); this.closeParenToken = closeParenToken; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; } - - internal override void WriteTo(ObjectWriter writer) + var openBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + var sections = (GreenNode?)reader.ReadValue(); + if (sections != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.lockKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.expression); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.statement); + AdjustFlagsAndWidth(sections); + this.sections = sections; } + var closeBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - static LockStatementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(LockStatementSyntax), r => new LockStatementSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.switchKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.expression); + writer.WriteValue(this.closeParenToken); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.sections); + writer.WriteValue(this.closeBraceToken); } - /// - /// Represents an if statement syntax. - /// - internal sealed partial class IfStatementSyntax : StatementSyntax + static SwitchStatementSyntax() { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken ifKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - internal readonly ElseClauseSyntax? @else; + ObjectBinder.RegisterTypeReader(typeof(SwitchStatementSyntax), r => new SwitchStatementSyntax(r)); + } +} - internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - if (@else != null) - { - this.AdjustFlagsAndWidth(@else); - this.@else = @else; - } - } +/// Represents a switch section syntax of a switch statement. +internal sealed partial class SwitchSectionSyntax : CSharpSyntaxNode +{ + internal readonly GreenNode? labels; + internal readonly GreenNode? statements; - internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, SyntaxFactoryContext context) - : base(kind) + internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (labels != null) { - this.SetFactoryContext(context); - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - if (@else != null) - { - this.AdjustFlagsAndWidth(@else); - this.@else = @else; - } + this.AdjustFlagsAndWidth(labels); + this.labels = labels; } - - internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) - : base(kind) + if (statements != null) { - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - if (@else != null) - { - this.AdjustFlagsAndWidth(@else); - this.@else = @else; - } + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - /// - /// Gets a SyntaxToken that represents the if keyword. - /// - public SyntaxToken IfKeyword => this.ifKeyword; - /// - /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. - /// - public SyntaxToken OpenParenToken => this.openParenToken; - /// - /// Gets an ExpressionSyntax that represents the condition of the if statement. - /// - public ExpressionSyntax Condition => this.condition; - /// - /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. - /// - public SyntaxToken CloseParenToken => this.closeParenToken; - /// - /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. - /// - public StatementSyntax Statement => this.statement; - /// - /// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. - /// - public ElseClauseSyntax? Else => this.@else; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.ifKeyword, - 2 => this.openParenToken, - 3 => this.condition, - 4 => this.closeParenToken, - 5 => this.statement, - 6 => this.@else, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); - - public IfStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax @else) + internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + if (labels != null) { - if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) - { - var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(labels); + this.labels = labels; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, GetDiagnostics(), annotations); - - internal IfStatementSyntax(ObjectReader reader) - : base(reader) + if (statements != null) { - this.SlotCount = 7; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var ifKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var condition = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(condition); - this.condition = condition; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; - var @else = (ElseClauseSyntax?)reader.ReadValue(); - if (@else != null) - { - AdjustFlagsAndWidth(@else); - this.@else = @else; - } + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + } - internal override void WriteTo(ObjectWriter writer) + internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements) + : base(kind) + { + this.SlotCount = 2; + if (labels != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.ifKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.condition); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.statement); - writer.WriteValue(this.@else); + this.AdjustFlagsAndWidth(labels); + this.labels = labels; } - - static IfStatementSyntax() + if (statements != null) { - ObjectBinder.RegisterTypeReader(typeof(IfStatementSyntax), r => new IfStatementSyntax(r)); + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } } - /// Represents an else statement syntax. - internal sealed partial class ElseClauseSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken elseKeyword; - internal readonly StatementSyntax statement; + /// + /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. + /// + public CoreSyntax.SyntaxList Labels => new CoreSyntax.SyntaxList(this.labels); + /// + /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. + /// + public CoreSyntax.SyntaxList Statements => new CoreSyntax.SyntaxList(this.statements); - internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } + 0 => this.labels, + 1 => this.statements, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchSectionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); - internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + public SwitchSectionSyntax Update(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) + { + if (labels != this.Labels || statements != this.Statements) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + var newNode = SyntaxFactory.SwitchSection(labels, statements); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement) - : base(kind) + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SwitchSectionSyntax(this.Kind, this.labels, this.statements, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SwitchSectionSyntax(this.Kind, this.labels, this.statements, GetDiagnostics(), annotations); + + internal SwitchSectionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var labels = (GreenNode?)reader.ReadValue(); + if (labels != null) + { + AdjustFlagsAndWidth(labels); + this.labels = labels; + } + var statements = (GreenNode?)reader.ReadValue(); + if (statements != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + AdjustFlagsAndWidth(statements); + this.statements = statements; } + } - /// - /// Gets a syntax token - /// - public SyntaxToken ElseKeyword => this.elseKeyword; - public StatementSyntax Statement => this.statement; + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.labels); + writer.WriteValue(this.statements); + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.elseKeyword, - 1 => this.statement, - _ => null, - }; + static SwitchSectionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(SwitchSectionSyntax), r => new SwitchSectionSyntax(r)); + } +} - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseClauseSyntax(this, parent, position); +/// Represents a switch label within a switch statement. +internal abstract partial class SwitchLabelSyntax : CSharpSyntaxNode +{ + internal SwitchLabelSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); + internal SwitchLabelSyntax(SyntaxKind kind) + : base(kind) + { + } - public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement) - { - if (elseKeyword != this.ElseKeyword || statement != this.Statement) - { - var newNode = SyntaxFactory.ElseClause(elseKeyword, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + protected SwitchLabelSyntax(ObjectReader reader) + : base(reader) + { + } - return this; - } + /// + /// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. + /// + public abstract SyntaxToken Keyword { get; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, diagnostics, GetAnnotations()); + /// + /// Gets a SyntaxToken that represents the colon that terminates the switch label. + /// + public abstract SyntaxToken ColonToken { get; } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, GetDiagnostics(), annotations); +/// Represents a case label within a switch statement. +internal sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly PatternSyntax pattern; + internal readonly WhenClauseSyntax? whenClause; + internal readonly SyntaxToken colonToken; - internal ElseClauseSyntax(ObjectReader reader) - : base(reader) + internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - this.SlotCount = 2; - var elseKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - var statement = (StatementSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override void WriteTo(ObjectWriter writer) + internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - base.WriteTo(writer); - writer.WriteValue(this.elseKeyword); - writer.WriteValue(this.statement); + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - static ElseClauseSyntax() + internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - ObjectBinder.RegisterTypeReader(typeof(ElseClauseSyntax), r => new ElseClauseSyntax(r)); + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; } - /// Represents a switch statement syntax. - internal sealed partial class SwitchStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken switchKeyword; - internal readonly SyntaxToken? openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken? closeParenToken; - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? sections; - internal readonly SyntaxToken closeBraceToken; + /// Gets the case keyword token. + public override SyntaxToken Keyword => this.keyword; + /// + /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. + /// + public PatternSyntax Pattern => this.pattern; + public WhenClauseSyntax? WhenClause => this.whenClause; + public override SyntaxToken ColonToken => this.colonToken; - internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - if (openParenToken != null) - { - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (closeParenToken != null) - { - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (sections != null) - { - this.AdjustFlagsAndWidth(sections); - this.sections = sections; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + 0 => this.keyword, + 1 => this.pattern, + 2 => this.whenClause, + 3 => this.colonToken, + _ => null, + }; - internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - if (openParenToken != null) - { - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (closeParenToken != null) - { - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (sections != null) - { - this.AdjustFlagsAndWidth(sections); - this.sections = sections; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CasePatternSwitchLabelSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); - internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken) - : base(kind) + public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken colonToken) + { + if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - if (openParenToken != null) - { - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (closeParenToken != null) - { - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (sections != null) - { - this.AdjustFlagsAndWidth(sections); - this.sections = sections; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - /// - /// Gets a SyntaxToken that represents the switch keyword. - /// - public SyntaxToken SwitchKeyword => this.switchKeyword; - /// - /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. - /// - public SyntaxToken? OpenParenToken => this.openParenToken; - /// - /// Gets an ExpressionSyntax representing the expression of the switch statement. - /// - public ExpressionSyntax Expression => this.expression; - /// - /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. - /// - public SyntaxToken? CloseParenToken => this.closeParenToken; - /// - /// Gets a SyntaxToken that represents the open braces preceding the switch sections. - /// - public SyntaxToken OpenBraceToken => this.openBraceToken; - /// - /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. - /// - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Sections => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.sections); - /// - /// Gets a SyntaxToken that represents the open braces following the switch sections. - /// - public SyntaxToken CloseBraceToken => this.closeBraceToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.switchKeyword, - 2 => this.openParenToken, - 3 => this.expression, - 4 => this.closeParenToken, - 5 => this.openBraceToken, - 6 => this.sections, - 7 => this.closeBraceToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchStatementSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, GetDiagnostics(), annotations); - public SwitchStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + internal CasePatternSwitchLabelSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var pattern = (PatternSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + var whenClause = (WhenClauseSyntax?)reader.ReadValue(); + if (whenClause != null) { - if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.keyword); + writer.WriteValue(this.pattern); + writer.WriteValue(this.whenClause); + writer.WriteValue(this.colonToken); + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, GetDiagnostics(), annotations); + static CasePatternSwitchLabelSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(CasePatternSwitchLabelSyntax), r => new CasePatternSwitchLabelSyntax(r)); + } +} - internal SwitchStatementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 8; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var switchKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - var openParenToken = (SyntaxToken?)reader.ReadValue(); - if (openParenToken != null) - { - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - } - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - var closeParenToken = (SyntaxToken?)reader.ReadValue(); - if (closeParenToken != null) - { - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } - var openBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - var sections = (GreenNode?)reader.ReadValue(); - if (sections != null) - { - AdjustFlagsAndWidth(sections); - this.sections = sections; - } - var closeBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } +/// Represents a case label within a switch statement. +internal sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly ExpressionSyntax value; + internal readonly SyntaxToken colonToken; - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.switchKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.expression); - writer.WriteValue(this.closeParenToken); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.sections); - writer.WriteValue(this.closeBraceToken); - } + internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(value); + this.value = value; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - static SwitchStatementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(SwitchStatementSyntax), r => new SwitchStatementSyntax(r)); - } + internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(value); + this.value = value; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; } - /// Represents a switch section syntax of a switch statement. - internal sealed partial class SwitchSectionSyntax : CSharpSyntaxNode + internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + : base(kind) { - internal readonly GreenNode? labels; - internal readonly GreenNode? statements; + this.SlotCount = 3; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(value); + this.value = value; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - if (labels != null) - { - this.AdjustFlagsAndWidth(labels); - this.labels = labels; - } - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - } + /// Gets the case keyword token. + public override SyntaxToken Keyword => this.keyword; + /// + /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. + /// + public ExpressionSyntax Value => this.value; + public override SyntaxToken ColonToken => this.colonToken; - internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (labels != null) - { - this.AdjustFlagsAndWidth(labels); - this.labels = labels; - } - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - } + 0 => this.keyword, + 1 => this.value, + 2 => this.colonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CaseSwitchLabelSyntax(this, parent, position); - internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); + + public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + { + if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken) { - this.SlotCount = 2; - if (labels != null) - { - this.AdjustFlagsAndWidth(labels); - this.labels = labels; - } - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } + var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// - /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. - /// - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Labels => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.labels); - /// - /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. - /// - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Statements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.statements); + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.labels, - 1 => this.statements, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchSectionSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, GetDiagnostics(), annotations); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); + internal CaseSwitchLabelSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var value = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(value); + this.value = value; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - public SwitchSectionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements) - { - if (labels != this.Labels || statements != this.Statements) - { - var newNode = SyntaxFactory.SwitchSection(labels, statements); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.keyword); + writer.WriteValue(this.value); + writer.WriteValue(this.colonToken); + } - return this; - } + static CaseSwitchLabelSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(CaseSwitchLabelSyntax), r => new CaseSwitchLabelSyntax(r)); + } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SwitchSectionSyntax(this.Kind, this.labels, this.statements, diagnostics, GetAnnotations()); +/// Represents a default label within a switch statement. +internal sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken colonToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SwitchSectionSyntax(this.Kind, this.labels, this.statements, GetDiagnostics(), annotations); + internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal SwitchSectionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var labels = (GreenNode?)reader.ReadValue(); - if (labels != null) - { - AdjustFlagsAndWidth(labels); - this.labels = labels; - } - var statements = (GreenNode?)reader.ReadValue(); - if (statements != null) - { - AdjustFlagsAndWidth(statements); - this.statements = statements; - } - } + internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.labels); - writer.WriteValue(this.statements); - } + internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - static SwitchSectionSyntax() + /// Gets the default keyword token. + public override SyntaxToken Keyword => this.keyword; + public override SyntaxToken ColonToken => this.colonToken; + + internal override GreenNode? GetSlot(int index) + => index switch { - ObjectBinder.RegisterTypeReader(typeof(SwitchSectionSyntax), r => new SwitchSectionSyntax(r)); - } - } + 0 => this.keyword, + 1 => this.colonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultSwitchLabelSyntax(this, parent, position); - /// Represents a switch label within a switch statement. - internal abstract partial class SwitchLabelSyntax : CSharpSyntaxNode + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); + + public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken) { - internal SwitchLabelSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (keyword != this.Keyword || colonToken != this.ColonToken) { + var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal SwitchLabelSyntax(SyntaxKind kind) - : base(kind) - { - } + return this; + } - protected SwitchLabelSyntax(ObjectReader reader) - : base(reader) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, diagnostics, GetAnnotations()); - /// - /// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. - /// - public abstract SyntaxToken Keyword { get; } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, GetDiagnostics(), annotations); - /// - /// Gets a SyntaxToken that represents the colon that terminates the switch label. - /// - public abstract SyntaxToken ColonToken { get; } + internal DefaultSwitchLabelSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; } - /// Represents a case label within a switch statement. - internal sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken keyword; - internal readonly PatternSyntax pattern; - internal readonly WhenClauseSyntax? whenClause; - internal readonly SyntaxToken colonToken; + base.WriteTo(writer); + writer.WriteValue(this.keyword); + writer.WriteValue(this.colonToken); + } - internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + static DefaultSwitchLabelSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(DefaultSwitchLabelSyntax), r => new DefaultSwitchLabelSyntax(r)); + } +} + +internal sealed partial class SwitchExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax governingExpression; + internal readonly SyntaxToken switchKeyword; + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? arms; + internal readonly SyntaxToken closeBraceToken; + + internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(governingExpression); + this.governingExpression = governingExpression; + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (arms != null) + { + this.AdjustFlagsAndWidth(arms); + this.arms = arms; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(governingExpression); + this.governingExpression = governingExpression; + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (arms != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(arms); + this.arms = arms; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) - : base(kind) + internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(governingExpression); + this.governingExpression = governingExpression; + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (arms != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(arms); + this.arms = arms; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - /// Gets the case keyword token. - public override SyntaxToken Keyword => this.keyword; - /// - /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. - /// - public PatternSyntax Pattern => this.pattern; - public WhenClauseSyntax? WhenClause => this.whenClause; - public override SyntaxToken ColonToken => this.colonToken; + public ExpressionSyntax GoverningExpression => this.governingExpression; + public SyntaxToken SwitchKeyword => this.switchKeyword; + public SyntaxToken OpenBraceToken => this.openBraceToken; + public CoreSyntax.SeparatedSyntaxList Arms => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arms)); + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.pattern, - 2 => this.whenClause, - 3 => this.colonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.governingExpression, + 1 => this.switchKeyword, + 2 => this.openBraceToken, + 3 => this.arms, + 4 => this.closeBraceToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CasePatternSwitchLabelSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); - public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken colonToken) + public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + { + if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) { - if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, diagnostics, GetAnnotations()); - internal CasePatternSwitchLabelSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var pattern = (PatternSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - var whenClause = (WhenClauseSyntax?)reader.ReadValue(); - if (whenClause != null) - { - AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal SwitchExpressionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var governingExpression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(governingExpression); + this.governingExpression = governingExpression; + var switchKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + var openBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + var arms = (GreenNode?)reader.ReadValue(); + if (arms != null) { - base.WriteTo(writer); - writer.WriteValue(this.keyword); - writer.WriteValue(this.pattern); - writer.WriteValue(this.whenClause); - writer.WriteValue(this.colonToken); + AdjustFlagsAndWidth(arms); + this.arms = arms; } + var closeBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - static CasePatternSwitchLabelSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(CasePatternSwitchLabelSyntax), r => new CasePatternSwitchLabelSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.governingExpression); + writer.WriteValue(this.switchKeyword); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.arms); + writer.WriteValue(this.closeBraceToken); } - /// Represents a case label within a switch statement. - internal sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax + static SwitchExpressionSyntax() { - internal readonly SyntaxToken keyword; - internal readonly ExpressionSyntax value; - internal readonly SyntaxToken colonToken; + ObjectBinder.RegisterTypeReader(typeof(SwitchExpressionSyntax), r => new SwitchExpressionSyntax(r)); + } +} + +internal sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode +{ + internal readonly PatternSyntax pattern; + internal readonly WhenClauseSyntax? whenClause; + internal readonly SyntaxToken equalsGreaterThanToken; + internal readonly ExpressionSyntax expression; - internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(value); - this.value = value; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(equalsGreaterThanToken); + this.equalsGreaterThanToken = equalsGreaterThanToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(value); - this.value = value; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(equalsGreaterThanToken); + this.equalsGreaterThanToken = equalsGreaterThanToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) - : base(kind) + internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(value); - this.value = value; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(equalsGreaterThanToken); + this.equalsGreaterThanToken = equalsGreaterThanToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - /// Gets the case keyword token. - public override SyntaxToken Keyword => this.keyword; - /// - /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. - /// - public ExpressionSyntax Value => this.value; - public override SyntaxToken ColonToken => this.colonToken; + public PatternSyntax Pattern => this.pattern; + public WhenClauseSyntax? WhenClause => this.whenClause; + public SyntaxToken EqualsGreaterThanToken => this.equalsGreaterThanToken; + public ExpressionSyntax Expression => this.expression; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.value, - 2 => this.colonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.pattern, + 1 => this.whenClause, + 2 => this.equalsGreaterThanToken, + 3 => this.expression, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CaseSwitchLabelSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionArmSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); - public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + { + if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression) { - if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, diagnostics, GetAnnotations()); - internal CaseSwitchLabelSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var value = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(value); - this.value = value; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal SwitchExpressionArmSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var pattern = (PatternSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + var whenClause = (WhenClauseSyntax?)reader.ReadValue(); + if (whenClause != null) { - base.WriteTo(writer); - writer.WriteValue(this.keyword); - writer.WriteValue(this.value); - writer.WriteValue(this.colonToken); + AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + var equalsGreaterThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(equalsGreaterThanToken); + this.equalsGreaterThanToken = equalsGreaterThanToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - static CaseSwitchLabelSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(CaseSwitchLabelSyntax), r => new CaseSwitchLabelSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.pattern); + writer.WriteValue(this.whenClause); + writer.WriteValue(this.equalsGreaterThanToken); + writer.WriteValue(this.expression); } - /// Represents a default label within a switch statement. - internal sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax + static SwitchExpressionArmSyntax() { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken colonToken; + ObjectBinder.RegisterTypeReader(typeof(SwitchExpressionArmSyntax), r => new SwitchExpressionArmSyntax(r)); + } +} - internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } +internal sealed partial class TryStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken tryKeyword; + internal readonly BlockSyntax block; + internal readonly GreenNode? catches; + internal readonly FinallyClauseSyntax? @finally; - internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken) - : base(kind) + this.AdjustFlagsAndWidth(tryKeyword); + this.tryKeyword = tryKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + if (catches != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(catches); + this.catches = catches; } - - /// Gets the default keyword token. - public override SyntaxToken Keyword => this.keyword; - public override SyntaxToken ColonToken => this.colonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.colonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultSwitchLabelSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); - - public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken) + if (@finally != null) { - if (keyword != this.Keyword || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(@finally); + this.@finally = @finally; } + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, GetDiagnostics(), annotations); - - internal DefaultSwitchLabelSyntax(ObjectReader reader) - : base(reader) + internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 2; - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + this.AdjustFlagsAndWidth(tryKeyword); + this.tryKeyword = tryKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + if (catches != null) { - base.WriteTo(writer); - writer.WriteValue(this.keyword); - writer.WriteValue(this.colonToken); + this.AdjustFlagsAndWidth(catches); + this.catches = catches; } - - static DefaultSwitchLabelSyntax() + if (@finally != null) { - ObjectBinder.RegisterTypeReader(typeof(DefaultSwitchLabelSyntax), r => new DefaultSwitchLabelSyntax(r)); + this.AdjustFlagsAndWidth(@finally); + this.@finally = @finally; } } - internal sealed partial class SwitchExpressionSyntax : ExpressionSyntax + internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally) + : base(kind) { - internal readonly ExpressionSyntax governingExpression; - internal readonly SyntaxToken switchKeyword; - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? arms; - internal readonly SyntaxToken closeBraceToken; - - internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(governingExpression); - this.governingExpression = governingExpression; - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (arms != null) - { - this.AdjustFlagsAndWidth(arms); - this.arms = arms; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(tryKeyword); + this.tryKeyword = tryKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + if (catches != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(governingExpression); - this.governingExpression = governingExpression; - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (arms != null) - { - this.AdjustFlagsAndWidth(arms); - this.arms = arms; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(catches); + this.catches = catches; } - - internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken) - : base(kind) + if (@finally != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(governingExpression); - this.governingExpression = governingExpression; - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (arms != null) - { - this.AdjustFlagsAndWidth(arms); - this.arms = arms; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(@finally); + this.@finally = @finally; } + } - public ExpressionSyntax GoverningExpression => this.governingExpression; - public SyntaxToken SwitchKeyword => this.switchKeyword; - public SyntaxToken OpenBraceToken => this.openBraceToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arms => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arms)); - public SyntaxToken CloseBraceToken => this.closeBraceToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken TryKeyword => this.tryKeyword; + public BlockSyntax Block => this.block; + public CoreSyntax.SyntaxList Catches => new CoreSyntax.SyntaxList(this.catches); + public FinallyClauseSyntax? Finally => this.@finally; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.governingExpression, - 1 => this.switchKeyword, - 2 => this.openBraceToken, - 3 => this.arms, - 4 => this.closeBraceToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.tryKeyword, + 2 => this.block, + 3 => this.catches, + 4 => this.@finally, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TryStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); - public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + public TryStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax @finally) + { + if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) { - if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, GetDiagnostics(), annotations); - internal SwitchExpressionSyntax(ObjectReader reader) - : base(reader) + internal TryStatementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 5; - var governingExpression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(governingExpression); - this.governingExpression = governingExpression; - var switchKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - var openBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - var arms = (GreenNode?)reader.ReadValue(); - if (arms != null) - { - AdjustFlagsAndWidth(arms); - this.arms = arms; - } - var closeBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + var tryKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(tryKeyword); + this.tryKeyword = tryKeyword; + var block = (BlockSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(block); + this.block = block; + var catches = (GreenNode?)reader.ReadValue(); + if (catches != null) { - base.WriteTo(writer); - writer.WriteValue(this.governingExpression); - writer.WriteValue(this.switchKeyword); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.arms); - writer.WriteValue(this.closeBraceToken); + AdjustFlagsAndWidth(catches); + this.catches = catches; } - - static SwitchExpressionSyntax() + var @finally = (FinallyClauseSyntax?)reader.ReadValue(); + if (@finally != null) { - ObjectBinder.RegisterTypeReader(typeof(SwitchExpressionSyntax), r => new SwitchExpressionSyntax(r)); + AdjustFlagsAndWidth(@finally); + this.@finally = @finally; } } - internal sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal readonly PatternSyntax pattern; - internal readonly WhenClauseSyntax? whenClause; - internal readonly SyntaxToken equalsGreaterThanToken; - internal readonly ExpressionSyntax expression; + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.tryKeyword); + writer.WriteValue(this.block); + writer.WriteValue(this.catches); + writer.WriteValue(this.@finally); + } + + static TryStatementSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(TryStatementSyntax), r => new TryStatementSyntax(r)); + } +} + +internal sealed partial class CatchClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken catchKeyword; + internal readonly CatchDeclarationSyntax? declaration; + internal readonly CatchFilterClauseSyntax? filter; + internal readonly BlockSyntax block; - internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(catchKeyword); + this.catchKeyword = catchKeyword; + if (declaration != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(equalsGreaterThanToken); - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } + if (filter != null) + { + this.AdjustFlagsAndWidth(filter); + this.filter = filter; + } + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(catchKeyword); + this.catchKeyword = catchKeyword; + if (declaration != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(equalsGreaterThanToken); - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } + if (filter != null) + { + this.AdjustFlagsAndWidth(filter); + this.filter = filter; + } + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) - : base(kind) + internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(catchKeyword); + this.catchKeyword = catchKeyword; + if (declaration != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(equalsGreaterThanToken); - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } + if (filter != null) + { + this.AdjustFlagsAndWidth(filter); + this.filter = filter; + } + this.AdjustFlagsAndWidth(block); + this.block = block; + } - public PatternSyntax Pattern => this.pattern; - public WhenClauseSyntax? WhenClause => this.whenClause; - public SyntaxToken EqualsGreaterThanToken => this.equalsGreaterThanToken; - public ExpressionSyntax Expression => this.expression; + public SyntaxToken CatchKeyword => this.catchKeyword; + public CatchDeclarationSyntax? Declaration => this.declaration; + public CatchFilterClauseSyntax? Filter => this.filter; + public BlockSyntax Block => this.block; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.pattern, - 1 => this.whenClause, - 2 => this.equalsGreaterThanToken, - 3 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.catchKeyword, + 1 => this.declaration, + 2 => this.filter, + 3 => this.block, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionArmSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchClauseSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); - public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax declaration, CatchFilterClauseSyntax filter, BlockSyntax block) + { + if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block) { - if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression) - { - var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, diagnostics, GetAnnotations()); - internal SwitchExpressionArmSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var pattern = (PatternSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - var whenClause = (WhenClauseSyntax?)reader.ReadValue(); - if (whenClause != null) - { - AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - var equalsGreaterThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(equalsGreaterThanToken); - this.equalsGreaterThanToken = equalsGreaterThanToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal CatchClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var catchKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(catchKeyword); + this.catchKeyword = catchKeyword; + var declaration = (CatchDeclarationSyntax?)reader.ReadValue(); + if (declaration != null) { - base.WriteTo(writer); - writer.WriteValue(this.pattern); - writer.WriteValue(this.whenClause); - writer.WriteValue(this.equalsGreaterThanToken); - writer.WriteValue(this.expression); + AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } - - static SwitchExpressionArmSyntax() + var filter = (CatchFilterClauseSyntax?)reader.ReadValue(); + if (filter != null) { - ObjectBinder.RegisterTypeReader(typeof(SwitchExpressionArmSyntax), r => new SwitchExpressionArmSyntax(r)); + AdjustFlagsAndWidth(filter); + this.filter = filter; } + var block = (BlockSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(block); + this.block = block; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.catchKeyword); + writer.WriteValue(this.declaration); + writer.WriteValue(this.filter); + writer.WriteValue(this.block); } - internal sealed partial class TryStatementSyntax : StatementSyntax + static CatchClauseSyntax() { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken tryKeyword; - internal readonly BlockSyntax block; - internal readonly GreenNode? catches; - internal readonly FinallyClauseSyntax? @finally; + ObjectBinder.RegisterTypeReader(typeof(CatchClauseSyntax), r => new CatchClauseSyntax(r)); + } +} + +internal sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken? identifier; + internal readonly SyntaxToken closeParenToken; - internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(tryKeyword); - this.tryKeyword = tryKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - if (catches != null) - { - this.AdjustFlagsAndWidth(catches); - this.catches = catches; - } - if (@finally != null) - { - this.AdjustFlagsAndWidth(@finally); - this.@finally = @finally; - } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, SyntaxFactoryContext context) - : base(kind) + internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(tryKeyword); - this.tryKeyword = tryKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - if (catches != null) - { - this.AdjustFlagsAndWidth(catches); - this.catches = catches; - } - if (@finally != null) - { - this.AdjustFlagsAndWidth(@finally); - this.@finally = @finally; - } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally) - : base(kind) + internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(tryKeyword); - this.tryKeyword = tryKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - if (catches != null) - { - this.AdjustFlagsAndWidth(catches); - this.catches = catches; - } - if (@finally != null) - { - this.AdjustFlagsAndWidth(@finally); - this.@finally = @finally; - } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken TryKeyword => this.tryKeyword; - public BlockSyntax Block => this.block; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Catches => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.catches); - public FinallyClauseSyntax? Finally => this.@finally; + public SyntaxToken OpenParenToken => this.openParenToken; + public TypeSyntax Type => this.type; + public SyntaxToken? Identifier => this.identifier; + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.tryKeyword, - 2 => this.block, - 3 => this.catches, - 4 => this.@finally, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.type, + 2 => this.identifier, + 3 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TryStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); - public TryStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList catches, FinallyClauseSyntax @finally) + public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken) { - if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) - { - var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, diagnostics, GetAnnotations()); - internal TryStatementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var tryKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(tryKeyword); - this.tryKeyword = tryKeyword; - var block = (BlockSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(block); - this.block = block; - var catches = (GreenNode?)reader.ReadValue(); - if (catches != null) - { - AdjustFlagsAndWidth(catches); - this.catches = catches; - } - var @finally = (FinallyClauseSyntax?)reader.ReadValue(); - if (@finally != null) - { - AdjustFlagsAndWidth(@finally); - this.@finally = @finally; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal CatchDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var identifier = (SyntaxToken?)reader.ReadValue(); + if (identifier != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.tryKeyword); - writer.WriteValue(this.block); - writer.WriteValue(this.catches); - writer.WriteValue(this.@finally); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - static TryStatementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(TryStatementSyntax), r => new TryStatementSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.type); + writer.WriteValue(this.identifier); + writer.WriteValue(this.closeParenToken); } - internal sealed partial class CatchClauseSyntax : CSharpSyntaxNode + static CatchDeclarationSyntax() { - internal readonly SyntaxToken catchKeyword; - internal readonly CatchDeclarationSyntax? declaration; - internal readonly CatchFilterClauseSyntax? filter; - internal readonly BlockSyntax block; + ObjectBinder.RegisterTypeReader(typeof(CatchDeclarationSyntax), r => new CatchDeclarationSyntax(r)); + } +} - internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(catchKeyword); - this.catchKeyword = catchKeyword; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (filter != null) - { - this.AdjustFlagsAndWidth(filter); - this.filter = filter; - } - this.AdjustFlagsAndWidth(block); - this.block = block; - } +internal sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken whenKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax filterExpression; + internal readonly SyntaxToken closeParenToken; + + internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(filterExpression); + this.filterExpression = filterExpression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(catchKeyword); - this.catchKeyword = catchKeyword; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (filter != null) - { - this.AdjustFlagsAndWidth(filter); - this.filter = filter; - } - this.AdjustFlagsAndWidth(block); - this.block = block; - } + internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(filterExpression); + this.filterExpression = filterExpression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(catchKeyword); - this.catchKeyword = catchKeyword; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (filter != null) - { - this.AdjustFlagsAndWidth(filter); - this.filter = filter; - } - this.AdjustFlagsAndWidth(block); - this.block = block; - } + internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(filterExpression); + this.filterExpression = filterExpression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public SyntaxToken CatchKeyword => this.catchKeyword; - public CatchDeclarationSyntax? Declaration => this.declaration; - public CatchFilterClauseSyntax? Filter => this.filter; - public BlockSyntax Block => this.block; + public SyntaxToken WhenKeyword => this.whenKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public ExpressionSyntax FilterExpression => this.filterExpression; + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.catchKeyword, - 1 => this.declaration, - 2 => this.filter, - 3 => this.block, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.whenKeyword, + 1 => this.openParenToken, + 2 => this.filterExpression, + 3 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchFilterClauseSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); - public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax declaration, CatchFilterClauseSyntax filter, BlockSyntax block) + public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + { + if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken) { - if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block) - { - var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, diagnostics, GetAnnotations()); - internal CatchClauseSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var catchKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(catchKeyword); - this.catchKeyword = catchKeyword; - var declaration = (CatchDeclarationSyntax?)reader.ReadValue(); - if (declaration != null) - { - AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - var filter = (CatchFilterClauseSyntax?)reader.ReadValue(); - if (filter != null) - { - AdjustFlagsAndWidth(filter); - this.filter = filter; - } - var block = (BlockSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(block); - this.block = block; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.catchKeyword); - writer.WriteValue(this.declaration); - writer.WriteValue(this.filter); - writer.WriteValue(this.block); - } + internal CatchFilterClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var whenKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var filterExpression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(filterExpression); + this.filterExpression = filterExpression; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - static CatchClauseSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(CatchClauseSyntax), r => new CatchClauseSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.whenKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.filterExpression); + writer.WriteValue(this.closeParenToken); } - internal sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode + static CatchFilterClauseSyntax() { - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken? identifier; - internal readonly SyntaxToken closeParenToken; + ObjectBinder.RegisterTypeReader(typeof(CatchFilterClauseSyntax), r => new CatchFilterClauseSyntax(r)); + } +} - internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +internal sealed partial class FinallyClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken finallyKeyword; + internal readonly BlockSyntax block; - internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(finallyKeyword); + this.finallyKeyword = finallyKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(finallyKeyword); + this.finallyKeyword = finallyKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - public SyntaxToken OpenParenToken => this.openParenToken; - public TypeSyntax Type => this.type; - public SyntaxToken? Identifier => this.identifier; - public SyntaxToken CloseParenToken => this.closeParenToken; + internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(finallyKeyword); + this.finallyKeyword = finallyKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.type, - 2 => this.identifier, - 3 => this.closeParenToken, - _ => null, - }; + public SyntaxToken FinallyKeyword => this.finallyKeyword; + public BlockSyntax Block => this.block; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchDeclarationSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.finallyKeyword, + 1 => this.block, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FinallyClauseSyntax(this, parent, position); - public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); - return this; + public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block) + { + if (finallyKeyword != this.FinallyKeyword || block != this.Block) + { + var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, diagnostics, GetAnnotations()); - internal CatchDeclarationSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var identifier = (SyntaxToken?)reader.ReadValue(); - if (identifier != null) - { - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.type); - writer.WriteValue(this.identifier); - writer.WriteValue(this.closeParenToken); - } + internal FinallyClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var finallyKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(finallyKeyword); + this.finallyKeyword = finallyKeyword; + var block = (BlockSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(block); + this.block = block; + } - static CatchDeclarationSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(CatchDeclarationSyntax), r => new CatchDeclarationSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.finallyKeyword); + writer.WriteValue(this.block); } - internal sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode + static FinallyClauseSyntax() { - internal readonly SyntaxToken whenKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax filterExpression; - internal readonly SyntaxToken closeParenToken; + ObjectBinder.RegisterTypeReader(typeof(FinallyClauseSyntax), r => new FinallyClauseSyntax(r)); + } +} + +internal sealed partial class CompilationUnitSyntax : CSharpSyntaxNode +{ + internal readonly GreenNode? externs; + internal readonly GreenNode? usings; + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? members; + internal readonly SyntaxToken endOfFileToken; - internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (externs != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(filterExpression); - this.filterExpression = filterExpression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(externs); + this.externs = externs; } - - internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + if (usings != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(filterExpression); - this.filterExpression = filterExpression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(usings); + this.usings = usings; } - - internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) - : base(kind) + if (attributeLists != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(filterExpression); - this.filterExpression = filterExpression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - public SyntaxToken WhenKeyword => this.whenKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public ExpressionSyntax FilterExpression => this.filterExpression; - public SyntaxToken CloseParenToken => this.closeParenToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.whenKeyword, - 1 => this.openParenToken, - 2 => this.filterExpression, - 3 => this.closeParenToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchFilterClauseSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); - - public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + if (members != null) { - if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(members); + this.members = members; } + this.AdjustFlagsAndWidth(endOfFileToken); + this.endOfFileToken = endOfFileToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, GetDiagnostics(), annotations); - - internal CatchFilterClauseSyntax(ObjectReader reader) - : base(reader) + internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + if (externs != null) { - this.SlotCount = 4; - var whenKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var filterExpression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(filterExpression); - this.filterExpression = filterExpression; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(externs); + this.externs = externs; } - - internal override void WriteTo(ObjectWriter writer) + if (usings != null) { - base.WriteTo(writer); - writer.WriteValue(this.whenKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.filterExpression); - writer.WriteValue(this.closeParenToken); + this.AdjustFlagsAndWidth(usings); + this.usings = usings; } - - static CatchFilterClauseSyntax() + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (members != null) { - ObjectBinder.RegisterTypeReader(typeof(CatchFilterClauseSyntax), r => new CatchFilterClauseSyntax(r)); + this.AdjustFlagsAndWidth(members); + this.members = members; } + this.AdjustFlagsAndWidth(endOfFileToken); + this.endOfFileToken = endOfFileToken; } - internal sealed partial class FinallyClauseSyntax : CSharpSyntaxNode + internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken) + : base(kind) { - internal readonly SyntaxToken finallyKeyword; - internal readonly BlockSyntax block; - - internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + if (externs != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(finallyKeyword); - this.finallyKeyword = finallyKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(externs); + this.externs = externs; } - - internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, SyntaxFactoryContext context) - : base(kind) + if (usings != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(finallyKeyword); - this.finallyKeyword = finallyKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(usings); + this.usings = usings; } - - internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block) - : base(kind) + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(finallyKeyword); - this.finallyKeyword = finallyKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + this.AdjustFlagsAndWidth(endOfFileToken); + this.endOfFileToken = endOfFileToken; + } - public SyntaxToken FinallyKeyword => this.finallyKeyword; - public BlockSyntax Block => this.block; + public CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); + public CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); + /// Gets the attribute declaration list. + public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public SyntaxToken EndOfFileToken => this.endOfFileToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.finallyKeyword, - 1 => this.block, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.externs, + 1 => this.usings, + 2 => this.attributeLists, + 3 => this.members, + 4 => this.endOfFileToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FinallyClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CompilationUnitSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); - public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block) + public CompilationUnitSyntax Update(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) + { + if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) { - if (finallyKeyword != this.FinallyKeyword || block != this.Block) - { - var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, GetDiagnostics(), annotations); - internal FinallyClauseSyntax(ObjectReader reader) - : base(reader) + internal CompilationUnitSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var externs = (GreenNode?)reader.ReadValue(); + if (externs != null) { - this.SlotCount = 2; - var finallyKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(finallyKeyword); - this.finallyKeyword = finallyKeyword; - var block = (BlockSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(block); - this.block = block; + AdjustFlagsAndWidth(externs); + this.externs = externs; } - - internal override void WriteTo(ObjectWriter writer) + var usings = (GreenNode?)reader.ReadValue(); + if (usings != null) { - base.WriteTo(writer); - writer.WriteValue(this.finallyKeyword); - writer.WriteValue(this.block); + AdjustFlagsAndWidth(usings); + this.usings = usings; } - - static FinallyClauseSyntax() + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - ObjectBinder.RegisterTypeReader(typeof(FinallyClauseSyntax), r => new FinallyClauseSyntax(r)); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + var members = (GreenNode?)reader.ReadValue(); + if (members != null) + { + AdjustFlagsAndWidth(members); + this.members = members; + } + var endOfFileToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfFileToken); + this.endOfFileToken = endOfFileToken; } - internal sealed partial class CompilationUnitSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal readonly GreenNode? externs; - internal readonly GreenNode? usings; - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? members; - internal readonly SyntaxToken endOfFileToken; + base.WriteTo(writer); + writer.WriteValue(this.externs); + writer.WriteValue(this.usings); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.members); + writer.WriteValue(this.endOfFileToken); + } - internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(endOfFileToken); - this.endOfFileToken = endOfFileToken; - } + static CompilationUnitSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(CompilationUnitSyntax), r => new CompilationUnitSyntax(r)); + } +} - internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(endOfFileToken); - this.endOfFileToken = endOfFileToken; - } +/// +/// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. +/// +internal sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken externKeyword; + internal readonly SyntaxToken aliasKeyword; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken semicolonToken; + + internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(externKeyword); + this.externKeyword = externKeyword; + this.AdjustFlagsAndWidth(aliasKeyword); + this.aliasKeyword = aliasKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(externKeyword); + this.externKeyword = externKeyword; + this.AdjustFlagsAndWidth(aliasKeyword); + this.aliasKeyword = aliasKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken) - : base(kind) - { - this.SlotCount = 5; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(endOfFileToken); - this.endOfFileToken = endOfFileToken; - } + internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(externKeyword); + this.externKeyword = externKeyword; + this.AdjustFlagsAndWidth(aliasKeyword); + this.aliasKeyword = aliasKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.externs); - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.usings); - /// Gets the attribute declaration list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); - public SyntaxToken EndOfFileToken => this.endOfFileToken; + /// SyntaxToken representing the extern keyword. + public SyntaxToken ExternKeyword => this.externKeyword; + /// SyntaxToken representing the alias keyword. + public SyntaxToken AliasKeyword => this.aliasKeyword; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + /// SyntaxToken representing the semicolon token. + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.externs, - 1 => this.usings, - 2 => this.attributeLists, - 3 => this.members, - 4 => this.endOfFileToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.externKeyword, + 1 => this.aliasKeyword, + 2 => this.identifier, + 3 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CompilationUnitSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExternAliasDirectiveSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); - public CompilationUnitSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken endOfFileToken) + public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + { + if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken) { - if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) - { - var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, diagnostics, GetAnnotations()); - internal CompilationUnitSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var externs = (GreenNode?)reader.ReadValue(); - if (externs != null) - { - AdjustFlagsAndWidth(externs); - this.externs = externs; - } - var usings = (GreenNode?)reader.ReadValue(); - if (usings != null) - { - AdjustFlagsAndWidth(usings); - this.usings = usings; - } - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var members = (GreenNode?)reader.ReadValue(); - if (members != null) - { - AdjustFlagsAndWidth(members); - this.members = members; - } - var endOfFileToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfFileToken); - this.endOfFileToken = endOfFileToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.externs); - writer.WriteValue(this.usings); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.members); - writer.WriteValue(this.endOfFileToken); - } + internal ExternAliasDirectiveSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var externKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(externKeyword); + this.externKeyword = externKeyword; + var aliasKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(aliasKeyword); + this.aliasKeyword = aliasKeyword; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - static CompilationUnitSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(CompilationUnitSyntax), r => new CompilationUnitSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.externKeyword); + writer.WriteValue(this.aliasKeyword); + writer.WriteValue(this.identifier); + writer.WriteValue(this.semicolonToken); } - /// - /// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. - /// - internal sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode + static ExternAliasDirectiveSyntax() { - internal readonly SyntaxToken externKeyword; - internal readonly SyntaxToken aliasKeyword; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken semicolonToken; + ObjectBinder.RegisterTypeReader(typeof(ExternAliasDirectiveSyntax), r => new ExternAliasDirectiveSyntax(r)); + } +} - internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken? globalKeyword; + internal readonly SyntaxToken usingKeyword; + internal readonly SyntaxToken? staticKeyword; + internal readonly SyntaxToken? unsafeKeyword; + internal readonly NameEqualsSyntax? alias; + internal readonly TypeSyntax namespaceOrType; + internal readonly SyntaxToken semicolonToken; + + internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 7; + if (globalKeyword != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(externKeyword); - this.externKeyword = externKeyword; - this.AdjustFlagsAndWidth(aliasKeyword); - this.aliasKeyword = aliasKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(globalKeyword); + this.globalKeyword = globalKeyword; } - - internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + if (staticKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(externKeyword); - this.externKeyword = externKeyword; - this.AdjustFlagsAndWidth(aliasKeyword); - this.aliasKeyword = aliasKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(staticKeyword); + this.staticKeyword = staticKeyword; + } + if (unsafeKeyword != null) + { + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; } + if (alias != null) + { + this.AdjustFlagsAndWidth(alias); + this.alias = alias; + } + this.AdjustFlagsAndWidth(namespaceOrType); + this.namespaceOrType = namespaceOrType; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) - : base(kind) + internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 7; + if (globalKeyword != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(externKeyword); - this.externKeyword = externKeyword; - this.AdjustFlagsAndWidth(aliasKeyword); - this.aliasKeyword = aliasKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(globalKeyword); + this.globalKeyword = globalKeyword; + } + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + if (staticKeyword != null) + { + this.AdjustFlagsAndWidth(staticKeyword); + this.staticKeyword = staticKeyword; + } + if (unsafeKeyword != null) + { + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + } + if (alias != null) + { + this.AdjustFlagsAndWidth(alias); + this.alias = alias; + } + this.AdjustFlagsAndWidth(namespaceOrType); + this.namespaceOrType = namespaceOrType; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 7; + if (globalKeyword != null) + { + this.AdjustFlagsAndWidth(globalKeyword); + this.globalKeyword = globalKeyword; + } + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + if (staticKeyword != null) + { + this.AdjustFlagsAndWidth(staticKeyword); + this.staticKeyword = staticKeyword; + } + if (unsafeKeyword != null) + { + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + } + if (alias != null) + { + this.AdjustFlagsAndWidth(alias); + this.alias = alias; } + this.AdjustFlagsAndWidth(namespaceOrType); + this.namespaceOrType = namespaceOrType; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - /// SyntaxToken representing the extern keyword. - public SyntaxToken ExternKeyword => this.externKeyword; - /// SyntaxToken representing the alias keyword. - public SyntaxToken AliasKeyword => this.aliasKeyword; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - /// SyntaxToken representing the semicolon token. - public SyntaxToken SemicolonToken => this.semicolonToken; + public SyntaxToken? GlobalKeyword => this.globalKeyword; + public SyntaxToken UsingKeyword => this.usingKeyword; + public SyntaxToken? StaticKeyword => this.staticKeyword; + public SyntaxToken? UnsafeKeyword => this.unsafeKeyword; + public NameEqualsSyntax? Alias => this.alias; + public TypeSyntax NamespaceOrType => this.namespaceOrType; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.externKeyword, - 1 => this.aliasKeyword, - 2 => this.identifier, - 3 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.globalKeyword, + 1 => this.usingKeyword, + 2 => this.staticKeyword, + 3 => this.unsafeKeyword, + 4 => this.alias, + 5 => this.namespaceOrType, + 6 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExternAliasDirectiveSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingDirectiveSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); - public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + { + if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || unsafeKeyword != this.UnsafeKeyword || alias != this.Alias || namespaceOrType != this.NamespaceOrType || semicolonToken != this.SemicolonToken) { - if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.unsafeKeyword, this.alias, this.namespaceOrType, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.unsafeKeyword, this.alias, this.namespaceOrType, this.semicolonToken, GetDiagnostics(), annotations); - internal ExternAliasDirectiveSyntax(ObjectReader reader) - : base(reader) + internal UsingDirectiveSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 7; + var globalKeyword = (SyntaxToken?)reader.ReadValue(); + if (globalKeyword != null) { - this.SlotCount = 4; - var externKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(externKeyword); - this.externKeyword = externKeyword; - var aliasKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(aliasKeyword); - this.aliasKeyword = aliasKeyword; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + AdjustFlagsAndWidth(globalKeyword); + this.globalKeyword = globalKeyword; } - - internal override void WriteTo(ObjectWriter writer) + var usingKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + var staticKeyword = (SyntaxToken?)reader.ReadValue(); + if (staticKeyword != null) { - base.WriteTo(writer); - writer.WriteValue(this.externKeyword); - writer.WriteValue(this.aliasKeyword); - writer.WriteValue(this.identifier); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(staticKeyword); + this.staticKeyword = staticKeyword; } - - static ExternAliasDirectiveSyntax() + var unsafeKeyword = (SyntaxToken?)reader.ReadValue(); + if (unsafeKeyword != null) + { + AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + } + var alias = (NameEqualsSyntax?)reader.ReadValue(); + if (alias != null) { - ObjectBinder.RegisterTypeReader(typeof(ExternAliasDirectiveSyntax), r => new ExternAliasDirectiveSyntax(r)); + AdjustFlagsAndWidth(alias); + this.alias = alias; } + var namespaceOrType = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(namespaceOrType); + this.namespaceOrType = namespaceOrType; + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.globalKeyword); + writer.WriteValue(this.usingKeyword); + writer.WriteValue(this.staticKeyword); + writer.WriteValue(this.unsafeKeyword); + writer.WriteValue(this.alias); + writer.WriteValue(this.namespaceOrType); + writer.WriteValue(this.semicolonToken); + } + + static UsingDirectiveSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(UsingDirectiveSyntax), r => new UsingDirectiveSyntax(r)); + } +} + +/// Member declaration syntax. +internal abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode +{ + internal MemberDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } + + internal MemberDeclarationSyntax(SyntaxKind kind) + : base(kind) + { + } + + protected MemberDeclarationSyntax(ObjectReader reader) + : base(reader) + { + } + + /// Gets the attribute declaration list. + public abstract CoreSyntax.SyntaxList AttributeLists { get; } + + /// Gets the modifier list. + public abstract CoreSyntax.SyntaxList Modifiers { get; } +} + +internal abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseNamespaceDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } + + internal BaseNamespaceDeclarationSyntax(SyntaxKind kind) + : base(kind) + { } - internal sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode + protected BaseNamespaceDeclarationSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken? globalKeyword; - internal readonly SyntaxToken usingKeyword; - internal readonly SyntaxToken? staticKeyword; - internal readonly SyntaxToken? unsafeKeyword; - internal readonly NameEqualsSyntax? alias; - internal readonly TypeSyntax namespaceOrType; - internal readonly SyntaxToken semicolonToken; + } + + public abstract SyntaxToken NamespaceKeyword { get; } + + public abstract NameSyntax Name { get; } + + public abstract CoreSyntax.SyntaxList Externs { get; } - internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + public abstract CoreSyntax.SyntaxList Usings { get; } + + public abstract CoreSyntax.SyntaxList Members { get; } +} + +internal sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken namespaceKeyword; + internal readonly NameSyntax name; + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? externs; + internal readonly GreenNode? usings; + internal readonly GreenNode? members; + internal readonly SyntaxToken closeBraceToken; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 10; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (externs != null) + { + this.AdjustFlagsAndWidth(externs); + this.externs = externs; + } + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + if (semicolonToken != null) { - this.SlotCount = 7; - if (globalKeyword != null) - { - this.AdjustFlagsAndWidth(globalKeyword); - this.globalKeyword = globalKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - if (staticKeyword != null) - { - this.AdjustFlagsAndWidth(staticKeyword); - this.staticKeyword = staticKeyword; - } - if (unsafeKeyword != null) - { - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - } - if (alias != null) - { - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - } - this.AdjustFlagsAndWidth(namespaceOrType); - this.namespaceOrType = namespaceOrType; this.AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; } + } - internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 10; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (externs != null) + { + this.AdjustFlagsAndWidth(externs); + this.externs = externs; + } + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + if (semicolonToken != null) { - this.SetFactoryContext(context); - this.SlotCount = 7; - if (globalKeyword != null) - { - this.AdjustFlagsAndWidth(globalKeyword); - this.globalKeyword = globalKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - if (staticKeyword != null) - { - this.AdjustFlagsAndWidth(staticKeyword); - this.staticKeyword = staticKeyword; - } - if (unsafeKeyword != null) - { - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - } - if (alias != null) - { - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - } - this.AdjustFlagsAndWidth(namespaceOrType); - this.namespaceOrType = namespaceOrType; this.AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; } + } - internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) - : base(kind) + internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) + : base(kind) + { + this.SlotCount = 10; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (externs != null) + { + this.AdjustFlagsAndWidth(externs); + this.externs = externs; + } + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + if (semicolonToken != null) { - this.SlotCount = 7; - if (globalKeyword != null) - { - this.AdjustFlagsAndWidth(globalKeyword); - this.globalKeyword = globalKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - if (staticKeyword != null) - { - this.AdjustFlagsAndWidth(staticKeyword); - this.staticKeyword = staticKeyword; - } - if (unsafeKeyword != null) - { - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - } - if (alias != null) - { - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - } - this.AdjustFlagsAndWidth(namespaceOrType); - this.namespaceOrType = namespaceOrType; this.AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; } + } - public SyntaxToken? GlobalKeyword => this.globalKeyword; - public SyntaxToken UsingKeyword => this.usingKeyword; - public SyntaxToken? StaticKeyword => this.staticKeyword; - public SyntaxToken? UnsafeKeyword => this.unsafeKeyword; - public NameEqualsSyntax? Alias => this.alias; - public TypeSyntax NamespaceOrType => this.namespaceOrType; - public SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; + public override NameSyntax Name => this.name; + public SyntaxToken OpenBraceToken => this.openBraceToken; + public override CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); + public override CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public SyntaxToken CloseBraceToken => this.closeBraceToken; + /// Gets the optional semicolon token. + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.globalKeyword, - 1 => this.usingKeyword, - 2 => this.staticKeyword, - 3 => this.unsafeKeyword, - 4 => this.alias, - 5 => this.namespaceOrType, - 6 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.namespaceKeyword, + 3 => this.name, + 4 => this.openBraceToken, + 5 => this.externs, + 6 => this.usings, + 7 => this.members, + 8 => this.closeBraceToken, + 9 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingDirectiveSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NamespaceDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); - public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + public NamespaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { - if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || unsafeKeyword != this.UnsafeKeyword || alias != this.Alias || namespaceOrType != this.NamespaceOrType || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.unsafeKeyword, this.alias, this.namespaceOrType, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.unsafeKeyword, this.alias, this.namespaceOrType, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); - internal UsingDirectiveSyntax(ObjectReader reader) - : base(reader) + internal NamespaceDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 10; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var namespaceKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + var name = (NameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var openBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + var externs = (GreenNode?)reader.ReadValue(); + if (externs != null) + { + AdjustFlagsAndWidth(externs); + this.externs = externs; + } + var usings = (GreenNode?)reader.ReadValue(); + if (usings != null) + { + AdjustFlagsAndWidth(usings); + this.usings = usings; + } + var members = (GreenNode?)reader.ReadValue(); + if (members != null) + { + AdjustFlagsAndWidth(members); + this.members = members; + } + var closeBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) { - this.SlotCount = 7; - var globalKeyword = (SyntaxToken?)reader.ReadValue(); - if (globalKeyword != null) - { - AdjustFlagsAndWidth(globalKeyword); - this.globalKeyword = globalKeyword; - } - var usingKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - var staticKeyword = (SyntaxToken?)reader.ReadValue(); - if (staticKeyword != null) - { - AdjustFlagsAndWidth(staticKeyword); - this.staticKeyword = staticKeyword; - } - var unsafeKeyword = (SyntaxToken?)reader.ReadValue(); - if (unsafeKeyword != null) - { - AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - } - var alias = (NameEqualsSyntax?)reader.ReadValue(); - if (alias != null) - { - AdjustFlagsAndWidth(alias); - this.alias = alias; - } - var namespaceOrType = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(namespaceOrType); - this.namespaceOrType = namespaceOrType; - var semicolonToken = (SyntaxToken)reader.ReadValue(); AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.namespaceKeyword); + writer.WriteValue(this.name); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.externs); + writer.WriteValue(this.usings); + writer.WriteValue(this.members); + writer.WriteValue(this.closeBraceToken); + writer.WriteValue(this.semicolonToken); + } - internal override void WriteTo(ObjectWriter writer) + static NamespaceDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(NamespaceDeclarationSyntax), r => new NamespaceDeclarationSyntax(r)); + } +} + +internal sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken namespaceKeyword; + internal readonly NameSyntax name; + internal readonly SyntaxToken semicolonToken; + internal readonly GreenNode? externs; + internal readonly GreenNode? usings; + internal readonly GreenNode? members; + + internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.globalKeyword); - writer.WriteValue(this.usingKeyword); - writer.WriteValue(this.staticKeyword); - writer.WriteValue(this.unsafeKeyword); - writer.WriteValue(this.alias); - writer.WriteValue(this.namespaceOrType); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static UsingDirectiveSyntax() + if (modifiers != null) { - ObjectBinder.RegisterTypeReader(typeof(UsingDirectiveSyntax), r => new UsingDirectiveSyntax(r)); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + if (externs != null) + { + this.AdjustFlagsAndWidth(externs); + this.externs = externs; + } + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; } } - /// Member declaration syntax. - internal abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode + internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxFactoryContext context) + : base(kind) { - internal MemberDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal MemberDeclarationSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - protected MemberDeclarationSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + if (externs != null) { + this.AdjustFlagsAndWidth(externs); + this.externs = externs; + } + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; } - - /// Gets the attribute declaration list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists { get; } - - /// Gets the modifier list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers { get; } } - internal abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax + internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members) + : base(kind) { - internal BaseNamespaceDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 8; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseNamespaceDeclarationSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - protected BaseNamespaceDeclarationSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + if (externs != null) { + this.AdjustFlagsAndWidth(externs); + this.externs = externs; } + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; + public override NameSyntax Name => this.name; + public SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); + public override CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); - public abstract SyntaxToken NamespaceKeyword { get; } + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.namespaceKeyword, + 3 => this.name, + 4 => this.semicolonToken, + 5 => this.externs, + 6 => this.usings, + 7 => this.members, + _ => null, + }; - public abstract NameSyntax Name { get; } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FileScopedNamespaceDeclarationSyntax(this, parent, position); - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Externs { get; } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Usings { get; } + public FileScopedNamespaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) + { + var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members { get; } + return this; } - internal sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken namespaceKeyword; - internal readonly NameSyntax name; - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? externs; - internal readonly GreenNode? usings; - internal readonly GreenNode? members; - internal readonly SyntaxToken closeBraceToken; - internal readonly SyntaxToken? semicolonToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, GetDiagnostics(), annotations); - internal 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) - : base(kind, diagnostics, annotations) + internal FileScopedNamespaceDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 8; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) - : base(kind) + var namespaceKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + var name = (NameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + var externs = (GreenNode?)reader.ReadValue(); + if (externs != null) { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + AdjustFlagsAndWidth(externs); + this.externs = externs; } - - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; - public override NameSyntax Name => this.name; - public SyntaxToken OpenBraceToken => this.openBraceToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.externs); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.usings); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); - public SyntaxToken CloseBraceToken => this.closeBraceToken; - /// Gets the optional semicolon token. - public SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.namespaceKeyword, - 3 => this.name, - 4 => this.openBraceToken, - 5 => this.externs, - 6 => this.usings, - 7 => this.members, - 8 => this.closeBraceToken, - 9 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NamespaceDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); - - public NamespaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var usings = (GreenNode?)reader.ReadValue(); + if (usings != null) + { + AdjustFlagsAndWidth(usings); + this.usings = usings; + } + var members = (GreenNode?)reader.ReadValue(); + if (members != null) + { + AdjustFlagsAndWidth(members); + this.members = members; } + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.namespaceKeyword); + writer.WriteValue(this.name); + writer.WriteValue(this.semicolonToken); + writer.WriteValue(this.externs); + writer.WriteValue(this.usings); + writer.WriteValue(this.members); + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); + static FileScopedNamespaceDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(FileScopedNamespaceDeclarationSyntax), r => new FileScopedNamespaceDeclarationSyntax(r)); + } +} - internal NamespaceDeclarationSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 10; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var namespaceKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - var name = (NameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var openBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - var externs = (GreenNode?)reader.ReadValue(); - if (externs != null) - { - AdjustFlagsAndWidth(externs); - this.externs = externs; - } - var usings = (GreenNode?)reader.ReadValue(); - if (usings != null) - { - AdjustFlagsAndWidth(usings); - this.usings = usings; - } - var members = (GreenNode?)reader.ReadValue(); - if (members != null) - { - AdjustFlagsAndWidth(members); - this.members = members; - } - var closeBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } +/// Class representing one or more attributes applied to a language construct. +internal sealed partial class AttributeListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openBracketToken; + internal readonly AttributeTargetSpecifierSyntax? target; + internal readonly GreenNode? attributes; + internal readonly SyntaxToken closeBracketToken; - internal override void WriteTo(ObjectWriter writer) + internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (target != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.namespaceKeyword); - writer.WriteValue(this.name); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.externs); - writer.WriteValue(this.usings); - writer.WriteValue(this.members); - writer.WriteValue(this.closeBraceToken); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(target); + this.target = target; } - - static NamespaceDeclarationSyntax() + if (attributes != null) { - ObjectBinder.RegisterTypeReader(typeof(NamespaceDeclarationSyntax), r => new NamespaceDeclarationSyntax(r)); + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; } - internal sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax + internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken namespaceKeyword; - internal readonly NameSyntax name; - internal readonly SyntaxToken semicolonToken; - internal readonly GreenNode? externs; - internal readonly GreenNode? usings; - internal readonly GreenNode? members; - - internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (target != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } + this.AdjustFlagsAndWidth(target); + this.target = target; } - - internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxFactoryContext context) - : base(kind) + if (attributes != null) { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members) - : base(kind) + internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (target != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } + this.AdjustFlagsAndWidth(target); + this.target = target; + } + if (attributes != null) + { + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; - public override NameSyntax Name => this.name; - public SyntaxToken SemicolonToken => this.semicolonToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.externs); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.usings); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// Gets the optional construct targeted by the attribute. + public AttributeTargetSpecifierSyntax? Target => this.target; + /// Gets the attribute declaration list. + public CoreSyntax.SeparatedSyntaxList Attributes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.attributes)); + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.namespaceKeyword, - 3 => this.name, - 4 => this.semicolonToken, - 5 => this.externs, - 6 => this.usings, - 7 => this.members, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.target, + 2 => this.attributes, + 3 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FileScopedNamespaceDeclarationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); - public FileScopedNamespaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members) + public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) - { - var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, diagnostics, GetAnnotations()); - internal FileScopedNamespaceDeclarationSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 8; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var namespaceKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - var name = (NameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - var externs = (GreenNode?)reader.ReadValue(); - if (externs != null) - { - AdjustFlagsAndWidth(externs); - this.externs = externs; - } - var usings = (GreenNode?)reader.ReadValue(); - if (usings != null) - { - AdjustFlagsAndWidth(usings); - this.usings = usings; - } - var members = (GreenNode?)reader.ReadValue(); - if (members != null) - { - AdjustFlagsAndWidth(members); - this.members = members; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal AttributeListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var openBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + var target = (AttributeTargetSpecifierSyntax?)reader.ReadValue(); + if (target != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.namespaceKeyword); - writer.WriteValue(this.name); - writer.WriteValue(this.semicolonToken); - writer.WriteValue(this.externs); - writer.WriteValue(this.usings); - writer.WriteValue(this.members); + AdjustFlagsAndWidth(target); + this.target = target; } - - static FileScopedNamespaceDeclarationSyntax() + var attributes = (GreenNode?)reader.ReadValue(); + if (attributes != null) { - ObjectBinder.RegisterTypeReader(typeof(FileScopedNamespaceDeclarationSyntax), r => new FileScopedNamespaceDeclarationSyntax(r)); + AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + var closeBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; } - /// Class representing one or more attributes applied to a language construct. - internal sealed partial class AttributeListSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken openBracketToken; - internal readonly AttributeTargetSpecifierSyntax? target; - internal readonly GreenNode? attributes; - internal readonly SyntaxToken closeBracketToken; - - internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (target != null) - { - this.AdjustFlagsAndWidth(target); - this.target = target; - } - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + base.WriteTo(writer); + writer.WriteValue(this.openBracketToken); + writer.WriteValue(this.target); + writer.WriteValue(this.attributes); + writer.WriteValue(this.closeBracketToken); + } - internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (target != null) - { - this.AdjustFlagsAndWidth(target); - this.target = target; - } - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + static AttributeListSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(AttributeListSyntax), r => new AttributeListSyntax(r)); + } +} - internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (target != null) - { - this.AdjustFlagsAndWidth(target); - this.target = target; - } - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } +/// Class representing what language construct an attribute targets. +internal sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken colonToken; - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// Gets the optional construct targeted by the attribute. - public AttributeTargetSpecifierSyntax? Target => this.target; - /// Gets the attribute declaration list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributes)); - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => this.closeBracketToken; + internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.target, - 2 => this.attributes, - 3 => this.closeBracketToken, - _ => null, - }; + internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeListSyntax(this, parent, position); + internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + /// Gets the colon token. + public SyntaxToken ColonToken => this.colonToken; - public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.identifier, + 1 => this.colonToken, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeTargetSpecifierSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); - internal AttributeListSyntax(ObjectReader reader) - : base(reader) + public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken) + { + if (identifier != this.Identifier || colonToken != this.ColonToken) { - this.SlotCount = 4; - var openBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - var target = (AttributeTargetSpecifierSyntax?)reader.ReadValue(); - if (target != null) - { - AdjustFlagsAndWidth(target); - this.target = target; - } - var attributes = (GreenNode?)reader.ReadValue(); - if (attributes != null) - { - AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - var closeBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openBracketToken); - writer.WriteValue(this.target); - writer.WriteValue(this.attributes); - writer.WriteValue(this.closeBracketToken); - } + return this; + } - static AttributeListSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(AttributeListSyntax), r => new AttributeListSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, GetDiagnostics(), annotations); + + internal AttributeTargetSpecifierSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; } - /// Class representing what language construct an attribute targets. - internal sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken colonToken; + base.WriteTo(writer); + writer.WriteValue(this.identifier); + writer.WriteValue(this.colonToken); + } + + static AttributeTargetSpecifierSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(AttributeTargetSpecifierSyntax), r => new AttributeTargetSpecifierSyntax(r)); + } +} + +/// Attribute syntax. +internal sealed partial class AttributeSyntax : CSharpSyntaxNode +{ + internal readonly NameSyntax name; + internal readonly AttributeArgumentListSyntax? argumentList; - internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (argumentList != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } + } - internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (argumentList != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } + } - internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken) - : base(kind) + internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (argumentList != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } + } - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - /// Gets the colon token. - public SyntaxToken ColonToken => this.colonToken; + /// Gets the name. + public NameSyntax Name => this.name; + public AttributeArgumentListSyntax? ArgumentList => this.argumentList; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.identifier, - 1 => this.colonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.argumentList, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeTargetSpecifierSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); - public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken) + public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax argumentList) + { + if (name != this.Name || argumentList != this.ArgumentList) { - if (identifier != this.Identifier || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Attribute(name, argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AttributeSyntax(this.Kind, this.name, this.argumentList, diagnostics, GetAnnotations()); - internal AttributeTargetSpecifierSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AttributeSyntax(this.Kind, this.name, this.argumentList, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal AttributeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var name = (NameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var argumentList = (AttributeArgumentListSyntax?)reader.ReadValue(); + if (argumentList != null) { - base.WriteTo(writer); - writer.WriteValue(this.identifier); - writer.WriteValue(this.colonToken); + AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } + } - static AttributeTargetSpecifierSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(AttributeTargetSpecifierSyntax), r => new AttributeTargetSpecifierSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.name); + writer.WriteValue(this.argumentList); } - /// Attribute syntax. - internal sealed partial class AttributeSyntax : CSharpSyntaxNode + static AttributeSyntax() { - internal readonly NameSyntax name; - internal readonly AttributeArgumentListSyntax? argumentList; + ObjectBinder.RegisterTypeReader(typeof(AttributeSyntax), r => new AttributeSyntax(r)); + } +} + +/// Attribute argument list syntax. +internal sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? arguments; + internal readonly SyntaxToken closeParenToken; - internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, SyntaxFactoryContext context) - : base(kind) + internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList) - : base(kind) + internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - /// Gets the name. - public NameSyntax Name => this.name; - public AttributeArgumentListSyntax? ArgumentList => this.argumentList; + /// Gets the open paren token. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Gets the arguments syntax list. + public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + /// Gets the close paren token. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.argumentList, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.arguments, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); - public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax argumentList) + public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { - if (name != this.Name || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.Attribute(name, argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AttributeSyntax(this.Kind, this.name, this.argumentList, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AttributeSyntax(this.Kind, this.name, this.argumentList, GetDiagnostics(), annotations); + return this; + } - internal AttributeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var name = (NameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var argumentList = (AttributeArgumentListSyntax?)reader.ReadValue(); - if (argumentList != null) - { - AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.name); - writer.WriteValue(this.argumentList); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); - static AttributeSyntax() + internal AttributeArgumentListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var arguments = (GreenNode?)reader.ReadValue(); + if (arguments != null) { - ObjectBinder.RegisterTypeReader(typeof(AttributeSyntax), r => new AttributeSyntax(r)); + AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - /// Attribute argument list syntax. - internal sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? arguments; - internal readonly SyntaxToken closeParenToken; + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.arguments); + writer.WriteValue(this.closeParenToken); + } - internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + static AttributeArgumentListSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(AttributeArgumentListSyntax), r => new AttributeArgumentListSyntax(r)); + } +} + +/// Attribute argument syntax. +internal sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode +{ + internal readonly NameEqualsSyntax? nameEquals; + internal readonly NameColonSyntax? nameColon; + internal readonly ExpressionSyntax expression; - internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (nameEquals != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; } - - internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) - : base(kind) + if (nameColon != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - /// Gets the open paren token. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Gets the arguments syntax list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arguments)); - /// Gets the close paren token. - public SyntaxToken CloseParenToken => this.closeParenToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.arguments, - 2 => this.closeParenToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentListSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); - - public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (nameEquals != null) { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); - - internal AttributeArgumentListSyntax(ObjectReader reader) - : base(reader) + if (nameColon != null) { - this.SlotCount = 3; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var arguments = (GreenNode?)reader.ReadValue(); - if (arguments != null) - { - AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal override void WriteTo(ObjectWriter writer) + internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 3; + if (nameEquals != null) { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.arguments); - writer.WriteValue(this.closeParenToken); + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; } - - static AttributeArgumentListSyntax() + if (nameColon != null) { - ObjectBinder.RegisterTypeReader(typeof(AttributeArgumentListSyntax), r => new AttributeArgumentListSyntax(r)); + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - /// Attribute argument syntax. - internal sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode - { - internal readonly NameEqualsSyntax? nameEquals; - internal readonly NameColonSyntax? nameColon; - internal readonly ExpressionSyntax expression; + public NameEqualsSyntax? NameEquals => this.nameEquals; + public NameColonSyntax? NameColon => this.nameColon; + /// Gets the expression. + public ExpressionSyntax Expression => this.expression; - internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + 0 => this.nameEquals, + 1 => this.nameColon, + 2 => this.expression, + _ => null, + }; - internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentSyntax(this, parent, position); - internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); + + public AttributeArgumentSyntax Update(NameEqualsSyntax nameEquals, NameColonSyntax nameColon, ExpressionSyntax expression) + { + if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression) { - this.SlotCount = 3; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public NameEqualsSyntax? NameEquals => this.nameEquals; - public NameColonSyntax? NameColon => this.nameColon; - /// Gets the expression. - public ExpressionSyntax Expression => this.expression; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.nameEquals, - 1 => this.nameColon, - 2 => this.expression, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, GetDiagnostics(), annotations); - public AttributeArgumentSyntax Update(NameEqualsSyntax nameEquals, NameColonSyntax nameColon, ExpressionSyntax expression) + internal AttributeArgumentSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var nameEquals = (NameEqualsSyntax?)reader.ReadValue(); + if (nameEquals != null) { - if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression) - { - var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; + } + var nameColon = (NameColonSyntax?)reader.ReadValue(); + if (nameColon != null) + { + AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.nameEquals); + writer.WriteValue(this.nameColon); + writer.WriteValue(this.expression); + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, GetDiagnostics(), annotations); + static AttributeArgumentSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(AttributeArgumentSyntax), r => new AttributeArgumentSyntax(r)); + } +} - internal AttributeArgumentSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var nameEquals = (NameEqualsSyntax?)reader.ReadValue(); - if (nameEquals != null) - { - AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - var nameColon = (NameColonSyntax?)reader.ReadValue(); - if (nameColon != null) - { - AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; - } +/// Class representing an identifier name followed by an equals token. +internal sealed partial class NameEqualsSyntax : CSharpSyntaxNode +{ + internal readonly IdentifierNameSyntax name; + internal readonly SyntaxToken equalsToken; - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.nameEquals); - writer.WriteValue(this.nameColon); - writer.WriteValue(this.expression); - } + internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + } - static AttributeArgumentSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(AttributeArgumentSyntax), r => new AttributeArgumentSyntax(r)); - } + internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; } - /// Class representing an identifier name followed by an equals token. - internal sealed partial class NameEqualsSyntax : CSharpSyntaxNode + internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken) + : base(kind) { - internal readonly IdentifierNameSyntax name; - internal readonly SyntaxToken equalsToken; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + } - internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - } + /// Gets the identifier name. + public IdentifierNameSyntax Name => this.name; + public SyntaxToken EqualsToken => this.equalsToken; - internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - } + 0 => this.name, + 1 => this.equalsToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameEqualsSyntax(this, parent, position); - internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); + + public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken) + { + if (name != this.Name || equalsToken != this.EqualsToken) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; + var newNode = SyntaxFactory.NameEquals(name, equalsToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// Gets the identifier name. - public IdentifierNameSyntax Name => this.name; - public SyntaxToken EqualsToken => this.equalsToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.equalsToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameEqualsSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, GetDiagnostics(), annotations); - public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken) - { - if (name != this.Name || equalsToken != this.EqualsToken) - { - var newNode = SyntaxFactory.NameEquals(name, equalsToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal NameEqualsSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var name = (IdentifierNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var equalsToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + } - return this; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.name); + writer.WriteValue(this.equalsToken); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, diagnostics, GetAnnotations()); + static NameEqualsSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(NameEqualsSyntax), r => new NameEqualsSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, GetDiagnostics(), annotations); +/// Type parameter list syntax. +internal sealed partial class TypeParameterListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken lessThanToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken greaterThanToken; - internal NameEqualsSyntax(ObjectReader reader) - : base(reader) + internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) { - this.SlotCount = 2; - var name = (IdentifierNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var equalsToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal override void WriteTo(ObjectWriter writer) + internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) { - base.WriteTo(writer); - writer.WriteValue(this.name); - writer.WriteValue(this.equalsToken); + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - static NameEqualsSyntax() + internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) { - ObjectBinder.RegisterTypeReader(typeof(NameEqualsSyntax), r => new NameEqualsSyntax(r)); + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; } - /// Type parameter list syntax. - internal sealed partial class TypeParameterListSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken lessThanToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken greaterThanToken; + /// Gets the < token. + public SyntaxToken LessThanToken => this.lessThanToken; + /// Gets the parameter list. + public CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// Gets the > token. + public SyntaxToken GreaterThanToken => this.greaterThanToken; - internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } + 0 => this.lessThanToken, + 1 => this.parameters, + 2 => this.greaterThanToken, + _ => null, + }; - internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterListSyntax(this, parent, position); - internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); + + public TypeParameterListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// Gets the < token. - public SyntaxToken LessThanToken => this.lessThanToken; - /// Gets the parameter list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); - /// Gets the > token. - public SyntaxToken GreaterThanToken => this.greaterThanToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanToken, - 1 => this.parameters, - 2 => this.greaterThanToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterListSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations); - public TypeParameterListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + internal TypeParameterListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var lessThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + var parameters = (GreenNode?)reader.ReadValue(); + if (parameters != null) { - if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + var greaterThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.lessThanToken); + writer.WriteValue(this.parameters); + writer.WriteValue(this.greaterThanToken); + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations); + static TypeParameterListSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(TypeParameterListSyntax), r => new TypeParameterListSyntax(r)); + } +} - internal TypeParameterListSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var lessThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - var parameters = (GreenNode?)reader.ReadValue(); - if (parameters != null) - { - AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - var greaterThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } +/// Type parameter syntax. +internal sealed partial class TypeParameterSyntax : CSharpSyntaxNode +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken? varianceKeyword; + internal readonly SyntaxToken identifier; - internal override void WriteTo(ObjectWriter writer) + internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.lessThanToken); - writer.WriteValue(this.parameters); - writer.WriteValue(this.greaterThanToken); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static TypeParameterListSyntax() + if (varianceKeyword != null) { - ObjectBinder.RegisterTypeReader(typeof(TypeParameterListSyntax), r => new TypeParameterListSyntax(r)); + this.AdjustFlagsAndWidth(varianceKeyword); + this.varianceKeyword = varianceKeyword; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } - /// Type parameter syntax. - internal sealed partial class TypeParameterSyntax : CSharpSyntaxNode + internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken? varianceKeyword; - internal readonly SyntaxToken identifier; - - internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (varianceKeyword != null) - { - this.AdjustFlagsAndWidth(varianceKeyword); - this.varianceKeyword = varianceKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, SyntaxFactoryContext context) - : base(kind) + if (varianceKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (varianceKeyword != null) - { - this.AdjustFlagsAndWidth(varianceKeyword); - this.varianceKeyword = varianceKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + this.AdjustFlagsAndWidth(varianceKeyword); + this.varianceKeyword = varianceKeyword; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) - : base(kind) + internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (varianceKeyword != null) - { - this.AdjustFlagsAndWidth(varianceKeyword); - this.varianceKeyword = varianceKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + if (varianceKeyword != null) + { + this.AdjustFlagsAndWidth(varianceKeyword); + this.varianceKeyword = varianceKeyword; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - /// Gets the attribute declaration list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public SyntaxToken? VarianceKeyword => this.varianceKeyword; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; + /// Gets the attribute declaration list. + public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken? VarianceKeyword => this.varianceKeyword; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.varianceKeyword, - 2 => this.identifier, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.varianceKeyword, + 2 => this.identifier, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); - public TypeParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) + public TypeParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) + { + if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) { - if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) - { - var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, diagnostics, GetAnnotations()); - internal TypeParameterSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var varianceKeyword = (SyntaxToken?)reader.ReadValue(); - if (varianceKeyword != null) - { - AdjustFlagsAndWidth(varianceKeyword); - this.varianceKeyword = varianceKeyword; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal TypeParameterSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.varianceKeyword); - writer.WriteValue(this.identifier); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static TypeParameterSyntax() + var varianceKeyword = (SyntaxToken?)reader.ReadValue(); + if (varianceKeyword != null) { - ObjectBinder.RegisterTypeReader(typeof(TypeParameterSyntax), r => new TypeParameterSyntax(r)); + AdjustFlagsAndWidth(varianceKeyword); + this.varianceKeyword = varianceKeyword; } + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } - /// Base class for type declaration syntax. - internal abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax + internal override void WriteTo(ObjectWriter writer) { - internal BaseTypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.varianceKeyword); + writer.WriteValue(this.identifier); + } - internal BaseTypeDeclarationSyntax(SyntaxKind kind) - : base(kind) - { - } + static TypeParameterSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(TypeParameterSyntax), r => new TypeParameterSyntax(r)); + } +} - protected BaseTypeDeclarationSyntax(ObjectReader reader) - : base(reader) - { - } +/// Base class for type declaration syntax. +internal abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseTypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } + + internal BaseTypeDeclarationSyntax(SyntaxKind kind) + : base(kind) + { + } + + protected BaseTypeDeclarationSyntax(ObjectReader reader) + : base(reader) + { + } + + /// Gets the identifier. + public abstract SyntaxToken Identifier { get; } - /// Gets the identifier. - public abstract SyntaxToken Identifier { get; } + /// Gets the base type list. + public abstract BaseListSyntax? BaseList { get; } - /// Gets the base type list. - public abstract BaseListSyntax? BaseList { get; } + /// Gets the open brace token. + public abstract SyntaxToken? OpenBraceToken { get; } - /// Gets the open brace token. - public abstract SyntaxToken? OpenBraceToken { get; } + /// Gets the close brace token. + public abstract SyntaxToken? CloseBraceToken { get; } - /// Gets the close brace token. - public abstract SyntaxToken? CloseBraceToken { get; } + /// Gets the optional semicolon token. + public abstract SyntaxToken? SemicolonToken { get; } +} - /// Gets the optional semicolon token. - public abstract SyntaxToken? SemicolonToken { get; } +/// Base class for type declaration syntax (class, struct, interface, record). +internal abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax +{ + internal TypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// Base class for type declaration syntax (class, struct, interface, record). - internal abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax + internal TypeDeclarationSyntax(SyntaxKind kind) + : base(kind) { - internal TypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + } - internal TypeDeclarationSyntax(SyntaxKind kind) - : base(kind) - { - } + protected TypeDeclarationSyntax(ObjectReader reader) + : base(reader) + { + } - protected TypeDeclarationSyntax(ObjectReader reader) - : base(reader) - { - } + /// Gets the type keyword token ("class", "struct", "interface", "record"). + public abstract SyntaxToken Keyword { get; } - /// Gets the type keyword token ("class", "struct", "interface", "record"). - public abstract SyntaxToken Keyword { get; } + public abstract TypeParameterListSyntax? TypeParameterList { get; } - public abstract TypeParameterListSyntax? TypeParameterList { get; } + public abstract ParameterListSyntax? ParameterList { get; } - public abstract ParameterListSyntax? ParameterList { get; } + /// Gets the type constraint list. + public abstract CoreSyntax.SyntaxList ConstraintClauses { get; } - /// Gets the type constraint list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses { get; } + /// Gets the member declarations. + public abstract CoreSyntax.SyntaxList Members { get; } +} - /// Gets the member declarations. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members { get; } - } +/// Class type declaration syntax. +internal sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax? parameterList; + internal readonly BaseListSyntax? baseList; + internal readonly GreenNode? constraintClauses; + internal readonly SyntaxToken? openBraceToken; + internal readonly GreenNode? members; + internal readonly SyntaxToken? closeBraceToken; + internal readonly SyntaxToken? semicolonToken; - /// Class type declaration syntax. - internal sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax + internal 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) + : base(kind, diagnostics, annotations) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax? parameterList; - internal readonly BaseListSyntax? baseList; - internal readonly GreenNode? constraintClauses; - internal readonly SyntaxToken? openBraceToken; - internal readonly GreenNode? members; - internal readonly SyntaxToken? closeBraceToken; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SlotCount = 12; + if (attributeLists != null) { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the class keyword token. + public override SyntaxToken Keyword => this.keyword; + public override SyntaxToken Identifier => this.identifier; + public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public override ParameterListSyntax? ParameterList => this.parameterList; + public override BaseListSyntax? BaseList => this.baseList; + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override SyntaxToken? OpenBraceToken => this.openBraceToken; + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override SyntaxToken? CloseBraceToken => this.closeBraceToken; + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.keyword, + 3 => this.identifier, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 8 => this.openBraceToken, + 9 => this.members, + 10 => this.closeBraceToken, + 11 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); + + public ClassDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); + + internal ClassDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 12; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); + if (typeParameterList != null) + { + AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + var parameterList = (ParameterListSyntax?)reader.ReadValue(); + if (parameterList != null) + { + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + var baseList = (BaseListSyntax?)reader.ReadValue(); + if (baseList != null) + { + AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + var constraintClauses = (GreenNode?)reader.ReadValue(); + if (constraintClauses != null) + { + AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + var openBraceToken = (SyntaxToken?)reader.ReadValue(); + if (openBraceToken != null) + { + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + var members = (GreenNode?)reader.ReadValue(); + if (members != null) + { + AdjustFlagsAndWidth(members); + this.members = members; + } + var closeBraceToken = (SyntaxToken?)reader.ReadValue(); + if (closeBraceToken != null) + { + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) + { + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.keyword); + writer.WriteValue(this.identifier); + writer.WriteValue(this.typeParameterList); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.baseList); + writer.WriteValue(this.constraintClauses); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.members); + writer.WriteValue(this.closeBraceToken); + writer.WriteValue(this.semicolonToken); + } + + static ClassDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ClassDeclarationSyntax), r => new ClassDeclarationSyntax(r)); + } +} + +/// Struct type declaration syntax. +internal sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax? parameterList; + internal readonly BaseListSyntax? baseList; + internal readonly GreenNode? constraintClauses; + internal readonly SyntaxToken? openBraceToken; + internal readonly GreenNode? members; + internal readonly SyntaxToken? closeBraceToken; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the struct keyword token. + public override SyntaxToken Keyword => this.keyword; + public override SyntaxToken Identifier => this.identifier; + public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public override ParameterListSyntax? ParameterList => this.parameterList; + public override BaseListSyntax? BaseList => this.baseList; + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override SyntaxToken? OpenBraceToken => this.openBraceToken; + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override SyntaxToken? CloseBraceToken => this.closeBraceToken; + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.keyword, + 3 => this.identifier, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 8 => this.openBraceToken, + 9 => this.members, + 10 => this.closeBraceToken, + 11 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StructDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); + + public StructDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); + + internal StructDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 12; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); + if (typeParameterList != null) + { + AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + var parameterList = (ParameterListSyntax?)reader.ReadValue(); + if (parameterList != null) + { + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + var baseList = (BaseListSyntax?)reader.ReadValue(); + if (baseList != null) + { + AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + var constraintClauses = (GreenNode?)reader.ReadValue(); + if (constraintClauses != null) + { + AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + var openBraceToken = (SyntaxToken?)reader.ReadValue(); + if (openBraceToken != null) + { + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + var members = (GreenNode?)reader.ReadValue(); + if (members != null) + { + AdjustFlagsAndWidth(members); + this.members = members; + } + var closeBraceToken = (SyntaxToken?)reader.ReadValue(); + if (closeBraceToken != null) + { + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) + { + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.keyword); + writer.WriteValue(this.identifier); + writer.WriteValue(this.typeParameterList); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.baseList); + writer.WriteValue(this.constraintClauses); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.members); + writer.WriteValue(this.closeBraceToken); + writer.WriteValue(this.semicolonToken); + } + + static StructDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(StructDeclarationSyntax), r => new StructDeclarationSyntax(r)); + } +} + +/// Interface type declaration syntax. +internal sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax? parameterList; + internal readonly BaseListSyntax? baseList; + internal readonly GreenNode? constraintClauses; + internal readonly SyntaxToken? openBraceToken; + internal readonly GreenNode? members; + internal readonly SyntaxToken? closeBraceToken; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the interface keyword token. + public override SyntaxToken Keyword => this.keyword; + public override SyntaxToken Identifier => this.identifier; + public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public override ParameterListSyntax? ParameterList => this.parameterList; + public override BaseListSyntax? BaseList => this.baseList; + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override SyntaxToken? OpenBraceToken => this.openBraceToken; + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override SyntaxToken? CloseBraceToken => this.closeBraceToken; + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.keyword, + 3 => this.identifier, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 8 => this.openBraceToken, + 9 => this.members, + 10 => this.closeBraceToken, + 11 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterfaceDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); + + public InterfaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); + + internal InterfaceDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 12; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); + if (typeParameterList != null) + { + AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + var parameterList = (ParameterListSyntax?)reader.ReadValue(); + if (parameterList != null) + { + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + var baseList = (BaseListSyntax?)reader.ReadValue(); + if (baseList != null) + { + AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + var constraintClauses = (GreenNode?)reader.ReadValue(); + if (constraintClauses != null) + { + AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + var openBraceToken = (SyntaxToken?)reader.ReadValue(); + if (openBraceToken != null) + { + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + var members = (GreenNode?)reader.ReadValue(); + if (members != null) + { + AdjustFlagsAndWidth(members); + this.members = members; + } + var closeBraceToken = (SyntaxToken?)reader.ReadValue(); + if (closeBraceToken != null) + { + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) + { + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.keyword); + writer.WriteValue(this.identifier); + writer.WriteValue(this.typeParameterList); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.baseList); + writer.WriteValue(this.constraintClauses); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.members); + writer.WriteValue(this.closeBraceToken); + writer.WriteValue(this.semicolonToken); + } + + static InterfaceDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(InterfaceDeclarationSyntax), r => new InterfaceDeclarationSyntax(r)); + } +} + +internal sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken? classOrStructKeyword; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax? parameterList; + internal readonly BaseListSyntax? baseList; + internal readonly GreenNode? constraintClauses; + internal readonly SyntaxToken? openBraceToken; + internal readonly GreenNode? members; + internal readonly SyntaxToken? closeBraceToken; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 13; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (classOrStructKeyword != null) + { + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } - internal 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) - : base(kind) + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 13; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (classOrStructKeyword != null) + { + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } - internal 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) - : base(kind) + internal 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) + : base(kind) + { + this.SlotCount = 13; + if (attributeLists != null) { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (classOrStructKeyword != null) + { + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the class keyword token. - public override SyntaxToken Keyword => this.keyword; - public override SyntaxToken Identifier => this.identifier; - public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public override ParameterListSyntax? ParameterList => this.parameterList; - public override BaseListSyntax? BaseList => this.baseList; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); - public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); - public override SyntaxToken? CloseBraceToken => this.closeBraceToken; - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.keyword, - 3 => this.identifier, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 8 => this.openBraceToken, - 9 => this.members, - 10 => this.closeBraceToken, - 11 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); - - public ClassDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override SyntaxToken Keyword => this.keyword; + public SyntaxToken? ClassOrStructKeyword => this.classOrStructKeyword; + public override SyntaxToken Identifier => this.identifier; + public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public override ParameterListSyntax? ParameterList => this.parameterList; + public override BaseListSyntax? BaseList => this.baseList; + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override SyntaxToken? OpenBraceToken => this.openBraceToken; + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override SyntaxToken? CloseBraceToken => this.closeBraceToken; + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.keyword, + 3 => this.classOrStructKeyword, + 4 => this.identifier, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.baseList, + 8 => this.constraintClauses, + 9 => this.openBraceToken, + 10 => this.members, + 11 => this.closeBraceToken, + 12 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecordDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); + + public RecordDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.RecordDeclaration(this.Kind, attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); + + internal RecordDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 13; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var classOrStructKeyword = (SyntaxToken?)reader.ReadValue(); + if (classOrStructKeyword != null) + { + AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + } + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); + if (typeParameterList != null) + { + AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + var parameterList = (ParameterListSyntax?)reader.ReadValue(); + if (parameterList != null) + { + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + var baseList = (BaseListSyntax?)reader.ReadValue(); + if (baseList != null) + { + AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + var constraintClauses = (GreenNode?)reader.ReadValue(); + if (constraintClauses != null) + { + AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + var openBraceToken = (SyntaxToken?)reader.ReadValue(); + if (openBraceToken != null) + { + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + var members = (GreenNode?)reader.ReadValue(); + if (members != null) + { + AdjustFlagsAndWidth(members); + this.members = members; + } + var closeBraceToken = (SyntaxToken?)reader.ReadValue(); + if (closeBraceToken != null) + { + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) + { + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.keyword); + writer.WriteValue(this.classOrStructKeyword); + writer.WriteValue(this.identifier); + writer.WriteValue(this.typeParameterList); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.baseList); + writer.WriteValue(this.constraintClauses); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.members); + writer.WriteValue(this.closeBraceToken); + writer.WriteValue(this.semicolonToken); + } + + static RecordDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(RecordDeclarationSyntax), r => new RecordDeclarationSyntax(r)); + } +} + +/// Enum type declaration syntax. +internal sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken enumKeyword; + internal readonly SyntaxToken identifier; + internal readonly BaseListSyntax? baseList; + internal readonly SyntaxToken? openBraceToken; + internal readonly GreenNode? members; + internal readonly SyntaxToken? closeBraceToken; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 9; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(enumKeyword); + this.enumKeyword = enumKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 9; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(enumKeyword); + this.enumKeyword = enumKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + : base(kind) + { + this.SlotCount = 9; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(enumKeyword); + this.enumKeyword = enumKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the enum keyword token. + public SyntaxToken EnumKeyword => this.enumKeyword; + public override SyntaxToken Identifier => this.identifier; + public override BaseListSyntax? BaseList => this.baseList; + public override SyntaxToken? OpenBraceToken => this.openBraceToken; + /// Gets the members declaration list. + public CoreSyntax.SeparatedSyntaxList Members => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.members)); + public override SyntaxToken? CloseBraceToken => this.closeBraceToken; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.enumKeyword, + 3 => this.identifier, + 4 => this.baseList, + 5 => this.openBraceToken, + 6 => this.members, + 7 => this.closeBraceToken, + 8 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); - return this; + public EnumDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax baseList, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); - internal ClassDeclarationSyntax(ObjectReader reader) - : base(reader) + internal EnumDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 9; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 12; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); - if (typeParameterList != null) - { - AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - var parameterList = (ParameterListSyntax?)reader.ReadValue(); - if (parameterList != null) - { - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - var baseList = (BaseListSyntax?)reader.ReadValue(); - if (baseList != null) - { - AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - var constraintClauses = (GreenNode?)reader.ReadValue(); - if (constraintClauses != null) - { - AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - var openBraceToken = (SyntaxToken?)reader.ReadValue(); - if (openBraceToken != null) - { - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - var members = (GreenNode?)reader.ReadValue(); - if (members != null) - { - AdjustFlagsAndWidth(members); - this.members = members; - } - var closeBraceToken = (SyntaxToken?)reader.ReadValue(); - if (closeBraceToken != null) - { - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.keyword); - writer.WriteValue(this.identifier); - writer.WriteValue(this.typeParameterList); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.baseList); - writer.WriteValue(this.constraintClauses); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.members); - writer.WriteValue(this.closeBraceToken); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static ClassDeclarationSyntax() + var enumKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(enumKeyword); + this.enumKeyword = enumKeyword; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var baseList = (BaseListSyntax?)reader.ReadValue(); + if (baseList != null) + { + AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + var openBraceToken = (SyntaxToken?)reader.ReadValue(); + if (openBraceToken != null) + { + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + var members = (GreenNode?)reader.ReadValue(); + if (members != null) + { + AdjustFlagsAndWidth(members); + this.members = members; + } + var closeBraceToken = (SyntaxToken?)reader.ReadValue(); + if (closeBraceToken != null) + { + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(ClassDeclarationSyntax), r => new ClassDeclarationSyntax(r)); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// Struct type declaration syntax. - internal sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.enumKeyword); + writer.WriteValue(this.identifier); + writer.WriteValue(this.baseList); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.members); + writer.WriteValue(this.closeBraceToken); + writer.WriteValue(this.semicolonToken); + } + + static EnumDeclarationSyntax() { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax? parameterList; - internal readonly BaseListSyntax? baseList; - internal readonly GreenNode? constraintClauses; - internal readonly SyntaxToken? openBraceToken; - internal readonly GreenNode? members; - internal readonly SyntaxToken? closeBraceToken; - internal readonly SyntaxToken? semicolonToken; + ObjectBinder.RegisterTypeReader(typeof(EnumDeclarationSyntax), r => new EnumDeclarationSyntax(r)); + } +} - internal 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) - : base(kind, diagnostics, annotations) +/// Delegate declaration syntax. +internal sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken delegateKeyword; + internal readonly TypeSyntax returnType; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax parameterList; + internal readonly GreenNode? constraintClauses; + internal readonly SyntaxToken semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal 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) - : base(kind) + internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 9; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal 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) - : base(kind) + internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the struct keyword token. - public override SyntaxToken Keyword => this.keyword; - public override SyntaxToken Identifier => this.identifier; - public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public override ParameterListSyntax? ParameterList => this.parameterList; - public override BaseListSyntax? BaseList => this.baseList; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); - public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); - public override SyntaxToken? CloseBraceToken => this.closeBraceToken; - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.keyword, - 3 => this.identifier, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 8 => this.openBraceToken, - 9 => this.members, - 10 => this.closeBraceToken, - 11 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StructDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); - - public StructDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the "delegate" keyword. + public SyntaxToken DelegateKeyword => this.delegateKeyword; + /// Gets the return type. + public TypeSyntax ReturnType => this.returnType; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + /// Gets the parameter list. + public ParameterListSyntax ParameterList => this.parameterList; + /// Gets the constraint clause list. + public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + /// Gets the semicolon token. + public SyntaxToken SemicolonToken => this.semicolonToken; - return this; - } + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.delegateKeyword, + 3 => this.returnType, + 4 => this.identifier, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.constraintClauses, + 8 => this.semicolonToken, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DelegateDeclarationSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); - internal StructDeclarationSyntax(ObjectReader reader) - : base(reader) + public DelegateDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) { - this.SlotCount = 12; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); - if (typeParameterList != null) - { - AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - var parameterList = (ParameterListSyntax?)reader.ReadValue(); - if (parameterList != null) - { - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - var baseList = (BaseListSyntax?)reader.ReadValue(); - if (baseList != null) - { - AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - var constraintClauses = (GreenNode?)reader.ReadValue(); - if (constraintClauses != null) - { - AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - var openBraceToken = (SyntaxToken?)reader.ReadValue(); - if (openBraceToken != null) - { - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - var members = (GreenNode?)reader.ReadValue(); - if (members != null) - { - AdjustFlagsAndWidth(members); - this.members = members; - } - var closeBraceToken = (SyntaxToken?)reader.ReadValue(); - if (closeBraceToken != null) - { - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, GetDiagnostics(), annotations); + + internal DelegateDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 9; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.keyword); - writer.WriteValue(this.identifier); - writer.WriteValue(this.typeParameterList); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.baseList); - writer.WriteValue(this.constraintClauses); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.members); - writer.WriteValue(this.closeBraceToken); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static StructDeclarationSyntax() + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var delegateKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + var returnType = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); + if (typeParameterList != null) + { + AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + var parameterList = (ParameterListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + var constraintClauses = (GreenNode?)reader.ReadValue(); + if (constraintClauses != null) { - ObjectBinder.RegisterTypeReader(typeof(StructDeclarationSyntax), r => new StructDeclarationSyntax(r)); + AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; } + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.delegateKeyword); + writer.WriteValue(this.returnType); + writer.WriteValue(this.identifier); + writer.WriteValue(this.typeParameterList); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.constraintClauses); + writer.WriteValue(this.semicolonToken); } - /// Interface type declaration syntax. - internal sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax + static DelegateDeclarationSyntax() { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax? parameterList; - internal readonly BaseListSyntax? baseList; - internal readonly GreenNode? constraintClauses; - internal readonly SyntaxToken? openBraceToken; - internal readonly GreenNode? members; - internal readonly SyntaxToken? closeBraceToken; - internal readonly SyntaxToken? semicolonToken; + ObjectBinder.RegisterTypeReader(typeof(DelegateDeclarationSyntax), r => new DelegateDeclarationSyntax(r)); + } +} + +internal sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken identifier; + internal readonly EqualsValueClauseSyntax? equalsValue; - internal 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) - : base(kind, diagnostics, annotations) + internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal 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) - : base(kind) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (equalsValue != null) { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(equalsValue); + this.equalsValue = equalsValue; + } + } + + internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (equalsValue != null) + { + this.AdjustFlagsAndWidth(equalsValue); + this.equalsValue = equalsValue; + } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the interface keyword token. - public override SyntaxToken Keyword => this.keyword; - public override SyntaxToken Identifier => this.identifier; - public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public override ParameterListSyntax? ParameterList => this.parameterList; - public override BaseListSyntax? BaseList => this.baseList; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); - public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); - public override SyntaxToken? CloseBraceToken => this.closeBraceToken; - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.keyword, - 3 => this.identifier, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 8 => this.openBraceToken, - 9 => this.members, - 10 => this.closeBraceToken, - 11 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterfaceDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); - - public InterfaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + : base(kind) + { + this.SlotCount = 4; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (equalsValue != null) + { + this.AdjustFlagsAndWidth(equalsValue); + this.equalsValue = equalsValue; } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public EqualsValueClauseSyntax? EqualsValue => this.equalsValue; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.identifier, + 3 => this.equalsValue, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumMemberDeclarationSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); - internal InterfaceDeclarationSyntax(ObjectReader reader) - : base(reader) + public EnumMemberDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax equalsValue) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) { - this.SlotCount = 12; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); - if (typeParameterList != null) - { - AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - var parameterList = (ParameterListSyntax?)reader.ReadValue(); - if (parameterList != null) - { - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - var baseList = (BaseListSyntax?)reader.ReadValue(); - if (baseList != null) - { - AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - var constraintClauses = (GreenNode?)reader.ReadValue(); - if (constraintClauses != null) - { - AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - var openBraceToken = (SyntaxToken?)reader.ReadValue(); - if (openBraceToken != null) - { - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - var members = (GreenNode?)reader.ReadValue(); - if (members != null) - { - AdjustFlagsAndWidth(members); - this.members = members; - } - var closeBraceToken = (SyntaxToken?)reader.ReadValue(); - if (closeBraceToken != null) - { - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, GetDiagnostics(), annotations); + + internal EnumMemberDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.keyword); - writer.WriteValue(this.identifier); - writer.WriteValue(this.typeParameterList); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.baseList); - writer.WriteValue(this.constraintClauses); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.members); - writer.WriteValue(this.closeBraceToken); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static InterfaceDeclarationSyntax() + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var equalsValue = (EqualsValueClauseSyntax?)reader.ReadValue(); + if (equalsValue != null) { - ObjectBinder.RegisterTypeReader(typeof(InterfaceDeclarationSyntax), r => new InterfaceDeclarationSyntax(r)); + AdjustFlagsAndWidth(equalsValue); + this.equalsValue = equalsValue; } } - internal sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.identifier); + writer.WriteValue(this.equalsValue); + } + + static EnumMemberDeclarationSyntax() { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken? classOrStructKeyword; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax? parameterList; - internal readonly BaseListSyntax? baseList; - internal readonly GreenNode? constraintClauses; - internal readonly SyntaxToken? openBraceToken; - internal readonly GreenNode? members; - internal readonly SyntaxToken? closeBraceToken; - internal readonly SyntaxToken? semicolonToken; + ObjectBinder.RegisterTypeReader(typeof(EnumMemberDeclarationSyntax), r => new EnumMemberDeclarationSyntax(r)); + } +} - internal 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) - : base(kind, diagnostics, annotations) +/// Base list syntax. +internal sealed partial class BaseListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken colonToken; + internal readonly GreenNode? types; + + internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (types != null) { - this.SlotCount = 13; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (classOrStructKeyword != null) - { - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(types); + this.types = types; } + } - internal 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) - : base(kind) + internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (types != null) { - this.SetFactoryContext(context); - this.SlotCount = 13; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (classOrStructKeyword != null) - { - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(types); + this.types = types; } + } - internal 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) - : base(kind) + internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (types != null) { - this.SlotCount = 13; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (classOrStructKeyword != null) - { - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(types); + this.types = types; } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public override SyntaxToken Keyword => this.keyword; - public SyntaxToken? ClassOrStructKeyword => this.classOrStructKeyword; - public override SyntaxToken Identifier => this.identifier; - public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public override ParameterListSyntax? ParameterList => this.parameterList; - public override BaseListSyntax? BaseList => this.baseList; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); - public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); - public override SyntaxToken? CloseBraceToken => this.closeBraceToken; - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.keyword, - 3 => this.classOrStructKeyword, - 4 => this.identifier, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.baseList, - 8 => this.constraintClauses, - 9 => this.openBraceToken, - 10 => this.members, - 11 => this.closeBraceToken, - 12 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecordDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); - - public RecordDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.RecordDeclaration(this.Kind, attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + /// Gets the colon token. + public SyntaxToken ColonToken => this.colonToken; + /// Gets the base type references. + public CoreSyntax.SeparatedSyntaxList Types => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.types)); - return this; - } + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.colonToken, + 1 => this.types, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseListSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); - internal RecordDeclarationSyntax(ObjectReader reader) - : base(reader) + public BaseListSyntax Update(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) + { + if (colonToken != this.ColonToken || types != this.Types) { - this.SlotCount = 13; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var classOrStructKeyword = (SyntaxToken?)reader.ReadValue(); - if (classOrStructKeyword != null) - { - AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); - if (typeParameterList != null) - { - AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - var parameterList = (ParameterListSyntax?)reader.ReadValue(); - if (parameterList != null) - { - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - var baseList = (BaseListSyntax?)reader.ReadValue(); - if (baseList != null) - { - AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - var constraintClauses = (GreenNode?)reader.ReadValue(); - if (constraintClauses != null) - { - AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - var openBraceToken = (SyntaxToken?)reader.ReadValue(); - if (openBraceToken != null) - { - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - var members = (GreenNode?)reader.ReadValue(); - if (members != null) - { - AdjustFlagsAndWidth(members); - this.members = members; - } - var closeBraceToken = (SyntaxToken?)reader.ReadValue(); - if (closeBraceToken != null) - { - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.BaseList(colonToken, types); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.keyword); - writer.WriteValue(this.classOrStructKeyword); - writer.WriteValue(this.identifier); - writer.WriteValue(this.typeParameterList); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.baseList); - writer.WriteValue(this.constraintClauses); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.members); - writer.WriteValue(this.closeBraceToken); - writer.WriteValue(this.semicolonToken); - } + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BaseListSyntax(this.Kind, this.colonToken, this.types, diagnostics, GetAnnotations()); - static RecordDeclarationSyntax() + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BaseListSyntax(this.Kind, this.colonToken, this.types, GetDiagnostics(), annotations); + + internal BaseListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + var types = (GreenNode?)reader.ReadValue(); + if (types != null) { - ObjectBinder.RegisterTypeReader(typeof(RecordDeclarationSyntax), r => new RecordDeclarationSyntax(r)); + AdjustFlagsAndWidth(types); + this.types = types; } } - /// Enum type declaration syntax. - internal sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken enumKeyword; - internal readonly SyntaxToken identifier; - internal readonly BaseListSyntax? baseList; - internal readonly SyntaxToken? openBraceToken; - internal readonly GreenNode? members; - internal readonly SyntaxToken? closeBraceToken; - internal readonly SyntaxToken? semicolonToken; + base.WriteTo(writer); + writer.WriteValue(this.colonToken); + writer.WriteValue(this.types); + } - internal 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) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(enumKeyword); - this.enumKeyword = enumKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + static BaseListSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(BaseListSyntax), r => new BaseListSyntax(r)); + } +} - internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(enumKeyword); - this.enumKeyword = enumKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } +/// Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. +internal abstract partial class BaseTypeSyntax : CSharpSyntaxNode +{ + internal BaseTypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } + + internal BaseTypeSyntax(SyntaxKind kind) + : base(kind) + { + } + + protected BaseTypeSyntax(ObjectReader reader) + : base(reader) + { + } + + public abstract TypeSyntax Type { get; } +} + +internal sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax +{ + internal readonly TypeSyntax type; + + internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } + + internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } + + internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } + + public override TypeSyntax Type => this.type; + + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.type : null; - internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleBaseTypeSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); + + public SimpleBaseTypeSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(enumKeyword); - this.enumKeyword = enumKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.SimpleBaseType(type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the enum keyword token. - public SyntaxToken EnumKeyword => this.enumKeyword; - public override SyntaxToken Identifier => this.identifier; - public override BaseListSyntax? BaseList => this.baseList; - public override SyntaxToken? OpenBraceToken => this.openBraceToken; - /// Gets the members declaration list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members)); - public override SyntaxToken? CloseBraceToken => this.closeBraceToken; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.enumKeyword, - 3 => this.identifier, - 4 => this.baseList, - 5 => this.openBraceToken, - 6 => this.members, - 7 => this.closeBraceToken, - 8 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); - - public EnumDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax baseList, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SimpleBaseTypeSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SimpleBaseTypeSyntax(this.Kind, this.type, GetDiagnostics(), annotations); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + internal SimpleBaseTypeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.type); + } - internal EnumDeclarationSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 9; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var enumKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(enumKeyword); - this.enumKeyword = enumKeyword; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var baseList = (BaseListSyntax?)reader.ReadValue(); - if (baseList != null) - { - AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - var openBraceToken = (SyntaxToken?)reader.ReadValue(); - if (openBraceToken != null) - { - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - var members = (GreenNode?)reader.ReadValue(); - if (members != null) - { - AdjustFlagsAndWidth(members); - this.members = members; - } - var closeBraceToken = (SyntaxToken?)reader.ReadValue(); - if (closeBraceToken != null) - { - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + static SimpleBaseTypeSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(SimpleBaseTypeSyntax), r => new SimpleBaseTypeSyntax(r)); + } +} - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.enumKeyword); - writer.WriteValue(this.identifier); - writer.WriteValue(this.baseList); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.members); - writer.WriteValue(this.closeBraceToken); - writer.WriteValue(this.semicolonToken); - } +internal sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax +{ + internal readonly TypeSyntax type; + internal readonly ArgumentListSyntax argumentList; - static EnumDeclarationSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(EnumDeclarationSyntax), r => new EnumDeclarationSyntax(r)); - } + internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - /// Delegate declaration syntax. - internal sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax + internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken delegateKeyword; - internal readonly TypeSyntax returnType; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax parameterList; - internal readonly GreenNode? constraintClauses; - internal readonly SyntaxToken semicolonToken; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal 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) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + + public override TypeSyntax Type => this.type; + public ArgumentListSyntax ArgumentList => this.argumentList; - internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + 0 => this.type, + 1 => this.argumentList, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrimaryConstructorBaseTypeSyntax(this, parent, position); - internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); + + public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) + { + if (type != this.Type || argumentList != this.ArgumentList) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the "delegate" keyword. - public SyntaxToken DelegateKeyword => this.delegateKeyword; - /// Gets the return type. - public TypeSyntax ReturnType => this.returnType; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - /// Gets the parameter list. - public ParameterListSyntax ParameterList => this.parameterList; - /// Gets the constraint clause list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); - /// Gets the semicolon token. - public SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.delegateKeyword, - 3 => this.returnType, - 4 => this.identifier, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.constraintClauses, - 8 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DelegateDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); - - public DelegateDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + return this; + } - return this; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, GetDiagnostics(), annotations); + + internal PrimaryConstructorBaseTypeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var argumentList = (ArgumentListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.type); + writer.WriteValue(this.argumentList); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, diagnostics, GetAnnotations()); + static PrimaryConstructorBaseTypeSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(PrimaryConstructorBaseTypeSyntax), r => new PrimaryConstructorBaseTypeSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, GetDiagnostics(), annotations); +/// Type parameter constraint clause. +internal sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken whereKeyword; + internal readonly IdentifierNameSyntax name; + internal readonly SyntaxToken colonToken; + internal readonly GreenNode? constraints; - internal DelegateDeclarationSyntax(ObjectReader reader) - : base(reader) + internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (constraints != null) { - this.SlotCount = 9; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var delegateKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - var returnType = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); - if (typeParameterList != null) - { - AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - var parameterList = (ParameterListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - var constraintClauses = (GreenNode?)reader.ReadValue(); - if (constraintClauses != null) - { - AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(constraints); + this.constraints = constraints; } + } - internal override void WriteTo(ObjectWriter writer) + internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (constraints != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.delegateKeyword); - writer.WriteValue(this.returnType); - writer.WriteValue(this.identifier); - writer.WriteValue(this.typeParameterList); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.constraintClauses); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(constraints); + this.constraints = constraints; } + } - static DelegateDeclarationSyntax() + internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (constraints != null) { - ObjectBinder.RegisterTypeReader(typeof(DelegateDeclarationSyntax), r => new DelegateDeclarationSyntax(r)); + this.AdjustFlagsAndWidth(constraints); + this.constraints = constraints; } } - internal sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken identifier; - internal readonly EqualsValueClauseSyntax? equalsValue; + public SyntaxToken WhereKeyword => this.whereKeyword; + /// Gets the identifier. + public IdentifierNameSyntax Name => this.name; + /// Gets the colon token. + public SyntaxToken ColonToken => this.colonToken; + /// Gets the constraints list. + public CoreSyntax.SeparatedSyntaxList Constraints => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.constraints)); - internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (equalsValue != null) - { - this.AdjustFlagsAndWidth(equalsValue); - this.equalsValue = equalsValue; - } - } + 0 => this.whereKeyword, + 1 => this.name, + 2 => this.colonToken, + 3 => this.constraints, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterConstraintClauseSyntax(this, parent, position); - internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, SyntaxFactoryContext context) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); + + public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) + { + if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (equalsValue != null) - { - this.AdjustFlagsAndWidth(equalsValue); - this.equalsValue = equalsValue; - } + var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) - : base(kind) + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, GetDiagnostics(), annotations); + + internal TypeParameterConstraintClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var whereKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + var name = (IdentifierNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + var constraints = (GreenNode?)reader.ReadValue(); + if (constraints != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (equalsValue != null) - { - this.AdjustFlagsAndWidth(equalsValue); - this.equalsValue = equalsValue; - } + AdjustFlagsAndWidth(constraints); + this.constraints = constraints; } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.whereKeyword); + writer.WriteValue(this.name); + writer.WriteValue(this.colonToken); + writer.WriteValue(this.constraints); + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public EqualsValueClauseSyntax? EqualsValue => this.equalsValue; + static TypeParameterConstraintClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(TypeParameterConstraintClauseSyntax), r => new TypeParameterConstraintClauseSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.identifier, - 3 => this.equalsValue, - _ => null, - }; +/// Base type for type parameter constraint syntax. +internal abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode +{ + internal TypeParameterConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumMemberDeclarationSyntax(this, parent, position); + internal TypeParameterConstraintSyntax(SyntaxKind kind) + : base(kind) + { + } + + protected TypeParameterConstraintSyntax(ObjectReader reader) + : base(reader) + { + } +} + +/// Constructor constraint syntax. +internal sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly SyntaxToken closeParenToken; + + internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); + /// Gets the "new" keyword. + public SyntaxToken NewKeyword => this.newKeyword; + /// Gets the open paren keyword. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Gets the close paren keyword. + public SyntaxToken CloseParenToken => this.closeParenToken; - public EnumMemberDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax equalsValue) + internal override GreenNode? GetSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) - { - var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.newKeyword, + 1 => this.openParenToken, + 2 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorConstraintSyntax(this, parent, position); - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); + + public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + { + if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, GetDiagnostics(), annotations); + + internal ConstructorConstraintSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var newKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.newKeyword); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.closeParenToken); + } + + static ConstructorConstraintSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ConstructorConstraintSyntax), r => new ConstructorConstraintSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, GetDiagnostics(), annotations); +/// Class or struct constraint syntax. +internal sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax +{ + internal readonly SyntaxToken classOrStructKeyword; + internal readonly SyntaxToken? questionToken; - internal EnumMemberDeclarationSyntax(ObjectReader reader) - : base(reader) + internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + if (questionToken != null) { - this.SlotCount = 4; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var equalsValue = (EqualsValueClauseSyntax?)reader.ReadValue(); - if (equalsValue != null) - { - AdjustFlagsAndWidth(equalsValue); - this.equalsValue = equalsValue; - } + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; } + } - internal override void WriteTo(ObjectWriter writer) + internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + if (questionToken != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.identifier); - writer.WriteValue(this.equalsValue); + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; } + } - static EnumMemberDeclarationSyntax() + internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + if (questionToken != null) { - ObjectBinder.RegisterTypeReader(typeof(EnumMemberDeclarationSyntax), r => new EnumMemberDeclarationSyntax(r)); + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; } } - /// Base list syntax. - internal sealed partial class BaseListSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken colonToken; - internal readonly GreenNode? types; + /// Gets the constraint keyword ("class" or "struct"). + public SyntaxToken ClassOrStructKeyword => this.classOrStructKeyword; + /// SyntaxToken representing the question mark. + public SyntaxToken? QuestionToken => this.questionToken; - internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (types != null) - { - this.AdjustFlagsAndWidth(types); - this.types = types; - } - } + 0 => this.classOrStructKeyword, + 1 => this.questionToken, + _ => null, + }; - internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, SyntaxFactoryContext context) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassOrStructConstraintSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); + + public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken) + { + if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (types != null) - { - this.AdjustFlagsAndWidth(types); - this.types = types; - } + var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind, classOrStructKeyword, questionToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types) - : base(kind) + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, GetDiagnostics(), annotations); + + internal ClassOrStructConstraintSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var classOrStructKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + var questionToken = (SyntaxToken?)reader.ReadValue(); + if (questionToken != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (types != null) - { - this.AdjustFlagsAndWidth(types); - this.types = types; - } + AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.classOrStructKeyword); + writer.WriteValue(this.questionToken); + } - /// Gets the colon token. - public SyntaxToken ColonToken => this.colonToken; - /// Gets the base type references. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Types => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.types)); + static ClassOrStructConstraintSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ClassOrStructConstraintSyntax), r => new ClassOrStructConstraintSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.colonToken, - 1 => this.types, - _ => null, - }; +/// Type constraint syntax. +internal sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax +{ + internal readonly TypeSyntax type; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseListSyntax(this, parent, position); + internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); + internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - public BaseListSyntax Update(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList types) - { - if (colonToken != this.ColonToken || types != this.Types) - { - var newNode = SyntaxFactory.BaseList(colonToken, types); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - return this; - } + /// Gets the type syntax. + public TypeSyntax Type => this.type; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BaseListSyntax(this.Kind, this.colonToken, this.types, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.type : null; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BaseListSyntax(this.Kind, this.colonToken, this.types, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeConstraintSyntax(this, parent, position); - internal BaseListSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 2; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - var types = (GreenNode?)reader.ReadValue(); - if (types != null) - { - AdjustFlagsAndWidth(types); - this.types = types; - } - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); - internal override void WriteTo(ObjectWriter writer) + public TypeConstraintSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - base.WriteTo(writer); - writer.WriteValue(this.colonToken); - writer.WriteValue(this.types); + var newNode = SyntaxFactory.TypeConstraint(type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static BaseListSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(BaseListSyntax), r => new BaseListSyntax(r)); - } + return this; } - /// Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. - internal abstract partial class BaseTypeSyntax : CSharpSyntaxNode - { - internal BaseTypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeConstraintSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - internal BaseTypeSyntax(SyntaxKind kind) - : base(kind) - { - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeConstraintSyntax(this.Kind, this.type, GetDiagnostics(), annotations); - protected BaseTypeSyntax(ObjectReader reader) - : base(reader) - { - } + internal TypeConstraintSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + } - public abstract TypeSyntax Type { get; } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.type); } - internal sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax + static TypeConstraintSyntax() { - internal readonly TypeSyntax type; + ObjectBinder.RegisterTypeReader(typeof(TypeConstraintSyntax), r => new TypeConstraintSyntax(r)); + } +} - internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } +/// Default constraint syntax. +internal sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax +{ + internal readonly SyntaxToken defaultKeyword; - internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(defaultKeyword); + this.defaultKeyword = defaultKeyword; + } - internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(defaultKeyword); + this.defaultKeyword = defaultKeyword; + } - public override TypeSyntax Type => this.type; + internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(defaultKeyword); + this.defaultKeyword = defaultKeyword; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.type : null; + /// Gets the "default" keyword. + public SyntaxToken DefaultKeyword => this.defaultKeyword; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleBaseTypeSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.defaultKeyword : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultConstraintSyntax(this, parent, position); - public SimpleBaseTypeSyntax Update(TypeSyntax type) - { - if (type != this.Type) - { - var newNode = SyntaxFactory.SimpleBaseType(type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); - return this; + public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword) + { + if (defaultKeyword != this.DefaultKeyword) + { + var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SimpleBaseTypeSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SimpleBaseTypeSyntax(this.Kind, this.type, GetDiagnostics(), annotations); + return this; + } - internal SimpleBaseTypeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.type); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, GetDiagnostics(), annotations); - static SimpleBaseTypeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(SimpleBaseTypeSyntax), r => new SimpleBaseTypeSyntax(r)); - } + internal DefaultConstraintSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var defaultKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(defaultKeyword); + this.defaultKeyword = defaultKeyword; } - internal sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly TypeSyntax type; - internal readonly ArgumentListSyntax argumentList; + base.WriteTo(writer); + writer.WriteValue(this.defaultKeyword); + } - internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + static DefaultConstraintSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(DefaultConstraintSyntax), r => new DefaultConstraintSyntax(r)); + } +} - internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } +internal abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseFieldDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal BaseFieldDeclarationSyntax(SyntaxKind kind) + : base(kind) + { + } - public override TypeSyntax Type => this.type; - public ArgumentListSyntax ArgumentList => this.argumentList; + protected BaseFieldDeclarationSyntax(ObjectReader reader) + : base(reader) + { + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.argumentList, - _ => null, - }; + public abstract VariableDeclarationSyntax Declaration { get; } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrimaryConstructorBaseTypeSyntax(this, parent, position); + public abstract SyntaxToken SemicolonToken { get; } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); +internal sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly VariableDeclarationSyntax declaration; + internal readonly SyntaxToken semicolonToken; - public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) + internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) { - if (type != this.Type || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, GetDiagnostics(), annotations); - - internal PrimaryConstructorBaseTypeSyntax(ObjectReader reader) - : base(reader) + if (modifiers != null) { - this.SlotCount = 2; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var argumentList = (ArgumentListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal override void WriteTo(ObjectWriter writer) + internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.type); - writer.WriteValue(this.argumentList); + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static PrimaryConstructorBaseTypeSyntax() + if (modifiers != null) { - ObjectBinder.RegisterTypeReader(typeof(PrimaryConstructorBaseTypeSyntax), r => new PrimaryConstructorBaseTypeSyntax(r)); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - /// Type parameter constraint clause. - internal sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode + internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + : base(kind) { - internal readonly SyntaxToken whereKeyword; - internal readonly IdentifierNameSyntax name; - internal readonly SyntaxToken colonToken; - internal readonly GreenNode? constraints; - - internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (constraints != null) - { - this.AdjustFlagsAndWidth(constraints); - this.constraints = constraints; - } - } - - internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, SyntaxFactoryContext context) - : base(kind) + this.SlotCount = 4; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (constraints != null) - { - this.AdjustFlagsAndWidth(constraints); - this.constraints = constraints; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints) - : base(kind) + if (modifiers != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (constraints != null) - { - this.AdjustFlagsAndWidth(constraints); - this.constraints = constraints; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public SyntaxToken WhereKeyword => this.whereKeyword; - /// Gets the identifier. - public IdentifierNameSyntax Name => this.name; - /// Gets the colon token. - public SyntaxToken ColonToken => this.colonToken; - /// Gets the constraints list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Constraints => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraints)); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override VariableDeclarationSyntax Declaration => this.declaration; + public override SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.whereKeyword, - 1 => this.name, - 2 => this.colonToken, - 3 => this.constraints, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.declaration, + 3 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterConstraintClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FieldDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); - public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList constraints) + public FieldDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { - if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) - { - var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); - internal TypeParameterConstraintClauseSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var whereKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - var name = (IdentifierNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - var constraints = (GreenNode?)reader.ReadValue(); - if (constraints != null) - { - AdjustFlagsAndWidth(constraints); - this.constraints = constraints; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal FieldDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.whereKeyword); - writer.WriteValue(this.name); - writer.WriteValue(this.colonToken); - writer.WriteValue(this.constraints); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static TypeParameterConstraintClauseSyntax() + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - ObjectBinder.RegisterTypeReader(typeof(TypeParameterConstraintClauseSyntax), r => new TypeParameterConstraintClauseSyntax(r)); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + var declaration = (VariableDeclarationSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - /// Base type for type parameter constraint syntax. - internal abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal TypeParameterConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.declaration); + writer.WriteValue(this.semicolonToken); + } + + static FieldDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(FieldDeclarationSyntax), r => new FieldDeclarationSyntax(r)); + } +} + +internal sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken eventKeyword; + internal readonly VariableDeclarationSyntax declaration; + internal readonly SyntaxToken semicolonToken; - internal TypeParameterConstraintSyntax(SyntaxKind kind) - : base(kind) + internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - protected TypeParameterConstraintSyntax(ObjectReader reader) - : base(reader) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - /// Constructor constraint syntax. - internal sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax + internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken newKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly SyntaxToken closeParenToken; - - internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) - : base(kind) + internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - /// Gets the "new" keyword. - public SyntaxToken NewKeyword => this.newKeyword; - /// Gets the open paren keyword. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Gets the close paren keyword. - public SyntaxToken CloseParenToken => this.closeParenToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public SyntaxToken EventKeyword => this.eventKeyword; + public override VariableDeclarationSyntax Declaration => this.declaration; + public override SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.openParenToken, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.eventKeyword, + 3 => this.declaration, + 4 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorConstraintSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventFieldDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); - public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + public EventFieldDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { - if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); - internal ConstructorConstraintSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var newKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal EventFieldDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.newKeyword); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.closeParenToken); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static ConstructorConstraintSyntax() + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - ObjectBinder.RegisterTypeReader(typeof(ConstructorConstraintSyntax), r => new ConstructorConstraintSyntax(r)); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + var eventKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + var declaration = (VariableDeclarationSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + var semicolonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - /// Class or struct constraint syntax. - internal sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken classOrStructKeyword; - internal readonly SyntaxToken? questionToken; - - internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - if (questionToken != null) - { - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - } - } + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.eventKeyword); + writer.WriteValue(this.declaration); + writer.WriteValue(this.semicolonToken); + } - internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - if (questionToken != null) - { - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - } - } + static EventFieldDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(EventFieldDeclarationSyntax), r => new EventFieldDeclarationSyntax(r)); + } +} - internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - if (questionToken != null) - { - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - } - } +internal sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode +{ + internal readonly NameSyntax name; + internal readonly SyntaxToken dotToken; - /// Gets the constraint keyword ("class" or "struct"). - public SyntaxToken ClassOrStructKeyword => this.classOrStructKeyword; - /// SyntaxToken representing the question mark. - public SyntaxToken? QuestionToken => this.questionToken; + internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.classOrStructKeyword, - 1 => this.questionToken, - _ => null, - }; + internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassOrStructConstraintSyntax(this, parent, position); + internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); + public NameSyntax Name => this.name; + public SyntaxToken DotToken => this.dotToken; - public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken) - { - var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind, classOrStructKeyword, questionToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.name, + 1 => this.dotToken, + _ => null, + }; - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExplicitInterfaceSpecifierSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); - internal ClassOrStructConstraintSyntax(ObjectReader reader) - : base(reader) + public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken) + { + if (name != this.Name || dotToken != this.DotToken) { - this.SlotCount = 2; - var classOrStructKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - var questionToken = (SyntaxToken?)reader.ReadValue(); - if (questionToken != null) - { - AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - } + var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.classOrStructKeyword); - writer.WriteValue(this.questionToken); - } + return this; + } - static ClassOrStructConstraintSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ClassOrStructConstraintSyntax), r => new ClassOrStructConstraintSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, GetDiagnostics(), annotations); + + internal ExplicitInterfaceSpecifierSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var name = (NameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var dotToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; } - /// Type constraint syntax. - internal sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly TypeSyntax type; + base.WriteTo(writer); + writer.WriteValue(this.name); + writer.WriteValue(this.dotToken); + } - internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + static ExplicitInterfaceSpecifierSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ExplicitInterfaceSpecifierSyntax), r => new ExplicitInterfaceSpecifierSyntax(r)); + } +} - internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } +/// Base type for method declaration syntax. +internal abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseMethodDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + internal BaseMethodDeclarationSyntax(SyntaxKind kind) + : base(kind) + { + } + + protected BaseMethodDeclarationSyntax(ObjectReader reader) + : base(reader) + { + } + + /// Gets the parameter list. + public abstract ParameterListSyntax ParameterList { get; } - /// Gets the type syntax. - public TypeSyntax Type => this.type; + public abstract BlockSyntax? Body { get; } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.type : null; + public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeConstraintSyntax(this, parent, position); + /// Gets the optional semicolon token. + public abstract SyntaxToken? SemicolonToken { get; } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); +/// Method declaration syntax. +internal sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax returnType; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax parameterList; + internal readonly GreenNode? constraintClauses; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - public TypeConstraintSyntax Update(TypeSyntax type) + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 11; + if (attributeLists != null) { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypeConstraint(type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeConstraintSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeConstraintSyntax(this.Kind, this.type, GetDiagnostics(), annotations); - - internal TypeConstraintSyntax(ObjectReader reader) - : base(reader) + if (modifiers != null) { - this.SlotCount = 1; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal override void WriteTo(ObjectWriter writer) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) { - base.WriteTo(writer); - writer.WriteValue(this.type); + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - static TypeConstraintSyntax() + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(TypeConstraintSyntax), r => new TypeConstraintSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// Default constraint syntax. - internal sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax + internal 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) + : base(kind) { - internal readonly SyntaxToken defaultKeyword; - - internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(defaultKeyword); - this.defaultKeyword = defaultKeyword; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(defaultKeyword); - this.defaultKeyword = defaultKeyword; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword) - : base(kind) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(defaultKeyword); - this.defaultKeyword = defaultKeyword; + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - /// Gets the "default" keyword. - public SyntaxToken DefaultKeyword => this.defaultKeyword; - - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.defaultKeyword : null; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultConstraintSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); - - public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) { - if (defaultKeyword != this.DefaultKeyword) - { - var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, GetDiagnostics(), annotations); - - internal DefaultConstraintSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) { - this.SlotCount = 1; - var defaultKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(defaultKeyword); - this.defaultKeyword = defaultKeyword; + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; } - - internal override void WriteTo(ObjectWriter writer) + if (body != null) { - base.WriteTo(writer); - writer.WriteValue(this.defaultKeyword); + this.AdjustFlagsAndWidth(body); + this.body = body; } - - static DefaultConstraintSyntax() + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(DefaultConstraintSyntax), r => new DefaultConstraintSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - internal abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax + internal 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) + : base(kind) { - internal BaseFieldDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 11; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseFieldDeclarationSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - protected BaseFieldDeclarationSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - public abstract VariableDeclarationSyntax Declaration { get; } - - public abstract SyntaxToken SemicolonToken { get; } - } - - internal sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly VariableDeclarationSyntax declaration; - internal readonly SyntaxToken semicolonToken; - - internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; } - - internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; } - - internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - : base(kind) + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; this.AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public override VariableDeclarationSyntax Declaration => this.declaration; - public override SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the return type syntax. + public TypeSyntax ReturnType => this.returnType; + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public override ParameterListSyntax ParameterList => this.parameterList; + /// Gets the constraint clause list. + public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override BlockSyntax? Body => this.body; + public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.declaration, - 3 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.returnType, + 3 => this.explicitInterfaceSpecifier, + 4 => this.identifier, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.constraintClauses, + 8 => this.body, + 9 => this.expressionBody, + 10 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FieldDeclarationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MethodDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); - public FieldDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public MethodDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); - internal FieldDeclarationSyntax(ObjectReader reader) - : base(reader) + internal MethodDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 11; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 4; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var declaration = (VariableDeclarationSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.declaration); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static FieldDeclarationSyntax() + var returnType = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); + if (explicitInterfaceSpecifier != null) { - ObjectBinder.RegisterTypeReader(typeof(FieldDeclarationSyntax), r => new FieldDeclarationSyntax(r)); + AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - } - - internal sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken eventKeyword; - internal readonly VariableDeclarationSyntax declaration; - internal readonly SyntaxToken semicolonToken; - - internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); + if (typeParameterList != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; } - - internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + var parameterList = (ParameterListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + var constraintClauses = (GreenNode?)reader.ReadValue(); + if (constraintClauses != null) + { + AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + var body = (BlockSyntax?)reader.ReadValue(); + if (body != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + AdjustFlagsAndWidth(body); + this.body = body; } - - internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - : base(kind) + var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); + if (expressionBody != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) + { + AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public SyntaxToken EventKeyword => this.eventKeyword; - public override VariableDeclarationSyntax Declaration => this.declaration; - public override SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.eventKeyword, - 3 => this.declaration, - 4 => this.semicolonToken, - _ => null, - }; + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.returnType); + writer.WriteValue(this.explicitInterfaceSpecifier); + writer.WriteValue(this.identifier); + writer.WriteValue(this.typeParameterList); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.constraintClauses); + writer.WriteValue(this.body); + writer.WriteValue(this.expressionBody); + writer.WriteValue(this.semicolonToken); + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventFieldDeclarationSyntax(this, parent, position); + static MethodDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(MethodDeclarationSyntax), r => new MethodDeclarationSyntax(r)); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); +/// Operator declaration syntax. +internal sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax returnType; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken operatorKeyword; + internal readonly SyntaxToken? checkedKeyword; + internal readonly SyntaxToken operatorToken; + internal readonly ParameterListSyntax parameterList; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - public EventFieldDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 11; + if (attributeLists != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); - - internal EventFieldDeclarationSyntax(ObjectReader reader) - : base(reader) + if (modifiers != null) { - this.SlotCount = 5; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var eventKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - var declaration = (VariableDeclarationSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - var semicolonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal override void WriteTo(ObjectWriter writer) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.eventKeyword); - writer.WriteValue(this.declaration); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - static EventFieldDeclarationSyntax() + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(EventFieldDeclarationSyntax), r => new EventFieldDeclarationSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - internal sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode + internal 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) + : base(kind) { - internal readonly NameSyntax name; - internal readonly SyntaxToken dotToken; - - internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken) - : base(kind) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - public NameSyntax Name => this.name; - public SyntaxToken DotToken => this.dotToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.dotToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExplicitInterfaceSpecifierSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); - - public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken) + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - if (name != this.Name || dotToken != this.DotToken) - { - var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, GetDiagnostics(), annotations); - - internal ExplicitInterfaceSpecifierSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) { - this.SlotCount = 2; - var name = (NameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var dotToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; + this.AdjustFlagsAndWidth(body); + this.body = body; } - - internal override void WriteTo(ObjectWriter writer) + if (expressionBody != null) { - base.WriteTo(writer); - writer.WriteValue(this.name); - writer.WriteValue(this.dotToken); + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - static ExplicitInterfaceSpecifierSyntax() + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(ExplicitInterfaceSpecifierSyntax), r => new ExplicitInterfaceSpecifierSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// Base type for method declaration syntax. - internal abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax + internal 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) + : base(kind) { - internal BaseMethodDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 11; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseMethodDeclarationSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - protected BaseMethodDeclarationSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - /// Gets the parameter list. - public abstract ParameterListSyntax ParameterList { get; } - - public abstract BlockSyntax? Body { get; } - - public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; } - - /// Gets the optional semicolon token. - public abstract SyntaxToken? SemicolonToken { get; } - } - - /// Method declaration syntax. - internal sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax returnType; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax parameterList; - internal readonly GreenNode? constraintClauses; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } - - internal 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) - : base(kind) + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) { - this.SetFactoryContext(context); - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - internal 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) - : base(kind) + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the return type. + public TypeSyntax ReturnType => this.returnType; + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + /// Gets the "operator" keyword. + public SyntaxToken OperatorKeyword => this.operatorKeyword; + /// Gets the "checked" keyword. + public SyntaxToken? CheckedKeyword => this.checkedKeyword; + /// Gets the operator token. + public SyntaxToken OperatorToken => this.operatorToken; + public override ParameterListSyntax ParameterList => this.parameterList; + public override BlockSyntax? Body => this.body; + public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.returnType, + 3 => this.explicitInterfaceSpecifier, + 4 => this.operatorKeyword, + 5 => this.checkedKeyword, + 6 => this.operatorToken, + 7 => this.parameterList, + 8 => this.body, + 9 => this.expressionBody, + 10 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); + + public OperatorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); + + internal OperatorDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 11; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var returnType = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); + if (explicitInterfaceSpecifier != null) + { + AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + var operatorKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + var checkedKeyword = (SyntaxToken?)reader.ReadValue(); + if (checkedKeyword != null) + { + AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var parameterList = (ParameterListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + var body = (BlockSyntax?)reader.ReadValue(); + if (body != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + AdjustFlagsAndWidth(body); + this.body = body; } - - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the return type syntax. - public TypeSyntax ReturnType => this.returnType; - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public override ParameterListSyntax ParameterList => this.parameterList; - /// Gets the constraint clause list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); - public override BlockSyntax? Body => this.body; - public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.returnType, - 3 => this.explicitInterfaceSpecifier, - 4 => this.identifier, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.constraintClauses, - 8 => this.body, - 9 => this.expressionBody, - 10 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MethodDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); - - public MethodDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); + if (expressionBody != null) + { + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) + { + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.returnType); + writer.WriteValue(this.explicitInterfaceSpecifier); + writer.WriteValue(this.operatorKeyword); + writer.WriteValue(this.checkedKeyword); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.body); + writer.WriteValue(this.expressionBody); + writer.WriteValue(this.semicolonToken); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + static OperatorDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(OperatorDeclarationSyntax), r => new OperatorDeclarationSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +/// Conversion operator declaration syntax. +internal sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken implicitOrExplicitKeyword; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken operatorKeyword; + internal readonly SyntaxToken? checkedKeyword; + internal readonly TypeSyntax type; + internal readonly ParameterListSyntax parameterList; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - internal MethodDeclarationSyntax(ObjectReader reader) - : base(reader) + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 11; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var returnType = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); - if (explicitInterfaceSpecifier != null) - { - AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var typeParameterList = (TypeParameterListSyntax?)reader.ReadValue(); - if (typeParameterList != null) - { - AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - var parameterList = (ParameterListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - var constraintClauses = (GreenNode?)reader.ReadValue(); - if (constraintClauses != null) - { - AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - var body = (BlockSyntax?)reader.ReadValue(); - if (body != null) - { - AdjustFlagsAndWidth(body); - this.body = body; - } - var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.returnType); - writer.WriteValue(this.explicitInterfaceSpecifier); - writer.WriteValue(this.identifier); - writer.WriteValue(this.typeParameterList); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.constraintClauses); - writer.WriteValue(this.body); - writer.WriteValue(this.expressionBody); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static MethodDeclarationSyntax() + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(MethodDeclarationSyntax), r => new MethodDeclarationSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// Operator declaration syntax. - internal sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax + internal 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) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax returnType; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken operatorKeyword; - internal readonly SyntaxToken? checkedKeyword; - internal readonly SyntaxToken operatorToken; - internal readonly ParameterListSyntax parameterList; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal 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) - : base(kind) + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the return type. - public TypeSyntax ReturnType => this.returnType; - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - /// Gets the "operator" keyword. - public SyntaxToken OperatorKeyword => this.operatorKeyword; - /// Gets the "checked" keyword. - public SyntaxToken? CheckedKeyword => this.checkedKeyword; - /// Gets the operator token. - public SyntaxToken OperatorToken => this.operatorToken; - public override ParameterListSyntax ParameterList => this.parameterList; - public override BlockSyntax? Body => this.body; - public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.returnType, - 3 => this.explicitInterfaceSpecifier, - 4 => this.operatorKeyword, - 5 => this.checkedKeyword, - 6 => this.operatorToken, - 7 => this.parameterList, - 8 => this.body, - 9 => this.expressionBody, - 10 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); - - public OperatorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); - - internal OperatorDeclarationSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) { - this.SlotCount = 11; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var returnType = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); - if (explicitInterfaceSpecifier != null) - { - AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - var operatorKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - var checkedKeyword = (SyntaxToken?)reader.ReadValue(); - if (checkedKeyword != null) - { - AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var parameterList = (ParameterListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - var body = (BlockSyntax?)reader.ReadValue(); - if (body != null) - { - AdjustFlagsAndWidth(body); - this.body = body; - } - var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(body); + this.body = body; } - - internal override void WriteTo(ObjectWriter writer) + if (expressionBody != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.returnType); - writer.WriteValue(this.explicitInterfaceSpecifier); - writer.WriteValue(this.operatorKeyword); - writer.WriteValue(this.checkedKeyword); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.body); - writer.WriteValue(this.expressionBody); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - static OperatorDeclarationSyntax() + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(OperatorDeclarationSyntax), r => new OperatorDeclarationSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// Conversion operator declaration syntax. - internal sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax + internal 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) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken implicitOrExplicitKeyword; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken operatorKeyword; - internal readonly SyntaxToken? checkedKeyword; - internal readonly TypeSyntax type; - internal readonly ParameterListSyntax parameterList; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal 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) - : base(kind) + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the "implicit" or "explicit" token. - public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - /// Gets the "operator" token. - public SyntaxToken OperatorKeyword => this.operatorKeyword; - /// Gets the "checked" keyword. - public SyntaxToken? CheckedKeyword => this.checkedKeyword; - /// Gets the type. - public TypeSyntax Type => this.type; - public override ParameterListSyntax ParameterList => this.parameterList; - public override BlockSyntax? Body => this.body; - public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.implicitOrExplicitKeyword, - 3 => this.explicitInterfaceSpecifier, - 4 => this.operatorKeyword, - 5 => this.checkedKeyword, - 6 => this.type, - 7 => this.parameterList, - 8 => this.body, - 9 => this.expressionBody, - 10 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); - - public ConversionOperatorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the "implicit" or "explicit" token. + public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + /// Gets the "operator" token. + public SyntaxToken OperatorKeyword => this.operatorKeyword; + /// Gets the "checked" keyword. + public SyntaxToken? CheckedKeyword => this.checkedKeyword; + /// Gets the type. + public TypeSyntax Type => this.type; + public override ParameterListSyntax ParameterList => this.parameterList; + public override BlockSyntax? Body => this.body; + public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.implicitOrExplicitKeyword, + 3 => this.explicitInterfaceSpecifier, + 4 => this.operatorKeyword, + 5 => this.checkedKeyword, + 6 => this.type, + 7 => this.parameterList, + 8 => this.body, + 9 => this.expressionBody, + 10 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); + + public ConversionOperatorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); + + internal ConversionOperatorDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 11; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var implicitOrExplicitKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); + if (explicitInterfaceSpecifier != null) + { + AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + var operatorKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + var checkedKeyword = (SyntaxToken?)reader.ReadValue(); + if (checkedKeyword != null) + { + AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var parameterList = (ParameterListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + var body = (BlockSyntax?)reader.ReadValue(); + if (body != null) + { + AdjustFlagsAndWidth(body); + this.body = body; + } + var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); + if (expressionBody != null) + { + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) + { + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.implicitOrExplicitKeyword); + writer.WriteValue(this.explicitInterfaceSpecifier); + writer.WriteValue(this.operatorKeyword); + writer.WriteValue(this.checkedKeyword); + writer.WriteValue(this.type); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.body); + writer.WriteValue(this.expressionBody); + writer.WriteValue(this.semicolonToken); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + static ConversionOperatorDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ConversionOperatorDeclarationSyntax), r => new ConversionOperatorDeclarationSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +/// Constructor declaration syntax. +internal sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken identifier; + internal readonly ParameterListSyntax parameterList; + internal readonly ConstructorInitializerSyntax? initializer; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - internal ConversionOperatorDeclarationSyntax(ObjectReader reader) - : base(reader) + internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 11; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var implicitOrExplicitKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); - if (explicitInterfaceSpecifier != null) - { - AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - var operatorKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - var checkedKeyword = (SyntaxToken?)reader.ReadValue(); - if (checkedKeyword != null) - { - AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var parameterList = (ParameterListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - var body = (BlockSyntax?)reader.ReadValue(); - if (body != null) - { - AdjustFlagsAndWidth(body); - this.body = body; - } - var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.implicitOrExplicitKeyword); - writer.WriteValue(this.explicitInterfaceSpecifier); - writer.WriteValue(this.operatorKeyword); - writer.WriteValue(this.checkedKeyword); - writer.WriteValue(this.type); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.body); - writer.WriteValue(this.expressionBody); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static ConversionOperatorDeclarationSyntax() + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(ConversionOperatorDeclarationSyntax), r => new ConversionOperatorDeclarationSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// Constructor declaration syntax. - internal sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax + internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken identifier; - internal readonly ParameterListSyntax parameterList; - internal readonly ConstructorInitializerSyntax? initializer; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - : base(kind) + internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + : base(kind) + { + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public override ParameterListSyntax ParameterList => this.parameterList; - public ConstructorInitializerSyntax? Initializer => this.initializer; - public override BlockSyntax? Body => this.body; - public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public override ParameterListSyntax ParameterList => this.parameterList; + public ConstructorInitializerSyntax? Initializer => this.initializer; + public override BlockSyntax? Body => this.body; + public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.identifier, - 3 => this.parameterList, - 4 => this.initializer, - 5 => this.body, - 6 => this.expressionBody, - 7 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.identifier, + 3 => this.parameterList, + 4 => this.initializer, + 5 => this.body, + 6 => this.expressionBody, + 7 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorDeclarationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); - public ConstructorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax initializer, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + public ConstructorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax initializer, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); - internal ConstructorDeclarationSyntax(ObjectReader reader) - : base(reader) + internal ConstructorDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 8; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 8; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var parameterList = (ParameterListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - var initializer = (ConstructorInitializerSyntax?)reader.ReadValue(); - if (initializer != null) - { - AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - var body = (BlockSyntax?)reader.ReadValue(); - if (body != null) - { - AdjustFlagsAndWidth(body); - this.body = body; - } - var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.identifier); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.initializer); - writer.WriteValue(this.body); - writer.WriteValue(this.expressionBody); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static ConstructorDeclarationSyntax() + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var parameterList = (ParameterListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + var initializer = (ConstructorInitializerSyntax?)reader.ReadValue(); + if (initializer != null) { - ObjectBinder.RegisterTypeReader(typeof(ConstructorDeclarationSyntax), r => new ConstructorDeclarationSyntax(r)); + AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } - } - - /// Constructor initializer syntax. - internal sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken colonToken; - internal readonly SyntaxToken thisOrBaseKeyword; - internal readonly ArgumentListSyntax argumentList; - - internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + var body = (BlockSyntax?)reader.ReadValue(); + if (body != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(thisOrBaseKeyword); - this.thisOrBaseKeyword = thisOrBaseKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + AdjustFlagsAndWidth(body); + this.body = body; } - - internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) + var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); + if (expressionBody != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(thisOrBaseKeyword); - this.thisOrBaseKeyword = thisOrBaseKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) - : base(kind) + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(thisOrBaseKeyword); - this.thisOrBaseKeyword = thisOrBaseKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - /// Gets the colon token. - public SyntaxToken ColonToken => this.colonToken; - /// Gets the "this" or "base" keyword. - public SyntaxToken ThisOrBaseKeyword => this.thisOrBaseKeyword; - public ArgumentListSyntax ArgumentList => this.argumentList; + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.identifier); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.initializer); + writer.WriteValue(this.body); + writer.WriteValue(this.expressionBody); + writer.WriteValue(this.semicolonToken); + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.colonToken, - 1 => this.thisOrBaseKeyword, - 2 => this.argumentList, - _ => null, - }; + static ConstructorDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ConstructorDeclarationSyntax), r => new ConstructorDeclarationSyntax(r)); + } +} - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorInitializerSyntax(this, parent, position); +/// Constructor initializer syntax. +internal sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken colonToken; + internal readonly SyntaxToken thisOrBaseKeyword; + internal readonly ArgumentListSyntax argumentList; + + internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(thisOrBaseKeyword); + this.thisOrBaseKeyword = thisOrBaseKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + + internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(thisOrBaseKeyword); + this.thisOrBaseKeyword = thisOrBaseKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + + internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(thisOrBaseKeyword); + this.thisOrBaseKeyword = thisOrBaseKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); + /// Gets the colon token. + public SyntaxToken ColonToken => this.colonToken; + /// Gets the "this" or "base" keyword. + public SyntaxToken ThisOrBaseKeyword => this.thisOrBaseKeyword; + public ArgumentListSyntax ArgumentList => this.argumentList; - public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + internal override GreenNode? GetSlot(int index) + => index switch { - if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ConstructorInitializer(this.Kind, colonToken, thisOrBaseKeyword, argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.colonToken, + 1 => this.thisOrBaseKeyword, + 2 => this.argumentList, + _ => null, + }; - return this; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorInitializerSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); + + public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + { + if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.ConstructorInitializer(this.Kind, colonToken, thisOrBaseKeyword, argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, GetDiagnostics(), annotations); + + internal ConstructorInitializerSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + var thisOrBaseKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(thisOrBaseKeyword); + this.thisOrBaseKeyword = thisOrBaseKeyword; + var argumentList = (ArgumentListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.colonToken); + writer.WriteValue(this.thisOrBaseKeyword); + writer.WriteValue(this.argumentList); + } + + static ConstructorInitializerSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ConstructorInitializerSyntax), r => new ConstructorInitializerSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, GetDiagnostics(), annotations); +/// Destructor declaration syntax. +internal sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken tildeToken; + internal readonly SyntaxToken identifier; + internal readonly ParameterListSyntax parameterList; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - internal ConstructorInitializerSyntax(ObjectReader reader) - : base(reader) + internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 3; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - var thisOrBaseKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(thisOrBaseKeyword); - this.thisOrBaseKeyword = thisOrBaseKeyword; - var argumentList = (ArgumentListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.colonToken); - writer.WriteValue(this.thisOrBaseKeyword); - writer.WriteValue(this.argumentList); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static ConstructorInitializerSyntax() + this.AdjustFlagsAndWidth(tildeToken); + this.tildeToken = tildeToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(ConstructorInitializerSyntax), r => new ConstructorInitializerSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// Destructor declaration syntax. - internal sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax + internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken tildeToken; - internal readonly SyntaxToken identifier; - internal readonly ParameterListSyntax parameterList; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(tildeToken); - this.tildeToken = tildeToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(tildeToken); - this.tildeToken = tildeToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(tildeToken); + this.tildeToken = tildeToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - : base(kind) + internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + : base(kind) + { + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(tildeToken); - this.tildeToken = tildeToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(tildeToken); + this.tildeToken = tildeToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the tilde token. - public SyntaxToken TildeToken => this.tildeToken; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public override ParameterListSyntax ParameterList => this.parameterList; - public override BlockSyntax? Body => this.body; - public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.tildeToken, - 3 => this.identifier, - 4 => this.parameterList, - 5 => this.body, - 6 => this.expressionBody, - 7 => this.semicolonToken, - _ => null, - }; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the tilde token. + public SyntaxToken TildeToken => this.tildeToken; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public override ParameterListSyntax ParameterList => this.parameterList; + public override BlockSyntax? Body => this.body; + public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DestructorDeclarationSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.tildeToken, + 3 => this.identifier, + 4 => this.parameterList, + 5 => this.body, + 6 => this.expressionBody, + 7 => this.semicolonToken, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DestructorDeclarationSyntax(this, parent, position); - public DestructorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); - return this; + public DestructorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - internal DestructorDeclarationSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 8; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var tildeToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(tildeToken); - this.tildeToken = tildeToken; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var parameterList = (ParameterListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - var body = (BlockSyntax?)reader.ReadValue(); - if (body != null) - { - AdjustFlagsAndWidth(body); - this.body = body; - } - var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal DestructorDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 8; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.tildeToken); - writer.WriteValue(this.identifier); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.body); - writer.WriteValue(this.expressionBody); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static DestructorDeclarationSyntax() + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - ObjectBinder.RegisterTypeReader(typeof(DestructorDeclarationSyntax), r => new DestructorDeclarationSyntax(r)); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - } - - /// Base type for property declaration syntax. - internal abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax - { - internal BasePropertyDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + var tildeToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(tildeToken); + this.tildeToken = tildeToken; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var parameterList = (ParameterListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + var body = (BlockSyntax?)reader.ReadValue(); + if (body != null) { + AdjustFlagsAndWidth(body); + this.body = body; } - - internal BasePropertyDeclarationSyntax(SyntaxKind kind) - : base(kind) + var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); + if (expressionBody != null) { + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - protected BasePropertyDeclarationSyntax(ObjectReader reader) - : base(reader) + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) { + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - /// Gets the type syntax. - public abstract TypeSyntax Type { get; } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.tildeToken); + writer.WriteValue(this.identifier); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.body); + writer.WriteValue(this.expressionBody); + writer.WriteValue(this.semicolonToken); + } + + static DestructorDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(DestructorDeclarationSyntax), r => new DestructorDeclarationSyntax(r)); + } +} - /// Gets the optional explicit interface specifier. - public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; } +/// Base type for property declaration syntax. +internal abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax +{ + internal BasePropertyDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public abstract AccessorListSyntax? AccessorList { get; } + internal BasePropertyDeclarationSyntax(SyntaxKind kind) + : base(kind) + { } - internal sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax + protected BasePropertyDeclarationSyntax(ObjectReader reader) + : base(reader) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax type; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken identifier; - internal readonly AccessorListSyntax? accessorList; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly EqualsValueClauseSyntax? initializer; - internal readonly SyntaxToken? semicolonToken; + } + + /// Gets the type syntax. + public abstract TypeSyntax Type { get; } - internal 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) - : base(kind, diagnostics, annotations) + /// Gets the optional explicit interface specifier. + public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; } + + public abstract AccessorListSyntax? AccessorList { get; } +} + +internal sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax type; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken identifier; + internal readonly AccessorListSyntax? accessorList; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly EqualsValueClauseSyntax? initializer; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) - : base(kind) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public override TypeSyntax Type => this.type; - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public override AccessorListSyntax? AccessorList => this.accessorList; - public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - public EqualsValueClauseSyntax? Initializer => this.initializer; - public SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.type, - 3 => this.explicitInterfaceSpecifier, - 4 => this.identifier, - 5 => this.accessorList, - 6 => this.expressionBody, - 7 => this.initializer, - 8 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); - - public PropertyDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, EqualsValueClauseSyntax initializer, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, GetDiagnostics(), annotations); - - internal PropertyDeclarationSyntax(ObjectReader reader) - : base(reader) + if (expressionBody != null) { - this.SlotCount = 9; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); - if (explicitInterfaceSpecifier != null) - { - AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var accessorList = (AccessorListSyntax?)reader.ReadValue(); - if (accessorList != null) - { - AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - var initializer = (EqualsValueClauseSyntax?)reader.ReadValue(); - if (initializer != null) - { - AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - internal override void WriteTo(ObjectWriter writer) + if (initializer != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.type); - writer.WriteValue(this.explicitInterfaceSpecifier); - writer.WriteValue(this.identifier); - writer.WriteValue(this.accessorList); - writer.WriteValue(this.expressionBody); - writer.WriteValue(this.initializer); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } - - static PropertyDeclarationSyntax() + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(PropertyDeclarationSyntax), r => new PropertyDeclarationSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// The syntax for the expression body of an expression-bodied member. - internal sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode + internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken arrowToken; - internal readonly ExpressionSyntax expression; - - internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression) - : base(kind) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - public SyntaxToken ArrowToken => this.arrowToken; - public ExpressionSyntax Expression => this.expression; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.arrowToken, - 1 => this.expression, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrowExpressionClauseSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); - - public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) { - if (arrowToken != this.ArrowToken || expression != this.Expression) - { - var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, GetDiagnostics(), annotations); - - internal ArrowExpressionClauseSyntax(ObjectReader reader) - : base(reader) + if (expressionBody != null) { - this.SlotCount = 2; - var arrowToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - var expression = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - internal override void WriteTo(ObjectWriter writer) + if (initializer != null) { - base.WriteTo(writer); - writer.WriteValue(this.arrowToken); - writer.WriteValue(this.expression); + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } - - static ArrowExpressionClauseSyntax() + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(ArrowExpressionClauseSyntax), r => new ArrowExpressionClauseSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - internal sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax + internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken eventKeyword; - internal readonly TypeSyntax type; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken identifier; - internal readonly AccessorListSyntax? accessorList; - internal readonly SyntaxToken? semicolonToken; - - internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) - : base(kind) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public SyntaxToken EventKeyword => this.eventKeyword; - public override TypeSyntax Type => this.type; - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public override AccessorListSyntax? AccessorList => this.accessorList; - public SyntaxToken? SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override TypeSyntax Type => this.type; + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public override AccessorListSyntax? AccessorList => this.accessorList; + public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + public EqualsValueClauseSyntax? Initializer => this.initializer; + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.eventKeyword, - 3 => this.type, - 4 => this.explicitInterfaceSpecifier, - 5 => this.identifier, - 6 => this.accessorList, - 7 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.type, + 3 => this.explicitInterfaceSpecifier, + 4 => this.identifier, + 5 => this.accessorList, + 6 => this.expressionBody, + 7 => this.initializer, + 8 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventDeclarationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); - public EventDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, SyntaxToken semicolonToken) + public PropertyDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, EqualsValueClauseSyntax initializer, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, GetDiagnostics(), annotations); - internal EventDeclarationSyntax(ObjectReader reader) - : base(reader) + internal PropertyDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 9; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 8; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var eventKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); - if (explicitInterfaceSpecifier != null) - { - AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var accessorList = (AccessorListSyntax?)reader.ReadValue(); - if (accessorList != null) - { - AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.eventKeyword); - writer.WriteValue(this.type); - writer.WriteValue(this.explicitInterfaceSpecifier); - writer.WriteValue(this.identifier); - writer.WriteValue(this.accessorList); - writer.WriteValue(this.semicolonToken); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static EventDeclarationSyntax() + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); + if (explicitInterfaceSpecifier != null) { - ObjectBinder.RegisterTypeReader(typeof(EventDeclarationSyntax), r => new EventDeclarationSyntax(r)); + AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var accessorList = (AccessorListSyntax?)reader.ReadValue(); + if (accessorList != null) + { + AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); + if (expressionBody != null) + { + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + var initializer = (EqualsValueClauseSyntax?)reader.ReadValue(); + if (initializer != null) + { + AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) + { + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - internal sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax type; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken thisKeyword; - internal readonly BracketedParameterListSyntax parameterList; - internal readonly AccessorListSyntax? accessorList; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.type); + writer.WriteValue(this.explicitInterfaceSpecifier); + writer.WriteValue(this.identifier); + writer.WriteValue(this.accessorList); + writer.WriteValue(this.expressionBody); + writer.WriteValue(this.initializer); + writer.WriteValue(this.semicolonToken); + } - internal 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) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + static PropertyDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(PropertyDeclarationSyntax), r => new PropertyDeclarationSyntax(r)); + } +} + +/// The syntax for the expression body of an expression-bodied member. +internal sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken arrowToken; + internal readonly ExpressionSyntax expression; + + internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + public SyntaxToken ArrowToken => this.arrowToken; + public ExpressionSyntax Expression => this.expression; - internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + 0 => this.arrowToken, + 1 => this.expression, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrowExpressionClauseSyntax(this, parent, position); - internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); + + public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression) + { + if (arrowToken != this.ArrowToken || expression != this.Expression) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public override TypeSyntax Type => this.type; - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - public SyntaxToken ThisKeyword => this.thisKeyword; - /// Gets the parameter list. - public BracketedParameterListSyntax ParameterList => this.parameterList; - public override AccessorListSyntax? AccessorList => this.accessorList; - public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - public SyntaxToken? SemicolonToken => this.semicolonToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.type, - 3 => this.explicitInterfaceSpecifier, - 4 => this.thisKeyword, - 5 => this.parameterList, - 6 => this.accessorList, - 7 => this.expressionBody, - 8 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); - - public IndexerDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, GetDiagnostics(), annotations); + + internal ArrowExpressionClauseSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var arrowToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + var expression = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.arrowToken); + writer.WriteValue(this.expression); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + static ArrowExpressionClauseSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ArrowExpressionClauseSyntax), r => new ArrowExpressionClauseSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +internal sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken eventKeyword; + internal readonly TypeSyntax type; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken identifier; + internal readonly AccessorListSyntax? accessorList; + internal readonly SyntaxToken? semicolonToken; - internal IndexerDeclarationSyntax(ObjectReader reader) - : base(reader) + internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 9; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); - if (explicitInterfaceSpecifier != null) - { - AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - var thisKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - var parameterList = (BracketedParameterListSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - var accessorList = (AccessorListSyntax?)reader.ReadValue(); - if (accessorList != null) - { - AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.type); - writer.WriteValue(this.explicitInterfaceSpecifier); - writer.WriteValue(this.thisKeyword); - writer.WriteValue(this.parameterList); - writer.WriteValue(this.accessorList); - writer.WriteValue(this.expressionBody); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static IndexerDeclarationSyntax() + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(IndexerDeclarationSyntax), r => new IndexerDeclarationSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - internal sealed partial class AccessorListSyntax : CSharpSyntaxNode + internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? accessors; - internal readonly SyntaxToken closeBraceToken; - - internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (accessors != null) - { - this.AdjustFlagsAndWidth(accessors); - this.accessors = accessors; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (accessors != null) - { - this.AdjustFlagsAndWidth(accessors); - this.accessors = accessors; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken) - : base(kind) + internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) + : base(kind) + { + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (accessors != null) - { - this.AdjustFlagsAndWidth(accessors); - this.accessors = accessors; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - public SyntaxToken OpenBraceToken => this.openBraceToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Accessors => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.accessors); - public SyntaxToken CloseBraceToken => this.closeBraceToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public SyntaxToken EventKeyword => this.eventKeyword; + public override TypeSyntax Type => this.type; + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public override AccessorListSyntax? AccessorList => this.accessorList; + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBraceToken, - 1 => this.accessors, - 2 => this.closeBraceToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.eventKeyword, + 3 => this.type, + 4 => this.explicitInterfaceSpecifier, + 5 => this.identifier, + 6 => this.accessorList, + 7 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); - public AccessorListSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + public EventDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) { - if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, diagnostics, GetAnnotations()); - internal AccessorListSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - var accessors = (GreenNode?)reader.ReadValue(); - if (accessors != null) - { - AdjustFlagsAndWidth(accessors); - this.accessors = accessors; - } - var closeBraceToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal EventDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 8; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.openBraceToken); - writer.WriteValue(this.accessors); - writer.WriteValue(this.closeBraceToken); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static AccessorListSyntax() + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - ObjectBinder.RegisterTypeReader(typeof(AccessorListSyntax), r => new AccessorListSyntax(r)); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - } - - internal sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken keyword; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + var eventKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var accessorList = (AccessorListSyntax?)reader.ReadValue(); + if (accessorList != null) { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; } - - internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - : base(kind) + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - /// Gets the attribute declaration list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - /// Gets the modifier list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - /// Gets the keyword token, or identifier if an erroneous accessor declaration. - public SyntaxToken Keyword => this.keyword; - /// Gets the optional body block which may be empty, but it is null if there are no braces. - public BlockSyntax? Body => this.body; - /// Gets the optional expression body. - public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.keyword, - 3 => this.body, - 4 => this.expressionBody, - 5 => this.semicolonToken, - _ => null, - }; + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.eventKeyword); + writer.WriteValue(this.type); + writer.WriteValue(this.explicitInterfaceSpecifier); + writer.WriteValue(this.identifier); + writer.WriteValue(this.accessorList); + writer.WriteValue(this.semicolonToken); + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorDeclarationSyntax(this, parent, position); + static EventDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(EventDeclarationSyntax), r => new EventDeclarationSyntax(r)); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); +internal sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax type; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken thisKeyword; + internal readonly BracketedParameterListSyntax parameterList; + internal readonly AccessorListSyntax? accessorList; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - public AccessorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 9; + if (attributeLists != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.AccessorDeclaration(this.Kind, attributeLists, modifiers, keyword, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); - - internal AccessorDeclarationSyntax(ObjectReader reader) - : base(reader) + if (modifiers != null) { - this.SlotCount = 6; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var keyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - var body = (BlockSyntax?)reader.ReadValue(); - if (body != null) - { - AdjustFlagsAndWidth(body); - this.body = body; - } - var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); - if (expressionBody != null) - { - AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - var semicolonToken = (SyntaxToken?)reader.ReadValue(); - if (semicolonToken != null) - { - AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal override void WriteTo(ObjectWriter writer) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.keyword); - writer.WriteValue(this.body); - writer.WriteValue(this.expressionBody); - writer.WriteValue(this.semicolonToken); + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - static AccessorDeclarationSyntax() + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(AccessorDeclarationSyntax), r => new AccessorDeclarationSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// Base type for parameter list syntax. - internal abstract partial class BaseParameterListSyntax : CSharpSyntaxNode + internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal BaseParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 9; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseParameterListSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - protected BaseParameterListSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - /// Gets the parameter list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters { get; } } - /// Parameter list syntax. - internal sealed partial class ParameterListSyntax : BaseParameterListSyntax + internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken closeParenToken; - - internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) - : base(kind) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - /// Gets the open paren token. - public SyntaxToken OpenParenToken => this.openParenToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); - /// Gets the close paren token. - public SyntaxToken CloseParenToken => this.closeParenToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override TypeSyntax Type => this.type; + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + public SyntaxToken ThisKeyword => this.thisKeyword; + /// Gets the parameter list. + public BracketedParameterListSyntax ParameterList => this.parameterList; + public override AccessorListSyntax? AccessorList => this.accessorList; + public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.parameters, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.type, + 3 => this.explicitInterfaceSpecifier, + 4 => this.thisKeyword, + 5 => this.parameterList, + 6 => this.accessorList, + 7 => this.expressionBody, + 8 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); - public ParameterListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public IndexerDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); - internal ParameterListSyntax(ObjectReader reader) - : base(reader) + internal IndexerDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 9; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 3; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var parameters = (GreenNode?)reader.ReadValue(); - if (parameters != null) - { - AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.parameters); - writer.WriteValue(this.closeParenToken); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static ParameterListSyntax() + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var explicitInterfaceSpecifier = (ExplicitInterfaceSpecifierSyntax?)reader.ReadValue(); + if (explicitInterfaceSpecifier != null) + { + AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + var thisKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + var parameterList = (BracketedParameterListSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + var accessorList = (AccessorListSyntax?)reader.ReadValue(); + if (accessorList != null) + { + AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); + if (expressionBody != null) + { + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(ParameterListSyntax), r => new ParameterListSyntax(r)); + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// Parameter list syntax with surrounding brackets. - internal sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.type); + writer.WriteValue(this.explicitInterfaceSpecifier); + writer.WriteValue(this.thisKeyword); + writer.WriteValue(this.parameterList); + writer.WriteValue(this.accessorList); + writer.WriteValue(this.expressionBody); + writer.WriteValue(this.semicolonToken); + } + + static IndexerDeclarationSyntax() { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken closeBracketToken; + ObjectBinder.RegisterTypeReader(typeof(IndexerDeclarationSyntax), r => new IndexerDeclarationSyntax(r)); + } +} + +internal sealed partial class AccessorListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? accessors; + internal readonly SyntaxToken closeBraceToken; - internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (accessors != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(accessors); + this.accessors = accessors; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) + internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (accessors != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(accessors); + this.accessors = accessors; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) - : base(kind) + internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (accessors != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(accessors); + this.accessors = accessors; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => this.openBracketToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => this.closeBracketToken; + public SyntaxToken OpenBraceToken => this.openBraceToken; + public CoreSyntax.SyntaxList Accessors => new CoreSyntax.SyntaxList(this.accessors); + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.parameters, - 2 => this.closeBracketToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBraceToken, + 1 => this.accessors, + 2 => this.closeBraceToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedParameterListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); - public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + public AccessorListSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) { - if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, diagnostics, GetAnnotations()); - internal BracketedParameterListSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - var parameters = (GreenNode?)reader.ReadValue(); - if (parameters != null) - { - AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - var closeBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal AccessorListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + var accessors = (GreenNode?)reader.ReadValue(); + if (accessors != null) { - base.WriteTo(writer); - writer.WriteValue(this.openBracketToken); - writer.WriteValue(this.parameters); - writer.WriteValue(this.closeBracketToken); + AdjustFlagsAndWidth(accessors); + this.accessors = accessors; } + var closeBraceToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - static BracketedParameterListSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(BracketedParameterListSyntax), r => new BracketedParameterListSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openBraceToken); + writer.WriteValue(this.accessors); + writer.WriteValue(this.closeBraceToken); } - /// Base parameter syntax. - internal abstract partial class BaseParameterSyntax : CSharpSyntaxNode + static AccessorListSyntax() { - internal BaseParameterSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + ObjectBinder.RegisterTypeReader(typeof(AccessorListSyntax), r => new AccessorListSyntax(r)); + } +} + +internal sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken keyword; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; + + internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseParameterSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - protected BaseParameterSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (body != null) { + this.AdjustFlagsAndWidth(body); + this.body = body; } - - /// Gets the attribute declaration list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists { get; } - - /// Gets the modifier list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers { get; } - - public abstract TypeSyntax? Type { get; } - } - - /// Parameter syntax. - internal sealed partial class ParameterSyntax : BaseParameterSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax? type; - internal readonly SyntaxToken identifier; - internal readonly EqualsValueClauseSyntax? @default; - - internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (expressionBody != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (@default != null) - { - this.AdjustFlagsAndWidth(@default); - this.@default = @default; - } + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, SyntaxFactoryContext context) - : base(kind) + if (semicolonToken != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (@default != null) - { - this.AdjustFlagsAndWidth(@default); - this.@default = @default; - } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) - : base(kind) + internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (@default != null) - { - this.AdjustFlagsAndWidth(@default); - this.@default = @default; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - /// Gets the attribute declaration list. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - /// Gets the modifier list. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public override TypeSyntax? Type => this.type; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public EqualsValueClauseSyntax? Default => this.@default; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.type, - 3 => this.identifier, - 4 => this.@default, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); - - public ParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, SyntaxToken identifier, EqualsValueClauseSyntax @default) + if (modifiers != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) - { - var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, GetDiagnostics(), annotations); - - internal ParameterSyntax(ObjectReader reader) - : base(reader) + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (body != null) { - this.SlotCount = 5; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var type = (TypeSyntax?)reader.ReadValue(); - if (type != null) - { - AdjustFlagsAndWidth(type); - this.type = type; - } - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var @default = (EqualsValueClauseSyntax?)reader.ReadValue(); - if (@default != null) - { - AdjustFlagsAndWidth(@default); - this.@default = @default; - } + this.AdjustFlagsAndWidth(body); + this.body = body; } - - internal override void WriteTo(ObjectWriter writer) + if (expressionBody != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.type); - writer.WriteValue(this.identifier); - writer.WriteValue(this.@default); + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - static ParameterSyntax() + if (semicolonToken != null) { - ObjectBinder.RegisterTypeReader(typeof(ParameterSyntax), r => new ParameterSyntax(r)); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// Parameter syntax. - internal sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax + internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax type; - - internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 6; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type) - : base(kind) + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (body != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(body); + this.body = body; } - - /// Gets the attribute declaration list. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - /// Gets the modifier list. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public override TypeSyntax Type => this.type; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.type, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); - - public FunctionPointerParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type) + if (expressionBody != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) - { - var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations); - - internal FunctionPointerParameterSyntax(ObjectReader reader) - : base(reader) + if (semicolonToken != null) { - this.SlotCount = 3; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - internal override void WriteTo(ObjectWriter writer) + /// Gets the attribute declaration list. + public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// Gets the modifier list. + public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the keyword token, or identifier if an erroneous accessor declaration. + public SyntaxToken Keyword => this.keyword; + /// Gets the optional body block which may be empty, but it is null if there are no braces. + public BlockSyntax? Body => this.body; + /// Gets the optional expression body. + public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.type); - } + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.keyword, + 3 => this.body, + 4 => this.expressionBody, + 5 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); - static FunctionPointerParameterSyntax() + public AccessorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - ObjectBinder.RegisterTypeReader(typeof(FunctionPointerParameterSyntax), r => new FunctionPointerParameterSyntax(r)); + var newNode = SyntaxFactory.AccessorDeclaration(this.Kind, attributeLists, modifiers, keyword, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; } - internal sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax? type; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); - internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal AccessorDeclarationSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 6; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxFactoryContext context) - : base(kind) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type) - : base(kind) + var keyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + var body = (BlockSyntax?)reader.ReadValue(); + if (body != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } + AdjustFlagsAndWidth(body); + this.body = body; } + var expressionBody = (ArrowExpressionClauseSyntax?)reader.ReadValue(); + if (expressionBody != null) + { + AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + var semicolonToken = (SyntaxToken?)reader.ReadValue(); + if (semicolonToken != null) + { + AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); - public TypeSyntax? Type => this.type; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.type, - _ => null, - }; + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.keyword); + writer.WriteValue(this.body); + writer.WriteValue(this.expressionBody); + writer.WriteValue(this.semicolonToken); + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IncompleteMemberSyntax(this, parent, position); + static AccessorDeclarationSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(AccessorDeclarationSyntax), r => new AccessorDeclarationSyntax(r)); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); +/// Base type for parameter list syntax. +internal abstract partial class BaseParameterListSyntax : CSharpSyntaxNode +{ + internal BaseParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public IncompleteMemberSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) - { - var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal BaseParameterListSyntax(SyntaxKind kind) + : base(kind) + { + } - return this; - } + protected BaseParameterListSyntax(ObjectReader reader) + : base(reader) + { + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations()); + /// Gets the parameter list. + public abstract CoreSyntax.SeparatedSyntaxList Parameters { get; } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations); +/// Parameter list syntax. +internal sealed partial class ParameterListSyntax : BaseParameterListSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken closeParenToken; - internal IncompleteMemberSyntax(ObjectReader reader) - : base(reader) + internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - this.SlotCount = 3; - var attributeLists = (GreenNode?)reader.ReadValue(); - if (attributeLists != null) - { - AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - var modifiers = (GreenNode?)reader.ReadValue(); - if (modifiers != null) - { - AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - var type = (TypeSyntax?)reader.ReadValue(); - if (type != null) - { - AdjustFlagsAndWidth(type); - this.type = type; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override void WriteTo(ObjectWriter writer) + internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - base.WriteTo(writer); - writer.WriteValue(this.attributeLists); - writer.WriteValue(this.modifiers); - writer.WriteValue(this.type); + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - static IncompleteMemberSyntax() + internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - ObjectBinder.RegisterTypeReader(typeof(IncompleteMemberSyntax), r => new IncompleteMemberSyntax(r)); + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - internal sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax - { - internal readonly GreenNode? tokens; + /// Gets the open paren token. + public SyntaxToken OpenParenToken => this.openParenToken; + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// Gets the close paren token. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 1; - if (tokens != null) - { - this.AdjustFlagsAndWidth(tokens); - this.tokens = tokens; - } - } + 0 => this.openParenToken, + 1 => this.parameters, + 2 => this.closeParenToken, + _ => null, + }; - internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - if (tokens != null) - { - this.AdjustFlagsAndWidth(tokens); - this.tokens = tokens; - } - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterListSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); - internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) - : base(kind) + public ParameterListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) { - this.SlotCount = 1; - if (tokens != null) - { - this.AdjustFlagsAndWidth(tokens); - this.tokens = tokens; - } + var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Tokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.tokens); - - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.tokens : null; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SkippedTokensTriviaSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations); - public SkippedTokensTriviaSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList tokens) + internal ParameterListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var parameters = (GreenNode?)reader.ReadValue(); + if (parameters != null) { - if (tokens != this.Tokens) - { - var newNode = SyntaxFactory.SkippedTokensTrivia(tokens); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SkippedTokensTriviaSyntax(this.Kind, this.tokens, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.parameters); + writer.WriteValue(this.closeParenToken); + } + + static ParameterListSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ParameterListSyntax), r => new ParameterListSyntax(r)); + } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SkippedTokensTriviaSyntax(this.Kind, this.tokens, GetDiagnostics(), annotations); +/// Parameter list syntax with surrounding brackets. +internal sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken closeBracketToken; - internal SkippedTokensTriviaSyntax(ObjectReader reader) - : base(reader) + internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - this.SlotCount = 1; - var tokens = (GreenNode?)reader.ReadValue(); - if (tokens != null) - { - AdjustFlagsAndWidth(tokens); - this.tokens = tokens; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal override void WriteTo(ObjectWriter writer) + internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - base.WriteTo(writer); - writer.WriteValue(this.tokens); + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - static SkippedTokensTriviaSyntax() + internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - ObjectBinder.RegisterTypeReader(typeof(SkippedTokensTriviaSyntax), r => new SkippedTokensTriviaSyntax(r)); + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; } - internal sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax - { - internal readonly GreenNode? content; - internal readonly SyntaxToken endOfComment; + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => this.openBracketToken; + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endOfComment); - this.endOfComment = endOfComment; - } + 0 => this.openBracketToken, + 1 => this.parameters, + 2 => this.closeBracketToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedParameterListSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); - internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, SyntaxFactoryContext context) - : base(kind) + public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endOfComment); - this.endOfComment = endOfComment; + var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment) - : base(kind) + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations); + + internal BracketedParameterListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + var parameters = (GreenNode?)reader.ReadValue(); + if (parameters != null) { - this.SlotCount = 2; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endOfComment); - this.endOfComment = endOfComment; + AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + var closeBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Content => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.content); - public SyntaxToken EndOfComment => this.endOfComment; + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openBracketToken); + writer.WriteValue(this.parameters); + writer.WriteValue(this.closeBracketToken); + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.content, - 1 => this.endOfComment, - _ => null, - }; + static BracketedParameterListSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(BracketedParameterListSyntax), r => new BracketedParameterListSyntax(r)); + } +} - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DocumentationCommentTriviaSyntax(this, parent, position); +/// Base parameter syntax. +internal abstract partial class BaseParameterSyntax : CSharpSyntaxNode +{ + internal BaseParameterSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); + internal BaseParameterSyntax(SyntaxKind kind) + : base(kind) + { + } - public DocumentationCommentTriviaSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, SyntaxToken endOfComment) - { - if (content != this.Content || endOfComment != this.EndOfComment) - { - var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind, content, endOfComment); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + protected BaseParameterSyntax(ObjectReader reader) + : base(reader) + { + } - return this; - } + /// Gets the attribute declaration list. + public abstract CoreSyntax.SyntaxList AttributeLists { get; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, diagnostics, GetAnnotations()); + /// Gets the modifier list. + public abstract CoreSyntax.SyntaxList Modifiers { get; } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, GetDiagnostics(), annotations); + public abstract TypeSyntax? Type { get; } +} + +/// Parameter syntax. +internal sealed partial class ParameterSyntax : BaseParameterSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax? type; + internal readonly SyntaxToken identifier; + internal readonly EqualsValueClauseSyntax? @default; - internal DocumentationCommentTriviaSyntax(ObjectReader reader) - : base(reader) + internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 2; - var content = (GreenNode?)reader.ReadValue(); - if (content != null) - { - AdjustFlagsAndWidth(content); - this.content = content; - } - var endOfComment = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfComment); - this.endOfComment = endOfComment; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.content); - writer.WriteValue(this.endOfComment); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static DocumentationCommentTriviaSyntax() + if (type != null) + { + this.AdjustFlagsAndWidth(type); + this.type = type; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (@default != null) { - ObjectBinder.RegisterTypeReader(typeof(DocumentationCommentTriviaSyntax), r => new DocumentationCommentTriviaSyntax(r)); + this.AdjustFlagsAndWidth(@default); + this.@default = @default; } } - /// - /// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). - /// For example, the M in <see cref="M" />. - /// - internal abstract partial class CrefSyntax : CSharpSyntaxNode + internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, SyntaxFactoryContext context) + : base(kind) { - internal CrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal CrefSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - protected CrefSyntax(ObjectReader reader) - : base(reader) + if (type != null) + { + this.AdjustFlagsAndWidth(type); + this.type = type; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (@default != null) { + this.AdjustFlagsAndWidth(@default); + this.@default = @default; } } - /// - /// A symbol reference that definitely refers to a type. - /// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - internal sealed partial class TypeCrefSyntax : CrefSyntax + internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) + : base(kind) { - internal readonly TypeSyntax type; - - internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type) - : base(kind) + if (type != null) { - this.SlotCount = 1; this.AdjustFlagsAndWidth(type); this.type = type; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (@default != null) + { + this.AdjustFlagsAndWidth(@default); + this.@default = @default; + } + } - public TypeSyntax Type => this.type; + /// Gets the attribute declaration list. + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// Gets the modifier list. + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override TypeSyntax? Type => this.type; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public EqualsValueClauseSyntax? Default => this.@default; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.type : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.type, + 3 => this.identifier, + 4 => this.@default, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeCrefSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); - public TypeCrefSyntax Update(TypeSyntax type) + public ParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, SyntaxToken identifier, EqualsValueClauseSyntax @default) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypeCref(type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeCrefSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeCrefSyntax(this.Kind, this.type, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, GetDiagnostics(), annotations); - internal TypeCrefSyntax(ObjectReader reader) - : base(reader) + internal ParameterSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) + { + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) + { + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + var type = (TypeSyntax?)reader.ReadValue(); + if (type != null) { - this.SlotCount = 1; - var type = (TypeSyntax)reader.ReadValue(); AdjustFlagsAndWidth(type); this.type = type; } - - internal override void WriteTo(ObjectWriter writer) + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var @default = (EqualsValueClauseSyntax?)reader.ReadValue(); + if (@default != null) { - base.WriteTo(writer); - writer.WriteValue(this.type); + AdjustFlagsAndWidth(@default); + this.@default = @default; } + } - static TypeCrefSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(TypeCrefSyntax), r => new TypeCrefSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.type); + writer.WriteValue(this.identifier); + writer.WriteValue(this.@default); } - /// - /// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. - /// For example, cref="System.String.ToString()". - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - internal sealed partial class QualifiedCrefSyntax : CrefSyntax + static ParameterSyntax() { - internal readonly TypeSyntax container; - internal readonly SyntaxToken dotToken; - internal readonly MemberCrefSyntax member; + ObjectBinder.RegisterTypeReader(typeof(ParameterSyntax), r => new ParameterSyntax(r)); + } +} + +/// Parameter syntax. +internal sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax type; - internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(container); - this.container = container; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(member); - this.member = member; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context) - : base(kind) + internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(container); - this.container = container; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(member); - this.member = member; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) - : base(kind) + internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(container); - this.container = container; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(member); - this.member = member; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - public TypeSyntax Container => this.container; - public SyntaxToken DotToken => this.dotToken; - public MemberCrefSyntax Member => this.member; + /// Gets the attribute declaration list. + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// Gets the modifier list. + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override TypeSyntax Type => this.type; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.container, - 1 => this.dotToken, - 2 => this.member, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.type, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedCrefSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); - public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + public FunctionPointerParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) { - if (container != this.Container || dotToken != this.DotToken || member != this.Member) - { - var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations()); - internal QualifiedCrefSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var container = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(container); - this.container = container; - var dotToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - var member = (MemberCrefSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(member); - this.member = member; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal FunctionPointerParameterSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - base.WriteTo(writer); - writer.WriteValue(this.container); - writer.WriteValue(this.dotToken); - writer.WriteValue(this.member); + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - static QualifiedCrefSyntax() + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - ObjectBinder.RegisterTypeReader(typeof(QualifiedCrefSyntax), r => new QualifiedCrefSyntax(r)); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; } - /// - /// The unqualified part of a CrefSyntax. - /// For example, "ToString()" in "object.ToString()". - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - internal abstract partial class MemberCrefSyntax : CrefSyntax + internal override void WriteTo(ObjectWriter writer) { - internal MemberCrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } - - internal MemberCrefSyntax(SyntaxKind kind) - : base(kind) - { - } - - protected MemberCrefSyntax(ObjectReader reader) - : base(reader) - { - } + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.type); } - /// - /// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, - /// with an optional type parameter list) and an optional parameter list. - /// For example, "M", "M<T>" or "M(int)". - /// Also, "A::B()" or "string()". - /// - internal sealed partial class NameMemberCrefSyntax : MemberCrefSyntax + static FunctionPointerParameterSyntax() { - internal readonly TypeSyntax name; - internal readonly CrefParameterListSyntax? parameters; + ObjectBinder.RegisterTypeReader(typeof(FunctionPointerParameterSyntax), r => new FunctionPointerParameterSyntax(r)); + } +} - internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - } +internal sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax? type; - internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) - : base(kind) + internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters) - : base(kind) + if (modifiers != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - public TypeSyntax Name => this.name; - public CrefParameterListSyntax? Parameters => this.parameters; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.parameters, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameMemberCrefSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); - - public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax parameters) + if (type != null) { - if (name != this.Name || parameters != this.Parameters) - { - var newNode = SyntaxFactory.NameMemberCref(name, parameters); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(type); + this.type = type; } + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, GetDiagnostics(), annotations); - - internal NameMemberCrefSyntax(ObjectReader reader) - : base(reader) + internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 2; - var name = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var parameters = (CrefParameterListSyntax?)reader.ReadValue(); - if (parameters != null) - { - AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.name); - writer.WriteValue(this.parameters); + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static NameMemberCrefSyntax() + if (type != null) { - ObjectBinder.RegisterTypeReader(typeof(NameMemberCrefSyntax), r => new NameMemberCrefSyntax(r)); + this.AdjustFlagsAndWidth(type); + this.type = type; } } - /// - /// A MemberCrefSyntax specified by a this keyword and an optional parameter list. - /// For example, "this" or "this[int]". - /// - internal sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax + internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type) + : base(kind) { - internal readonly SyntaxToken thisKeyword; - internal readonly CrefBracketedParameterListSyntax? parameters; - - internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) - : base(kind) + if (type != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(type); + this.type = type; } + } - public SyntaxToken ThisKeyword => this.thisKeyword; - public CrefBracketedParameterListSyntax? Parameters => this.parameters; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public TypeSyntax? Type => this.type; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.thisKeyword, - 1 => this.parameters, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.type, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerMemberCrefSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IncompleteMemberSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); - public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax parameters) + public IncompleteMemberSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) { - if (thisKeyword != this.ThisKeyword || parameters != this.Parameters) - { - var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations); - internal IndexerMemberCrefSyntax(ObjectReader reader) - : base(reader) + internal IncompleteMemberSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var attributeLists = (GreenNode?)reader.ReadValue(); + if (attributeLists != null) { - this.SlotCount = 2; - var thisKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - var parameters = (CrefBracketedParameterListSyntax?)reader.ReadValue(); - if (parameters != null) - { - AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override void WriteTo(ObjectWriter writer) + var modifiers = (GreenNode?)reader.ReadValue(); + if (modifiers != null) { - base.WriteTo(writer); - writer.WriteValue(this.thisKeyword); - writer.WriteValue(this.parameters); + AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - static IndexerMemberCrefSyntax() + var type = (TypeSyntax?)reader.ReadValue(); + if (type != null) { - ObjectBinder.RegisterTypeReader(typeof(IndexerMemberCrefSyntax), r => new IndexerMemberCrefSyntax(r)); + AdjustFlagsAndWidth(type); + this.type = type; } } - /// - /// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. - /// For example, "operator +" or "operator -[int]". - /// NOTE: the operator must be overloadable. - /// - internal sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.attributeLists); + writer.WriteValue(this.modifiers); + writer.WriteValue(this.type); + } + + static IncompleteMemberSyntax() { - internal readonly SyntaxToken operatorKeyword; - internal readonly SyntaxToken? checkedKeyword; - internal readonly SyntaxToken operatorToken; - internal readonly CrefParameterListSyntax? parameters; + ObjectBinder.RegisterTypeReader(typeof(IncompleteMemberSyntax), r => new IncompleteMemberSyntax(r)); + } +} - internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax +{ + internal readonly GreenNode? tokens; + + internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + if (tokens != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(tokens); + this.tokens = tokens; } + } - internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) - : base(kind) + internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + if (tokens != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(tokens); + this.tokens = tokens; } + } - internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) - : base(kind) + internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) + : base(kind) + { + this.SlotCount = 1; + if (tokens != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(tokens); + this.tokens = tokens; } + } - public SyntaxToken OperatorKeyword => this.operatorKeyword; - public SyntaxToken? CheckedKeyword => this.checkedKeyword; - /// Gets the operator token. - public SyntaxToken OperatorToken => this.operatorToken; - public CrefParameterListSyntax? Parameters => this.parameters; + public CoreSyntax.SyntaxList Tokens => new CoreSyntax.SyntaxList(this.tokens); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorKeyword, - 1 => this.checkedKeyword, - 2 => this.operatorToken, - 3 => this.parameters, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.tokens : null; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorMemberCrefSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SkippedTokensTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); - public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax parameters) + public SkippedTokensTriviaSyntax Update(CoreSyntax.SyntaxList tokens) + { + if (tokens != this.Tokens) { - if (operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters) - { - var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, operatorToken, parameters); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.SkippedTokensTrivia(tokens); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameters, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameters, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SkippedTokensTriviaSyntax(this.Kind, this.tokens, diagnostics, GetAnnotations()); - internal OperatorMemberCrefSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var operatorKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - var checkedKeyword = (SyntaxToken?)reader.ReadValue(); - if (checkedKeyword != null) - { - AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - var operatorToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - var parameters = (CrefParameterListSyntax?)reader.ReadValue(); - if (parameters != null) - { - AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SkippedTokensTriviaSyntax(this.Kind, this.tokens, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal SkippedTokensTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var tokens = (GreenNode?)reader.ReadValue(); + if (tokens != null) { - base.WriteTo(writer); - writer.WriteValue(this.operatorKeyword); - writer.WriteValue(this.checkedKeyword); - writer.WriteValue(this.operatorToken); - writer.WriteValue(this.parameters); + AdjustFlagsAndWidth(tokens); + this.tokens = tokens; } + } - static OperatorMemberCrefSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(OperatorMemberCrefSyntax), r => new OperatorMemberCrefSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.tokens); } - /// - /// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. - /// For example, "implicit operator int" or "explicit operator MyType(int)". - /// - internal sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax - { - internal readonly SyntaxToken implicitOrExplicitKeyword; - internal readonly SyntaxToken operatorKeyword; - internal readonly SyntaxToken? checkedKeyword; - internal readonly TypeSyntax type; - internal readonly CrefParameterListSyntax? parameters; - - internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + static SkippedTokensTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(SkippedTokensTriviaSyntax), r => new SkippedTokensTriviaSyntax(r)); + } +} + +internal sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax +{ + internal readonly GreenNode? content; + internal readonly SyntaxToken endOfComment; + + internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (content != null) + { + this.AdjustFlagsAndWidth(content); + this.content = content; } + this.AdjustFlagsAndWidth(endOfComment); + this.endOfComment = endOfComment; + } - internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) - : base(kind) + internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + if (content != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(content); + this.content = content; } + this.AdjustFlagsAndWidth(endOfComment); + this.endOfComment = endOfComment; + } - internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) - : base(kind) + internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment) + : base(kind) + { + this.SlotCount = 2; + if (content != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(content); + this.content = content; } + this.AdjustFlagsAndWidth(endOfComment); + this.endOfComment = endOfComment; + } - public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; - public SyntaxToken OperatorKeyword => this.operatorKeyword; - public SyntaxToken? CheckedKeyword => this.checkedKeyword; - public TypeSyntax Type => this.type; - public CrefParameterListSyntax? Parameters => this.parameters; + public CoreSyntax.SyntaxList Content => new CoreSyntax.SyntaxList(this.content); + public SyntaxToken EndOfComment => this.endOfComment; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.implicitOrExplicitKeyword, - 1 => this.operatorKeyword, - 2 => this.checkedKeyword, - 3 => this.type, - 4 => this.parameters, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.content, + 1 => this.endOfComment, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorMemberCrefSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DocumentationCommentTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); - public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax parameters) + public DocumentationCommentTriviaSyntax Update(CoreSyntax.SyntaxList content, SyntaxToken endOfComment) + { + if (content != this.Content || endOfComment != this.EndOfComment) { - if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameters != this.Parameters) - { - var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind, content, endOfComment); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.checkedKeyword, this.type, this.parameters, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.checkedKeyword, this.type, this.parameters, GetDiagnostics(), annotations); + return this; + } - internal ConversionOperatorMemberCrefSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var implicitOrExplicitKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - var operatorKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - var checkedKeyword = (SyntaxToken?)reader.ReadValue(); - if (checkedKeyword != null) - { - AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - var parameters = (CrefParameterListSyntax?)reader.ReadValue(); - if (parameters != null) - { - AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.implicitOrExplicitKeyword); - writer.WriteValue(this.operatorKeyword); - writer.WriteValue(this.checkedKeyword); - writer.WriteValue(this.type); - writer.WriteValue(this.parameters); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, GetDiagnostics(), annotations); - static ConversionOperatorMemberCrefSyntax() + internal DocumentationCommentTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var content = (GreenNode?)reader.ReadValue(); + if (content != null) { - ObjectBinder.RegisterTypeReader(typeof(ConversionOperatorMemberCrefSyntax), r => new ConversionOperatorMemberCrefSyntax(r)); + AdjustFlagsAndWidth(content); + this.content = content; } + var endOfComment = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfComment); + this.endOfComment = endOfComment; } - /// - /// A list of cref parameters with surrounding punctuation. - /// Unlike regular parameters, cref parameters do not have names. - /// - internal abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) { - internal BaseCrefParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + base.WriteTo(writer); + writer.WriteValue(this.content); + writer.WriteValue(this.endOfComment); + } - internal BaseCrefParameterListSyntax(SyntaxKind kind) - : base(kind) - { - } + static DocumentationCommentTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(DocumentationCommentTriviaSyntax), r => new DocumentationCommentTriviaSyntax(r)); + } +} - protected BaseCrefParameterListSyntax(ObjectReader reader) - : base(reader) - { - } +/// +/// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). +/// For example, the M in <see cref="M" />. +/// +internal abstract partial class CrefSyntax : CSharpSyntaxNode +{ + internal CrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - /// Gets the parameter list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters { get; } + internal CrefSyntax(SyntaxKind kind) + : base(kind) + { } - /// - /// A parenthesized list of cref parameters. - /// - internal sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax + protected CrefSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken closeParenToken; + } +} - internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +/// +/// A symbol reference that definitely refers to a type. +/// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +internal sealed partial class TypeCrefSyntax : CrefSyntax +{ + internal readonly TypeSyntax type; - internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } + + internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - /// Gets the open paren token. - public SyntaxToken OpenParenToken => this.openParenToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); - /// Gets the close paren token. - public SyntaxToken CloseParenToken => this.closeParenToken; + public TypeSyntax Type => this.type; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.parameters, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.type : null; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeCrefSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); - public CrefParameterListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public TypeCrefSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TypeCref(type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeCrefSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - internal CrefParameterListSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var parameters = (GreenNode?)reader.ReadValue(); - if (parameters != null) - { - AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeCrefSyntax(this.Kind, this.type, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.parameters); - writer.WriteValue(this.closeParenToken); - } + internal TypeCrefSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + } - static CrefParameterListSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(CrefParameterListSyntax), r => new CrefParameterListSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.type); } - /// - /// A bracketed list of cref parameters. - /// - internal sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax + static TypeCrefSyntax() { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken closeBracketToken; + ObjectBinder.RegisterTypeReader(typeof(TypeCrefSyntax), r => new TypeCrefSyntax(r)); + } +} - internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } +/// +/// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. +/// For example, cref="System.String.ToString()". +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +internal sealed partial class QualifiedCrefSyntax : CrefSyntax +{ + internal readonly TypeSyntax container; + internal readonly SyntaxToken dotToken; + internal readonly MemberCrefSyntax member; - internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(container); + this.container = container; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(member); + this.member = member; + } - internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(container); + this.container = container; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(member); + this.member = member; + } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => this.openBracketToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => this.closeBracketToken; + internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(container); + this.container = container; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(member); + this.member = member; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.parameters, - 2 => this.closeBracketToken, - _ => null, - }; + public TypeSyntax Container => this.container; + public SyntaxToken DotToken => this.dotToken; + public MemberCrefSyntax Member => this.member; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefBracketedParameterListSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.container, + 1 => this.dotToken, + 2 => this.member, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedCrefSyntax(this, parent, position); - public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); - return this; + public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + { + if (container != this.Container || dotToken != this.DotToken || member != this.Member) + { + var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, diagnostics, GetAnnotations()); - internal CrefBracketedParameterListSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var openBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - var parameters = (GreenNode?)reader.ReadValue(); - if (parameters != null) - { - AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - var closeBracketToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openBracketToken); - writer.WriteValue(this.parameters); - writer.WriteValue(this.closeBracketToken); - } + internal QualifiedCrefSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var container = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(container); + this.container = container; + var dotToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + var member = (MemberCrefSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(member); + this.member = member; + } - static CrefBracketedParameterListSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(CrefBracketedParameterListSyntax), r => new CrefBracketedParameterListSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.container); + writer.WriteValue(this.dotToken); + writer.WriteValue(this.member); } - /// - /// An element of a BaseCrefParameterListSyntax. - /// Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, - /// an optional readonly keyword, and a type - - /// there is no name and there are no attributes or other modifiers. - /// - internal sealed partial class CrefParameterSyntax : CSharpSyntaxNode + static QualifiedCrefSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(QualifiedCrefSyntax), r => new QualifiedCrefSyntax(r)); + } +} + +/// +/// The unqualified part of a CrefSyntax. +/// For example, "ToString()" in "object.ToString()". +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +internal abstract partial class MemberCrefSyntax : CrefSyntax +{ + internal MemberCrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } + + internal MemberCrefSyntax(SyntaxKind kind) + : base(kind) + { + } + + protected MemberCrefSyntax(ObjectReader reader) + : base(reader) + { + } +} + +/// +/// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, +/// with an optional type parameter list) and an optional parameter list. +/// For example, "M", "M<T>" or "M(int)". +/// Also, "A::B()" or "string()". +/// +internal sealed partial class NameMemberCrefSyntax : MemberCrefSyntax +{ + internal readonly TypeSyntax name; + internal readonly CrefParameterListSyntax? parameters; + + internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal readonly SyntaxToken? refKindKeyword; - internal readonly SyntaxToken? readOnlyKeyword; - internal readonly TypeSyntax type; - - internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (parameters != null) { - this.SlotCount = 3; - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) + internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - : base(kind) + internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (parameters != null) { - this.SlotCount = 3; - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - public SyntaxToken? RefKindKeyword => this.refKindKeyword; - public SyntaxToken? ReadOnlyKeyword => this.readOnlyKeyword; - public TypeSyntax Type => this.type; + public TypeSyntax Name => this.name; + public CrefParameterListSyntax? Parameters => this.parameters; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.refKindKeyword, - 1 => this.readOnlyKeyword, - 2 => this.type, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.parameters, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameMemberCrefSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); - public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax parameters) + { + if (name != this.Name || parameters != this.Parameters) { - if (refKindKeyword != this.RefKindKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) - { - var newNode = SyntaxFactory.CrefParameter(refKindKeyword, readOnlyKeyword, type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.NameMemberCref(name, parameters); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.readOnlyKeyword, this.type, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.readOnlyKeyword, this.type, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, diagnostics, GetAnnotations()); - internal CrefParameterSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var refKindKeyword = (SyntaxToken?)reader.ReadValue(); - if (refKindKeyword != null) - { - AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - var readOnlyKeyword = (SyntaxToken?)reader.ReadValue(); - if (readOnlyKeyword != null) - { - AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - var type = (TypeSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(type); - this.type = type; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal NameMemberCrefSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var name = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var parameters = (CrefParameterListSyntax?)reader.ReadValue(); + if (parameters != null) { - base.WriteTo(writer); - writer.WriteValue(this.refKindKeyword); - writer.WriteValue(this.readOnlyKeyword); - writer.WriteValue(this.type); + AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - static CrefParameterSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(CrefParameterSyntax), r => new CrefParameterSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.name); + writer.WriteValue(this.parameters); } - internal abstract partial class XmlNodeSyntax : CSharpSyntaxNode + static NameMemberCrefSyntax() { - internal XmlNodeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + ObjectBinder.RegisterTypeReader(typeof(NameMemberCrefSyntax), r => new NameMemberCrefSyntax(r)); + } +} + +/// +/// A MemberCrefSyntax specified by a this keyword and an optional parameter list. +/// For example, "this" or "this[int]". +/// +internal sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax +{ + internal readonly SyntaxToken thisKeyword; + internal readonly CrefBracketedParameterListSyntax? parameters; - internal XmlNodeSyntax(SyntaxKind kind) - : base(kind) + internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + if (parameters != null) { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - protected XmlNodeSyntax(ObjectReader reader) - : base(reader) + internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + if (parameters != null) { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } } - internal sealed partial class XmlElementSyntax : XmlNodeSyntax + internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + : base(kind) { - internal readonly XmlElementStartTagSyntax startTag; - internal readonly GreenNode? content; - internal readonly XmlElementEndTagSyntax endTag; - - internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 2; + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + if (parameters != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startTag); - this.startTag = startTag; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endTag); - this.endTag = endTag; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, SyntaxFactoryContext context) - : base(kind) + public SyntaxToken ThisKeyword => this.thisKeyword; + public CrefBracketedParameterListSyntax? Parameters => this.parameters; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startTag); - this.startTag = startTag; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endTag); - this.endTag = endTag; - } + 0 => this.thisKeyword, + 1 => this.parameters, + _ => null, + }; - internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerMemberCrefSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); + + public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax parameters) + { + if (thisKeyword != this.ThisKeyword || parameters != this.Parameters) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startTag); - this.startTag = startTag; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endTag); - this.endTag = endTag; + var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public XmlElementStartTagSyntax StartTag => this.startTag; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Content => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.content); - public XmlElementEndTagSyntax EndTag => this.endTag; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.startTag, - 1 => this.content, - 2 => this.endTag, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, GetDiagnostics(), annotations); - public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + internal IndexerMemberCrefSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var thisKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + var parameters = (CrefBracketedParameterListSyntax?)reader.ReadValue(); + if (parameters != null) { - if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) - { - var newNode = SyntaxFactory.XmlElement(startTag, content, endTag); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.thisKeyword); + writer.WriteValue(this.parameters); + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, GetDiagnostics(), annotations); + static IndexerMemberCrefSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(IndexerMemberCrefSyntax), r => new IndexerMemberCrefSyntax(r)); + } +} - internal XmlElementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var startTag = (XmlElementStartTagSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(startTag); - this.startTag = startTag; - var content = (GreenNode?)reader.ReadValue(); - if (content != null) - { - AdjustFlagsAndWidth(content); - this.content = content; - } - var endTag = (XmlElementEndTagSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(endTag); - this.endTag = endTag; - } +/// +/// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. +/// For example, "operator +" or "operator -[int]". +/// NOTE: the operator must be overloadable. +/// +internal sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax +{ + internal readonly SyntaxToken operatorKeyword; + internal readonly SyntaxToken? checkedKeyword; + internal readonly SyntaxToken operatorToken; + internal readonly CrefParameterListSyntax? parameters; - internal override void WriteTo(ObjectWriter writer) + internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - base.WriteTo(writer); - writer.WriteValue(this.startTag); - writer.WriteValue(this.content); - writer.WriteValue(this.endTag); + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } - - static XmlElementSyntax() + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (parameters != null) { - ObjectBinder.RegisterTypeReader(typeof(XmlElementSyntax), r => new XmlElementSyntax(r)); + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } } - internal sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode + internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken lessThanToken; - internal readonly XmlNameSyntax name; - internal readonly GreenNode? attributes; - internal readonly SyntaxToken greaterThanToken; - - internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } - - internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken) - : base(kind) + internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (parameters != null) + { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - public SyntaxToken LessThanToken => this.lessThanToken; - public XmlNameSyntax Name => this.name; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributes); - public SyntaxToken GreaterThanToken => this.greaterThanToken; + public SyntaxToken OperatorKeyword => this.operatorKeyword; + public SyntaxToken? CheckedKeyword => this.checkedKeyword; + /// Gets the operator token. + public SyntaxToken OperatorToken => this.operatorToken; + public CrefParameterListSyntax? Parameters => this.parameters; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanToken, - 1 => this.name, - 2 => this.attributes, - 3 => this.greaterThanToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.operatorKeyword, + 1 => this.checkedKeyword, + 2 => this.operatorToken, + 3 => this.parameters, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementStartTagSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorMemberCrefSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); - public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) + public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax parameters) + { + if (operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters) { - if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, operatorToken, parameters); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameters, diagnostics, GetAnnotations()); - internal XmlElementStartTagSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var lessThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - var name = (XmlNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var attributes = (GreenNode?)reader.ReadValue(); - if (attributes != null) - { - AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - var greaterThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameters, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal OperatorMemberCrefSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var operatorKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + var checkedKeyword = (SyntaxToken?)reader.ReadValue(); + if (checkedKeyword != null) { - base.WriteTo(writer); - writer.WriteValue(this.lessThanToken); - writer.WriteValue(this.name); - writer.WriteValue(this.attributes); - writer.WriteValue(this.greaterThanToken); + AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } - - static XmlElementStartTagSyntax() + var operatorToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + var parameters = (CrefParameterListSyntax?)reader.ReadValue(); + if (parameters != null) { - ObjectBinder.RegisterTypeReader(typeof(XmlElementStartTagSyntax), r => new XmlElementStartTagSyntax(r)); + AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } } - internal sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.operatorKeyword); + writer.WriteValue(this.checkedKeyword); + writer.WriteValue(this.operatorToken); + writer.WriteValue(this.parameters); + } + + static OperatorMemberCrefSyntax() { - internal readonly SyntaxToken lessThanSlashToken; - internal readonly XmlNameSyntax name; - internal readonly SyntaxToken greaterThanToken; + ObjectBinder.RegisterTypeReader(typeof(OperatorMemberCrefSyntax), r => new OperatorMemberCrefSyntax(r)); + } +} - internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +/// +/// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. +/// For example, "implicit operator int" or "explicit operator MyType(int)". +/// +internal sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax +{ + internal readonly SyntaxToken implicitOrExplicitKeyword; + internal readonly SyntaxToken operatorKeyword; + internal readonly SyntaxToken? checkedKeyword; + internal readonly TypeSyntax type; + internal readonly CrefParameterListSyntax? parameters; + + internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + if (parameters != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanSlashToken); - this.lessThanSlashToken = lessThanSlashToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, SyntaxFactoryContext context) - : base(kind) + internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanSlashToken); - this.lessThanSlashToken = lessThanSlashToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) - : base(kind) + internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + if (parameters != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanSlashToken); - this.lessThanSlashToken = lessThanSlashToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - public SyntaxToken LessThanSlashToken => this.lessThanSlashToken; - public XmlNameSyntax Name => this.name; - public SyntaxToken GreaterThanToken => this.greaterThanToken; + public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; + public SyntaxToken OperatorKeyword => this.operatorKeyword; + public SyntaxToken? CheckedKeyword => this.checkedKeyword; + public TypeSyntax Type => this.type; + public CrefParameterListSyntax? Parameters => this.parameters; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanSlashToken, - 1 => this.name, - 2 => this.greaterThanToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.implicitOrExplicitKeyword, + 1 => this.operatorKeyword, + 2 => this.checkedKeyword, + 3 => this.type, + 4 => this.parameters, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementEndTagSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorMemberCrefSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); - public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax parameters) + { + if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameters != this.Parameters) { - if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.checkedKeyword, this.type, this.parameters, diagnostics, GetAnnotations()); - internal XmlElementEndTagSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var lessThanSlashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(lessThanSlashToken); - this.lessThanSlashToken = lessThanSlashToken; - var name = (XmlNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var greaterThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.checkedKeyword, this.type, this.parameters, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal ConversionOperatorMemberCrefSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var implicitOrExplicitKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + var operatorKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + var checkedKeyword = (SyntaxToken?)reader.ReadValue(); + if (checkedKeyword != null) { - base.WriteTo(writer); - writer.WriteValue(this.lessThanSlashToken); - writer.WriteValue(this.name); - writer.WriteValue(this.greaterThanToken); + AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } - - static XmlElementEndTagSyntax() + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + var parameters = (CrefParameterListSyntax?)reader.ReadValue(); + if (parameters != null) { - ObjectBinder.RegisterTypeReader(typeof(XmlElementEndTagSyntax), r => new XmlElementEndTagSyntax(r)); + AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } } - internal sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.implicitOrExplicitKeyword); + writer.WriteValue(this.operatorKeyword); + writer.WriteValue(this.checkedKeyword); + writer.WriteValue(this.type); + writer.WriteValue(this.parameters); + } + + static ConversionOperatorMemberCrefSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ConversionOperatorMemberCrefSyntax), r => new ConversionOperatorMemberCrefSyntax(r)); + } +} + +/// +/// A list of cref parameters with surrounding punctuation. +/// Unlike regular parameters, cref parameters do not have names. +/// +internal abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode +{ + internal BaseCrefParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } + + internal BaseCrefParameterListSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken lessThanToken; - internal readonly XmlNameSyntax name; - internal readonly GreenNode? attributes; - internal readonly SyntaxToken slashGreaterThanToken; + } + + protected BaseCrefParameterListSyntax(ObjectReader reader) + : base(reader) + { + } - internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + /// Gets the parameter list. + public abstract CoreSyntax.SeparatedSyntaxList Parameters { get; } +} + +/// +/// A parenthesized list of cref parameters. +/// +internal sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken closeParenToken; + + internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(slashGreaterThanToken); - this.slashGreaterThanToken = slashGreaterThanToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, SyntaxFactoryContext context) - : base(kind) + internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(slashGreaterThanToken); - this.slashGreaterThanToken = slashGreaterThanToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken) - : base(kind) + internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(slashGreaterThanToken); - this.slashGreaterThanToken = slashGreaterThanToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public SyntaxToken LessThanToken => this.lessThanToken; - public XmlNameSyntax Name => this.name; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributes); - public SyntaxToken SlashGreaterThanToken => this.slashGreaterThanToken; + /// Gets the open paren token. + public SyntaxToken OpenParenToken => this.openParenToken; + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// Gets the close paren token. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanToken, - 1 => this.name, - 2 => this.attributes, - 3 => this.slashGreaterThanToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.parameters, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlEmptyElementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); - public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) + public CrefParameterListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) { - if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) - { - var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations()); - internal XmlEmptyElementSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var lessThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - var name = (XmlNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var attributes = (GreenNode?)reader.ReadValue(); - if (attributes != null) - { - AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - var slashGreaterThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(slashGreaterThanToken); - this.slashGreaterThanToken = slashGreaterThanToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal CrefParameterListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var parameters = (GreenNode?)reader.ReadValue(); + if (parameters != null) { - base.WriteTo(writer); - writer.WriteValue(this.lessThanToken); - writer.WriteValue(this.name); - writer.WriteValue(this.attributes); - writer.WriteValue(this.slashGreaterThanToken); + AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - static XmlEmptyElementSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(XmlEmptyElementSyntax), r => new XmlEmptyElementSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.parameters); + writer.WriteValue(this.closeParenToken); } - internal sealed partial class XmlNameSyntax : CSharpSyntaxNode + static CrefParameterListSyntax() { - internal readonly XmlPrefixSyntax? prefix; - internal readonly SyntaxToken localName; + ObjectBinder.RegisterTypeReader(typeof(CrefParameterListSyntax), r => new CrefParameterListSyntax(r)); + } +} + +/// +/// A bracketed list of cref parameters. +/// +internal sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken closeBracketToken; - internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - this.SlotCount = 2; - if (prefix != null) - { - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - } - this.AdjustFlagsAndWidth(localName); - this.localName = localName; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, SyntaxFactoryContext context) - : base(kind) + internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (prefix != null) - { - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - } - this.AdjustFlagsAndWidth(localName); - this.localName = localName; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName) - : base(kind) + internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - this.SlotCount = 2; - if (prefix != null) - { - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - } - this.AdjustFlagsAndWidth(localName); - this.localName = localName; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - public XmlPrefixSyntax? Prefix => this.prefix; - public SyntaxToken LocalName => this.localName; + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => this.openBracketToken; + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.prefix, - 1 => this.localName, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.parameters, + 2 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefBracketedParameterListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); - public XmlNameSyntax Update(XmlPrefixSyntax prefix, SyntaxToken localName) + public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) { - if (prefix != this.Prefix || localName != this.LocalName) - { - var newNode = SyntaxFactory.XmlName(prefix, localName); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlNameSyntax(this.Kind, this.prefix, this.localName, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlNameSyntax(this.Kind, this.prefix, this.localName, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations); - internal XmlNameSyntax(ObjectReader reader) - : base(reader) + internal CrefBracketedParameterListSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var openBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + var parameters = (GreenNode?)reader.ReadValue(); + if (parameters != null) { - this.SlotCount = 2; - var prefix = (XmlPrefixSyntax?)reader.ReadValue(); - if (prefix != null) - { - AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - } - var localName = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(localName); - this.localName = localName; + AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + var closeBracketToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openBracketToken); + writer.WriteValue(this.parameters); + writer.WriteValue(this.closeBracketToken); + } + + static CrefBracketedParameterListSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(CrefBracketedParameterListSyntax), r => new CrefBracketedParameterListSyntax(r)); + } +} + +/// +/// An element of a BaseCrefParameterListSyntax. +/// Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, +/// an optional readonly keyword, and a type - +/// there is no name and there are no attributes or other modifiers. +/// +internal sealed partial class CrefParameterSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken? refKindKeyword; + internal readonly SyntaxToken? readOnlyKeyword; + internal readonly TypeSyntax type; - internal override void WriteTo(ObjectWriter writer) + internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (refKindKeyword != null) { - base.WriteTo(writer); - writer.WriteValue(this.prefix); - writer.WriteValue(this.localName); + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } - - static XmlNameSyntax() + if (readOnlyKeyword != null) { - ObjectBinder.RegisterTypeReader(typeof(XmlNameSyntax), r => new XmlNameSyntax(r)); + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + this.AdjustFlagsAndWidth(type); + this.type = type; } - internal sealed partial class XmlPrefixSyntax : CSharpSyntaxNode + internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken prefix; - internal readonly SyntaxToken colonToken; - - internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + if (refKindKeyword != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } - - internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + if (readOnlyKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken) - : base(kind) + internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + : base(kind) + { + this.SlotCount = 3; + if (refKindKeyword != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } - - public SyntaxToken Prefix => this.prefix; - public SyntaxToken ColonToken => this.colonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.prefix, - 1 => this.colonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlPrefixSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); - - public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken) + if (readOnlyKeyword != null) { - if (prefix != this.Prefix || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, GetDiagnostics(), annotations); + public SyntaxToken? RefKindKeyword => this.refKindKeyword; + public SyntaxToken? ReadOnlyKeyword => this.readOnlyKeyword; + public TypeSyntax Type => this.type; - internal XmlPrefixSyntax(ObjectReader reader) - : base(reader) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - var prefix = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - var colonToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } + 0 => this.refKindKeyword, + 1 => this.readOnlyKeyword, + 2 => this.type, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterSyntax(this, parent, position); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.prefix); - writer.WriteValue(this.colonToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); - static XmlPrefixSyntax() + public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + { + if (refKindKeyword != this.RefKindKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) { - ObjectBinder.RegisterTypeReader(typeof(XmlPrefixSyntax), r => new XmlPrefixSyntax(r)); + var newNode = SyntaxFactory.CrefParameter(refKindKeyword, readOnlyKeyword, type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; } - internal abstract partial class XmlAttributeSyntax : CSharpSyntaxNode + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.readOnlyKeyword, this.type, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.readOnlyKeyword, this.type, GetDiagnostics(), annotations); + + internal CrefParameterSyntax(ObjectReader reader) + : base(reader) { - internal XmlAttributeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + var refKindKeyword = (SyntaxToken?)reader.ReadValue(); + if (refKindKeyword != null) { + AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } - - internal XmlAttributeSyntax(SyntaxKind kind) - : base(kind) + var readOnlyKeyword = (SyntaxToken?)reader.ReadValue(); + if (readOnlyKeyword != null) { + AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + var type = (TypeSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(type); + this.type = type; + } - protected XmlAttributeSyntax(ObjectReader reader) - : base(reader) - { - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.refKindKeyword); + writer.WriteValue(this.readOnlyKeyword); + writer.WriteValue(this.type); + } - public abstract XmlNameSyntax Name { get; } + static CrefParameterSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(CrefParameterSyntax), r => new CrefParameterSyntax(r)); + } +} - public abstract SyntaxToken EqualsToken { get; } +internal abstract partial class XmlNodeSyntax : CSharpSyntaxNode +{ + internal XmlNodeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public abstract SyntaxToken StartQuoteToken { get; } + internal XmlNodeSyntax(SyntaxKind kind) + : base(kind) + { + } - public abstract SyntaxToken EndQuoteToken { get; } + protected XmlNodeSyntax(ObjectReader reader) + : base(reader) + { } +} + +internal sealed partial class XmlElementSyntax : XmlNodeSyntax +{ + internal readonly XmlElementStartTagSyntax startTag; + internal readonly GreenNode? content; + internal readonly XmlElementEndTagSyntax endTag; - internal sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax + internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal readonly XmlNameSyntax name; - internal readonly SyntaxToken equalsToken; - internal readonly SyntaxToken startQuoteToken; - internal readonly GreenNode? textTokens; - internal readonly SyntaxToken endQuoteToken; + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startTag); + this.startTag = startTag; + if (content != null) + { + this.AdjustFlagsAndWidth(content); + this.content = content; + } + this.AdjustFlagsAndWidth(endTag); + this.endTag = endTag; + } - internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startTag); + this.startTag = startTag; + if (content != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } - - internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; + this.AdjustFlagsAndWidth(content); + this.content = content; } + this.AdjustFlagsAndWidth(endTag); + this.endTag = endTag; + } - internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken) - : base(kind) + internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startTag); + this.startTag = startTag; + if (content != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; + this.AdjustFlagsAndWidth(content); + this.content = content; } + this.AdjustFlagsAndWidth(endTag); + this.endTag = endTag; + } - public override XmlNameSyntax Name => this.name; - public override SyntaxToken EqualsToken => this.equalsToken; - public override SyntaxToken StartQuoteToken => this.startQuoteToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.textTokens); - public override SyntaxToken EndQuoteToken => this.endQuoteToken; + public XmlElementStartTagSyntax StartTag => this.startTag; + public CoreSyntax.SyntaxList Content => new CoreSyntax.SyntaxList(this.content); + public XmlElementEndTagSyntax EndTag => this.endTag; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.equalsToken, - 2 => this.startQuoteToken, - 3 => this.textTokens, - 4 => this.endQuoteToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.startTag, + 1 => this.content, + 2 => this.endTag, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextAttributeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); - public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) + public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + { + if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlElement(startTag, content, endTag); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, diagnostics, GetAnnotations()); - internal XmlTextAttributeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var name = (XmlNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var equalsToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - var startQuoteToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - var textTokens = (GreenNode?)reader.ReadValue(); - if (textTokens != null) - { - AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - var endQuoteToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal XmlElementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var startTag = (XmlElementStartTagSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(startTag); + this.startTag = startTag; + var content = (GreenNode?)reader.ReadValue(); + if (content != null) { - base.WriteTo(writer); - writer.WriteValue(this.name); - writer.WriteValue(this.equalsToken); - writer.WriteValue(this.startQuoteToken); - writer.WriteValue(this.textTokens); - writer.WriteValue(this.endQuoteToken); + AdjustFlagsAndWidth(content); + this.content = content; } + var endTag = (XmlElementEndTagSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(endTag); + this.endTag = endTag; + } - static XmlTextAttributeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(XmlTextAttributeSyntax), r => new XmlTextAttributeSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.startTag); + writer.WriteValue(this.content); + writer.WriteValue(this.endTag); } - internal sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax + static XmlElementSyntax() { - internal readonly XmlNameSyntax name; - internal readonly SyntaxToken equalsToken; - internal readonly SyntaxToken startQuoteToken; - internal readonly CrefSyntax cref; - internal readonly SyntaxToken endQuoteToken; + ObjectBinder.RegisterTypeReader(typeof(XmlElementSyntax), r => new XmlElementSyntax(r)); + } +} + +internal sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken lessThanToken; + internal readonly XmlNameSyntax name; + internal readonly GreenNode? attributes; + internal readonly SyntaxToken greaterThanToken; - internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(cref); - this.cref = cref; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, SyntaxFactoryContext context) - : base(kind) + internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(cref); - this.cref = cref; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) - : base(kind) + internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(cref); - this.cref = cref; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - public override XmlNameSyntax Name => this.name; - public override SyntaxToken EqualsToken => this.equalsToken; - public override SyntaxToken StartQuoteToken => this.startQuoteToken; - public CrefSyntax Cref => this.cref; - public override SyntaxToken EndQuoteToken => this.endQuoteToken; + public SyntaxToken LessThanToken => this.lessThanToken; + public XmlNameSyntax Name => this.name; + public CoreSyntax.SyntaxList Attributes => new CoreSyntax.SyntaxList(this.attributes); + public SyntaxToken GreaterThanToken => this.greaterThanToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.equalsToken, - 2 => this.startQuoteToken, - 3 => this.cref, - 4 => this.endQuoteToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.lessThanToken, + 1 => this.name, + 2 => this.attributes, + 3 => this.greaterThanToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCrefAttributeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementStartTagSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); - public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, diagnostics, GetAnnotations()); - internal XmlCrefAttributeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var name = (XmlNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var equalsToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - var startQuoteToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - var cref = (CrefSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(cref); - this.cref = cref; - var endQuoteToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal XmlElementStartTagSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var lessThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + var name = (XmlNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var attributes = (GreenNode?)reader.ReadValue(); + if (attributes != null) { - base.WriteTo(writer); - writer.WriteValue(this.name); - writer.WriteValue(this.equalsToken); - writer.WriteValue(this.startQuoteToken); - writer.WriteValue(this.cref); - writer.WriteValue(this.endQuoteToken); + AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + var greaterThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - static XmlCrefAttributeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(XmlCrefAttributeSyntax), r => new XmlCrefAttributeSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.lessThanToken); + writer.WriteValue(this.name); + writer.WriteValue(this.attributes); + writer.WriteValue(this.greaterThanToken); } - internal sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax + static XmlElementStartTagSyntax() { - internal readonly XmlNameSyntax name; - internal readonly SyntaxToken equalsToken; - internal readonly SyntaxToken startQuoteToken; - internal readonly IdentifierNameSyntax identifier; - internal readonly SyntaxToken endQuoteToken; + ObjectBinder.RegisterTypeReader(typeof(XmlElementStartTagSyntax), r => new XmlElementStartTagSyntax(r)); + } +} - internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } +internal sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken lessThanSlashToken; + internal readonly XmlNameSyntax name; + internal readonly SyntaxToken greaterThanToken; - internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } + internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanSlashToken); + this.lessThanSlashToken = lessThanSlashToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } + internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanSlashToken); + this.lessThanSlashToken = lessThanSlashToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - public override XmlNameSyntax Name => this.name; - public override SyntaxToken EqualsToken => this.equalsToken; - public override SyntaxToken StartQuoteToken => this.startQuoteToken; - public IdentifierNameSyntax Identifier => this.identifier; - public override SyntaxToken EndQuoteToken => this.endQuoteToken; + internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanSlashToken); + this.lessThanSlashToken = lessThanSlashToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.equalsToken, - 2 => this.startQuoteToken, - 3 => this.identifier, - 4 => this.endQuoteToken, - _ => null, - }; + public SyntaxToken LessThanSlashToken => this.lessThanSlashToken; + public XmlNameSyntax Name => this.name; + public SyntaxToken GreaterThanToken => this.greaterThanToken; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameAttributeSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.lessThanSlashToken, + 1 => this.name, + 2 => this.greaterThanToken, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementEndTagSyntax(this, parent, position); - public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) - { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); - return this; + public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + { + if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken) + { + var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, diagnostics, GetAnnotations()); - internal XmlNameAttributeSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var name = (XmlNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var equalsToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - var startQuoteToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - var identifier = (IdentifierNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var endQuoteToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.name); - writer.WriteValue(this.equalsToken); - writer.WriteValue(this.startQuoteToken); - writer.WriteValue(this.identifier); - writer.WriteValue(this.endQuoteToken); - } + internal XmlElementEndTagSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var lessThanSlashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(lessThanSlashToken); + this.lessThanSlashToken = lessThanSlashToken; + var name = (XmlNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var greaterThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - static XmlNameAttributeSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(XmlNameAttributeSyntax), r => new XmlNameAttributeSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.lessThanSlashToken); + writer.WriteValue(this.name); + writer.WriteValue(this.greaterThanToken); } - internal sealed partial class XmlTextSyntax : XmlNodeSyntax + static XmlElementEndTagSyntax() { - internal readonly GreenNode? textTokens; + ObjectBinder.RegisterTypeReader(typeof(XmlElementEndTagSyntax), r => new XmlElementEndTagSyntax(r)); + } +} + +internal sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax +{ + internal readonly SyntaxToken lessThanToken; + internal readonly XmlNameSyntax name; + internal readonly GreenNode? attributes; + internal readonly SyntaxToken slashGreaterThanToken; - internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { - this.SlotCount = 1; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(slashGreaterThanToken); + this.slashGreaterThanToken = slashGreaterThanToken; + } - internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, SyntaxFactoryContext context) - : base(kind) + internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(slashGreaterThanToken); + this.slashGreaterThanToken = slashGreaterThanToken; + } - internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) - : base(kind) + internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { - this.SlotCount = 1; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(slashGreaterThanToken); + this.slashGreaterThanToken = slashGreaterThanToken; + } - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.textTokens); + public SyntaxToken LessThanToken => this.lessThanToken; + public XmlNameSyntax Name => this.name; + public CoreSyntax.SyntaxList Attributes => new CoreSyntax.SyntaxList(this.attributes); + public SyntaxToken SlashGreaterThanToken => this.slashGreaterThanToken; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.textTokens : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.lessThanToken, + 1 => this.name, + 2 => this.attributes, + 3 => this.slashGreaterThanToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlEmptyElementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); - public XmlTextSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens) + public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) + { + if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) { - if (textTokens != this.TextTokens) - { - var newNode = SyntaxFactory.XmlText(textTokens); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlTextSyntax(this.Kind, this.textTokens, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlTextSyntax(this.Kind, this.textTokens, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, diagnostics, GetAnnotations()); - internal XmlTextSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 1; - var textTokens = (GreenNode?)reader.ReadValue(); - if (textTokens != null) - { - AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal XmlEmptyElementSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var lessThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + var name = (XmlNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var attributes = (GreenNode?)reader.ReadValue(); + if (attributes != null) { - base.WriteTo(writer); - writer.WriteValue(this.textTokens); + AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + var slashGreaterThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(slashGreaterThanToken); + this.slashGreaterThanToken = slashGreaterThanToken; + } - static XmlTextSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(XmlTextSyntax), r => new XmlTextSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.lessThanToken); + writer.WriteValue(this.name); + writer.WriteValue(this.attributes); + writer.WriteValue(this.slashGreaterThanToken); } - internal sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax + static XmlEmptyElementSyntax() { - internal readonly SyntaxToken startCDataToken; - internal readonly GreenNode? textTokens; - internal readonly SyntaxToken endCDataToken; + ObjectBinder.RegisterTypeReader(typeof(XmlEmptyElementSyntax), r => new XmlEmptyElementSyntax(r)); + } +} + +internal sealed partial class XmlNameSyntax : CSharpSyntaxNode +{ + internal readonly XmlPrefixSyntax? prefix; + internal readonly SyntaxToken localName; - internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (prefix != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startCDataToken); - this.startCDataToken = startCDataToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endCDataToken); - this.endCDataToken = endCDataToken; + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; } + this.AdjustFlagsAndWidth(localName); + this.localName = localName; + } - internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, SyntaxFactoryContext context) - : base(kind) + internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + if (prefix != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startCDataToken); - this.startCDataToken = startCDataToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endCDataToken); - this.endCDataToken = endCDataToken; + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; } + this.AdjustFlagsAndWidth(localName); + this.localName = localName; + } - internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken) - : base(kind) + internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName) + : base(kind) + { + this.SlotCount = 2; + if (prefix != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startCDataToken); - this.startCDataToken = startCDataToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endCDataToken); - this.endCDataToken = endCDataToken; + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; } + this.AdjustFlagsAndWidth(localName); + this.localName = localName; + } - public SyntaxToken StartCDataToken => this.startCDataToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.textTokens); - public SyntaxToken EndCDataToken => this.endCDataToken; + public XmlPrefixSyntax? Prefix => this.prefix; + public SyntaxToken LocalName => this.localName; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.startCDataToken, - 1 => this.textTokens, - 2 => this.endCDataToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.prefix, + 1 => this.localName, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCDataSectionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); - public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + public XmlNameSyntax Update(XmlPrefixSyntax prefix, SyntaxToken localName) + { + if (prefix != this.Prefix || localName != this.LocalName) { - if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) - { - var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlName(prefix, localName); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, GetDiagnostics(), annotations); + return this; + } - internal XmlCDataSectionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var startCDataToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(startCDataToken); - this.startCDataToken = startCDataToken; - var textTokens = (GreenNode?)reader.ReadValue(); - if (textTokens != null) - { - AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - var endCDataToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endCDataToken); - this.endCDataToken = endCDataToken; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlNameSyntax(this.Kind, this.prefix, this.localName, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.startCDataToken); - writer.WriteValue(this.textTokens); - writer.WriteValue(this.endCDataToken); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlNameSyntax(this.Kind, this.prefix, this.localName, GetDiagnostics(), annotations); - static XmlCDataSectionSyntax() + internal XmlNameSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var prefix = (XmlPrefixSyntax?)reader.ReadValue(); + if (prefix != null) { - ObjectBinder.RegisterTypeReader(typeof(XmlCDataSectionSyntax), r => new XmlCDataSectionSyntax(r)); + AdjustFlagsAndWidth(prefix); + this.prefix = prefix; } + var localName = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(localName); + this.localName = localName; } - internal sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken startProcessingInstructionToken; - internal readonly XmlNameSyntax name; - internal readonly GreenNode? textTokens; - internal readonly SyntaxToken endProcessingInstructionToken; - - internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(startProcessingInstructionToken); - this.startProcessingInstructionToken = startProcessingInstructionToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endProcessingInstructionToken); - this.endProcessingInstructionToken = endProcessingInstructionToken; - } + base.WriteTo(writer); + writer.WriteValue(this.prefix); + writer.WriteValue(this.localName); + } - internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(startProcessingInstructionToken); - this.startProcessingInstructionToken = startProcessingInstructionToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endProcessingInstructionToken); - this.endProcessingInstructionToken = endProcessingInstructionToken; - } + static XmlNameSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(XmlNameSyntax), r => new XmlNameSyntax(r)); + } +} - internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(startProcessingInstructionToken); - this.startProcessingInstructionToken = startProcessingInstructionToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endProcessingInstructionToken); - this.endProcessingInstructionToken = endProcessingInstructionToken; - } +internal sealed partial class XmlPrefixSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken prefix; + internal readonly SyntaxToken colonToken; - public SyntaxToken StartProcessingInstructionToken => this.startProcessingInstructionToken; - public XmlNameSyntax Name => this.name; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.textTokens); - public SyntaxToken EndProcessingInstructionToken => this.endProcessingInstructionToken; + internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.startProcessingInstructionToken, - 1 => this.name, - 2 => this.textTokens, - 3 => this.endProcessingInstructionToken, - _ => null, - }; + internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlProcessingInstructionSyntax(this, parent, position); + internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); + public SyntaxToken Prefix => this.prefix; + public SyntaxToken ColonToken => this.colonToken; - public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) - { - var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.prefix, + 1 => this.colonToken, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlPrefixSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); - internal XmlProcessingInstructionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var startProcessingInstructionToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(startProcessingInstructionToken); - this.startProcessingInstructionToken = startProcessingInstructionToken; - var name = (XmlNameSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var textTokens = (GreenNode?)reader.ReadValue(); - if (textTokens != null) - { - AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - var endProcessingInstructionToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endProcessingInstructionToken); - this.endProcessingInstructionToken = endProcessingInstructionToken; - } - - internal override void WriteTo(ObjectWriter writer) + public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken) + { + if (prefix != this.Prefix || colonToken != this.ColonToken) { - base.WriteTo(writer); - writer.WriteValue(this.startProcessingInstructionToken); - writer.WriteValue(this.name); - writer.WriteValue(this.textTokens); - writer.WriteValue(this.endProcessingInstructionToken); + var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static XmlProcessingInstructionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(XmlProcessingInstructionSyntax), r => new XmlProcessingInstructionSyntax(r)); - } + return this; } - internal sealed partial class XmlCommentSyntax : XmlNodeSyntax - { - internal readonly SyntaxToken lessThanExclamationMinusMinusToken; - internal readonly GreenNode? textTokens; - internal readonly SyntaxToken minusMinusGreaterThanToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, diagnostics, GetAnnotations()); - internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); - this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); - this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, GetDiagnostics(), annotations); - internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); - this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); - this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; - } + internal XmlPrefixSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 2; + var prefix = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(prefix); + this.prefix = prefix; + var colonToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); - this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); - this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.prefix); + writer.WriteValue(this.colonToken); + } - public SyntaxToken LessThanExclamationMinusMinusToken => this.lessThanExclamationMinusMinusToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.textTokens); - public SyntaxToken MinusMinusGreaterThanToken => this.minusMinusGreaterThanToken; + static XmlPrefixSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(XmlPrefixSyntax), r => new XmlPrefixSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanExclamationMinusMinusToken, - 1 => this.textTokens, - 2 => this.minusMinusGreaterThanToken, - _ => null, - }; +internal abstract partial class XmlAttributeSyntax : CSharpSyntaxNode +{ + internal XmlAttributeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCommentSyntax(this, parent, position); + internal XmlAttributeSyntax(SyntaxKind kind) + : base(kind) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); + protected XmlAttributeSyntax(ObjectReader reader) + : base(reader) + { + } - public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) - { - if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) - { - var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public abstract XmlNameSyntax Name { get; } - return this; - } + public abstract SyntaxToken EqualsToken { get; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, diagnostics, GetAnnotations()); + public abstract SyntaxToken StartQuoteToken { get; } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, GetDiagnostics(), annotations); + public abstract SyntaxToken EndQuoteToken { get; } +} - internal XmlCommentSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var lessThanExclamationMinusMinusToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); - this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; - var textTokens = (GreenNode?)reader.ReadValue(); - if (textTokens != null) - { - AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - var minusMinusGreaterThanToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(minusMinusGreaterThanToken); - this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; - } +internal sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax +{ + internal readonly XmlNameSyntax name; + internal readonly SyntaxToken equalsToken; + internal readonly SyntaxToken startQuoteToken; + internal readonly GreenNode? textTokens; + internal readonly SyntaxToken endQuoteToken; - internal override void WriteTo(ObjectWriter writer) + internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + if (textTokens != null) { - base.WriteTo(writer); - writer.WriteValue(this.lessThanExclamationMinusMinusToken); - writer.WriteValue(this.textTokens); - writer.WriteValue(this.minusMinusGreaterThanToken); + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } - static XmlCommentSyntax() + internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + if (textTokens != null) { - ObjectBinder.RegisterTypeReader(typeof(XmlCommentSyntax), r => new XmlCommentSyntax(r)); + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; } - internal abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax + internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken) + : base(kind) { - internal DirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + if (textTokens != null) { - this.flags |= NodeFlags.ContainsDirectives; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } - internal DirectiveTriviaSyntax(SyntaxKind kind) - : base(kind) - { - this.flags |= NodeFlags.ContainsDirectives; - } + public override XmlNameSyntax Name => this.name; + public override SyntaxToken EqualsToken => this.equalsToken; + public override SyntaxToken StartQuoteToken => this.startQuoteToken; + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public override SyntaxToken EndQuoteToken => this.endQuoteToken; - protected DirectiveTriviaSyntax(ObjectReader reader) - : base(reader) + internal override GreenNode? GetSlot(int index) + => index switch { - this.flags |= NodeFlags.ContainsDirectives; - } + 0 => this.name, + 1 => this.equalsToken, + 2 => this.startQuoteToken, + 3 => this.textTokens, + 4 => this.endQuoteToken, + _ => null, + }; - public abstract SyntaxToken HashToken { get; } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextAttributeSyntax(this, parent, position); - public abstract SyntaxToken EndOfDirectiveToken { get; } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); - public abstract bool IsActive { get; } - } - - internal abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax + public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) { - internal BranchingDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } - - internal BranchingDirectiveTriviaSyntax(SyntaxKind kind) - : base(kind) - { - } - - protected BranchingDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) { + var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public abstract bool BranchTaken { get; } + return this; } - internal abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax - { - internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, diagnostics, GetAnnotations()); - internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind) - : base(kind) - { - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, GetDiagnostics(), annotations); - protected ConditionalDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) + internal XmlTextAttributeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var name = (XmlNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var equalsToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + var startQuoteToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + var textTokens = (GreenNode?)reader.ReadValue(); + if (textTokens != null) { + AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } - - public abstract ExpressionSyntax Condition { get; } - - public abstract bool ConditionValue { get; } + var endQuoteToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; } - internal sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken ifKeyword; - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; - internal readonly bool branchTaken; - internal readonly bool conditionValue; - - internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; - } - - internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; - } + base.WriteTo(writer); + writer.WriteValue(this.name); + writer.WriteValue(this.equalsToken); + writer.WriteValue(this.startQuoteToken); + writer.WriteValue(this.textTokens); + writer.WriteValue(this.endQuoteToken); + } - internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; - } - - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken IfKeyword => this.ifKeyword; - public override ExpressionSyntax Condition => this.condition; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - public override bool BranchTaken => this.branchTaken; - public override bool ConditionValue => this.conditionValue; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.ifKeyword, - 2 => this.condition, - 3 => this.endOfDirectiveToken, - _ => null, - }; + static XmlTextAttributeSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(XmlTextAttributeSyntax), r => new XmlTextAttributeSyntax(r)); + } +} - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfDirectiveTriviaSyntax(this, parent, position); +internal sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax +{ + internal readonly XmlNameSyntax name; + internal readonly SyntaxToken equalsToken; + internal readonly SyntaxToken startQuoteToken; + internal readonly CrefSyntax cref; + internal readonly SyntaxToken endQuoteToken; + + internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(cref); + this.cref = cref; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(cref); + this.cref = cref; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(cref); + this.cref = cref; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + public override XmlNameSyntax Name => this.name; + public override SyntaxToken EqualsToken => this.equalsToken; + public override SyntaxToken StartQuoteToken => this.startQuoteToken; + public CrefSyntax Cref => this.cref; + public override SyntaxToken EndQuoteToken => this.endQuoteToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.equalsToken, + 2 => this.startQuoteToken, + 3 => this.cref, + 4 => this.endQuoteToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCrefAttributeSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); + + public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + { + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken) + { + var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, GetDiagnostics(), annotations); + + internal XmlCrefAttributeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var name = (XmlNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var equalsToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + var startQuoteToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + var cref = (CrefSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(cref); + this.cref = cref; + var endQuoteToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.name); + writer.WriteValue(this.equalsToken); + writer.WriteValue(this.startQuoteToken); + writer.WriteValue(this.cref); + writer.WriteValue(this.endQuoteToken); + } - public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { - if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + static XmlCrefAttributeSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(XmlCrefAttributeSyntax), r => new XmlCrefAttributeSyntax(r)); + } +} - return this; - } +internal sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax +{ + internal readonly XmlNameSyntax name; + internal readonly SyntaxToken equalsToken; + internal readonly SyntaxToken startQuoteToken; + internal readonly IdentifierNameSyntax identifier; + internal readonly SyntaxToken endQuoteToken; + + internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + public override XmlNameSyntax Name => this.name; + public override SyntaxToken EqualsToken => this.equalsToken; + public override SyntaxToken StartQuoteToken => this.startQuoteToken; + public IdentifierNameSyntax Identifier => this.identifier; + public override SyntaxToken EndQuoteToken => this.endQuoteToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.equalsToken, + 2 => this.startQuoteToken, + 3 => this.identifier, + 4 => this.endQuoteToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameAttributeSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); + + public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + { + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken) + { + var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, GetDiagnostics(), annotations); + + internal XmlNameAttributeSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var name = (XmlNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var equalsToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + var startQuoteToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + var identifier = (IdentifierNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var endQuoteToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.name); + writer.WriteValue(this.equalsToken); + writer.WriteValue(this.startQuoteToken); + writer.WriteValue(this.identifier); + writer.WriteValue(this.endQuoteToken); + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations); + static XmlNameAttributeSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(XmlNameAttributeSyntax), r => new XmlNameAttributeSyntax(r)); + } +} - internal IfDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var ifKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - var condition = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(condition); - this.condition = condition; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - this.branchTaken = (bool)reader.ReadBoolean(); - this.conditionValue = (bool)reader.ReadBoolean(); - } +internal sealed partial class XmlTextSyntax : XmlNodeSyntax +{ + internal readonly GreenNode? textTokens; - internal override void WriteTo(ObjectWriter writer) + internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + if (textTokens != null) { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.ifKeyword); - writer.WriteValue(this.condition); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - writer.WriteBoolean(this.branchTaken); - writer.WriteBoolean(this.conditionValue); + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + } - static IfDirectiveTriviaSyntax() + internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + if (textTokens != null) { - ObjectBinder.RegisterTypeReader(typeof(IfDirectiveTriviaSyntax), r => new IfDirectiveTriviaSyntax(r)); + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } } - internal sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax + internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken elifKeyword; - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; - internal readonly bool branchTaken; - internal readonly bool conditionValue; - - internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 1; + if (textTokens != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elifKeyword); - this.elifKeyword = elifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; - } - - internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elifKeyword); - this.elifKeyword = elifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + } - internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elifKeyword); - this.elifKeyword = elifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; - } - - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken ElifKeyword => this.elifKeyword; - public override ExpressionSyntax Condition => this.condition; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - public override bool BranchTaken => this.branchTaken; - public override bool ConditionValue => this.conditionValue; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.elifKeyword, - 2 => this.condition, - 3 => this.endOfDirectiveToken, - _ => null, - }; + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElifDirectiveTriviaSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.textTokens : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextSyntax(this, parent, position); - public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { - if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); - return this; + public XmlTextSyntax Update(CoreSyntax.SyntaxList textTokens) + { + if (textTokens != this.TextTokens) + { + var newNode = SyntaxFactory.XmlText(textTokens); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlTextSyntax(this.Kind, this.textTokens, diagnostics, GetAnnotations()); - internal ElifDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var elifKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(elifKeyword); - this.elifKeyword = elifKeyword; - var condition = (ExpressionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(condition); - this.condition = condition; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - this.branchTaken = (bool)reader.ReadBoolean(); - this.conditionValue = (bool)reader.ReadBoolean(); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlTextSyntax(this.Kind, this.textTokens, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal XmlTextSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 1; + var textTokens = (GreenNode?)reader.ReadValue(); + if (textTokens != null) { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.elifKeyword); - writer.WriteValue(this.condition); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - writer.WriteBoolean(this.branchTaken); - writer.WriteBoolean(this.conditionValue); + AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + } - static ElifDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ElifDirectiveTriviaSyntax), r => new ElifDirectiveTriviaSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.textTokens); } - internal sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax + static XmlTextSyntax() { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken elseKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; - internal readonly bool branchTaken; + ObjectBinder.RegisterTypeReader(typeof(XmlTextSyntax), r => new XmlTextSyntax(r)); + } +} + +internal sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax +{ + internal readonly SyntaxToken startCDataToken; + internal readonly GreenNode? textTokens; + internal readonly SyntaxToken endCDataToken; - internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startCDataToken); + this.startCDataToken = startCDataToken; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endCDataToken); + this.endCDataToken = endCDataToken; + } - internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, SyntaxFactoryContext context) - : base(kind) + internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startCDataToken); + this.startCDataToken = startCDataToken; + if (textTokens != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endCDataToken); + this.endCDataToken = endCDataToken; + } - internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) - : base(kind) + internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startCDataToken); + this.startCDataToken = startCDataToken; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endCDataToken); + this.endCDataToken = endCDataToken; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken ElseKeyword => this.elseKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - public override bool BranchTaken => this.branchTaken; + public SyntaxToken StartCDataToken => this.startCDataToken; + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public SyntaxToken EndCDataToken => this.endCDataToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.elseKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.startCDataToken, + 1 => this.textTokens, + 2 => this.endCDataToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCDataSectionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); - public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + { + if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) { - if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, diagnostics, GetAnnotations()); - internal ElseDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var elseKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - this.branchTaken = (bool)reader.ReadBoolean(); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal XmlCDataSectionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var startCDataToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(startCDataToken); + this.startCDataToken = startCDataToken; + var textTokens = (GreenNode?)reader.ReadValue(); + if (textTokens != null) { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.elseKeyword); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - writer.WriteBoolean(this.branchTaken); + AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + var endCDataToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endCDataToken); + this.endCDataToken = endCDataToken; + } - static ElseDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ElseDirectiveTriviaSyntax), r => new ElseDirectiveTriviaSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.startCDataToken); + writer.WriteValue(this.textTokens); + writer.WriteValue(this.endCDataToken); } - internal sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax + static XmlCDataSectionSyntax() { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken endIfKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + ObjectBinder.RegisterTypeReader(typeof(XmlCDataSectionSyntax), r => new XmlCDataSectionSyntax(r)); + } +} + +internal sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax +{ + internal readonly SyntaxToken startProcessingInstructionToken; + internal readonly XmlNameSyntax name; + internal readonly GreenNode? textTokens; + internal readonly SyntaxToken endProcessingInstructionToken; - internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(startProcessingInstructionToken); + this.startProcessingInstructionToken = startProcessingInstructionToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endIfKeyword); - this.endIfKeyword = endIfKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endProcessingInstructionToken); + this.endProcessingInstructionToken = endProcessingInstructionToken; + } - internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(startProcessingInstructionToken); + this.startProcessingInstructionToken = startProcessingInstructionToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (textTokens != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endIfKeyword); - this.endIfKeyword = endIfKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endProcessingInstructionToken); + this.endProcessingInstructionToken = endProcessingInstructionToken; + } - internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(startProcessingInstructionToken); + this.startProcessingInstructionToken = startProcessingInstructionToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endIfKeyword); - this.endIfKeyword = endIfKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endProcessingInstructionToken); + this.endProcessingInstructionToken = endProcessingInstructionToken; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken EndIfKeyword => this.endIfKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public SyntaxToken StartProcessingInstructionToken => this.startProcessingInstructionToken; + public XmlNameSyntax Name => this.name; + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public SyntaxToken EndProcessingInstructionToken => this.endProcessingInstructionToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.endIfKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.startProcessingInstructionToken, + 1 => this.name, + 2 => this.textTokens, + 3 => this.endProcessingInstructionToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndIfDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlProcessingInstructionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); - public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + { + if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) { - if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, diagnostics, GetAnnotations()); - internal EndIfDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var endIfKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endIfKeyword); - this.endIfKeyword = endIfKeyword; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal XmlProcessingInstructionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var startProcessingInstructionToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(startProcessingInstructionToken); + this.startProcessingInstructionToken = startProcessingInstructionToken; + var name = (XmlNameSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var textTokens = (GreenNode?)reader.ReadValue(); + if (textTokens != null) { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.endIfKeyword); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); + AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + var endProcessingInstructionToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endProcessingInstructionToken); + this.endProcessingInstructionToken = endProcessingInstructionToken; + } - static EndIfDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(EndIfDirectiveTriviaSyntax), r => new EndIfDirectiveTriviaSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.startProcessingInstructionToken); + writer.WriteValue(this.name); + writer.WriteValue(this.textTokens); + writer.WriteValue(this.endProcessingInstructionToken); } - internal sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax + static XmlProcessingInstructionSyntax() { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken regionKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + ObjectBinder.RegisterTypeReader(typeof(XmlProcessingInstructionSyntax), r => new XmlProcessingInstructionSyntax(r)); + } +} + +internal sealed partial class XmlCommentSyntax : XmlNodeSyntax +{ + internal readonly SyntaxToken lessThanExclamationMinusMinusToken; + internal readonly GreenNode? textTokens; + internal readonly SyntaxToken minusMinusGreaterThanToken; - internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); + this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(regionKeyword); - this.regionKeyword = regionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); + this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; + } - internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); + this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; + if (textTokens != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(regionKeyword); - this.regionKeyword = regionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); + this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; + } - internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); + this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(regionKeyword); - this.regionKeyword = regionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); + this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken RegionKeyword => this.regionKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public SyntaxToken LessThanExclamationMinusMinusToken => this.lessThanExclamationMinusMinusToken; + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public SyntaxToken MinusMinusGreaterThanToken => this.minusMinusGreaterThanToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.regionKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.lessThanExclamationMinusMinusToken, + 1 => this.textTokens, + 2 => this.minusMinusGreaterThanToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RegionDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCommentSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); - public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) + { + if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) { - if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + return this; + } - internal RegionDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var regionKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(regionKeyword); - this.regionKeyword = regionKeyword; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, diagnostics, GetAnnotations()); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.regionKeyword); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, GetDiagnostics(), annotations); - static RegionDirectiveTriviaSyntax() + internal XmlCommentSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var lessThanExclamationMinusMinusToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); + this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; + var textTokens = (GreenNode?)reader.ReadValue(); + if (textTokens != null) { - ObjectBinder.RegisterTypeReader(typeof(RegionDirectiveTriviaSyntax), r => new RegionDirectiveTriviaSyntax(r)); + AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + var minusMinusGreaterThanToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(minusMinusGreaterThanToken); + this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; } - internal sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken endRegionKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; - - internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endRegionKeyword); - this.endRegionKeyword = endRegionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + base.WriteTo(writer); + writer.WriteValue(this.lessThanExclamationMinusMinusToken); + writer.WriteValue(this.textTokens); + writer.WriteValue(this.minusMinusGreaterThanToken); + } - internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endRegionKeyword); - this.endRegionKeyword = endRegionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + static XmlCommentSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(XmlCommentSyntax), r => new XmlCommentSyntax(r)); + } +} - internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endRegionKeyword); - this.endRegionKeyword = endRegionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } +internal abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax +{ + internal DirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.flags |= NodeFlags.ContainsDirectives; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken EndRegionKeyword => this.endRegionKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + internal DirectiveTriviaSyntax(SyntaxKind kind) + : base(kind) + { + this.flags |= NodeFlags.ContainsDirectives; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.endRegionKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; + protected DirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.flags |= NodeFlags.ContainsDirectives; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndRegionDirectiveTriviaSyntax(this, parent, position); + public abstract SyntaxToken HashToken { get; } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); + public abstract SyntaxToken EndOfDirectiveToken { get; } - public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public abstract bool IsActive { get; } +} - return this; - } +internal abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal BranchingDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + internal BranchingDirectiveTriviaSyntax(SyntaxKind kind) + : base(kind) + { + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + protected BranchingDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + } - internal EndRegionDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var endRegionKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endRegionKeyword); - this.endRegionKeyword = endRegionKeyword; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } + public abstract bool BranchTaken { get; } +} - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.endRegionKeyword); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - } +internal abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax +{ + internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - static EndRegionDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(EndRegionDirectiveTriviaSyntax), r => new EndRegionDirectiveTriviaSyntax(r)); - } + internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind) + : base(kind) + { } - internal sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax + protected ConditionalDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken errorKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + } - internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(errorKeyword); - this.errorKeyword = errorKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + public abstract ExpressionSyntax Condition { get; } - internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(errorKeyword); - this.errorKeyword = errorKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + public abstract bool ConditionValue { get; } +} - internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(errorKeyword); - this.errorKeyword = errorKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } +internal sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken ifKeyword; + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + internal readonly bool branchTaken; + internal readonly bool conditionValue; + + internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken IfKeyword => this.ifKeyword; + public override ExpressionSyntax Condition => this.condition; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + public override bool BranchTaken => this.branchTaken; + public override bool ConditionValue => this.conditionValue; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.ifKeyword, + 2 => this.condition, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); + + public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { + if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations); + + internal IfDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var ifKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + var condition = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(condition); + this.condition = condition; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + this.branchTaken = (bool)reader.ReadBoolean(); + this.conditionValue = (bool)reader.ReadBoolean(); + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.ifKeyword); + writer.WriteValue(this.condition); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + writer.WriteBoolean(this.branchTaken); + writer.WriteBoolean(this.conditionValue); + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken ErrorKeyword => this.errorKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + static IfDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(IfDirectiveTriviaSyntax), r => new IfDirectiveTriviaSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.errorKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; +internal sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken elifKeyword; + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + internal readonly bool branchTaken; + internal readonly bool conditionValue; + + internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elifKeyword); + this.elifKeyword = elifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elifKeyword); + this.elifKeyword = elifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elifKeyword); + this.elifKeyword = elifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken ElifKeyword => this.elifKeyword; + public override ExpressionSyntax Condition => this.condition; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + public override bool BranchTaken => this.branchTaken; + public override bool ConditionValue => this.conditionValue; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.elifKeyword, + 2 => this.condition, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElifDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); + + public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { + if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations); + + internal ElifDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var elifKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(elifKeyword); + this.elifKeyword = elifKeyword; + var condition = (ExpressionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(condition); + this.condition = condition; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + this.branchTaken = (bool)reader.ReadBoolean(); + this.conditionValue = (bool)reader.ReadBoolean(); + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.elifKeyword); + writer.WriteValue(this.condition); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + writer.WriteBoolean(this.branchTaken); + writer.WriteBoolean(this.conditionValue); + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ErrorDirectiveTriviaSyntax(this, parent, position); + static ElifDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ElifDirectiveTriviaSyntax), r => new ElifDirectiveTriviaSyntax(r)); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); +internal sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken elseKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + internal readonly bool branchTaken; + + internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + } + + internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + } - public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + } - return this; - } + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken ElseKeyword => this.elseKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + public override bool BranchTaken => this.branchTaken; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.elseKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseDirectiveTriviaSyntax(this, parent, position); - internal ErrorDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var errorKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(errorKeyword); - this.errorKeyword = errorKeyword; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); - internal override void WriteTo(ObjectWriter writer) + public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + { + if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.errorKeyword); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); + var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static ErrorDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ErrorDirectiveTriviaSyntax), r => new ErrorDirectiveTriviaSyntax(r)); - } + return this; } - internal sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken warningKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, diagnostics, GetAnnotations()); - internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, GetDiagnostics(), annotations); - internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal ElseDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var elseKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + this.branchTaken = (bool)reader.ReadBoolean(); + } - internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.elseKeyword); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + writer.WriteBoolean(this.branchTaken); + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken WarningKeyword => this.warningKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + static ElseDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ElseDirectiveTriviaSyntax), r => new ElseDirectiveTriviaSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.warningKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; +internal sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken endIfKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WarningDirectiveTriviaSyntax(this, parent, position); + internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endIfKeyword); + this.endIfKeyword = endIfKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); + internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endIfKeyword); + this.endIfKeyword = endIfKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endIfKeyword); + this.endIfKeyword = endIfKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - return this; - } + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken EndIfKeyword => this.endIfKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.endIfKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndIfDirectiveTriviaSyntax(this, parent, position); - internal WarningDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var warningKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); - internal override void WriteTo(ObjectWriter writer) + public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.warningKeyword); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); + var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static WarningDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(WarningDirectiveTriviaSyntax), r => new WarningDirectiveTriviaSyntax(r)); - } + return this; } - internal sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); - internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal EndIfDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var endIfKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endIfKeyword); + this.endIfKeyword = endIfKeyword; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.endIfKeyword); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken Identifier => this.identifier; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + static EndIfDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(EndIfDirectiveTriviaSyntax), r => new EndIfDirectiveTriviaSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.identifier, - 2 => this.endOfDirectiveToken, - _ => null, - }; +internal sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken regionKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BadDirectiveTriviaSyntax(this, parent, position); + internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(regionKeyword); + this.regionKeyword = regionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); + internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(regionKeyword); + this.regionKeyword = regionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(regionKeyword); + this.regionKeyword = regionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - return this; - } + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken RegionKeyword => this.regionKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.regionKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RegionDirectiveTriviaSyntax(this, parent, position); - internal BadDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var identifier = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); - internal override void WriteTo(ObjectWriter writer) + public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.identifier); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); + var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static BadDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(BadDirectiveTriviaSyntax), r => new BadDirectiveTriviaSyntax(r)); - } + return this; } - internal sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + + internal RegionDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken defineKeyword; - internal readonly SyntaxToken name; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + this.SlotCount = 3; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var regionKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(regionKeyword); + this.regionKeyword = regionKeyword; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(defineKeyword); - this.defineKeyword = defineKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.regionKeyword); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } - internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(defineKeyword); - this.defineKeyword = defineKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + static RegionDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(RegionDirectiveTriviaSyntax), r => new RegionDirectiveTriviaSyntax(r)); + } +} - internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(defineKeyword); - this.defineKeyword = defineKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } +internal sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken endRegionKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken DefineKeyword => this.defineKeyword; - public SyntaxToken Name => this.name; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endRegionKeyword); + this.endRegionKeyword = endRegionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.defineKeyword, - 2 => this.name, - 3 => this.endOfDirectiveToken, - _ => null, - }; + internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endRegionKeyword); + this.endRegionKeyword = endRegionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefineDirectiveTriviaSyntax(this, parent, position); + internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endRegionKeyword); + this.endRegionKeyword = endRegionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken EndRegionKeyword => this.endRegionKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + internal override GreenNode? GetSlot(int index) + => index switch { - if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.hashToken, + 1 => this.endRegionKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndRegionDirectiveTriviaSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); - internal DefineDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) + public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - this.SlotCount = 4; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var defineKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(defineKeyword); - this.defineKeyword = defineKeyword; - var name = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); + var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.defineKeyword); - writer.WriteValue(this.name); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - } + return this; + } - static DefineDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(DefineDirectiveTriviaSyntax), r => new DefineDirectiveTriviaSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + + internal EndRegionDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var endRegionKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endRegionKeyword); + this.endRegionKeyword = endRegionKeyword; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); } - internal sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken undefKeyword; - internal readonly SyntaxToken name; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.endRegionKeyword); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } - internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(undefKeyword); - this.undefKeyword = undefKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + static EndRegionDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(EndRegionDirectiveTriviaSyntax), r => new EndRegionDirectiveTriviaSyntax(r)); + } +} - internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(undefKeyword); - this.undefKeyword = undefKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } +internal sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken errorKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(undefKeyword); - this.undefKeyword = undefKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(errorKeyword); + this.errorKeyword = errorKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken UndefKeyword => this.undefKeyword; - public SyntaxToken Name => this.name; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.undefKeyword, - 2 => this.name, - 3 => this.endOfDirectiveToken, - _ => null, - }; + internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(errorKeyword); + this.errorKeyword = errorKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UndefDirectiveTriviaSyntax(this, parent, position); + internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(errorKeyword); + this.errorKeyword = errorKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken ErrorKeyword => this.errorKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + internal override GreenNode? GetSlot(int index) + => index switch { - if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + 0 => this.hashToken, + 1 => this.errorKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ErrorDirectiveTriviaSyntax(this, parent, position); - internal UndefDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var undefKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(undefKeyword); - this.undefKeyword = undefKeyword; - var name = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(name); - this.name = name; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); - internal override void WriteTo(ObjectWriter writer) + public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.undefKeyword); - writer.WriteValue(this.name); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); + var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - static UndefDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(UndefDirectiveTriviaSyntax), r => new UndefDirectiveTriviaSyntax(r)); - } + return this; } - internal abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + + internal ErrorDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) { - internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + this.SlotCount = 3; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var errorKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(errorKeyword); + this.errorKeyword = errorKeyword; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind) - : base(kind) - { - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.errorKeyword); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } - protected LineOrSpanDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - } + static ErrorDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ErrorDirectiveTriviaSyntax), r => new ErrorDirectiveTriviaSyntax(r)); + } +} - public abstract SyntaxToken LineKeyword { get; } +internal sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken warningKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - public abstract SyntaxToken? File { get; } + internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; } - internal sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax + internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken lineKeyword; - internal readonly SyntaxToken line; - internal readonly SyntaxToken? file; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(line); - this.line = line; - if (file != null) - { - this.AdjustFlagsAndWidth(file); - this.file = file; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(line); - this.line = line; - if (file != null) - { - this.AdjustFlagsAndWidth(file); - this.file = file; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(line); - this.line = line; - if (file != null) - { - this.AdjustFlagsAndWidth(file); - this.file = file; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override SyntaxToken HashToken => this.hashToken; - public override SyntaxToken LineKeyword => this.lineKeyword; - public SyntaxToken Line => this.line; - public override SyntaxToken? File => this.file; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken WarningKeyword => this.warningKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.lineKeyword, - 2 => this.line, - 3 => this.file, - 4 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.warningKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WarningDirectiveTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); - public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - internal LineDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var lineKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - var line = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(line); - this.line = line; - var file = (SyntaxToken?)reader.ReadValue(); - if (file != null) - { - AdjustFlagsAndWidth(file); - this.file = file; - } - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.lineKeyword); - writer.WriteValue(this.line); - writer.WriteValue(this.file); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - } + internal WarningDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var warningKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - static LineDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(LineDirectiveTriviaSyntax), r => new LineDirectiveTriviaSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.warningKeyword); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); } - internal sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode + static WarningDirectiveTriviaSyntax() { - internal readonly SyntaxToken openParenToken; - internal readonly SyntaxToken line; - internal readonly SyntaxToken commaToken; - internal readonly SyntaxToken character; - internal readonly SyntaxToken closeParenToken; + ObjectBinder.RegisterTypeReader(typeof(WarningDirectiveTriviaSyntax), r => new WarningDirectiveTriviaSyntax(r)); + } +} - internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(line); - this.line = line; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(character); - this.character = character; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +internal sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(line); - this.line = line; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(character); - this.character = character; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(line); - this.line = line; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(character); - this.character = character; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public SyntaxToken OpenParenToken => this.openParenToken; - public SyntaxToken Line => this.line; - public SyntaxToken CommaToken => this.commaToken; - public SyntaxToken Character => this.character; - public SyntaxToken CloseParenToken => this.closeParenToken; + internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.line, - 2 => this.commaToken, - 3 => this.character, - 4 => this.closeParenToken, - _ => null, - }; + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken Identifier => this.identifier; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectivePositionSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.identifier, + 2 => this.endOfDirectiveToken, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BadDirectiveTriviaSyntax(this, parent, position); - public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); - return this; + public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - internal LineDirectivePositionSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var openParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - var line = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(line); - this.line = line; - var commaToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - var character = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(character); - this.character = character; - var closeParenToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.openParenToken); - writer.WriteValue(this.line); - writer.WriteValue(this.commaToken); - writer.WriteValue(this.character); - writer.WriteValue(this.closeParenToken); - } + internal BadDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var identifier = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - static LineDirectivePositionSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(LineDirectivePositionSyntax), r => new LineDirectivePositionSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.identifier); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); } - internal sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax + static BadDirectiveTriviaSyntax() { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken lineKeyword; - internal readonly LineDirectivePositionSyntax start; - internal readonly SyntaxToken minusToken; - internal readonly LineDirectivePositionSyntax end; - internal readonly SyntaxToken? characterOffset; - internal readonly SyntaxToken file; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + ObjectBinder.RegisterTypeReader(typeof(BadDirectiveTriviaSyntax), r => new BadDirectiveTriviaSyntax(r)); + } +} - internal 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) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 8; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(start); - this.start = start; - this.AdjustFlagsAndWidth(minusToken); - this.minusToken = minusToken; - this.AdjustFlagsAndWidth(end); - this.end = end; - if (characterOffset != null) - { - this.AdjustFlagsAndWidth(characterOffset); - this.characterOffset = characterOffset; - } - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 8; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(start); - this.start = start; - this.AdjustFlagsAndWidth(minusToken); - this.minusToken = minusToken; - this.AdjustFlagsAndWidth(end); - this.end = end; - if (characterOffset != null) - { - this.AdjustFlagsAndWidth(characterOffset); - this.characterOffset = characterOffset; - } - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 8; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(start); - this.start = start; - this.AdjustFlagsAndWidth(minusToken); - this.minusToken = minusToken; - this.AdjustFlagsAndWidth(end); - this.end = end; - if (characterOffset != null) - { - this.AdjustFlagsAndWidth(characterOffset); - this.characterOffset = characterOffset; - } - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - public override SyntaxToken HashToken => this.hashToken; - public override SyntaxToken LineKeyword => this.lineKeyword; - public LineDirectivePositionSyntax Start => this.start; - public SyntaxToken MinusToken => this.minusToken; - public LineDirectivePositionSyntax End => this.end; - public SyntaxToken? CharacterOffset => this.characterOffset; - public override SyntaxToken File => this.file; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.lineKeyword, - 2 => this.start, - 3 => this.minusToken, - 4 => this.end, - 5 => this.characterOffset, - 6 => this.file, - 7 => this.endOfDirectiveToken, - _ => null, - }; +internal sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken defineKeyword; + internal readonly SyntaxToken name; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(defineKeyword); + this.defineKeyword = defineKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(defineKeyword); + this.defineKeyword = defineKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(defineKeyword); + this.defineKeyword = defineKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken DefineKeyword => this.defineKeyword; + public SyntaxToken Name => this.name; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.defineKeyword, + 2 => this.name, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefineDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); + + public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + + internal DefineDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var defineKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(defineKeyword); + this.defineKeyword = defineKeyword; + var name = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineSpanDirectiveTriviaSyntax(this, parent, position); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.defineKeyword); + writer.WriteValue(this.name); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); + static DefineDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(DefineDirectiveTriviaSyntax), r => new DefineDirectiveTriviaSyntax(r)); + } +} - public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +internal sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken undefKeyword; + internal readonly SyntaxToken name; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(undefKeyword); + this.undefKeyword = undefKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(undefKeyword); + this.undefKeyword = undefKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(undefKeyword); + this.undefKeyword = undefKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken UndefKeyword => this.undefKeyword; + public SyntaxToken Name => this.name; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.undefKeyword, + 2 => this.name, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UndefDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); + + public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + + internal UndefDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var undefKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(undefKeyword); + this.undefKeyword = undefKeyword; + var name = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(name); + this.name = name; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); - - internal LineSpanDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 8; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var lineKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - var start = (LineDirectivePositionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(start); - this.start = start; - var minusToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(minusToken); - this.minusToken = minusToken; - var end = (LineDirectivePositionSyntax)reader.ReadValue(); - AdjustFlagsAndWidth(end); - this.end = end; - var characterOffset = (SyntaxToken?)reader.ReadValue(); - if (characterOffset != null) - { - AdjustFlagsAndWidth(characterOffset); - this.characterOffset = characterOffset; - } - var file = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(file); - this.file = file; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.undefKeyword); + writer.WriteValue(this.name); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.lineKeyword); - writer.WriteValue(this.start); - writer.WriteValue(this.minusToken); - writer.WriteValue(this.end); - writer.WriteValue(this.characterOffset); - writer.WriteValue(this.file); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - } + static UndefDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(UndefDirectiveTriviaSyntax), r => new UndefDirectiveTriviaSyntax(r)); + } +} - static LineSpanDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(LineSpanDirectiveTriviaSyntax), r => new LineSpanDirectiveTriviaSyntax(r)); - } +internal abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - internal sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken pragmaKeyword; - internal readonly SyntaxToken warningKeyword; - internal readonly SyntaxToken disableOrRestoreKeyword; - internal readonly GreenNode? errorCodes; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; - - internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 6; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(disableOrRestoreKeyword); - this.disableOrRestoreKeyword = disableOrRestoreKeyword; - if (errorCodes != null) - { - this.AdjustFlagsAndWidth(errorCodes); - this.errorCodes = errorCodes; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 6; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(disableOrRestoreKeyword); - this.disableOrRestoreKeyword = disableOrRestoreKeyword; - if (errorCodes != null) - { - this.AdjustFlagsAndWidth(errorCodes); - this.errorCodes = errorCodes; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 6; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(disableOrRestoreKeyword); - this.disableOrRestoreKeyword = disableOrRestoreKeyword; - if (errorCodes != null) - { - this.AdjustFlagsAndWidth(errorCodes); - this.errorCodes = errorCodes; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken PragmaKeyword => this.pragmaKeyword; - public SyntaxToken WarningKeyword => this.warningKeyword; - public SyntaxToken DisableOrRestoreKeyword => this.disableOrRestoreKeyword; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList ErrorCodes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.errorCodes)); - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.pragmaKeyword, - 2 => this.warningKeyword, - 3 => this.disableOrRestoreKeyword, - 4 => this.errorCodes, - 5 => this.endOfDirectiveToken, - _ => null, - }; + protected LineOrSpanDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaWarningDirectiveTriviaSyntax(this, parent, position); + public abstract SyntaxToken LineKeyword { get; } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); + public abstract SyntaxToken? File { get; } +} - public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) +internal sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken lineKeyword; + internal readonly SyntaxToken line; + internal readonly SyntaxToken? file; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(line); + this.line = line; + if (file != null) { - if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); - - internal PragmaWarningDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 6; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var pragmaKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - var warningKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - var disableOrRestoreKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(disableOrRestoreKeyword); - this.disableOrRestoreKeyword = disableOrRestoreKeyword; - var errorCodes = (GreenNode?)reader.ReadValue(); - if (errorCodes != null) - { - AdjustFlagsAndWidth(errorCodes); - this.errorCodes = errorCodes; - } - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); + this.AdjustFlagsAndWidth(file); + this.file = file; } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal override void WriteTo(ObjectWriter writer) + internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(line); + this.line = line; + if (file != null) { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.pragmaKeyword); - writer.WriteValue(this.warningKeyword); - writer.WriteValue(this.disableOrRestoreKeyword); - writer.WriteValue(this.errorCodes); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); + this.AdjustFlagsAndWidth(file); + this.file = file; } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - static PragmaWarningDirectiveTriviaSyntax() + internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(line); + this.line = line; + if (file != null) { - ObjectBinder.RegisterTypeReader(typeof(PragmaWarningDirectiveTriviaSyntax), r => new PragmaWarningDirectiveTriviaSyntax(r)); + this.AdjustFlagsAndWidth(file); + this.file = file; } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; } - internal sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken pragmaKeyword; - internal readonly SyntaxToken checksumKeyword; - internal readonly SyntaxToken file; - internal readonly SyntaxToken guid; - internal readonly SyntaxToken bytes; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + public override SyntaxToken HashToken => this.hashToken; + public override SyntaxToken LineKeyword => this.lineKeyword; + public SyntaxToken Line => this.line; + public override SyntaxToken? File => this.file; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 7; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(checksumKeyword); - this.checksumKeyword = checksumKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(guid); - this.guid = guid; - this.AdjustFlagsAndWidth(bytes); - this.bytes = bytes; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 7; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(checksumKeyword); - this.checksumKeyword = checksumKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(guid); - this.guid = guid; - this.AdjustFlagsAndWidth(bytes); - this.bytes = bytes; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 7; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(checksumKeyword); - this.checksumKeyword = checksumKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(guid); - this.guid = guid; - this.AdjustFlagsAndWidth(bytes); - this.bytes = bytes; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken PragmaKeyword => this.pragmaKeyword; - public SyntaxToken ChecksumKeyword => this.checksumKeyword; - public SyntaxToken File => this.file; - public SyntaxToken Guid => this.guid; - public SyntaxToken Bytes => this.bytes; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.pragmaKeyword, - 2 => this.checksumKeyword, - 3 => this.file, - 4 => this.guid, - 5 => this.bytes, - 6 => this.endOfDirectiveToken, - _ => null, - }; + 0 => this.hashToken, + 1 => this.lineKeyword, + 2 => this.line, + 3 => this.file, + 4 => this.endOfDirectiveToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaChecksumDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectiveTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); - public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); - internal PragmaChecksumDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) + internal LineDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var lineKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + var line = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(line); + this.line = line; + var file = (SyntaxToken?)reader.ReadValue(); + if (file != null) { - this.SlotCount = 7; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var pragmaKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - var checksumKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(checksumKeyword); - this.checksumKeyword = checksumKeyword; - var file = (SyntaxToken)reader.ReadValue(); AdjustFlagsAndWidth(file); this.file = file; - var guid = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(guid); - this.guid = guid; - var bytes = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(bytes); - this.bytes = bytes; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } - - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.pragmaKeyword); - writer.WriteValue(this.checksumKeyword); - writer.WriteValue(this.file); - writer.WriteValue(this.guid); - writer.WriteValue(this.bytes); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); } + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - static PragmaChecksumDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(PragmaChecksumDirectiveTriviaSyntax), r => new PragmaChecksumDirectiveTriviaSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.lineKeyword); + writer.WriteValue(this.line); + writer.WriteValue(this.file); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); } - internal sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax + static LineDirectiveTriviaSyntax() { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken referenceKeyword; - internal readonly SyntaxToken file; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + ObjectBinder.RegisterTypeReader(typeof(LineDirectiveTriviaSyntax), r => new LineDirectiveTriviaSyntax(r)); + } +} - internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(referenceKeyword); - this.referenceKeyword = referenceKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } +internal sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openParenToken; + internal readonly SyntaxToken line; + internal readonly SyntaxToken commaToken; + internal readonly SyntaxToken character; + internal readonly SyntaxToken closeParenToken; + + internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(line); + this.line = line; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(character); + this.character = character; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(line); + this.line = line; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(character); + this.character = character; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(line); + this.line = line; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(character); + this.character = character; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + public SyntaxToken OpenParenToken => this.openParenToken; + public SyntaxToken Line => this.line; + public SyntaxToken CommaToken => this.commaToken; + public SyntaxToken Character => this.character; + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.line, + 2 => this.commaToken, + 3 => this.character, + 4 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectivePositionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); + + public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, GetDiagnostics(), annotations); + + internal LineDirectivePositionSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var openParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + var line = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(line); + this.line = line; + var commaToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + var character = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(character); + this.character = character; + var closeParenToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(referenceKeyword); - this.referenceKeyword = referenceKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.openParenToken); + writer.WriteValue(this.line); + writer.WriteValue(this.commaToken); + writer.WriteValue(this.character); + writer.WriteValue(this.closeParenToken); + } - internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(referenceKeyword); - this.referenceKeyword = referenceKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + static LineDirectivePositionSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(LineDirectivePositionSyntax), r => new LineDirectivePositionSyntax(r)); + } +} - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken ReferenceKeyword => this.referenceKeyword; - public SyntaxToken File => this.file; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; +internal sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken lineKeyword; + internal readonly LineDirectivePositionSyntax start; + internal readonly SyntaxToken minusToken; + internal readonly LineDirectivePositionSyntax end; + internal readonly SyntaxToken? characterOffset; + internal readonly SyntaxToken file; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(start); + this.start = start; + this.AdjustFlagsAndWidth(minusToken); + this.minusToken = minusToken; + this.AdjustFlagsAndWidth(end); + this.end = end; + if (characterOffset != null) + { + this.AdjustFlagsAndWidth(characterOffset); + this.characterOffset = characterOffset; + } + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 8; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(start); + this.start = start; + this.AdjustFlagsAndWidth(minusToken); + this.minusToken = minusToken; + this.AdjustFlagsAndWidth(end); + this.end = end; + if (characterOffset != null) + { + this.AdjustFlagsAndWidth(characterOffset); + this.characterOffset = characterOffset; + } + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 8; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(start); + this.start = start; + this.AdjustFlagsAndWidth(minusToken); + this.minusToken = minusToken; + this.AdjustFlagsAndWidth(end); + this.end = end; + if (characterOffset != null) + { + this.AdjustFlagsAndWidth(characterOffset); + this.characterOffset = characterOffset; + } + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public override SyntaxToken LineKeyword => this.lineKeyword; + public LineDirectivePositionSyntax Start => this.start; + public SyntaxToken MinusToken => this.minusToken; + public LineDirectivePositionSyntax End => this.end; + public SyntaxToken? CharacterOffset => this.characterOffset; + public override SyntaxToken File => this.file; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.lineKeyword, + 2 => this.start, + 3 => this.minusToken, + 4 => this.end, + 5 => this.characterOffset, + 6 => this.file, + 7 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineSpanDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); + + public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + + internal LineSpanDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 8; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var lineKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + var start = (LineDirectivePositionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(start); + this.start = start; + var minusToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(minusToken); + this.minusToken = minusToken; + var end = (LineDirectivePositionSyntax)reader.ReadValue(); + AdjustFlagsAndWidth(end); + this.end = end; + var characterOffset = (SyntaxToken?)reader.ReadValue(); + if (characterOffset != null) + { + AdjustFlagsAndWidth(characterOffset); + this.characterOffset = characterOffset; + } + var file = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(file); + this.file = file; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.lineKeyword); + writer.WriteValue(this.start); + writer.WriteValue(this.minusToken); + writer.WriteValue(this.end); + writer.WriteValue(this.characterOffset); + writer.WriteValue(this.file); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } + + static LineSpanDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(LineSpanDirectiveTriviaSyntax), r => new LineSpanDirectiveTriviaSyntax(r)); + } +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.referenceKeyword, - 2 => this.file, - 3 => this.endOfDirectiveToken, - _ => null, - }; +internal sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken pragmaKeyword; + internal readonly SyntaxToken warningKeyword; + internal readonly SyntaxToken disableOrRestoreKeyword; + internal readonly GreenNode? errorCodes; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(disableOrRestoreKeyword); + this.disableOrRestoreKeyword = disableOrRestoreKeyword; + if (errorCodes != null) + { + this.AdjustFlagsAndWidth(errorCodes); + this.errorCodes = errorCodes; + } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(disableOrRestoreKeyword); + this.disableOrRestoreKeyword = disableOrRestoreKeyword; + if (errorCodes != null) + { + this.AdjustFlagsAndWidth(errorCodes); + this.errorCodes = errorCodes; + } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 6; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(disableOrRestoreKeyword); + this.disableOrRestoreKeyword = disableOrRestoreKeyword; + if (errorCodes != null) + { + this.AdjustFlagsAndWidth(errorCodes); + this.errorCodes = errorCodes; + } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken PragmaKeyword => this.pragmaKeyword; + public SyntaxToken WarningKeyword => this.warningKeyword; + public SyntaxToken DisableOrRestoreKeyword => this.disableOrRestoreKeyword; + public CoreSyntax.SeparatedSyntaxList ErrorCodes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.errorCodes)); + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.pragmaKeyword, + 2 => this.warningKeyword, + 3 => this.disableOrRestoreKeyword, + 4 => this.errorCodes, + 5 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaWarningDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); + + public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReferenceDirectiveTriviaSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); - public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + internal PragmaWarningDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 6; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var pragmaKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + var warningKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + var disableOrRestoreKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(disableOrRestoreKeyword); + this.disableOrRestoreKeyword = disableOrRestoreKeyword; + var errorCodes = (GreenNode?)reader.ReadValue(); + if (errorCodes != null) { - if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + AdjustFlagsAndWidth(errorCodes); + this.errorCodes = errorCodes; } + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.pragmaKeyword); + writer.WriteValue(this.warningKeyword); + writer.WriteValue(this.disableOrRestoreKeyword); + writer.WriteValue(this.errorCodes); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + static PragmaWarningDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(PragmaWarningDirectiveTriviaSyntax), r => new PragmaWarningDirectiveTriviaSyntax(r)); + } +} - internal ReferenceDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 4; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var referenceKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(referenceKeyword); - this.referenceKeyword = referenceKeyword; - var file = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(file); - this.file = file; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } +internal sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken pragmaKeyword; + internal readonly SyntaxToken checksumKeyword; + internal readonly SyntaxToken file; + internal readonly SyntaxToken guid; + internal readonly SyntaxToken bytes; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 7; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(checksumKeyword); + this.checksumKeyword = checksumKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(guid); + this.guid = guid; + this.AdjustFlagsAndWidth(bytes); + this.bytes = bytes; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 7; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(checksumKeyword); + this.checksumKeyword = checksumKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(guid); + this.guid = guid; + this.AdjustFlagsAndWidth(bytes); + this.bytes = bytes; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 7; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(checksumKeyword); + this.checksumKeyword = checksumKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(guid); + this.guid = guid; + this.AdjustFlagsAndWidth(bytes); + this.bytes = bytes; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken PragmaKeyword => this.pragmaKeyword; + public SyntaxToken ChecksumKeyword => this.checksumKeyword; + public SyntaxToken File => this.file; + public SyntaxToken Guid => this.guid; + public SyntaxToken Bytes => this.bytes; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.pragmaKeyword, + 2 => this.checksumKeyword, + 3 => this.file, + 4 => this.guid, + 5 => this.bytes, + 6 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaChecksumDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); + + public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + + internal PragmaChecksumDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 7; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var pragmaKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + var checksumKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(checksumKeyword); + this.checksumKeyword = checksumKeyword; + var file = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(file); + this.file = file; + var guid = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(guid); + this.guid = guid; + var bytes = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(bytes); + this.bytes = bytes; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } + + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.pragmaKeyword); + writer.WriteValue(this.checksumKeyword); + writer.WriteValue(this.file); + writer.WriteValue(this.guid); + writer.WriteValue(this.bytes); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } + + static PragmaChecksumDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(PragmaChecksumDirectiveTriviaSyntax), r => new PragmaChecksumDirectiveTriviaSyntax(r)); + } +} - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.referenceKeyword); - writer.WriteValue(this.file); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - } +internal sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken referenceKeyword; + internal readonly SyntaxToken file; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(referenceKeyword); + this.referenceKeyword = referenceKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(referenceKeyword); + this.referenceKeyword = referenceKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(referenceKeyword); + this.referenceKeyword = referenceKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken ReferenceKeyword => this.referenceKeyword; + public SyntaxToken File => this.file; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.referenceKeyword, + 2 => this.file, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReferenceDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); + + public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + + internal ReferenceDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var referenceKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(referenceKeyword); + this.referenceKeyword = referenceKeyword; + var file = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(file); + this.file = file; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - static ReferenceDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ReferenceDirectiveTriviaSyntax), r => new ReferenceDirectiveTriviaSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.referenceKeyword); + writer.WriteValue(this.file); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); } - internal sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax + static ReferenceDirectiveTriviaSyntax() { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken loadKeyword; - internal readonly SyntaxToken file; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + ObjectBinder.RegisterTypeReader(typeof(ReferenceDirectiveTriviaSyntax), r => new ReferenceDirectiveTriviaSyntax(r)); + } +} - internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(loadKeyword); - this.loadKeyword = loadKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } +internal sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken loadKeyword; + internal readonly SyntaxToken file; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(loadKeyword); + this.loadKeyword = loadKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(loadKeyword); + this.loadKeyword = loadKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(loadKeyword); + this.loadKeyword = loadKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken LoadKeyword => this.loadKeyword; + public SyntaxToken File => this.file; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.loadKeyword, + 2 => this.file, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LoadDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); + + public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + + internal LoadDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 4; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var loadKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(loadKeyword); + this.loadKeyword = loadKeyword; + var file = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(file); + this.file = file; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(loadKeyword); - this.loadKeyword = loadKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.loadKeyword); + writer.WriteValue(this.file); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } - internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(loadKeyword); - this.loadKeyword = loadKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + static LoadDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(LoadDirectiveTriviaSyntax), r => new LoadDirectiveTriviaSyntax(r)); + } +} + +internal sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken exclamationToken; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken LoadKeyword => this.loadKeyword; - public SyntaxToken File => this.file; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(exclamationToken); + this.exclamationToken = exclamationToken; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.loadKeyword, - 2 => this.file, - 3 => this.endOfDirectiveToken, - _ => null, - }; + internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(exclamationToken); + this.exclamationToken = exclamationToken; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LoadDirectiveTriviaSyntax(this, parent, position); + internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(exclamationToken); + this.exclamationToken = exclamationToken; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken ExclamationToken => this.exclamationToken; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + internal override GreenNode? GetSlot(int index) + => index switch { - if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.hashToken, + 1 => this.exclamationToken, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ShebangDirectiveTriviaSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); - internal LoadDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) + public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken) { - this.SlotCount = 4; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var loadKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(loadKeyword); - this.loadKeyword = loadKeyword; - var file = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(file); - this.file = file; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); + var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.loadKeyword); - writer.WriteValue(this.file); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - } + return this; + } - static LoadDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(LoadDirectiveTriviaSyntax), r => new LoadDirectiveTriviaSyntax(r)); - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + + internal ShebangDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 3; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var exclamationToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(exclamationToken); + this.exclamationToken = exclamationToken; + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); } - internal sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal override void WriteTo(ObjectWriter writer) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken exclamationToken; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.exclamationToken); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); + } - internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(exclamationToken); - this.exclamationToken = exclamationToken; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + static ShebangDirectiveTriviaSyntax() + { + ObjectBinder.RegisterTypeReader(typeof(ShebangDirectiveTriviaSyntax), r => new ShebangDirectiveTriviaSyntax(r)); + } +} + +internal sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken nullableKeyword; + internal readonly SyntaxToken settingToken; + internal readonly SyntaxToken? targetToken; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(nullableKeyword); + this.nullableKeyword = nullableKeyword; + this.AdjustFlagsAndWidth(settingToken); + this.settingToken = settingToken; + if (targetToken != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(exclamationToken); - this.exclamationToken = exclamationToken; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(targetToken); + this.targetToken = targetToken; } - - internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(nullableKeyword); + this.nullableKeyword = nullableKeyword; + this.AdjustFlagsAndWidth(settingToken); + this.settingToken = settingToken; + if (targetToken != null) + { + this.AdjustFlagsAndWidth(targetToken); + this.targetToken = targetToken; + } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(nullableKeyword); + this.nullableKeyword = nullableKeyword; + this.AdjustFlagsAndWidth(settingToken); + this.settingToken = settingToken; + if (targetToken != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(exclamationToken); - this.exclamationToken = exclamationToken; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(targetToken); + this.targetToken = targetToken; } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken ExclamationToken => this.exclamationToken; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken NullableKeyword => this.nullableKeyword; + public SyntaxToken SettingToken => this.settingToken; + public SyntaxToken? TargetToken => this.targetToken; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.exclamationToken, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.nullableKeyword, + 2 => this.settingToken, + 3 => this.targetToken, + 4 => this.endOfDirectiveToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ShebangDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableDirectiveTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); - public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + return this; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - internal ShebangDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 3; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var exclamationToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(exclamationToken); - this.exclamationToken = exclamationToken; - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); - internal override void WriteTo(ObjectWriter writer) + internal NullableDirectiveTriviaSyntax(ObjectReader reader) + : base(reader) + { + this.SlotCount = 5; + var hashToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + var nullableKeyword = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(nullableKeyword); + this.nullableKeyword = nullableKeyword; + var settingToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(settingToken); + this.settingToken = settingToken; + var targetToken = (SyntaxToken?)reader.ReadValue(); + if (targetToken != null) { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.exclamationToken); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); + AdjustFlagsAndWidth(targetToken); + this.targetToken = targetToken; } + var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); + AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = (bool)reader.ReadBoolean(); + } - static ShebangDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(ShebangDirectiveTriviaSyntax), r => new ShebangDirectiveTriviaSyntax(r)); - } + internal override void WriteTo(ObjectWriter writer) + { + base.WriteTo(writer); + writer.WriteValue(this.hashToken); + writer.WriteValue(this.nullableKeyword); + writer.WriteValue(this.settingToken); + writer.WriteValue(this.targetToken); + writer.WriteValue(this.endOfDirectiveToken); + writer.WriteBoolean(this.isActive); } - internal sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax + static NullableDirectiveTriviaSyntax() { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken nullableKeyword; - internal readonly SyntaxToken settingToken; - internal readonly SyntaxToken? targetToken; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + ObjectBinder.RegisterTypeReader(typeof(NullableDirectiveTriviaSyntax), r => new NullableDirectiveTriviaSyntax(r)); + } +} - internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(nullableKeyword); - this.nullableKeyword = nullableKeyword; - this.AdjustFlagsAndWidth(settingToken); - this.settingToken = settingToken; - if (targetToken != null) - { - this.AdjustFlagsAndWidth(targetToken); - this.targetToken = targetToken; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(nullableKeyword); - this.nullableKeyword = nullableKeyword; - this.AdjustFlagsAndWidth(settingToken); - this.settingToken = settingToken; - if (targetToken != null) - { - this.AdjustFlagsAndWidth(targetToken); - this.targetToken = targetToken; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(nullableKeyword); - this.nullableKeyword = nullableKeyword; - this.AdjustFlagsAndWidth(settingToken); - this.settingToken = settingToken; - if (targetToken != null) - { - this.AdjustFlagsAndWidth(targetToken); - this.targetToken = targetToken; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } +internal partial class CSharpSyntaxVisitor +{ + public virtual TResult VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBlock(BlockSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); +} - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken NullableKeyword => this.nullableKeyword; - public SyntaxToken SettingToken => this.settingToken; - public SyntaxToken? TargetToken => this.targetToken; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; +internal partial class CSharpSyntaxVisitor +{ + public virtual void VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); + public virtual void VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); + public virtual void VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); + public virtual void VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); + public virtual void VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); + public virtual void VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); + public virtual void VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); + public virtual void VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); + public virtual void VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); + public virtual void VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); + public virtual void VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); + public virtual void VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); + public virtual void VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); + public virtual void VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); + public virtual void VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); + public virtual void VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); + public virtual void VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); + public virtual void VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); + public virtual void VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); + public virtual void VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); + public virtual void VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitBlock(BlockSyntax node) => this.DefaultVisit(node); + public virtual void VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); + public virtual void VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); + public virtual void VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); + public virtual void VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); + public virtual void VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); + public virtual void VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual void VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual void VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual void VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); + public virtual void VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); + public virtual void VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); + public virtual void VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); + public virtual void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); + public virtual void VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); + public virtual void VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); + public virtual void VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); + public virtual void VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); + public virtual void VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); + public virtual void VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); + public virtual void VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); + public virtual void VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); + public virtual void VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); + public virtual void VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); + public virtual void VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); + public virtual void VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); + public virtual void VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); + public virtual void VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); + public virtual void VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); + public virtual void VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); + public virtual void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.nullableKeyword, - 2 => this.settingToken, - 3 => this.targetToken, - 4 => this.endOfDirectiveToken, - _ => null, - }; +internal partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor +{ + public override CSharpSyntaxNode VisitIdentifierName(IdentifierNameSyntax node) + => node.Update((SyntaxToken)Visit(node.Identifier)); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableDirectiveTriviaSyntax(this, parent, position); + public override CSharpSyntaxNode VisitQualifiedName(QualifiedNameSyntax node) + => node.Update((NameSyntax)Visit(node.Left), (SyntaxToken)Visit(node.DotToken), (SimpleNameSyntax)Visit(node.Right)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); + public override CSharpSyntaxNode VisitGenericName(GenericNameSyntax node) + => node.Update((SyntaxToken)Visit(node.Identifier), (TypeArgumentListSyntax)Visit(node.TypeArgumentList)); - public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override CSharpSyntaxNode VisitTypeArgumentList(TypeArgumentListSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.GreaterThanToken)); - return this; - } + public override CSharpSyntaxNode VisitAliasQualifiedName(AliasQualifiedNameSyntax node) + => node.Update((IdentifierNameSyntax)Visit(node.Alias), (SyntaxToken)Visit(node.ColonColonToken), (SimpleNameSyntax)Visit(node.Name)); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + public override CSharpSyntaxNode VisitPredefinedType(PredefinedTypeSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword)); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + public override CSharpSyntaxNode VisitArrayType(ArrayTypeSyntax node) + => node.Update((TypeSyntax)Visit(node.ElementType), VisitList(node.RankSpecifiers)); - internal NullableDirectiveTriviaSyntax(ObjectReader reader) - : base(reader) - { - this.SlotCount = 5; - var hashToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - var nullableKeyword = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(nullableKeyword); - this.nullableKeyword = nullableKeyword; - var settingToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(settingToken); - this.settingToken = settingToken; - var targetToken = (SyntaxToken?)reader.ReadValue(); - if (targetToken != null) - { - AdjustFlagsAndWidth(targetToken); - this.targetToken = targetToken; - } - var endOfDirectiveToken = (SyntaxToken)reader.ReadValue(); - AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = (bool)reader.ReadBoolean(); - } - - internal override void WriteTo(ObjectWriter writer) - { - base.WriteTo(writer); - writer.WriteValue(this.hashToken); - writer.WriteValue(this.nullableKeyword); - writer.WriteValue(this.settingToken); - writer.WriteValue(this.targetToken); - writer.WriteValue(this.endOfDirectiveToken); - writer.WriteBoolean(this.isActive); - } - - static NullableDirectiveTriviaSyntax() - { - ObjectBinder.RegisterTypeReader(typeof(NullableDirectiveTriviaSyntax), r => new NullableDirectiveTriviaSyntax(r)); - } - } - - internal partial class CSharpSyntaxVisitor - { - public virtual TResult VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBlock(BlockSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); - } - - internal partial class CSharpSyntaxVisitor - { - public virtual void VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); - public virtual void VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); - public virtual void VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); - public virtual void VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); - public virtual void VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); - public virtual void VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); - public virtual void VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); - public virtual void VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); - public virtual void VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); - public virtual void VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); - public virtual void VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); - public virtual void VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); - public virtual void VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); - public virtual void VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); - public virtual void VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); - public virtual void VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); - public virtual void VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); - public virtual void VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); - public virtual void VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); - public virtual void VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); - public virtual void VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitBlock(BlockSyntax node) => this.DefaultVisit(node); - public virtual void VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); - public virtual void VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); - public virtual void VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); - public virtual void VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); - public virtual void VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); - public virtual void VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual void VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual void VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual void VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); - public virtual void VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); - public virtual void VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); - public virtual void VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); - public virtual void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); - public virtual void VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); - public virtual void VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); - public virtual void VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); - public virtual void VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); - public virtual void VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); - public virtual void VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); - public virtual void VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); - public virtual void VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); - public virtual void VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); - public virtual void VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); - public virtual void VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); - public virtual void VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); - public virtual void VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); - public virtual void VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); - public virtual void VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); - public virtual void VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); - public virtual void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); - } - - internal partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor - { - public override CSharpSyntaxNode VisitIdentifierName(IdentifierNameSyntax node) - => node.Update((SyntaxToken)Visit(node.Identifier)); - - public override CSharpSyntaxNode VisitQualifiedName(QualifiedNameSyntax node) - => node.Update((NameSyntax)Visit(node.Left), (SyntaxToken)Visit(node.DotToken), (SimpleNameSyntax)Visit(node.Right)); - - public override CSharpSyntaxNode VisitGenericName(GenericNameSyntax node) - => node.Update((SyntaxToken)Visit(node.Identifier), (TypeArgumentListSyntax)Visit(node.TypeArgumentList)); - - public override CSharpSyntaxNode VisitTypeArgumentList(TypeArgumentListSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.GreaterThanToken)); - - public override CSharpSyntaxNode VisitAliasQualifiedName(AliasQualifiedNameSyntax node) - => node.Update((IdentifierNameSyntax)Visit(node.Alias), (SyntaxToken)Visit(node.ColonColonToken), (SimpleNameSyntax)Visit(node.Name)); - - public override CSharpSyntaxNode VisitPredefinedType(PredefinedTypeSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword)); - - public override CSharpSyntaxNode VisitArrayType(ArrayTypeSyntax node) - => node.Update((TypeSyntax)Visit(node.ElementType), VisitList(node.RankSpecifiers)); - - public override CSharpSyntaxNode VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Sizes), (SyntaxToken)Visit(node.CloseBracketToken)); - - public override CSharpSyntaxNode VisitPointerType(PointerTypeSyntax node) - => node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.AsteriskToken)); - - public override CSharpSyntaxNode VisitFunctionPointerType(FunctionPointerTypeSyntax node) - => node.Update((SyntaxToken)Visit(node.DelegateKeyword), (SyntaxToken)Visit(node.AsteriskToken), (FunctionPointerCallingConventionSyntax)Visit(node.CallingConvention), (FunctionPointerParameterListSyntax)Visit(node.ParameterList)); - - public override CSharpSyntaxNode VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken)); - - public override CSharpSyntaxNode VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) - => node.Update((SyntaxToken)Visit(node.ManagedOrUnmanagedKeyword), (FunctionPointerUnmanagedCallingConventionListSyntax)Visit(node.UnmanagedCallingConventionList)); - - public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.CallingConventions), (SyntaxToken)Visit(node.CloseBracketToken)); - - public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) - => node.Update((SyntaxToken)Visit(node.Name)); + public override CSharpSyntaxNode VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Sizes), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitNullableType(NullableTypeSyntax node) - => node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.QuestionToken)); + public override CSharpSyntaxNode VisitPointerType(PointerTypeSyntax node) + => node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.AsteriskToken)); - public override CSharpSyntaxNode VisitTupleType(TupleTypeSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Elements), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitFunctionPointerType(FunctionPointerTypeSyntax node) + => node.Update((SyntaxToken)Visit(node.DelegateKeyword), (SyntaxToken)Visit(node.AsteriskToken), (FunctionPointerCallingConventionSyntax)Visit(node.CallingConvention), (FunctionPointerParameterListSyntax)Visit(node.ParameterList)); - public override CSharpSyntaxNode VisitTupleElement(TupleElementSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier)); + public override CSharpSyntaxNode VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken)); - public override CSharpSyntaxNode VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) - => node.Update((SyntaxToken)Visit(node.OmittedTypeArgumentToken)); + public override CSharpSyntaxNode VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) + => node.Update((SyntaxToken)Visit(node.ManagedOrUnmanagedKeyword), (FunctionPointerUnmanagedCallingConventionListSyntax)Visit(node.UnmanagedCallingConventionList)); - public override CSharpSyntaxNode VisitRefType(RefTypeSyntax node) - => node.Update((SyntaxToken)Visit(node.RefKeyword), (SyntaxToken)Visit(node.ReadOnlyKeyword), (TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.CallingConventions), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitScopedType(ScopedTypeSyntax node) - => node.Update((SyntaxToken)Visit(node.ScopedKeyword), (TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) + => node.Update((SyntaxToken)Visit(node.Name)); - public override CSharpSyntaxNode VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitNullableType(NullableTypeSyntax node) + => node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.QuestionToken)); - public override CSharpSyntaxNode VisitTupleExpression(TupleExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitTupleType(TupleTypeSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Elements), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Operand)); + public override CSharpSyntaxNode VisitTupleElement(TupleElementSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier)); - public override CSharpSyntaxNode VisitAwaitExpression(AwaitExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.AwaitKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) + => node.Update((SyntaxToken)Visit(node.OmittedTypeArgumentToken)); - public override CSharpSyntaxNode VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Operand), (SyntaxToken)Visit(node.OperatorToken)); + public override CSharpSyntaxNode VisitRefType(RefTypeSyntax node) + => node.Update((SyntaxToken)Visit(node.RefKeyword), (SyntaxToken)Visit(node.ReadOnlyKeyword), (TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name)); + public override CSharpSyntaxNode VisitScopedType(ScopedTypeSyntax node) + => node.Update((SyntaxToken)Visit(node.ScopedKeyword), (TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.WhenNotNull)); + public override CSharpSyntaxNode VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitMemberBindingExpression(MemberBindingExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name)); + public override CSharpSyntaxNode VisitTupleExpression(TupleExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitElementBindingExpression(ElementBindingExpressionSyntax node) - => node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Operand)); - public override CSharpSyntaxNode VisitRangeExpression(RangeExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.LeftOperand), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.RightOperand)); + public override CSharpSyntaxNode VisitAwaitExpression(AwaitExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.AwaitKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitImplicitElementAccess(ImplicitElementAccessSyntax node) - => node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Operand), (SyntaxToken)Visit(node.OperatorToken)); - public override CSharpSyntaxNode VisitBinaryExpression(BinaryExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right)); + public override CSharpSyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name)); - public override CSharpSyntaxNode VisitAssignmentExpression(AssignmentExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right)); + public override CSharpSyntaxNode VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.WhenNotNull)); - public override CSharpSyntaxNode VisitConditionalExpression(ConditionalExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.QuestionToken), (ExpressionSyntax)Visit(node.WhenTrue), (SyntaxToken)Visit(node.ColonToken), (ExpressionSyntax)Visit(node.WhenFalse)); + public override CSharpSyntaxNode VisitMemberBindingExpression(MemberBindingExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name)); - public override CSharpSyntaxNode VisitThisExpression(ThisExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Token)); + public override CSharpSyntaxNode VisitElementBindingExpression(ElementBindingExpressionSyntax node) + => node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitBaseExpression(BaseExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Token)); + public override CSharpSyntaxNode VisitRangeExpression(RangeExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.LeftOperand), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.RightOperand)); - public override CSharpSyntaxNode VisitLiteralExpression(LiteralExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Token)); + public override CSharpSyntaxNode VisitImplicitElementAccess(ImplicitElementAccessSyntax node) + => node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitMakeRefExpression(MakeRefExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitBinaryExpression(BinaryExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right)); - public override CSharpSyntaxNode VisitRefTypeExpression(RefTypeExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitAssignmentExpression(AssignmentExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right)); - public override CSharpSyntaxNode VisitRefValueExpression(RefValueExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.Comma), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitConditionalExpression(ConditionalExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.QuestionToken), (ExpressionSyntax)Visit(node.WhenTrue), (SyntaxToken)Visit(node.ColonToken), (ExpressionSyntax)Visit(node.WhenFalse)); - public override CSharpSyntaxNode VisitCheckedExpression(CheckedExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitThisExpression(ThisExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Token)); - public override CSharpSyntaxNode VisitDefaultExpression(DefaultExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitBaseExpression(BaseExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Token)); - public override CSharpSyntaxNode VisitTypeOfExpression(TypeOfExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitLiteralExpression(LiteralExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Token)); - public override CSharpSyntaxNode VisitSizeOfExpression(SizeOfExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitMakeRefExpression(MakeRefExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitInvocationExpression(InvocationExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (ArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitRefTypeExpression(RefTypeExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitElementAccessExpression(ElementAccessExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (BracketedArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitRefValueExpression(RefValueExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.Comma), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitArgumentList(ArgumentListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitCheckedExpression(CheckedExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitBracketedArgumentList(BracketedArgumentListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseBracketToken)); + public override CSharpSyntaxNode VisitDefaultExpression(DefaultExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitArgument(ArgumentSyntax node) - => node.Update((NameColonSyntax)Visit(node.NameColon), (SyntaxToken)Visit(node.RefKindKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitTypeOfExpression(TypeOfExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitExpressionColon(ExpressionColonSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitSizeOfExpression(SizeOfExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitNameColon(NameColonSyntax node) - => node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitInvocationExpression(InvocationExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (ArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitDeclarationExpression(DeclarationExpressionSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation)); + public override CSharpSyntaxNode VisitElementAccessExpression(ElementAccessExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (BracketedArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitCastExpression(CastExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitArgumentList(ArgumentListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) - => node.Update(VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); + public override CSharpSyntaxNode VisitBracketedArgumentList(BracketedArgumentListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (ParameterSyntax)Visit(node.Parameter), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); + public override CSharpSyntaxNode VisitArgument(ArgumentSyntax node) + => node.Update((NameColonSyntax)Visit(node.NameColon), (SyntaxToken)Visit(node.RefKindKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitRefExpression(RefExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.RefKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitExpressionColon(ExpressionColonSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ParameterListSyntax)Visit(node.ParameterList), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); + public override CSharpSyntaxNode VisitNameColon(NameColonSyntax node) + => node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitInitializerExpression(InitializerExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Expressions), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitDeclarationExpression(DeclarationExpressionSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation)); - public override CSharpSyntaxNode VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitCastExpression(CastExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) + => node.Update(VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); - public override CSharpSyntaxNode VisitWithExpression(WithExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.WithKeyword), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (ParameterSyntax)Visit(node.Parameter), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); - public override CSharpSyntaxNode VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) - => node.Update((NameEqualsSyntax)Visit(node.NameEquals), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitRefExpression(RefExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.RefKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Initializers), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ParameterListSyntax)Visit(node.ParameterList), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); - public override CSharpSyntaxNode VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (ArrayTypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitInitializerExpression(InitializerExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Expressions), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Commas), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (TypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (SyntaxToken)Visit(node.OpenBracketToken), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitWithExpression(WithExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.WithKeyword), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitCollectionExpression(CollectionExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Elements), (SyntaxToken)Visit(node.CloseBracketToken)); + public override CSharpSyntaxNode VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) + => node.Update((NameEqualsSyntax)Visit(node.NameEquals), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitExpressionElement(ExpressionElementSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Initializers), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitSpreadElement(SpreadElementSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (ArrayTypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitQueryExpression(QueryExpressionSyntax node) - => node.Update((FromClauseSyntax)Visit(node.FromClause), (QueryBodySyntax)Visit(node.Body)); + public override CSharpSyntaxNode VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Commas), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitQueryBody(QueryBodySyntax node) - => node.Update(VisitList(node.Clauses), (SelectOrGroupClauseSyntax)Visit(node.SelectOrGroup), (QueryContinuationSyntax)Visit(node.Continuation)); + public override CSharpSyntaxNode VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (TypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitFromClause(FromClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.FromKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (SyntaxToken)Visit(node.OpenBracketToken), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitLetClause(LetClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.LetKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitCollectionExpression(CollectionExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Elements), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitJoinClause(JoinClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.JoinKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.InExpression), (SyntaxToken)Visit(node.OnKeyword), (ExpressionSyntax)Visit(node.LeftExpression), (SyntaxToken)Visit(node.EqualsKeyword), (ExpressionSyntax)Visit(node.RightExpression), (JoinIntoClauseSyntax)Visit(node.Into)); + public override CSharpSyntaxNode VisitExpressionElement(ExpressionElementSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitJoinIntoClause(JoinIntoClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier)); + public override CSharpSyntaxNode VisitSpreadElement(SpreadElementSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitWhereClause(WhereClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.WhereKeyword), (ExpressionSyntax)Visit(node.Condition)); + public override CSharpSyntaxNode VisitQueryExpression(QueryExpressionSyntax node) + => node.Update((FromClauseSyntax)Visit(node.FromClause), (QueryBodySyntax)Visit(node.Body)); - public override CSharpSyntaxNode VisitOrderByClause(OrderByClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.OrderByKeyword), VisitList(node.Orderings)); + public override CSharpSyntaxNode VisitQueryBody(QueryBodySyntax node) + => node.Update(VisitList(node.Clauses), (SelectOrGroupClauseSyntax)Visit(node.SelectOrGroup), (QueryContinuationSyntax)Visit(node.Continuation)); - public override CSharpSyntaxNode VisitOrdering(OrderingSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.AscendingOrDescendingKeyword)); + public override CSharpSyntaxNode VisitFromClause(FromClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.FromKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitSelectClause(SelectClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.SelectKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitLetClause(LetClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.LetKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitGroupClause(GroupClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.GroupKeyword), (ExpressionSyntax)Visit(node.GroupExpression), (SyntaxToken)Visit(node.ByKeyword), (ExpressionSyntax)Visit(node.ByExpression)); + public override CSharpSyntaxNode VisitJoinClause(JoinClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.JoinKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.InExpression), (SyntaxToken)Visit(node.OnKeyword), (ExpressionSyntax)Visit(node.LeftExpression), (SyntaxToken)Visit(node.EqualsKeyword), (ExpressionSyntax)Visit(node.RightExpression), (JoinIntoClauseSyntax)Visit(node.Into)); - public override CSharpSyntaxNode VisitQueryContinuation(QueryContinuationSyntax node) - => node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier), (QueryBodySyntax)Visit(node.Body)); + public override CSharpSyntaxNode VisitJoinIntoClause(JoinIntoClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier)); - public override CSharpSyntaxNode VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OmittedArraySizeExpressionToken)); + public override CSharpSyntaxNode VisitWhereClause(WhereClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.WhereKeyword), (ExpressionSyntax)Visit(node.Condition)); - public override CSharpSyntaxNode VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.StringStartToken), VisitList(node.Contents), (SyntaxToken)Visit(node.StringEndToken)); + public override CSharpSyntaxNode VisitOrderByClause(OrderByClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.OrderByKeyword), VisitList(node.Orderings)); - public override CSharpSyntaxNode VisitIsPatternExpression(IsPatternExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.IsKeyword), (PatternSyntax)Visit(node.Pattern)); + public override CSharpSyntaxNode VisitOrdering(OrderingSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.AscendingOrDescendingKeyword)); - public override CSharpSyntaxNode VisitThrowExpression(ThrowExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitSelectClause(SelectClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.SelectKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitWhenClause(WhenClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.WhenKeyword), (ExpressionSyntax)Visit(node.Condition)); + public override CSharpSyntaxNode VisitGroupClause(GroupClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.GroupKeyword), (ExpressionSyntax)Visit(node.GroupExpression), (SyntaxToken)Visit(node.ByKeyword), (ExpressionSyntax)Visit(node.ByExpression)); - public override CSharpSyntaxNode VisitDiscardPattern(DiscardPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.UnderscoreToken)); + public override CSharpSyntaxNode VisitQueryContinuation(QueryContinuationSyntax node) + => node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier), (QueryBodySyntax)Visit(node.Body)); - public override CSharpSyntaxNode VisitDeclarationPattern(DeclarationPatternSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation)); + public override CSharpSyntaxNode VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OmittedArraySizeExpressionToken)); - public override CSharpSyntaxNode VisitVarPattern(VarPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.VarKeyword), (VariableDesignationSyntax)Visit(node.Designation)); + public override CSharpSyntaxNode VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.StringStartToken), VisitList(node.Contents), (SyntaxToken)Visit(node.StringEndToken)); - public override CSharpSyntaxNode VisitRecursivePattern(RecursivePatternSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), (PositionalPatternClauseSyntax)Visit(node.PositionalPatternClause), (PropertyPatternClauseSyntax)Visit(node.PropertyPatternClause), (VariableDesignationSyntax)Visit(node.Designation)); + public override CSharpSyntaxNode VisitIsPatternExpression(IsPatternExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.IsKeyword), (PatternSyntax)Visit(node.Pattern)); - public override CSharpSyntaxNode VisitPositionalPatternClause(PositionalPatternClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitThrowExpression(ThrowExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitPropertyPatternClause(PropertyPatternClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitWhenClause(WhenClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.WhenKeyword), (ExpressionSyntax)Visit(node.Condition)); - public override CSharpSyntaxNode VisitSubpattern(SubpatternSyntax node) - => node.Update((BaseExpressionColonSyntax)Visit(node.ExpressionColon), (PatternSyntax)Visit(node.Pattern)); + public override CSharpSyntaxNode VisitDiscardPattern(DiscardPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.UnderscoreToken)); - public override CSharpSyntaxNode VisitConstantPattern(ConstantPatternSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitDeclarationPattern(DeclarationPatternSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation)); - public override CSharpSyntaxNode VisitParenthesizedPattern(ParenthesizedPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), (PatternSyntax)Visit(node.Pattern), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitVarPattern(VarPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.VarKeyword), (VariableDesignationSyntax)Visit(node.Designation)); - public override CSharpSyntaxNode VisitRelationalPattern(RelationalPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitRecursivePattern(RecursivePatternSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), (PositionalPatternClauseSyntax)Visit(node.PositionalPatternClause), (PropertyPatternClauseSyntax)Visit(node.PropertyPatternClause), (VariableDesignationSyntax)Visit(node.Designation)); - public override CSharpSyntaxNode VisitTypePattern(TypePatternSyntax node) - => node.Update((TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitPositionalPatternClause(PositionalPatternClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitBinaryPattern(BinaryPatternSyntax node) - => node.Update((PatternSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Right)); + public override CSharpSyntaxNode VisitPropertyPatternClause(PropertyPatternClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitUnaryPattern(UnaryPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Pattern)); + public override CSharpSyntaxNode VisitSubpattern(SubpatternSyntax node) + => node.Update((BaseExpressionColonSyntax)Visit(node.ExpressionColon), (PatternSyntax)Visit(node.Pattern)); - public override CSharpSyntaxNode VisitListPattern(ListPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Patterns), (SyntaxToken)Visit(node.CloseBracketToken), (VariableDesignationSyntax)Visit(node.Designation)); + public override CSharpSyntaxNode VisitConstantPattern(ConstantPatternSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitSlicePattern(SlicePatternSyntax node) - => node.Update((SyntaxToken)Visit(node.DotDotToken), (PatternSyntax)Visit(node.Pattern)); + public override CSharpSyntaxNode VisitParenthesizedPattern(ParenthesizedPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), (PatternSyntax)Visit(node.Pattern), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitInterpolatedStringText(InterpolatedStringTextSyntax node) - => node.Update((SyntaxToken)Visit(node.TextToken)); + public override CSharpSyntaxNode VisitRelationalPattern(RelationalPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitInterpolation(InterpolationSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBraceToken), (ExpressionSyntax)Visit(node.Expression), (InterpolationAlignmentClauseSyntax)Visit(node.AlignmentClause), (InterpolationFormatClauseSyntax)Visit(node.FormatClause), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitTypePattern(TypePatternSyntax node) + => node.Update((TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.CommaToken), (ExpressionSyntax)Visit(node.Value)); + public override CSharpSyntaxNode VisitBinaryPattern(BinaryPatternSyntax node) + => node.Update((PatternSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Right)); - public override CSharpSyntaxNode VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.FormatStringToken)); + public override CSharpSyntaxNode VisitUnaryPattern(UnaryPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Pattern)); - public override CSharpSyntaxNode VisitGlobalStatement(GlobalStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitListPattern(ListPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Patterns), (SyntaxToken)Visit(node.CloseBracketToken), (VariableDesignationSyntax)Visit(node.Designation)); - public override CSharpSyntaxNode VisitBlock(BlockSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Statements), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitSlicePattern(SlicePatternSyntax node) + => node.Update((SyntaxToken)Visit(node.DotDotToken), (PatternSyntax)Visit(node.Pattern)); - public override CSharpSyntaxNode VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitInterpolatedStringText(InterpolatedStringTextSyntax node) + => node.Update((SyntaxToken)Visit(node.TextToken)); - public override CSharpSyntaxNode VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitInterpolation(InterpolationSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBraceToken), (ExpressionSyntax)Visit(node.Expression), (InterpolationAlignmentClauseSyntax)Visit(node.AlignmentClause), (InterpolationFormatClauseSyntax)Visit(node.FormatClause), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitVariableDeclaration(VariableDeclarationSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), VisitList(node.Variables)); + public override CSharpSyntaxNode VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.CommaToken), (ExpressionSyntax)Visit(node.Value)); - public override CSharpSyntaxNode VisitVariableDeclarator(VariableDeclaratorSyntax node) - => node.Update((SyntaxToken)Visit(node.Identifier), (BracketedArgumentListSyntax)Visit(node.ArgumentList), (EqualsValueClauseSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.FormatStringToken)); - public override CSharpSyntaxNode VisitEqualsValueClause(EqualsValueClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Value)); + public override CSharpSyntaxNode VisitGlobalStatement(GlobalStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) - => node.Update((SyntaxToken)Visit(node.Identifier)); + public override CSharpSyntaxNode VisitBlock(BlockSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Statements), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitDiscardDesignation(DiscardDesignationSyntax node) - => node.Update((SyntaxToken)Visit(node.UnderscoreToken)); + public override CSharpSyntaxNode VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Variables), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitExpressionStatement(ExpressionStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitVariableDeclaration(VariableDeclarationSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), VisitList(node.Variables)); - public override CSharpSyntaxNode VisitEmptyStatement(EmptyStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitVariableDeclarator(VariableDeclaratorSyntax node) + => node.Update((SyntaxToken)Visit(node.Identifier), (BracketedArgumentListSyntax)Visit(node.ArgumentList), (EqualsValueClauseSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitLabeledStatement(LabeledStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitEqualsValueClause(EqualsValueClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Value)); - public override CSharpSyntaxNode VisitGotoStatement(GotoStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.GotoKeyword), (SyntaxToken)Visit(node.CaseOrDefaultKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) + => node.Update((SyntaxToken)Visit(node.Identifier)); - public override CSharpSyntaxNode VisitBreakStatement(BreakStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.BreakKeyword), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitDiscardDesignation(DiscardDesignationSyntax node) + => node.Update((SyntaxToken)Visit(node.UnderscoreToken)); - public override CSharpSyntaxNode VisitContinueStatement(ContinueStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ContinueKeyword), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Variables), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitReturnStatement(ReturnStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ReturnKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitExpressionStatement(ExpressionStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitThrowStatement(ThrowStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitEmptyStatement(EmptyStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitYieldStatement(YieldStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.YieldKeyword), (SyntaxToken)Visit(node.ReturnOrBreakKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitLabeledStatement(LabeledStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitWhileStatement(WhileStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitGotoStatement(GotoStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.GotoKeyword), (SyntaxToken)Visit(node.CaseOrDefaultKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitDoStatement(DoStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.DoKeyword), (StatementSyntax)Visit(node.Statement), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitBreakStatement(BreakStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.BreakKeyword), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitForStatement(ForStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ForKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), VisitList(node.Initializers), (SyntaxToken)Visit(node.FirstSemicolonToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.SecondSemicolonToken), VisitList(node.Incrementors), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitContinueStatement(ContinueStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ContinueKeyword), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitForEachStatement(ForEachStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitReturnStatement(ReturnStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ReturnKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitForEachVariableStatement(ForEachVariableStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Variable), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitThrowStatement(ThrowStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitUsingStatement(UsingStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitYieldStatement(YieldStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.YieldKeyword), (SyntaxToken)Visit(node.ReturnOrBreakKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitFixedStatement(FixedStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.FixedKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitWhileStatement(WhileStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitCheckedStatement(CheckedStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Block)); + public override CSharpSyntaxNode VisitDoStatement(DoStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.DoKeyword), (StatementSyntax)Visit(node.Statement), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitUnsafeStatement(UnsafeStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.UnsafeKeyword), (BlockSyntax)Visit(node.Block)); + public override CSharpSyntaxNode VisitForStatement(ForStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ForKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), VisitList(node.Initializers), (SyntaxToken)Visit(node.FirstSemicolonToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.SecondSemicolonToken), VisitList(node.Incrementors), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitLockStatement(LockStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.LockKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitForEachStatement(ForEachStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitIfStatement(IfStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.IfKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement), (ElseClauseSyntax)Visit(node.Else)); + public override CSharpSyntaxNode VisitForEachVariableStatement(ForEachVariableStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Variable), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitElseClause(ElseClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.ElseKeyword), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitUsingStatement(UsingStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitSwitchStatement(SwitchStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Sections), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitFixedStatement(FixedStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.FixedKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitSwitchSection(SwitchSectionSyntax node) - => node.Update(VisitList(node.Labels), VisitList(node.Statements)); + public override CSharpSyntaxNode VisitCheckedStatement(CheckedStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Block)); - public override CSharpSyntaxNode VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitUnsafeStatement(UnsafeStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.UnsafeKeyword), (BlockSyntax)Visit(node.Block)); - public override CSharpSyntaxNode VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (ExpressionSyntax)Visit(node.Value), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitLockStatement(LockStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.LockKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitIfStatement(IfStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.IfKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement), (ElseClauseSyntax)Visit(node.Else)); - public override CSharpSyntaxNode VisitSwitchExpression(SwitchExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.GoverningExpression), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Arms), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitElseClause(ElseClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.ElseKeyword), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) - => node.Update((PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.EqualsGreaterThanToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitSwitchStatement(SwitchStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Sections), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitTryStatement(TryStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.TryKeyword), (BlockSyntax)Visit(node.Block), VisitList(node.Catches), (FinallyClauseSyntax)Visit(node.Finally)); + public override CSharpSyntaxNode VisitSwitchSection(SwitchSectionSyntax node) + => node.Update(VisitList(node.Labels), VisitList(node.Statements)); - public override CSharpSyntaxNode VisitCatchClause(CatchClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.CatchKeyword), (CatchDeclarationSyntax)Visit(node.Declaration), (CatchFilterClauseSyntax)Visit(node.Filter), (BlockSyntax)Visit(node.Block)); + public override CSharpSyntaxNode VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitCatchDeclaration(CatchDeclarationSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (ExpressionSyntax)Visit(node.Value), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitCatchFilterClause(CatchFilterClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.WhenKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.FilterExpression), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitFinallyClause(FinallyClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.FinallyKeyword), (BlockSyntax)Visit(node.Block)); + public override CSharpSyntaxNode VisitSwitchExpression(SwitchExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.GoverningExpression), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Arms), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitCompilationUnit(CompilationUnitSyntax node) - => node.Update(VisitList(node.Externs), VisitList(node.Usings), VisitList(node.AttributeLists), VisitList(node.Members), (SyntaxToken)Visit(node.EndOfFileToken)); + public override CSharpSyntaxNode VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) + => node.Update((PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.EqualsGreaterThanToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitExternAliasDirective(ExternAliasDirectiveSyntax node) - => node.Update((SyntaxToken)Visit(node.ExternKeyword), (SyntaxToken)Visit(node.AliasKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitTryStatement(TryStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.TryKeyword), (BlockSyntax)Visit(node.Block), VisitList(node.Catches), (FinallyClauseSyntax)Visit(node.Finally)); - public override CSharpSyntaxNode VisitUsingDirective(UsingDirectiveSyntax node) - => node.Update((SyntaxToken)Visit(node.GlobalKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.StaticKeyword), (SyntaxToken)Visit(node.UnsafeKeyword), (NameEqualsSyntax)Visit(node.Alias), (TypeSyntax)Visit(node.NamespaceOrType), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitCatchClause(CatchClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.CatchKeyword), (CatchDeclarationSyntax)Visit(node.Declaration), (CatchFilterClauseSyntax)Visit(node.Filter), (BlockSyntax)Visit(node.Block)); - public override CSharpSyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitCatchDeclaration(CatchDeclarationSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.SemicolonToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members)); + public override CSharpSyntaxNode VisitCatchFilterClause(CatchFilterClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.WhenKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.FilterExpression), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitAttributeList(AttributeListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), (AttributeTargetSpecifierSyntax)Visit(node.Target), VisitList(node.Attributes), (SyntaxToken)Visit(node.CloseBracketToken)); + public override CSharpSyntaxNode VisitFinallyClause(FinallyClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.FinallyKeyword), (BlockSyntax)Visit(node.Block)); - public override CSharpSyntaxNode VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) - => node.Update((SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitCompilationUnit(CompilationUnitSyntax node) + => node.Update(VisitList(node.Externs), VisitList(node.Usings), VisitList(node.AttributeLists), VisitList(node.Members), (SyntaxToken)Visit(node.EndOfFileToken)); - public override CSharpSyntaxNode VisitAttribute(AttributeSyntax node) - => node.Update((NameSyntax)Visit(node.Name), (AttributeArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitExternAliasDirective(ExternAliasDirectiveSyntax node) + => node.Update((SyntaxToken)Visit(node.ExternKeyword), (SyntaxToken)Visit(node.AliasKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitAttributeArgumentList(AttributeArgumentListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitUsingDirective(UsingDirectiveSyntax node) + => node.Update((SyntaxToken)Visit(node.GlobalKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.StaticKeyword), (SyntaxToken)Visit(node.UnsafeKeyword), (NameEqualsSyntax)Visit(node.Alias), (TypeSyntax)Visit(node.NamespaceOrType), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitAttributeArgument(AttributeArgumentSyntax node) - => node.Update((NameEqualsSyntax)Visit(node.NameEquals), (NameColonSyntax)Visit(node.NameColon), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitNameEquals(NameEqualsSyntax node) - => node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken)); + public override CSharpSyntaxNode VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.SemicolonToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members)); - public override CSharpSyntaxNode VisitTypeParameterList(TypeParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken)); + public override CSharpSyntaxNode VisitAttributeList(AttributeListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), (AttributeTargetSpecifierSyntax)Visit(node.Target), VisitList(node.Attributes), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitTypeParameter(TypeParameterSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.VarianceKeyword), (SyntaxToken)Visit(node.Identifier)); + public override CSharpSyntaxNode VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) + => node.Update((SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitAttribute(AttributeSyntax node) + => node.Update((NameSyntax)Visit(node.Name), (AttributeArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitStructDeclaration(StructDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitAttributeArgumentList(AttributeArgumentListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitAttributeArgument(AttributeArgumentSyntax node) + => node.Update((NameEqualsSyntax)Visit(node.NameEquals), (NameColonSyntax)Visit(node.NameColon), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitRecordDeclaration(RecordDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitNameEquals(NameEqualsSyntax node) + => node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken)); - public override CSharpSyntaxNode VisitEnumDeclaration(EnumDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EnumKeyword), (SyntaxToken)Visit(node.Identifier), (BaseListSyntax)Visit(node.BaseList), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitTypeParameterList(TypeParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken)); - public override CSharpSyntaxNode VisitDelegateDeclaration(DelegateDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitTypeParameter(TypeParameterSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.VarianceKeyword), (SyntaxToken)Visit(node.Identifier)); - public override CSharpSyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.EqualsValue)); + public override CSharpSyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitBaseList(BaseListSyntax node) - => node.Update((SyntaxToken)Visit(node.ColonToken), VisitList(node.Types)); + public override CSharpSyntaxNode VisitStructDeclaration(StructDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitSimpleBaseType(SimpleBaseTypeSyntax node) - => node.Update((TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitRecordDeclaration(RecordDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.WhereKeyword), (IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken), VisitList(node.Constraints)); + public override CSharpSyntaxNode VisitEnumDeclaration(EnumDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EnumKeyword), (SyntaxToken)Visit(node.Identifier), (BaseListSyntax)Visit(node.BaseList), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitConstructorConstraint(ConstructorConstraintSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitDelegateDeclaration(DelegateDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) - => node.Update((SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.QuestionToken)); + public override CSharpSyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.EqualsValue)); - public override CSharpSyntaxNode VisitTypeConstraint(TypeConstraintSyntax node) - => node.Update((TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitBaseList(BaseListSyntax node) + => node.Update((SyntaxToken)Visit(node.ColonToken), VisitList(node.Types)); - public override CSharpSyntaxNode VisitDefaultConstraint(DefaultConstraintSyntax node) - => node.Update((SyntaxToken)Visit(node.DefaultKeyword)); + public override CSharpSyntaxNode VisitSimpleBaseType(SimpleBaseTypeSyntax node) + => node.Update((TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitFieldDeclaration(FieldDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.WhereKeyword), (IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken), VisitList(node.Constraints)); - public override CSharpSyntaxNode VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) - => node.Update((NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.DotToken)); + public override CSharpSyntaxNode VisitConstructorConstraint(ConstructorConstraintSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitMethodDeclaration(MethodDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) + => node.Update((SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.QuestionToken)); - public override CSharpSyntaxNode VisitOperatorDeclaration(OperatorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (SyntaxToken)Visit(node.OperatorToken), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitTypeConstraint(TypeConstraintSyntax node) + => node.Update((TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (TypeSyntax)Visit(node.Type), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitDefaultConstraint(DefaultConstraintSyntax node) + => node.Update((SyntaxToken)Visit(node.DefaultKeyword)); - public override CSharpSyntaxNode VisitConstructorDeclaration(ConstructorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (ConstructorInitializerSyntax)Visit(node.Initializer), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitFieldDeclaration(FieldDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitConstructorInitializer(ConstructorInitializerSyntax node) - => node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.ThisOrBaseKeyword), (ArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitDestructorDeclaration(DestructorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.TildeToken), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) + => node.Update((NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.DotToken)); - public override CSharpSyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (EqualsValueClauseSyntax)Visit(node.Initializer), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitMethodDeclaration(MethodDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.ArrowToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitOperatorDeclaration(OperatorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (SyntaxToken)Visit(node.OperatorToken), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitEventDeclaration(EventDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (TypeSyntax)Visit(node.Type), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitIndexerDeclaration(IndexerDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.ThisKeyword), (BracketedParameterListSyntax)Visit(node.ParameterList), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitConstructorDeclaration(ConstructorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (ConstructorInitializerSyntax)Visit(node.Initializer), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitAccessorList(AccessorListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Accessors), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitConstructorInitializer(ConstructorInitializerSyntax node) + => node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.ThisOrBaseKeyword), (ArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitAccessorDeclaration(AccessorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitDestructorDeclaration(DestructorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.TildeToken), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitParameterList(ParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (EqualsValueClauseSyntax)Visit(node.Initializer), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitBracketedParameterList(BracketedParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken)); + public override CSharpSyntaxNode VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.ArrowToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitParameter(ParameterSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.Default)); + public override CSharpSyntaxNode VisitEventDeclaration(EventDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitIndexerDeclaration(IndexerDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.ThisKeyword), (BracketedParameterListSyntax)Visit(node.ParameterList), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitIncompleteMember(IncompleteMemberSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitAccessorList(AccessorListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Accessors), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) - => node.Update(VisitList(node.Tokens)); + public override CSharpSyntaxNode VisitAccessorDeclaration(AccessorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) - => node.Update(VisitList(node.Content), (SyntaxToken)Visit(node.EndOfComment)); + public override CSharpSyntaxNode VisitParameterList(ParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitTypeCref(TypeCrefSyntax node) - => node.Update((TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitBracketedParameterList(BracketedParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitQualifiedCref(QualifiedCrefSyntax node) - => node.Update((TypeSyntax)Visit(node.Container), (SyntaxToken)Visit(node.DotToken), (MemberCrefSyntax)Visit(node.Member)); + public override CSharpSyntaxNode VisitParameter(ParameterSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.Default)); - public override CSharpSyntaxNode VisitNameMemberCref(NameMemberCrefSyntax node) - => node.Update((TypeSyntax)Visit(node.Name), (CrefParameterListSyntax)Visit(node.Parameters)); + public override CSharpSyntaxNode VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitIndexerMemberCref(IndexerMemberCrefSyntax node) - => node.Update((SyntaxToken)Visit(node.ThisKeyword), (CrefBracketedParameterListSyntax)Visit(node.Parameters)); + public override CSharpSyntaxNode VisitIncompleteMember(IncompleteMemberSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitOperatorMemberCref(OperatorMemberCrefSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (SyntaxToken)Visit(node.OperatorToken), (CrefParameterListSyntax)Visit(node.Parameters)); + public override CSharpSyntaxNode VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) + => node.Update(VisitList(node.Tokens)); - public override CSharpSyntaxNode VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) - => node.Update((SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (TypeSyntax)Visit(node.Type), (CrefParameterListSyntax)Visit(node.Parameters)); + public override CSharpSyntaxNode VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) + => node.Update(VisitList(node.Content), (SyntaxToken)Visit(node.EndOfComment)); - public override CSharpSyntaxNode VisitCrefParameterList(CrefParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitTypeCref(TypeCrefSyntax node) + => node.Update((TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken)); + public override CSharpSyntaxNode VisitQualifiedCref(QualifiedCrefSyntax node) + => node.Update((TypeSyntax)Visit(node.Container), (SyntaxToken)Visit(node.DotToken), (MemberCrefSyntax)Visit(node.Member)); - public override CSharpSyntaxNode VisitCrefParameter(CrefParameterSyntax node) - => node.Update((SyntaxToken)Visit(node.RefKindKeyword), (SyntaxToken)Visit(node.ReadOnlyKeyword), (TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitNameMemberCref(NameMemberCrefSyntax node) + => node.Update((TypeSyntax)Visit(node.Name), (CrefParameterListSyntax)Visit(node.Parameters)); - public override CSharpSyntaxNode VisitXmlElement(XmlElementSyntax node) - => node.Update((XmlElementStartTagSyntax)Visit(node.StartTag), VisitList(node.Content), (XmlElementEndTagSyntax)Visit(node.EndTag)); + public override CSharpSyntaxNode VisitIndexerMemberCref(IndexerMemberCrefSyntax node) + => node.Update((SyntaxToken)Visit(node.ThisKeyword), (CrefBracketedParameterListSyntax)Visit(node.Parameters)); - public override CSharpSyntaxNode VisitXmlElementStartTag(XmlElementStartTagSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.GreaterThanToken)); + public override CSharpSyntaxNode VisitOperatorMemberCref(OperatorMemberCrefSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (SyntaxToken)Visit(node.OperatorToken), (CrefParameterListSyntax)Visit(node.Parameters)); - public override CSharpSyntaxNode VisitXmlElementEndTag(XmlElementEndTagSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanSlashToken), (XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.GreaterThanToken)); + public override CSharpSyntaxNode VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) + => node.Update((SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (TypeSyntax)Visit(node.Type), (CrefParameterListSyntax)Visit(node.Parameters)); - public override CSharpSyntaxNode VisitXmlEmptyElement(XmlEmptyElementSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.SlashGreaterThanToken)); + public override CSharpSyntaxNode VisitCrefParameterList(CrefParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitXmlName(XmlNameSyntax node) - => node.Update((XmlPrefixSyntax)Visit(node.Prefix), (SyntaxToken)Visit(node.LocalName)); + public override CSharpSyntaxNode VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitXmlPrefix(XmlPrefixSyntax node) - => node.Update((SyntaxToken)Visit(node.Prefix), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitCrefParameter(CrefParameterSyntax node) + => node.Update((SyntaxToken)Visit(node.RefKindKeyword), (SyntaxToken)Visit(node.ReadOnlyKeyword), (TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitXmlTextAttribute(XmlTextAttributeSyntax node) - => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndQuoteToken)); + public override CSharpSyntaxNode VisitXmlElement(XmlElementSyntax node) + => node.Update((XmlElementStartTagSyntax)Visit(node.StartTag), VisitList(node.Content), (XmlElementEndTagSyntax)Visit(node.EndTag)); - public override CSharpSyntaxNode VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) - => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (CrefSyntax)Visit(node.Cref), (SyntaxToken)Visit(node.EndQuoteToken)); + public override CSharpSyntaxNode VisitXmlElementStartTag(XmlElementStartTagSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.GreaterThanToken)); - public override CSharpSyntaxNode VisitXmlNameAttribute(XmlNameAttributeSyntax node) - => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (IdentifierNameSyntax)Visit(node.Identifier), (SyntaxToken)Visit(node.EndQuoteToken)); + public override CSharpSyntaxNode VisitXmlElementEndTag(XmlElementEndTagSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanSlashToken), (XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.GreaterThanToken)); - public override CSharpSyntaxNode VisitXmlText(XmlTextSyntax node) - => node.Update(VisitList(node.TextTokens)); + public override CSharpSyntaxNode VisitXmlEmptyElement(XmlEmptyElementSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.SlashGreaterThanToken)); - public override CSharpSyntaxNode VisitXmlCDataSection(XmlCDataSectionSyntax node) - => node.Update((SyntaxToken)Visit(node.StartCDataToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndCDataToken)); + public override CSharpSyntaxNode VisitXmlName(XmlNameSyntax node) + => node.Update((XmlPrefixSyntax)Visit(node.Prefix), (SyntaxToken)Visit(node.LocalName)); - public override CSharpSyntaxNode VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) - => node.Update((SyntaxToken)Visit(node.StartProcessingInstructionToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndProcessingInstructionToken)); + public override CSharpSyntaxNode VisitXmlPrefix(XmlPrefixSyntax node) + => node.Update((SyntaxToken)Visit(node.Prefix), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitXmlComment(XmlCommentSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanExclamationMinusMinusToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.MinusMinusGreaterThanToken)); + public override CSharpSyntaxNode VisitXmlTextAttribute(XmlTextAttributeSyntax node) + => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndQuoteToken)); - public override CSharpSyntaxNode VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.IfKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); + public override CSharpSyntaxNode VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) + => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (CrefSyntax)Visit(node.Cref), (SyntaxToken)Visit(node.EndQuoteToken)); - public override CSharpSyntaxNode VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElifKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); + public override CSharpSyntaxNode VisitXmlNameAttribute(XmlNameAttributeSyntax node) + => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (IdentifierNameSyntax)Visit(node.Identifier), (SyntaxToken)Visit(node.EndQuoteToken)); - public override CSharpSyntaxNode VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElseKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken); + public override CSharpSyntaxNode VisitXmlText(XmlTextSyntax node) + => node.Update(VisitList(node.TextTokens)); - public override CSharpSyntaxNode VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndIfKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitXmlCDataSection(XmlCDataSectionSyntax node) + => node.Update((SyntaxToken)Visit(node.StartCDataToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndCDataToken)); - public override CSharpSyntaxNode VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.RegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) + => node.Update((SyntaxToken)Visit(node.StartProcessingInstructionToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndProcessingInstructionToken)); - public override CSharpSyntaxNode VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndRegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitXmlComment(XmlCommentSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanExclamationMinusMinusToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.MinusMinusGreaterThanToken)); - public override CSharpSyntaxNode VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ErrorKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.IfKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); - public override CSharpSyntaxNode VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElifKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); - public override CSharpSyntaxNode VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElseKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken); - public override CSharpSyntaxNode VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.DefineKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndIfKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.UndefKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.RegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndRegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitLineDirectivePosition(LineDirectivePositionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.CommaToken), (SyntaxToken)Visit(node.Character), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ErrorKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (LineDirectivePositionSyntax)Visit(node.Start), (SyntaxToken)Visit(node.MinusToken), (LineDirectivePositionSyntax)Visit(node.End), (SyntaxToken)Visit(node.CharacterOffset), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.DisableOrRestoreKeyword), VisitList(node.ErrorCodes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.ChecksumKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.Guid), (SyntaxToken)Visit(node.Bytes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.DefineKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ReferenceKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.UndefKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LoadKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ExclamationToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitLineDirectivePosition(LineDirectivePositionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.CommaToken), (SyntaxToken)Visit(node.Character), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.NullableKeyword), (SyntaxToken)Visit(node.SettingToken), (SyntaxToken)Visit(node.TargetToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - } + public override CSharpSyntaxNode VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (LineDirectivePositionSyntax)Visit(node.Start), (SyntaxToken)Visit(node.MinusToken), (LineDirectivePositionSyntax)Visit(node.End), (SyntaxToken)Visit(node.CharacterOffset), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - internal partial class ContextAwareSyntax - { + public override CSharpSyntaxNode VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.DisableOrRestoreKeyword), VisitList(node.ErrorCodes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - private SyntaxFactoryContext context; + public override CSharpSyntaxNode VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.ChecksumKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.Guid), (SyntaxToken)Visit(node.Bytes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public ContextAwareSyntax(SyntaxFactoryContext context) - => this.context = context; + public override CSharpSyntaxNode VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ReferenceKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public IdentifierNameSyntax IdentifierName(SyntaxToken identifier) - { -#if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.GlobalKeyword: break; - default: throw new ArgumentException(nameof(identifier)); - } -#endif + public override CSharpSyntaxNode VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LoadKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, this.context, out hash); - if (cached != null) return (IdentifierNameSyntax)cached; + public override CSharpSyntaxNode VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ExclamationToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + public override CSharpSyntaxNode VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.NullableKeyword), (SyntaxToken)Visit(node.SettingToken), (SyntaxToken)Visit(node.TargetToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); +} + +internal partial class ContextAwareSyntax +{ - return result; + private SyntaxFactoryContext context; + + public ContextAwareSyntax(SyntaxFactoryContext context) + => this.context = context; + + public IdentifierNameSyntax IdentifierName(SyntaxToken identifier) + { +#if DEBUG + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + switch (identifier.Kind) + { + case SyntaxKind.IdentifierToken: + case SyntaxKind.GlobalKeyword: break; + default: throw new ArgumentException(nameof(identifier)); } +#endif - public QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, this.context, out hash); + if (cached != null) return (IdentifierNameSyntax)cached; + + var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier, this.context); + if (hash >= 0) { + SyntaxNodeCache.AddNode(result, hash); + } + + return result; + } + + public QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + { #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, this.context, out hash); - if (cached != null) return (QualifiedNameSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, this.context, out hash); + if (cached != null) return (QualifiedNameSyntax)cached; - var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) - { + return result; + } + + public GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, this.context, out hash); - if (cached != null) return (GenericNameSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, this.context, out hash); + if (cached != null) return (GenericNameSyntax)cached; - var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) - { + return result; + } + + public TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context, out hash); - if (cached != null) return (TypeArgumentListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context, out hash); + if (cached != null) return (TypeArgumentListSyntax)cached; - var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) - { + return result; + } + + public AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + { #if DEBUG - if (alias == null) throw new ArgumentNullException(nameof(alias)); - if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken)); - if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); + if (alias == null) throw new ArgumentNullException(nameof(alias)); + if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken)); + if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context, out hash); - if (cached != null) return (AliasQualifiedNameSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context, out hash); + if (cached != null) return (AliasQualifiedNameSyntax)cached; - var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) - { + return result; + } + + public PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.BoolKeyword: - case SyntaxKind.ByteKeyword: - case SyntaxKind.SByteKeyword: - case SyntaxKind.IntKeyword: - case SyntaxKind.UIntKeyword: - case SyntaxKind.ShortKeyword: - case SyntaxKind.UShortKeyword: - case SyntaxKind.LongKeyword: - case SyntaxKind.ULongKeyword: - case SyntaxKind.FloatKeyword: - case SyntaxKind.DoubleKeyword: - case SyntaxKind.DecimalKeyword: - case SyntaxKind.StringKeyword: - case SyntaxKind.CharKeyword: - case SyntaxKind.ObjectKeyword: - case SyntaxKind.VoidKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.BoolKeyword: + case SyntaxKind.ByteKeyword: + case SyntaxKind.SByteKeyword: + case SyntaxKind.IntKeyword: + case SyntaxKind.UIntKeyword: + case SyntaxKind.ShortKeyword: + case SyntaxKind.UShortKeyword: + case SyntaxKind.LongKeyword: + case SyntaxKind.ULongKeyword: + case SyntaxKind.FloatKeyword: + case SyntaxKind.DoubleKeyword: + case SyntaxKind.DecimalKeyword: + case SyntaxKind.StringKeyword: + case SyntaxKind.CharKeyword: + case SyntaxKind.ObjectKeyword: + case SyntaxKind.VoidKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, this.context, out hash); - if (cached != null) return (PredefinedTypeSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, this.context, out hash); + if (cached != null) return (PredefinedTypeSyntax)cached; - var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ArrayTypeSyntax ArrayType(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList rankSpecifiers) - { + return result; + } + + public ArrayTypeSyntax ArrayType(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context, out hash); - if (cached != null) return (ArrayTypeSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context, out hash); + if (cached != null) return (ArrayTypeSyntax)cached; - var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) - { + return result; + } + + public ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (ArrayRankSpecifierSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (ArrayRankSpecifierSyntax)cached; - var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) - { + return result; + } + + public PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); - if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); + if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, this.context, out hash); - if (cached != null) return (PointerTypeSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, this.context, out hash); + if (cached != null) return (PointerTypeSyntax)cached; - var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) - { + return result; + } + + public FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); - if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); + if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); #endif - return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList, this.context); - } + return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList, this.context); + } - public FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { + public FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); - if (cached != null) return (FunctionPointerParameterListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); + if (cached != null) return (FunctionPointerParameterListSyntax)cached; - var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) - { + return result; + } + + public FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + { #if DEBUG - if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword)); - switch (managedOrUnmanagedKeyword.Kind) - { - case SyntaxKind.ManagedKeyword: - case SyntaxKind.UnmanagedKeyword: break; - default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword)); - } + if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword)); + switch (managedOrUnmanagedKeyword.Kind) + { + case SyntaxKind.ManagedKeyword: + case SyntaxKind.UnmanagedKeyword: break; + default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword)); + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context, out hash); - if (cached != null) return (FunctionPointerCallingConventionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context, out hash); + if (cached != null) return (FunctionPointerCallingConventionSyntax)cached; - var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) - { + return result; + } + + public FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached; - var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name) - { + return result; + } + + public FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context, out hash); - if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context, out hash); + if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached; - var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) - { + return result; + } + + public NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); - if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); + if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, this.context, out hash); - if (cached != null) return (NullableTypeSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, this.context, out hash); + if (cached != null) return (NullableTypeSyntax)cached; - var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TupleTypeSyntax TupleType(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) - { + return result; + } + + public TupleTypeSyntax TupleType(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context, out hash); - if (cached != null) return (TupleTypeSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context, out hash); + if (cached != null) return (TupleTypeSyntax)cached; - var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier) - { + return result; + } + + public TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier != null) + { + switch (identifier.Kind) { - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(identifier)); - } + case SyntaxKind.IdentifierToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(identifier)); } + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, this.context, out hash); - if (cached != null) return (TupleElementSyntax)cached; - - var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, this.context, out hash); + if (cached != null) return (TupleElementSyntax)cached; - return result; + var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken) - { + return result; + } + + public OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken) + { #if DEBUG - if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken)); - if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); + if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken)); + if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context, out hash); - if (cached != null) return (OmittedTypeArgumentSyntax)cached; - - var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context, out hash); + if (cached != null) return (OmittedTypeArgumentSyntax)cached; - return result; + var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - { + return result; + } + + public RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + { #if DEBUG - if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); - if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); - if (readOnlyKeyword != null) + if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); + if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); + if (readOnlyKeyword != null) + { + switch (readOnlyKeyword.Kind) { - switch (readOnlyKeyword.Kind) - { - case SyntaxKind.ReadOnlyKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(readOnlyKeyword)); - } + case SyntaxKind.ReadOnlyKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(readOnlyKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context, out hash); - if (cached != null) return (RefTypeSyntax)cached; - - var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context, out hash); + if (cached != null) return (RefTypeSyntax)cached; - return result; + var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) - { + return result; + } + + public ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) + { #if DEBUG - if (scopedKeyword == null) throw new ArgumentNullException(nameof(scopedKeyword)); - if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (scopedKeyword == null) throw new ArgumentNullException(nameof(scopedKeyword)); + if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, this.context, out hash); - if (cached != null) return (ScopedTypeSyntax)cached; - - var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, this.context, out hash); + if (cached != null) return (ScopedTypeSyntax)cached; - return result; + var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + return result; + } + + public ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context, out hash); - if (cached != null) return (ParenthesizedExpressionSyntax)cached; - - var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context, out hash); + if (cached != null) return (ParenthesizedExpressionSyntax)cached; - return result; + var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context, out hash); - if (cached != null) return (TupleExpressionSyntax)cached; - - var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context, out hash); + if (cached != null) return (TupleExpressionSyntax)cached; - return result; + var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + return result; + } + + public PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.UnaryPlusExpression: - case SyntaxKind.UnaryMinusExpression: - case SyntaxKind.BitwiseNotExpression: - case SyntaxKind.LogicalNotExpression: - case SyntaxKind.PreIncrementExpression: - case SyntaxKind.PreDecrementExpression: - case SyntaxKind.AddressOfExpression: - case SyntaxKind.PointerIndirectionExpression: - case SyntaxKind.IndexExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.UnaryPlusExpression: + case SyntaxKind.UnaryMinusExpression: + case SyntaxKind.BitwiseNotExpression: + case SyntaxKind.LogicalNotExpression: + case SyntaxKind.PreIncrementExpression: + case SyntaxKind.PreDecrementExpression: + case SyntaxKind.AddressOfExpression: + case SyntaxKind.PointerIndirectionExpression: + case SyntaxKind.IndexExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.TildeToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.CaretToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (operand == null) throw new ArgumentNullException(nameof(operand)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.TildeToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.CaretToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (operand == null) throw new ArgumentNullException(nameof(operand)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, this.context, out hash); - if (cached != null) return (PrefixUnaryExpressionSyntax)cached; - - var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, this.context, out hash); + if (cached != null) return (PrefixUnaryExpressionSyntax)cached; - return result; + var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression) - { + return result; + } + + public AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression) + { #if DEBUG - if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword)); - if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword)); + if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context, out hash); - if (cached != null) return (AwaitExpressionSyntax)cached; - - var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context, out hash); + if (cached != null) return (AwaitExpressionSyntax)cached; - return result; + var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + return result; + } + + public PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.PostIncrementExpression: - case SyntaxKind.PostDecrementExpression: - case SyntaxKind.SuppressNullableWarningExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.PostIncrementExpression: + case SyntaxKind.PostDecrementExpression: + case SyntaxKind.SuppressNullableWarningExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (operand == null) throw new ArgumentNullException(nameof(operand)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.ExclamationToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } + if (operand == null) throw new ArgumentNullException(nameof(operand)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.ExclamationToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, this.context, out hash); - if (cached != null) return (PostfixUnaryExpressionSyntax)cached; - - var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, this.context, out hash); + if (cached != null) return (PostfixUnaryExpressionSyntax)cached; - return result; + var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + return result; + } + + public MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SimpleMemberAccessExpression: - case SyntaxKind.PointerMemberAccessExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SimpleMemberAccessExpression: + case SyntaxKind.PointerMemberAccessExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.DotToken: - case SyntaxKind.MinusGreaterThanToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (name == null) throw new ArgumentNullException(nameof(name)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.DotToken: + case SyntaxKind.MinusGreaterThanToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, this.context, out hash); - if (cached != null) return (MemberAccessExpressionSyntax)cached; - - var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, this.context, out hash); + if (cached != null) return (MemberAccessExpressionSyntax)cached; - return result; + var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) - { + return result; + } + + public ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); - if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); + if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context, out hash); - if (cached != null) return (ConditionalAccessExpressionSyntax)cached; - - var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context, out hash); + if (cached != null) return (ConditionalAccessExpressionSyntax)cached; - return result; + var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name) - { + return result; + } + + public MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, this.context, out hash); - if (cached != null) return (MemberBindingExpressionSyntax)cached; - - var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, this.context, out hash); + if (cached != null) return (MemberBindingExpressionSyntax)cached; - return result; + var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList) - { + return result; + } + + public ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, this.context, out hash); - if (cached != null) return (ElementBindingExpressionSyntax)cached; - - var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, this.context, out hash); + if (cached != null) return (ElementBindingExpressionSyntax)cached; - return result; + var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) - { + return result; + } + + public RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context, out hash); - if (cached != null) return (RangeExpressionSyntax)cached; - - var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context, out hash); + if (cached != null) return (RangeExpressionSyntax)cached; - return result; + var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList) - { + return result; + } + + public ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, this.context, out hash); - if (cached != null) return (ImplicitElementAccessSyntax)cached; - - var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, this.context, out hash); + if (cached != null) return (ImplicitElementAccessSyntax)cached; - return result; + var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + return result; + } + + public BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.AddExpression: - case SyntaxKind.SubtractExpression: - case SyntaxKind.MultiplyExpression: - case SyntaxKind.DivideExpression: - case SyntaxKind.ModuloExpression: - case SyntaxKind.LeftShiftExpression: - case SyntaxKind.RightShiftExpression: - case SyntaxKind.UnsignedRightShiftExpression: - case SyntaxKind.LogicalOrExpression: - case SyntaxKind.LogicalAndExpression: - case SyntaxKind.BitwiseOrExpression: - case SyntaxKind.BitwiseAndExpression: - case SyntaxKind.ExclusiveOrExpression: - case SyntaxKind.EqualsExpression: - case SyntaxKind.NotEqualsExpression: - case SyntaxKind.LessThanExpression: - case SyntaxKind.LessThanOrEqualExpression: - case SyntaxKind.GreaterThanExpression: - case SyntaxKind.GreaterThanOrEqualExpression: - case SyntaxKind.IsExpression: - case SyntaxKind.AsExpression: - case SyntaxKind.CoalesceExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.AddExpression: + case SyntaxKind.SubtractExpression: + case SyntaxKind.MultiplyExpression: + case SyntaxKind.DivideExpression: + case SyntaxKind.ModuloExpression: + case SyntaxKind.LeftShiftExpression: + case SyntaxKind.RightShiftExpression: + case SyntaxKind.UnsignedRightShiftExpression: + case SyntaxKind.LogicalOrExpression: + case SyntaxKind.LogicalAndExpression: + case SyntaxKind.BitwiseOrExpression: + case SyntaxKind.BitwiseAndExpression: + case SyntaxKind.ExclusiveOrExpression: + case SyntaxKind.EqualsExpression: + case SyntaxKind.NotEqualsExpression: + case SyntaxKind.LessThanExpression: + case SyntaxKind.LessThanOrEqualExpression: + case SyntaxKind.GreaterThanExpression: + case SyntaxKind.GreaterThanOrEqualExpression: + case SyntaxKind.IsExpression: + case SyntaxKind.AsExpression: + case SyntaxKind.CoalesceExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarBarToken: - case SyntaxKind.AmpersandAmpersandToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.IsKeyword: - case SyntaxKind.AsKeyword: - case SyntaxKind.QuestionQuestionToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarBarToken: + case SyntaxKind.AmpersandAmpersandToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.IsKeyword: + case SyntaxKind.AsKeyword: + case SyntaxKind.QuestionQuestionToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); - if (cached != null) return (BinaryExpressionSyntax)cached; - - var result = new BinaryExpressionSyntax(kind, left, operatorToken, right, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); + if (cached != null) return (BinaryExpressionSyntax)cached; - return result; + var result = new BinaryExpressionSyntax(kind, left, operatorToken, right, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + return result; + } + + public AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SimpleAssignmentExpression: - case SyntaxKind.AddAssignmentExpression: - case SyntaxKind.SubtractAssignmentExpression: - case SyntaxKind.MultiplyAssignmentExpression: - case SyntaxKind.DivideAssignmentExpression: - case SyntaxKind.ModuloAssignmentExpression: - case SyntaxKind.AndAssignmentExpression: - case SyntaxKind.ExclusiveOrAssignmentExpression: - case SyntaxKind.OrAssignmentExpression: - case SyntaxKind.LeftShiftAssignmentExpression: - case SyntaxKind.RightShiftAssignmentExpression: - case SyntaxKind.UnsignedRightShiftAssignmentExpression: - case SyntaxKind.CoalesceAssignmentExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SimpleAssignmentExpression: + case SyntaxKind.AddAssignmentExpression: + case SyntaxKind.SubtractAssignmentExpression: + case SyntaxKind.MultiplyAssignmentExpression: + case SyntaxKind.DivideAssignmentExpression: + case SyntaxKind.ModuloAssignmentExpression: + case SyntaxKind.AndAssignmentExpression: + case SyntaxKind.ExclusiveOrAssignmentExpression: + case SyntaxKind.OrAssignmentExpression: + case SyntaxKind.LeftShiftAssignmentExpression: + case SyntaxKind.RightShiftAssignmentExpression: + case SyntaxKind.UnsignedRightShiftAssignmentExpression: + case SyntaxKind.CoalesceAssignmentExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.EqualsToken: - case SyntaxKind.PlusEqualsToken: - case SyntaxKind.MinusEqualsToken: - case SyntaxKind.AsteriskEqualsToken: - case SyntaxKind.SlashEqualsToken: - case SyntaxKind.PercentEqualsToken: - case SyntaxKind.AmpersandEqualsToken: - case SyntaxKind.CaretEqualsToken: - case SyntaxKind.BarEqualsToken: - case SyntaxKind.LessThanLessThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: - case SyntaxKind.QuestionQuestionEqualsToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.EqualsToken: + case SyntaxKind.PlusEqualsToken: + case SyntaxKind.MinusEqualsToken: + case SyntaxKind.AsteriskEqualsToken: + case SyntaxKind.SlashEqualsToken: + case SyntaxKind.PercentEqualsToken: + case SyntaxKind.AmpersandEqualsToken: + case SyntaxKind.CaretEqualsToken: + case SyntaxKind.BarEqualsToken: + case SyntaxKind.LessThanLessThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + case SyntaxKind.QuestionQuestionEqualsToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); - if (cached != null) return (AssignmentExpressionSyntax)cached; - - var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); + if (cached != null) return (AssignmentExpressionSyntax)cached; - return result; + var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) - { + return result; + } + + public ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + { #if DEBUG - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); - if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); - if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); + if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); + if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse)); #endif - return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse, this.context); - } + return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse, this.context); + } - public ThisExpressionSyntax ThisExpression(SyntaxToken token) - { + public ThisExpressionSyntax ThisExpression(SyntaxToken token) + { #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); + if (token == null) throw new ArgumentNullException(nameof(token)); + if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, this.context, out hash); - if (cached != null) return (ThisExpressionSyntax)cached; - - var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, this.context, out hash); + if (cached != null) return (ThisExpressionSyntax)cached; - return result; + var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BaseExpressionSyntax BaseExpression(SyntaxToken token) - { + return result; + } + + public BaseExpressionSyntax BaseExpression(SyntaxToken token) + { #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); + if (token == null) throw new ArgumentNullException(nameof(token)); + if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, this.context, out hash); - if (cached != null) return (BaseExpressionSyntax)cached; - - var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, this.context, out hash); + if (cached != null) return (BaseExpressionSyntax)cached; - return result; + var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) + return result; + } + + public LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ArgListExpression: - case SyntaxKind.NumericLiteralExpression: - case SyntaxKind.StringLiteralExpression: - case SyntaxKind.Utf8StringLiteralExpression: - case SyntaxKind.CharacterLiteralExpression: - case SyntaxKind.TrueLiteralExpression: - case SyntaxKind.FalseLiteralExpression: - case SyntaxKind.NullLiteralExpression: - case SyntaxKind.DefaultLiteralExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ArgListExpression: + case SyntaxKind.NumericLiteralExpression: + case SyntaxKind.StringLiteralExpression: + case SyntaxKind.Utf8StringLiteralExpression: + case SyntaxKind.CharacterLiteralExpression: + case SyntaxKind.TrueLiteralExpression: + case SyntaxKind.FalseLiteralExpression: + case SyntaxKind.NullLiteralExpression: + case SyntaxKind.DefaultLiteralExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - switch (token.Kind) - { - case SyntaxKind.ArgListKeyword: - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.StringLiteralToken: - case SyntaxKind.Utf8StringLiteralToken: - case SyntaxKind.MultiLineRawStringLiteralToken: - case SyntaxKind.Utf8MultiLineRawStringLiteralToken: - case SyntaxKind.SingleLineRawStringLiteralToken: - case SyntaxKind.Utf8SingleLineRawStringLiteralToken: - case SyntaxKind.CharacterLiteralToken: - case SyntaxKind.TrueKeyword: - case SyntaxKind.FalseKeyword: - case SyntaxKind.NullKeyword: - case SyntaxKind.DefaultKeyword: break; - default: throw new ArgumentException(nameof(token)); - } + if (token == null) throw new ArgumentNullException(nameof(token)); + switch (token.Kind) + { + case SyntaxKind.ArgListKeyword: + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.StringLiteralToken: + case SyntaxKind.Utf8StringLiteralToken: + case SyntaxKind.MultiLineRawStringLiteralToken: + case SyntaxKind.Utf8MultiLineRawStringLiteralToken: + case SyntaxKind.SingleLineRawStringLiteralToken: + case SyntaxKind.Utf8SingleLineRawStringLiteralToken: + case SyntaxKind.CharacterLiteralToken: + case SyntaxKind.TrueKeyword: + case SyntaxKind.FalseKeyword: + case SyntaxKind.NullKeyword: + case SyntaxKind.DefaultKeyword: break; + default: throw new ArgumentException(nameof(token)); + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, token, this.context, out hash); - if (cached != null) return (LiteralExpressionSyntax)cached; - - var result = new LiteralExpressionSyntax(kind, token, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, token, this.context, out hash); + if (cached != null) return (LiteralExpressionSyntax)cached; - return result; + var result = new LiteralExpressionSyntax(kind, token, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + return result; + } + + public MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken, this.context); - } + return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken, this.context); + } - public RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + public RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken, this.context); - } + return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken, this.context); + } - public RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) - { + public RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (comma == null) throw new ArgumentNullException(nameof(comma)); - if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (comma == null) throw new ArgumentNullException(nameof(comma)); + if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken, this.context); - } + return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken, this.context); + } - public CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + public CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.CheckedExpression: - case SyntaxKind.UncheckedExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.CheckedExpression: + case SyntaxKind.UncheckedExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.UncheckedKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.CheckedKeyword: + case SyntaxKind.UncheckedKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken, this.context); - } + return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken, this.context); + } - public DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken, this.context); - } + return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken, this.context); + } - public TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); - } + return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); + } - public SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); - } + return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); + } - public InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList) - { + public InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, this.context, out hash); - if (cached != null) return (InvocationExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, this.context, out hash); + if (cached != null) return (InvocationExpressionSyntax)cached; - var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - { + return result; + } + + public ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, this.context, out hash); - if (cached != null) return (ElementAccessExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, this.context, out hash); + if (cached != null) return (ElementAccessExpressionSyntax)cached; - var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); - if (cached != null) return (ArgumentListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); + if (cached != null) return (ArgumentListSyntax)cached; - var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) - { + return result; + } + + public BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (BracketedArgumentListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (BracketedArgumentListSyntax)cached; - var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) - { + return result; + } + + public ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) + { #if DEBUG - if (refKindKeyword != null) + if (refKindKeyword != null) + { + switch (refKindKeyword.Kind) { - switch (refKindKeyword.Kind) - { - case SyntaxKind.RefKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.InKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(refKindKeyword)); - } + case SyntaxKind.RefKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.InKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(refKindKeyword)); } - if (expression == null) throw new ArgumentNullException(nameof(expression)); + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context, out hash); - if (cached != null) return (ArgumentSyntax)cached; - - var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context, out hash); + if (cached != null) return (ArgumentSyntax)cached; - return result; + var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken) - { + return result; + } + + public ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, this.context, out hash); - if (cached != null) return (ExpressionColonSyntax)cached; - - var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, this.context, out hash); + if (cached != null) return (ExpressionColonSyntax)cached; - return result; + var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken) - { + return result; + } + + public NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, this.context, out hash); - if (cached != null) return (NameColonSyntax)cached; - - var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, this.context, out hash); + if (cached != null) return (NameColonSyntax)cached; - return result; + var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) - { + return result; + } + + public DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, this.context, out hash); - if (cached != null) return (DeclarationExpressionSyntax)cached; - - var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, this.context, out hash); + if (cached != null) return (DeclarationExpressionSyntax)cached; - return result; + var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) - { + return result; + } + + public CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression, this.context); - } + return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression, this.context); + } - public AnonymousMethodExpressionSyntax AnonymousMethodExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) - { + public AnonymousMethodExpressionSyntax AnonymousMethodExpression(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody, this.context); - } + return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody, this.context); + } - public SimpleLambdaExpressionSyntax SimpleLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { + public SimpleLambdaExpressionSyntax SimpleLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (parameter == null) throw new ArgumentNullException(nameof(parameter)); - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (parameter == null) throw new ArgumentNullException(nameof(parameter)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); #endif - return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody, this.context); - } + return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody, this.context); + } - public RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression) - { + public RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression) + { #if DEBUG - if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); - if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); + if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, this.context, out hash); - if (cached != null) return (RefExpressionSyntax)cached; - - var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, this.context, out hash); + if (cached != null) return (RefExpressionSyntax)cached; - return result; + var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { + return result; + } + + public ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); #endif - return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody, this.context); - } + return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody, this.context); + } - public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ObjectInitializerExpression: - case SyntaxKind.CollectionInitializerExpression: - case SyntaxKind.ArrayInitializerExpression: - case SyntaxKind.ComplexElementInitializerExpression: - case SyntaxKind.WithInitializerExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ObjectInitializerExpression: + case SyntaxKind.CollectionInitializerExpression: + case SyntaxKind.ArrayInitializerExpression: + case SyntaxKind.ComplexElementInitializerExpression: + case SyntaxKind.WithInitializerExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, this.context, out hash); - if (cached != null) return (InitializerExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, this.context, out hash); + if (cached != null) return (InitializerExpressionSyntax)cached; - var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) - { + return result; + } + + public ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context, out hash); - if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context, out hash); + if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached; - var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) - { + return result; + } + + public ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer, this.context); - } + return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer, this.context); + } - public WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) - { + public WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword)); - if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword)); + if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context, out hash); - if (cached != null) return (WithExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context, out hash); + if (cached != null) return (WithExpressionSyntax)cached; - var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) - { + return result; + } + + public AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context, out hash); - if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context, out hash); + if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached; - var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) - { + return result; + } + + public AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken, this.context); - } + return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken, this.context); + } - public ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) - { + public ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context, out hash); - if (cached != null) return (ArrayCreationExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context, out hash); + if (cached != null) return (ArrayCreationExpressionSyntax)cached; - var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { + return result; + } + + public ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer, this.context); - } + return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer, this.context); + } - public StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) - { + public StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); - if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); + if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context, out hash); - if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context, out hash); + if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached; - var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { + return result; + } + + public ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { #if DEBUG - if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); - if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); + if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer, this.context); - } + return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer, this.context); + } - public CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) - { + public CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (CollectionExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (CollectionExpressionSyntax)cached; - var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ExpressionElementSyntax ExpressionElement(ExpressionSyntax expression) - { + return result; + } + + public ExpressionElementSyntax ExpressionElement(ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, this.context, out hash); - if (cached != null) return (ExpressionElementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, this.context, out hash); + if (cached != null) return (ExpressionElementSyntax)cached; - var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SpreadElementSyntax SpreadElement(SyntaxToken operatorToken, ExpressionSyntax expression) - { + return result; + } + + public SpreadElementSyntax SpreadElement(SyntaxToken operatorToken, ExpressionSyntax expression) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, this.context, out hash); - if (cached != null) return (SpreadElementSyntax)cached; - - var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, this.context, out hash); + if (cached != null) return (SpreadElementSyntax)cached; - public QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body) + var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression, this.context); + if (hash >= 0) { + SyntaxNodeCache.AddNode(result, hash); + } + + return result; + } + + public QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body) + { #if DEBUG - if (fromClause == null) throw new ArgumentNullException(nameof(fromClause)); - if (body == null) throw new ArgumentNullException(nameof(body)); + if (fromClause == null) throw new ArgumentNullException(nameof(fromClause)); + if (body == null) throw new ArgumentNullException(nameof(body)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, this.context, out hash); - if (cached != null) return (QueryExpressionSyntax)cached; - - var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, this.context, out hash); + if (cached != null) return (QueryExpressionSyntax)cached; - return result; + var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public QueryBodySyntax QueryBody(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) - { + return result; + } + + public QueryBodySyntax QueryBody(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + { #if DEBUG - if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); + if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context, out hash); - if (cached != null) return (QueryBodySyntax)cached; - - var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context, out hash); + if (cached != null) return (QueryBodySyntax)cached; - return result; + var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) - { + return result; + } + + public FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + { #if DEBUG - if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword)); - if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword)); + if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression, this.context); - } + return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression, this.context); + } - public LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) - { + public LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + { #if DEBUG - if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword)); - if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword)); + if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression, this.context); - } + return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression, this.context); + } - public JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) - { + public JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + { #if DEBUG - if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword)); - if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (inExpression == null) throw new ArgumentNullException(nameof(inExpression)); - if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword)); - if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); - if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression)); - if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword)); - if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); - if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression)); + if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword)); + if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (inExpression == null) throw new ArgumentNullException(nameof(inExpression)); + if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword)); + if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); + if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression)); + if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword)); + if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); + if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression)); #endif - return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into, this.context); - } + return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into, this.context); + } - public JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier) - { + public JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier) + { #if DEBUG - if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); - if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); + if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context, out hash); - if (cached != null) return (JoinIntoClauseSyntax)cached; - - var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context, out hash); + if (cached != null) return (JoinIntoClauseSyntax)cached; - return result; + var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition) - { + return result; + } + + public WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition) + { #if DEBUG - if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); - if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); + if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, this.context, out hash); - if (cached != null) return (WhereClauseSyntax)cached; - - var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, this.context, out hash); + if (cached != null) return (WhereClauseSyntax)cached; - return result; + var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList orderings) - { + return result; + } + + public OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) + { #if DEBUG - if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword)); - if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); + if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword)); + if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context, out hash); - if (cached != null) return (OrderByClauseSyntax)cached; - - var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context, out hash); + if (cached != null) return (OrderByClauseSyntax)cached; - return result; + var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) + return result; + } + + public OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.AscendingOrdering: - case SyntaxKind.DescendingOrdering: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.AscendingOrdering: + case SyntaxKind.DescendingOrdering: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (ascendingOrDescendingKeyword != null) + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (ascendingOrDescendingKeyword != null) + { + switch (ascendingOrDescendingKeyword.Kind) { - switch (ascendingOrDescendingKeyword.Kind) - { - case SyntaxKind.AscendingKeyword: - case SyntaxKind.DescendingKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword)); - } + case SyntaxKind.AscendingKeyword: + case SyntaxKind.DescendingKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword)); } + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, this.context, out hash); - if (cached != null) return (OrderingSyntax)cached; - - var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, this.context, out hash); + if (cached != null) return (OrderingSyntax)cached; - return result; + var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression) - { + return result; + } + + public SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression) + { #if DEBUG - if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword)); - if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword)); + if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, this.context, out hash); - if (cached != null) return (SelectClauseSyntax)cached; - - var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, this.context, out hash); + if (cached != null) return (SelectClauseSyntax)cached; - return result; + var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) - { + return result; + } + + public GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + { #if DEBUG - if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword)); - if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); - if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression)); - if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword)); - if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); - if (byExpression == null) throw new ArgumentNullException(nameof(byExpression)); + if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword)); + if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); + if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression)); + if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword)); + if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); + if (byExpression == null) throw new ArgumentNullException(nameof(byExpression)); #endif - return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression, this.context); - } + return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression, this.context); + } - public QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) - { + public QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + { #if DEBUG - if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); - if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (body == null) throw new ArgumentNullException(nameof(body)); + if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); + if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (body == null) throw new ArgumentNullException(nameof(body)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context, out hash); - if (cached != null) return (QueryContinuationSyntax)cached; - - var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context, out hash); + if (cached != null) return (QueryContinuationSyntax)cached; - return result; + var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken) - { + return result; + } + + public OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken) + { #if DEBUG - if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken)); - if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); + if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken)); + if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context, out hash); - if (cached != null) return (OmittedArraySizeExpressionSyntax)cached; - - var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context, out hash); + if (cached != null) return (OmittedArraySizeExpressionSyntax)cached; - return result; + var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList contents, SyntaxToken stringEndToken) - { + return result; + } + + public InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) + { #if DEBUG - if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken)); - switch (stringStartToken.Kind) - { - case SyntaxKind.InterpolatedStringStartToken: - case SyntaxKind.InterpolatedVerbatimStringStartToken: - case SyntaxKind.InterpolatedSingleLineRawStringStartToken: - case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; - default: throw new ArgumentException(nameof(stringStartToken)); - } - if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken)); - switch (stringEndToken.Kind) - { - case SyntaxKind.InterpolatedStringEndToken: - case SyntaxKind.InterpolatedRawStringEndToken: break; - default: throw new ArgumentException(nameof(stringEndToken)); - } + if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken)); + switch (stringStartToken.Kind) + { + case SyntaxKind.InterpolatedStringStartToken: + case SyntaxKind.InterpolatedVerbatimStringStartToken: + case SyntaxKind.InterpolatedSingleLineRawStringStartToken: + case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; + default: throw new ArgumentException(nameof(stringStartToken)); + } + if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken)); + switch (stringEndToken.Kind) + { + case SyntaxKind.InterpolatedStringEndToken: + case SyntaxKind.InterpolatedRawStringEndToken: break; + default: throw new ArgumentException(nameof(stringEndToken)); + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context, out hash); - if (cached != null) return (InterpolatedStringExpressionSyntax)cached; - - var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context, out hash); + if (cached != null) return (InterpolatedStringExpressionSyntax)cached; - return result; + var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) - { + return result; + } + + public IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword)); - if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword)); + if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context, out hash); - if (cached != null) return (IsPatternExpressionSyntax)cached; - - var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context, out hash); + if (cached != null) return (IsPatternExpressionSyntax)cached; - return result; + var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression) - { + return result; + } + + public ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression) + { #if DEBUG - if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); - if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); + if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, this.context, out hash); - if (cached != null) return (ThrowExpressionSyntax)cached; - - var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, this.context, out hash); + if (cached != null) return (ThrowExpressionSyntax)cached; - return result; + var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition) - { + return result; + } + + public WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition) + { #if DEBUG - if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); - if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); + if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, this.context, out hash); - if (cached != null) return (WhenClauseSyntax)cached; - - var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, this.context, out hash); + if (cached != null) return (WhenClauseSyntax)cached; - return result; + var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken) - { + return result; + } + + public DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken) + { #if DEBUG - if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); - if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); + if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); + if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, this.context, out hash); - if (cached != null) return (DiscardPatternSyntax)cached; - - var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, this.context, out hash); + if (cached != null) return (DiscardPatternSyntax)cached; - return result; + var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) - { + return result; + } + + public DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, this.context, out hash); - if (cached != null) return (DeclarationPatternSyntax)cached; - - var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, this.context, out hash); + if (cached != null) return (DeclarationPatternSyntax)cached; - return result; + var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation) - { + return result; + } + + public VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation) + { #if DEBUG - if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword)); - if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword)); + if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, this.context, out hash); - if (cached != null) return (VarPatternSyntax)cached; - - var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, this.context, out hash); + if (cached != null) return (VarPatternSyntax)cached; - return result; + var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) - { + return result; + } + + public RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) + { #if DEBUG #endif - return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation, this.context); - } + return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation, this.context); + } - public PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) - { + public PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context, out hash); - if (cached != null) return (PositionalPatternClauseSyntax)cached; - - var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context, out hash); + if (cached != null) return (PositionalPatternClauseSyntax)cached; - return result; + var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) - { + return result; + } + + public PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context, out hash); - if (cached != null) return (PropertyPatternClauseSyntax)cached; - - var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context, out hash); + if (cached != null) return (PropertyPatternClauseSyntax)cached; - return result; + var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) - { + return result; + } + + public SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) + { #if DEBUG - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, this.context, out hash); - if (cached != null) return (SubpatternSyntax)cached; - - var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, this.context, out hash); + if (cached != null) return (SubpatternSyntax)cached; - return result; + var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression) - { + return result; + } + + public ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, this.context, out hash); - if (cached != null) return (ConstantPatternSyntax)cached; - - var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, this.context, out hash); + if (cached != null) return (ConstantPatternSyntax)cached; - return result; + var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) - { + return result; + } + + public ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context, out hash); - if (cached != null) return (ParenthesizedPatternSyntax)cached; - - var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context, out hash); + if (cached != null) return (ParenthesizedPatternSyntax)cached; - return result; + var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression) - { + return result; + } + + public RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, this.context, out hash); - if (cached != null) return (RelationalPatternSyntax)cached; - - var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, this.context, out hash); + if (cached != null) return (RelationalPatternSyntax)cached; - return result; + var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypePatternSyntax TypePattern(TypeSyntax type) - { + return result; + } + + public TypePatternSyntax TypePattern(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, this.context, out hash); - if (cached != null) return (TypePatternSyntax)cached; - - var result = new TypePatternSyntax(SyntaxKind.TypePattern, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, this.context, out hash); + if (cached != null) return (TypePatternSyntax)cached; - return result; + var result = new TypePatternSyntax(SyntaxKind.TypePattern, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + return result; + } + + public BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.OrPattern: - case SyntaxKind.AndPattern: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.OrPattern: + case SyntaxKind.AndPattern: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.OrKeyword: - case SyntaxKind.AndKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.OrKeyword: + case SyntaxKind.AndKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); - if (cached != null) return (BinaryPatternSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); + if (cached != null) return (BinaryPatternSyntax)cached; - var result = new BinaryPatternSyntax(kind, left, operatorToken, right, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new BinaryPatternSyntax(kind, left, operatorToken, right, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern) - { + return result; + } + + public UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, this.context, out hash); - if (cached != null) return (UnaryPatternSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, this.context, out hash); + if (cached != null) return (UnaryPatternSyntax)cached; - var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ListPatternSyntax ListPattern(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) - { + return result; + } + + public ListPatternSyntax ListPattern(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation, this.context); - } + return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation, this.context); + } - public SlicePatternSyntax SlicePattern(SyntaxToken dotDotToken, PatternSyntax? pattern) - { + public SlicePatternSyntax SlicePattern(SyntaxToken dotDotToken, PatternSyntax? pattern) + { #if DEBUG - if (dotDotToken == null) throw new ArgumentNullException(nameof(dotDotToken)); - if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); + if (dotDotToken == null) throw new ArgumentNullException(nameof(dotDotToken)); + if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, this.context, out hash); - if (cached != null) return (SlicePatternSyntax)cached; - - var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, this.context, out hash); + if (cached != null) return (SlicePatternSyntax)cached; - public InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken) + var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern, this.context); + if (hash >= 0) { + SyntaxNodeCache.AddNode(result, hash); + } + + return result; + } + + public InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken) + { #if DEBUG - if (textToken == null) throw new ArgumentNullException(nameof(textToken)); - if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); + if (textToken == null) throw new ArgumentNullException(nameof(textToken)); + if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, this.context, out hash); - if (cached != null) return (InterpolatedStringTextSyntax)cached; - - var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, this.context, out hash); + if (cached != null) return (InterpolatedStringTextSyntax)cached; - return result; + var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) - { + return result; + } + + public InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken, this.context); - } + return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken, this.context); + } - public InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value) - { + public InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value) + { #if DEBUG - if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); - if (value == null) throw new ArgumentNullException(nameof(value)); + if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); + if (value == null) throw new ArgumentNullException(nameof(value)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context, out hash); - if (cached != null) return (InterpolationAlignmentClauseSyntax)cached; - - var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context, out hash); + if (cached != null) return (InterpolationAlignmentClauseSyntax)cached; - return result; + var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken) - { + return result; + } + + public InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken) + { #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken)); - if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken)); + if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context, out hash); - if (cached != null) return (InterpolationFormatClauseSyntax)cached; - - var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context, out hash); + if (cached != null) return (InterpolationFormatClauseSyntax)cached; - return result; + var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public GlobalStatementSyntax GlobalStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, StatementSyntax statement) - { + return result; + } + + public GlobalStatementSyntax GlobalStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) + { #if DEBUG - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context, out hash); - if (cached != null) return (GlobalStatementSyntax)cached; - - var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context, out hash); + if (cached != null) return (GlobalStatementSyntax)cached; - return result; + var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BlockSyntax Block(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements, SyntaxToken closeBraceToken) - { + return result; + } + + public BlockSyntax Block(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken, this.context); - } + return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken, this.context); + } - public LocalFunctionStatementSyntax LocalFunctionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public LocalFunctionStatementSyntax LocalFunctionStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); - } + return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); + } - public LocalDeclarationStatementSyntax LocalDeclarationStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + public LocalDeclarationStatementSyntax LocalDeclarationStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (usingKeyword != null) + } + if (usingKeyword != null) + { + switch (usingKeyword.Kind) { - switch (usingKeyword.Kind) - { - case SyntaxKind.UsingKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(usingKeyword)); - } + case SyntaxKind.UsingKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(usingKeyword)); } - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken, this.context); - } + return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken, this.context); + } - public VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables) - { + public VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, this.context, out hash); - if (cached != null) return (VariableDeclarationSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, this.context, out hash); + if (cached != null) return (VariableDeclarationSyntax)cached; - var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) - { + return result; + } + + public VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context, out hash); - if (cached != null) return (VariableDeclaratorSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context, out hash); + if (cached != null) return (VariableDeclaratorSyntax)cached; - var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value) - { + return result; + } + + public EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value) + { #if DEBUG - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (value == null) throw new ArgumentNullException(nameof(value)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (value == null) throw new ArgumentNullException(nameof(value)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, this.context, out hash); - if (cached != null) return (EqualsValueClauseSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, this.context, out hash); + if (cached != null) return (EqualsValueClauseSyntax)cached; - var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier) - { + return result; + } + + public SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, this.context, out hash); - if (cached != null) return (SingleVariableDesignationSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, this.context, out hash); + if (cached != null) return (SingleVariableDesignationSyntax)cached; - var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) - { + return result; + } + + public DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) + { #if DEBUG - if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); - if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); + if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); + if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, this.context, out hash); - if (cached != null) return (DiscardDesignationSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, this.context, out hash); + if (cached != null) return (DiscardDesignationSyntax)cached; - var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) - { + return result; + } + + public ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context, out hash); - if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context, out hash); + if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached; - var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ExpressionStatementSyntax ExpressionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) - { + return result; + } + + public ExpressionStatementSyntax ExpressionStatement(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context, out hash); - if (cached != null) return (ExpressionStatementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context, out hash); + if (cached != null) return (ExpressionStatementSyntax)cached; - var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public EmptyStatementSyntax EmptyStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) - { + return result; + } + + public EmptyStatementSyntax EmptyStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + { #if DEBUG - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context, out hash); - if (cached != null) return (EmptyStatementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context, out hash); + if (cached != null) return (EmptyStatementSyntax)cached; - var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public LabeledStatementSyntax LabeledStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) - { + return result; + } + + public LabeledStatementSyntax LabeledStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement, this.context); - } + return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement, this.context); + } - public GotoStatementSyntax GotoStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.GotoStatement: - case SyntaxKind.GotoCaseStatement: - case SyntaxKind.GotoDefaultStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.GotoStatement: + case SyntaxKind.GotoCaseStatement: + case SyntaxKind.GotoDefaultStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword)); - if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); - if (caseOrDefaultKeyword != null) + if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword)); + if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); + if (caseOrDefaultKeyword != null) + { + switch (caseOrDefaultKeyword.Kind) { - switch (caseOrDefaultKeyword.Kind) - { - case SyntaxKind.CaseKeyword: - case SyntaxKind.DefaultKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(caseOrDefaultKeyword)); - } + case SyntaxKind.CaseKeyword: + case SyntaxKind.DefaultKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(caseOrDefaultKeyword)); } - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken, this.context); - } + return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken, this.context); + } - public BreakStatementSyntax BreakStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) - { + public BreakStatementSyntax BreakStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + { #if DEBUG - if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword)); - if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword)); + if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context, out hash); - if (cached != null) return (BreakStatementSyntax)cached; - - var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context, out hash); + if (cached != null) return (BreakStatementSyntax)cached; - return result; + var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ContinueStatementSyntax ContinueStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) - { + return result; + } + + public ContinueStatementSyntax ContinueStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + { #if DEBUG - if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword)); - if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword)); + if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context, out hash); - if (cached != null) return (ContinueStatementSyntax)cached; - - var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context, out hash); + if (cached != null) return (ContinueStatementSyntax)cached; - return result; + var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ReturnStatementSyntax ReturnStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { + return result; + } + + public ReturnStatementSyntax ReturnStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { #if DEBUG - if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword)); - if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword)); + if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken, this.context); - } + return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken, this.context); + } - public ThrowStatementSyntax ThrowStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { + public ThrowStatementSyntax ThrowStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { #if DEBUG - if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); - if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); + if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken, this.context); - } + return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken, this.context); + } - public YieldStatementSyntax YieldStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.YieldReturnStatement: - case SyntaxKind.YieldBreakStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.YieldReturnStatement: + case SyntaxKind.YieldBreakStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword)); - if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); - if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword)); - switch (returnOrBreakKeyword.Kind) - { - case SyntaxKind.ReturnKeyword: - case SyntaxKind.BreakKeyword: break; - default: throw new ArgumentException(nameof(returnOrBreakKeyword)); - } - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword)); + if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); + if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword)); + switch (returnOrBreakKeyword.Kind) + { + case SyntaxKind.ReturnKeyword: + case SyntaxKind.BreakKeyword: break; + default: throw new ArgumentException(nameof(returnOrBreakKeyword)); + } + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken, this.context); - } + return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken, this.context); + } - public WhileStatementSyntax WhileStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) - { + public WhileStatementSyntax WhileStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); - if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); + if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement, this.context); - } + return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement, this.context); + } - public DoStatementSyntax DoStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) - { + public DoStatementSyntax DoStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + { #if DEBUG - if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword)); - if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); - if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword)); + if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); + if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.context); - } + return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.context); + } - public ForStatementSyntax ForStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) - { + public ForStatementSyntax ForStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword)); - if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken)); - if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); - if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken)); - if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword)); + if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken)); + if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); + if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken)); + if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement, this.context); - } + return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement, this.context); + } - public ForEachStatementSyntax ForEachStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public ForEachStatementSyntax ForEachStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); - if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); + if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement, this.context); - } + return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement, this.context); + } - public ForEachVariableStatementSyntax ForEachVariableStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public ForEachVariableStatementSyntax ForEachVariableStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); - if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (variable == null) throw new ArgumentNullException(nameof(variable)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); + if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (variable == null) throw new ArgumentNullException(nameof(variable)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement, this.context); - } + return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement, this.context); + } - public UsingStatementSyntax UsingStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public UsingStatementSyntax UsingStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); - if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); + if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement, this.context); - } + return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement, this.context); + } - public FixedStatementSyntax FixedStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) - { + public FixedStatementSyntax FixedStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword)); - if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword)); + if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement, this.context); - } + return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement, this.context); + } - public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.CheckedStatement: - case SyntaxKind.UncheckedStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.CheckedStatement: + case SyntaxKind.UncheckedStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.UncheckedKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (block == null) throw new ArgumentNullException(nameof(block)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.CheckedKeyword: + case SyntaxKind.UncheckedKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, this.context, out hash); - if (cached != null) return (CheckedStatementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, this.context, out hash); + if (cached != null) return (CheckedStatementSyntax)cached; - var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public UnsafeStatementSyntax UnsafeStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) - { + return result; + } + + public UnsafeStatementSyntax UnsafeStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + { #if DEBUG - if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword)); - if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword)); + if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context, out hash); - if (cached != null) return (UnsafeStatementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context, out hash); + if (cached != null) return (UnsafeStatementSyntax)cached; - var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public LockStatementSyntax LockStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + return result; + } + + public LockStatementSyntax LockStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword)); - if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword)); + if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement, this.context); - } + return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement, this.context); + } - public IfStatementSyntax IfStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) - { + public IfStatementSyntax IfStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + { #if DEBUG - if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); - if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); + if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else, this.context); - } + return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else, this.context); + } - public ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement) - { + public ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement) + { #if DEBUG - if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); - if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); + if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, this.context, out hash); - if (cached != null) return (ElseClauseSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, this.context, out hash); + if (cached != null) return (ElseClauseSyntax)cached; - var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SwitchStatementSyntax SwitchStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList sections, SyntaxToken closeBraceToken) - { + return result; + } + + public SwitchStatementSyntax SwitchStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + { #if DEBUG - if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); - if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); - if (openParenToken != null) + if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); + if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); + if (openParenToken != null) + { + switch (openParenToken.Kind) { - switch (openParenToken.Kind) - { - case SyntaxKind.OpenParenToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openParenToken)); - } + case SyntaxKind.OpenParenToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openParenToken)); } - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken != null) + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken != null) + { + switch (closeParenToken.Kind) { - switch (closeParenToken.Kind) - { - case SyntaxKind.CloseParenToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeParenToken)); - } + case SyntaxKind.CloseParenToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeParenToken)); } - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + } + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken, this.context); - } + return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken, this.context); + } - public SwitchSectionSyntax SwitchSection(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements) - { + public SwitchSectionSyntax SwitchSection(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) + { #if DEBUG #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context, out hash); - if (cached != null) return (SwitchSectionSyntax)cached; - - var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context, out hash); + if (cached != null) return (SwitchSectionSyntax)cached; - public CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context); + if (hash >= 0) { + SyntaxNodeCache.AddNode(result, hash); + } + + return result; + } + + public CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken, this.context); - } + return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken, this.context); + } - public CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) - { + public CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); - if (value == null) throw new ArgumentNullException(nameof(value)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); + if (value == null) throw new ArgumentNullException(nameof(value)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context, out hash); - if (cached != null) return (CaseSwitchLabelSyntax)cached; - - var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context, out hash); + if (cached != null) return (CaseSwitchLabelSyntax)cached; - return result; + var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken) - { + return result; + } + + public DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context, out hash); - if (cached != null) return (DefaultSwitchLabelSyntax)cached; - - var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context, out hash); + if (cached != null) return (DefaultSwitchLabelSyntax)cached; - return result; + var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) - { + return result; + } + + public SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + { #if DEBUG - if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); - if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); - if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); + if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); + if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken, this.context); - } + return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken, this.context); + } - public SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) - { + public SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + { #if DEBUG - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken)); - if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken)); + if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression, this.context); - } + return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression, this.context); + } - public TryStatementSyntax TryStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) - { + public TryStatementSyntax TryStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) + { #if DEBUG - if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword)); - if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword)); + if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally, this.context); - } + return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally, this.context); + } - public CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - { + public CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) + { #if DEBUG - if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword)); - if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword)); + if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block, this.context); - } + return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block, this.context); + } - public CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) - { + public CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier != null) + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier != null) + { + switch (identifier.Kind) { - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(identifier)); - } + case SyntaxKind.IdentifierToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(identifier)); } - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + } + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken, this.context); - } + return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken, this.context); + } - public CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) - { + public CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + { #if DEBUG - if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); - if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); + if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken, this.context); - } + return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken, this.context); + } - public FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block) - { + public FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block) + { #if DEBUG - if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword)); - if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword)); + if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, this.context, out hash); - if (cached != null) return (FinallyClauseSyntax)cached; - - var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, this.context, out hash); + if (cached != null) return (FinallyClauseSyntax)cached; - return result; + var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public CompilationUnitSyntax CompilationUnit(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken endOfFileToken) - { + return result; + } + + public CompilationUnitSyntax CompilationUnit(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) + { #if DEBUG - if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken)); - if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); + if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken)); + if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); #endif - return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken, this.context); - } + return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken, this.context); + } - public ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) - { + public ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + { #if DEBUG - if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword)); - if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); - if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword)); - if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword)); + if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); + if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword)); + if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken, this.context); - } + return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken, this.context); + } - public UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) - { + public UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + { #if DEBUG - if (globalKeyword != null) + if (globalKeyword != null) + { + switch (globalKeyword.Kind) { - switch (globalKeyword.Kind) - { - case SyntaxKind.GlobalKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(globalKeyword)); - } + case SyntaxKind.GlobalKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(globalKeyword)); } - if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); - if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); - if (staticKeyword != null) + } + if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); + if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); + if (staticKeyword != null) + { + switch (staticKeyword.Kind) { - switch (staticKeyword.Kind) - { - case SyntaxKind.StaticKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(staticKeyword)); - } + case SyntaxKind.StaticKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(staticKeyword)); } - if (unsafeKeyword != null) + } + if (unsafeKeyword != null) + { + switch (unsafeKeyword.Kind) { - switch (unsafeKeyword.Kind) - { - case SyntaxKind.UnsafeKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(unsafeKeyword)); - } + case SyntaxKind.UnsafeKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(unsafeKeyword)); } - if (namespaceOrType == null) throw new ArgumentNullException(nameof(namespaceOrType)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (namespaceOrType == null) throw new ArgumentNullException(nameof(namespaceOrType)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken, this.context); - } + return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken, this.context); + } - public NamespaceDeclarationSyntax NamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) - { + public NamespaceDeclarationSyntax NamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); - if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - if (semicolonToken != null) + if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); + if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken, this.context); + } - public FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members) - { + public FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) + { #if DEBUG - if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); - if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); + if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node, this.context); - } + return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node, this.context); + } - public AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) - { + public AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken, this.context); - } + return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken, this.context); + } - public AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken) - { + public AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context, out hash); - if (cached != null) return (AttributeTargetSpecifierSyntax)cached; - - var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context, out hash); + if (cached != null) return (AttributeTargetSpecifierSyntax)cached; - return result; + var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList) - { + return result; + } + + public AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, this.context, out hash); - if (cached != null) return (AttributeSyntax)cached; - - var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, this.context, out hash); + if (cached != null) return (AttributeSyntax)cached; - return result; + var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); - if (cached != null) return (AttributeArgumentListSyntax)cached; - - var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); + if (cached != null) return (AttributeArgumentListSyntax)cached; - return result; + var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) - { + return result; + } + + public AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context, out hash); - if (cached != null) return (AttributeArgumentSyntax)cached; - - var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context, out hash); + if (cached != null) return (AttributeArgumentSyntax)cached; - return result; + var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken) - { + return result; + } + + public NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, this.context, out hash); - if (cached != null) return (NameEqualsSyntax)cached; - - var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, this.context, out hash); + if (cached != null) return (NameEqualsSyntax)cached; - return result; + var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { + return result; + } + + public TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); - if (cached != null) return (TypeParameterListSyntax)cached; - - var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); + if (cached != null) return (TypeParameterListSyntax)cached; - return result; + var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypeParameterSyntax TypeParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) - { + return result; + } + + public TypeParameterSyntax TypeParameter(CoreSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) + { #if DEBUG - if (varianceKeyword != null) + if (varianceKeyword != null) + { + switch (varianceKeyword.Kind) { - switch (varianceKeyword.Kind) - { - case SyntaxKind.InKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(varianceKeyword)); - } + case SyntaxKind.InKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(varianceKeyword)); } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context, out hash); - if (cached != null) return (TypeParameterSyntax)cached; - - var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context, out hash); + if (cached != null) return (TypeParameterSyntax)cached; - return result; + var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ClassDeclarationSyntax ClassDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + return result; + } + + public ClassDeclarationSyntax ClassDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); + } - public StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public StructDeclarationSyntax StructDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); + } - public InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public InterfaceDeclarationSyntax InterfaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); + } - public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.RecordDeclaration: - case SyntaxKind.RecordStructDeclaration: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.RecordDeclaration: + case SyntaxKind.RecordStructDeclaration: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (classOrStructKeyword != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (classOrStructKeyword != null) + { + switch (classOrStructKeyword.Kind) { - switch (classOrStructKeyword.Kind) - { - case SyntaxKind.ClassKeyword: - case SyntaxKind.StructKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(classOrStructKeyword)); - } + case SyntaxKind.ClassKeyword: + case SyntaxKind.StructKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(classOrStructKeyword)); } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); + } - public EnumDeclarationSyntax EnumDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public EnumDeclarationSyntax EnumDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword)); - if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword)); + if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); + } - public DelegateDeclarationSyntax DelegateDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) - { + public DelegateDeclarationSyntax DelegateDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken, this.context); - } + return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken, this.context); + } - public EnumMemberDeclarationSyntax EnumMemberDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) - { + public EnumMemberDeclarationSyntax EnumMemberDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue, this.context); - } + return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue, this.context); + } - public BaseListSyntax BaseList(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList types) - { + public BaseListSyntax BaseList(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) + { #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, this.context, out hash); - if (cached != null) return (BaseListSyntax)cached; - - var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, this.context, out hash); + if (cached != null) return (BaseListSyntax)cached; - return result; + var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) - { + return result; + } + + public SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, this.context, out hash); - if (cached != null) return (SimpleBaseTypeSyntax)cached; - - var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, this.context, out hash); + if (cached != null) return (SimpleBaseTypeSyntax)cached; - return result; + var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) - { + return result; + } + + public PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context, out hash); - if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached; - - var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context, out hash); + if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached; - return result; + var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList constraints) - { + return result; + } + + public TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) + { #if DEBUG - if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); - if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); + if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node, this.context); - } + return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node, this.context); + } - public ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) - { + public ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context, out hash); - if (cached != null) return (ConstructorConstraintSyntax)cached; - - var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context, out hash); + if (cached != null) return (ConstructorConstraintSyntax)cached; - return result; + var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) + return result; + } + + public ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ClassConstraint: - case SyntaxKind.StructConstraint: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ClassConstraint: + case SyntaxKind.StructConstraint: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword)); - switch (classOrStructKeyword.Kind) - { - case SyntaxKind.ClassKeyword: - case SyntaxKind.StructKeyword: break; - default: throw new ArgumentException(nameof(classOrStructKeyword)); - } - if (questionToken != null) + if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword)); + switch (classOrStructKeyword.Kind) + { + case SyntaxKind.ClassKeyword: + case SyntaxKind.StructKeyword: break; + default: throw new ArgumentException(nameof(classOrStructKeyword)); + } + if (questionToken != null) + { + switch (questionToken.Kind) { - switch (questionToken.Kind) - { - case SyntaxKind.QuestionToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(questionToken)); - } + case SyntaxKind.QuestionToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(questionToken)); } + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, this.context, out hash); - if (cached != null) return (ClassOrStructConstraintSyntax)cached; - - var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, this.context, out hash); + if (cached != null) return (ClassOrStructConstraintSyntax)cached; - return result; + var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypeConstraintSyntax TypeConstraint(TypeSyntax type) - { + return result; + } + + public TypeConstraintSyntax TypeConstraint(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, this.context, out hash); - if (cached != null) return (TypeConstraintSyntax)cached; - - var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, this.context, out hash); + if (cached != null) return (TypeConstraintSyntax)cached; - return result; + var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) - { + return result; + } + + public DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) + { #if DEBUG - if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword)); - if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); + if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword)); + if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, this.context, out hash); - if (cached != null) return (DefaultConstraintSyntax)cached; - - var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, this.context, out hash); + if (cached != null) return (DefaultConstraintSyntax)cached; - return result; + var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FieldDeclarationSyntax FieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + return result; + } + + public FieldDeclarationSyntax FieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken, this.context); - } + return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken, this.context); + } - public EventFieldDeclarationSyntax EventFieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + public EventFieldDeclarationSyntax EventFieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); - if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); + if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken, this.context); - } + return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken, this.context); + } - public ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken) - { + public ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context, out hash); - if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached; - - var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context, out hash); + if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached; - return result; + var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public MethodDeclarationSyntax MethodDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + return result; + } + + public MethodDeclarationSyntax MethodDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); - } + return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); + } - public OperatorDeclarationSyntax OperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public OperatorDeclarationSyntax OperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) - { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - } - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.TildeToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.FalseKeyword: - case SyntaxKind.TrueKeyword: - case SyntaxKind.IsKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + } + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.TildeToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: + case SyntaxKind.IsKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken, this.context); - } + return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken, this.context); + } - public ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); - switch (implicitOrExplicitKeyword.Kind) - { - case SyntaxKind.ImplicitKeyword: - case SyntaxKind.ExplicitKeyword: break; - default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); - } - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) + if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); + switch (implicitOrExplicitKeyword.Kind) + { + case SyntaxKind.ImplicitKeyword: + case SyntaxKind.ExplicitKeyword: break; + default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); + } + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + } + if (type == null) throw new ArgumentNullException(nameof(type)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken, this.context); - } + return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken, this.context); + } - public ConstructorDeclarationSyntax ConstructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public ConstructorDeclarationSyntax ConstructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken, this.context); - } + return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken, this.context); + } - public ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + public ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.BaseConstructorInitializer: - case SyntaxKind.ThisConstructorInitializer: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.BaseConstructorInitializer: + case SyntaxKind.ThisConstructorInitializer: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword)); - switch (thisOrBaseKeyword.Kind) - { - case SyntaxKind.BaseKeyword: - case SyntaxKind.ThisKeyword: break; - default: throw new ArgumentException(nameof(thisOrBaseKeyword)); - } - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword)); + switch (thisOrBaseKeyword.Kind) + { + case SyntaxKind.BaseKeyword: + case SyntaxKind.ThisKeyword: break; + default: throw new ArgumentException(nameof(thisOrBaseKeyword)); + } + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, this.context, out hash); - if (cached != null) return (ConstructorInitializerSyntax)cached; - - var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, this.context, out hash); + if (cached != null) return (ConstructorInitializerSyntax)cached; - return result; + var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DestructorDeclarationSyntax DestructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + return result; + } + + public DestructorDeclarationSyntax DestructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken)); - if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken)); + if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken, this.context); - } + return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken, this.context); + } - public PropertyDeclarationSyntax PropertyDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) - { + public PropertyDeclarationSyntax PropertyDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, this.context); - } + return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, this.context); + } - public ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression) - { + public ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression) + { #if DEBUG - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context, out hash); - if (cached != null) return (ArrowExpressionClauseSyntax)cached; - - var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context, out hash); + if (cached != null) return (ArrowExpressionClauseSyntax)cached; - return result; + var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public EventDeclarationSyntax EventDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) - { + return result; + } + + public EventDeclarationSyntax EventDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) + { #if DEBUG - if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); - if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken != null) + if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); + if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, this.context); - } + return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, this.context); + } - public IndexerDeclarationSyntax IndexerDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public IndexerDeclarationSyntax IndexerDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); - if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); + if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, this.context); - } + return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, this.context); + } - public AccessorListSyntax AccessorList(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) - { + public AccessorListSyntax AccessorList(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context, out hash); - if (cached != null) return (AccessorListSyntax)cached; - - var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context, out hash); + if (cached != null) return (AccessorListSyntax)cached; - return result; + var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + return result; + } + + public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.GetAccessorDeclaration: - case SyntaxKind.SetAccessorDeclaration: - case SyntaxKind.InitAccessorDeclaration: - case SyntaxKind.AddAccessorDeclaration: - case SyntaxKind.RemoveAccessorDeclaration: - case SyntaxKind.UnknownAccessorDeclaration: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.GetAccessorDeclaration: + case SyntaxKind.SetAccessorDeclaration: + case SyntaxKind.InitAccessorDeclaration: + case SyntaxKind.AddAccessorDeclaration: + case SyntaxKind.RemoveAccessorDeclaration: + case SyntaxKind.UnknownAccessorDeclaration: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - case SyntaxKind.InitKeyword: - case SyntaxKind.AddKeyword: - case SyntaxKind.RemoveKeyword: - case SyntaxKind.IdentifierToken: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (semicolonToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + case SyntaxKind.InitKeyword: + case SyntaxKind.AddKeyword: + case SyntaxKind.RemoveKeyword: + case SyntaxKind.IdentifierToken: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken, this.context); - } + return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken, this.context); + } - public ParameterListSyntax ParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { + public ParameterListSyntax ParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); - if (cached != null) return (ParameterListSyntax)cached; - - var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); + if (cached != null) return (ParameterListSyntax)cached; - return result; + var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { + return result; + } + + public BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (BracketedParameterListSyntax)cached; - - var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (BracketedParameterListSyntax)cached; - return result; + var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ParameterSyntax Parameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) - { + return result; + } + + public ParameterSyntax Parameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.ArgListKeyword: break; - default: throw new ArgumentException(nameof(identifier)); - } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + switch (identifier.Kind) + { + case SyntaxKind.IdentifierToken: + case SyntaxKind.ArgListKeyword: break; + default: throw new ArgumentException(nameof(identifier)); + } #endif - return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default, this.context); - } + return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default, this.context); + } - public FunctionPointerParameterSyntax FunctionPointerParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type) - { + public FunctionPointerParameterSyntax FunctionPointerParameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context, out hash); - if (cached != null) return (FunctionPointerParameterSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context, out hash); + if (cached != null) return (FunctionPointerParameterSyntax)cached; - var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public IncompleteMemberSyntax IncompleteMember(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? type) - { + return result; + } + + public IncompleteMemberSyntax IncompleteMember(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type) + { #if DEBUG #endif - return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type, this.context); - } + return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type, this.context); + } - public SkippedTokensTriviaSyntax SkippedTokensTrivia(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList tokens) - { + public SkippedTokensTriviaSyntax SkippedTokensTrivia(CoreSyntax.SyntaxList tokens) + { #if DEBUG #endif - return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node, this.context); - } + return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node, this.context); + } - public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, SyntaxToken endOfComment) + public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList content, SyntaxToken endOfComment) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SingleLineDocumentationCommentTrivia: - case SyntaxKind.MultiLineDocumentationCommentTrivia: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SingleLineDocumentationCommentTrivia: + case SyntaxKind.MultiLineDocumentationCommentTrivia: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment)); - if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); + if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment)); + if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); #endif - return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment, this.context); - } + return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment, this.context); + } - public TypeCrefSyntax TypeCref(TypeSyntax type) - { + public TypeCrefSyntax TypeCref(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, this.context, out hash); - if (cached != null) return (TypeCrefSyntax)cached; - - var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, this.context, out hash); + if (cached != null) return (TypeCrefSyntax)cached; - return result; + var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) - { + return result; + } + + public QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + { #if DEBUG - if (container == null) throw new ArgumentNullException(nameof(container)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - if (member == null) throw new ArgumentNullException(nameof(member)); + if (container == null) throw new ArgumentNullException(nameof(container)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (member == null) throw new ArgumentNullException(nameof(member)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, this.context, out hash); - if (cached != null) return (QualifiedCrefSyntax)cached; - - var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, this.context, out hash); + if (cached != null) return (QualifiedCrefSyntax)cached; - return result; + var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) - { + return result; + } + + public NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, this.context, out hash); - if (cached != null) return (NameMemberCrefSyntax)cached; - - var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, this.context, out hash); + if (cached != null) return (NameMemberCrefSyntax)cached; - return result; + var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) - { + return result; + } + + public IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + { #if DEBUG - if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); - if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); + if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); + if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context, out hash); - if (cached != null) return (IndexerMemberCrefSyntax)cached; - - var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context, out hash); + if (cached != null) return (IndexerMemberCrefSyntax)cached; - return result; + var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) - { + return result; + } + + public OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + { #if DEBUG - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) - { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - } - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.TildeToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.FalseKeyword: - case SyntaxKind.TrueKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } + } + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.TildeToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } #endif - return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters, this.context); - } + return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters, this.context); + } - public ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) - { + public ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + { #if DEBUG - if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); - switch (implicitOrExplicitKeyword.Kind) - { - case SyntaxKind.ImplicitKeyword: - case SyntaxKind.ExplicitKeyword: break; - default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); - } - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) + if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); + switch (implicitOrExplicitKeyword.Kind) + { + case SyntaxKind.ImplicitKeyword: + case SyntaxKind.ExplicitKeyword: break; + default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); + } + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters, this.context); - } + return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters, this.context); + } - public CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { + public CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); - if (cached != null) return (CrefParameterListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); + if (cached != null) return (CrefParameterListSyntax)cached; - var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { + return result; + } + + public CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (CrefBracketedParameterListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (CrefBracketedParameterListSyntax)cached; - var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - { + return result; + } + + public CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + { #if DEBUG - if (refKindKeyword != null) + if (refKindKeyword != null) + { + switch (refKindKeyword.Kind) { - switch (refKindKeyword.Kind) - { - case SyntaxKind.RefKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.InKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(refKindKeyword)); - } + case SyntaxKind.RefKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.InKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(refKindKeyword)); } - if (readOnlyKeyword != null) + } + if (readOnlyKeyword != null) + { + switch (readOnlyKeyword.Kind) { - switch (readOnlyKeyword.Kind) - { - case SyntaxKind.ReadOnlyKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(readOnlyKeyword)); - } + case SyntaxKind.ReadOnlyKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(readOnlyKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context, out hash); - if (cached != null) return (CrefParameterSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context, out hash); + if (cached != null) return (CrefParameterSyntax)cached; - var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) - { + return result; + } + + public XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + { #if DEBUG - if (startTag == null) throw new ArgumentNullException(nameof(startTag)); - if (endTag == null) throw new ArgumentNullException(nameof(endTag)); + if (startTag == null) throw new ArgumentNullException(nameof(startTag)); + if (endTag == null) throw new ArgumentNullException(nameof(endTag)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context, out hash); - if (cached != null) return (XmlElementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context, out hash); + if (cached != null) return (XmlElementSyntax)cached; - var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) - { + return result; + } + + public XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken, this.context); - } + return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken, this.context); + } - public XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) - { + public XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken)); - if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken)); + if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context, out hash); - if (cached != null) return (XmlElementEndTagSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context, out hash); + if (cached != null) return (XmlElementEndTagSyntax)cached; - var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) - { + return result; + } + + public XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken)); - if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken)); + if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); #endif - return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken, this.context); - } + return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken, this.context); + } - public XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName) - { + public XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName) + { #if DEBUG - if (localName == null) throw new ArgumentNullException(nameof(localName)); - if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); + if (localName == null) throw new ArgumentNullException(nameof(localName)); + if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, this.context, out hash); - if (cached != null) return (XmlNameSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, this.context, out hash); + if (cached != null) return (XmlNameSyntax)cached; - var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) - { + return result; + } + + public XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) + { #if DEBUG - if (prefix == null) throw new ArgumentNullException(nameof(prefix)); - if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (prefix == null) throw new ArgumentNullException(nameof(prefix)); + if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, this.context, out hash); - if (cached != null) return (XmlPrefixSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, this.context, out hash); + if (cached != null) return (XmlPrefixSyntax)cached; - var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) - { + return result; + } + + public XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken, this.context); - } + return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken, this.context); + } - public XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) - { + public XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (cref == null) throw new ArgumentNullException(nameof(cref)); - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (cref == null) throw new ArgumentNullException(nameof(cref)); + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken, this.context); - } + return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken, this.context); + } - public XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) - { + public XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken, this.context); - } + return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken, this.context); + } - public XmlTextSyntax XmlText(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens) - { + public XmlTextSyntax XmlText(CoreSyntax.SyntaxList textTokens) + { #if DEBUG #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, this.context, out hash); - if (cached != null) return (XmlTextSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, this.context, out hash); + if (cached != null) return (XmlTextSyntax)cached; - var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) - { + return result; + } + + public XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + { #if DEBUG - if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken)); - if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); - if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken)); - if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); + if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken)); + if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); + if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken)); + if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context, out hash); - if (cached != null) return (XmlCDataSectionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context, out hash); + if (cached != null) return (XmlCDataSectionSyntax)cached; - var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) - { + return result; + } + + public XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + { #if DEBUG - if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken)); - if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken)); - if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); + if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken)); + if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken)); + if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); #endif - return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken, this.context); - } + return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken, this.context); + } - public XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) - { + public XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) + { #if DEBUG - if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken)); - if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); - if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken)); - if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); + if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken)); + if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); + if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken)); + if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context, out hash); - if (cached != null) return (XmlCommentSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context, out hash); + if (cached != null) return (XmlCommentSyntax)cached; - var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { + return result; + } + + public IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); - if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); + if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); - } + return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); + } - public ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { + public ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword)); - if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword)); + if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); - } + return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); + } - public ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) - { + public ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); - if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); + if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken, this.context); - } + return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken, this.context); + } - public EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword)); - if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword)); + if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive, this.context); - } + return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive, this.context); + } - public RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword)); - if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword)); + if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive, this.context); - } + return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive, this.context); + } - public EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword)); - if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword)); + if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive, this.context); - } + return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive, this.context); + } - public ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword)); - if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword)); + if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive, this.context); - } + return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive, this.context); + } - public WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); - if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); + if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive, this.context); - } + return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive, this.context); + } - public BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - { + public BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive, this.context); - } + return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive, this.context); + } - public DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { + public DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword)); - if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword)); + if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive, this.context); - } + return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive, this.context); + } - public UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { + public UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword)); - if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword)); + if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive, this.context); - } + return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive, this.context); + } - public LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); - if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); - if (line == null) throw new ArgumentNullException(nameof(line)); - switch (line.Kind) - { - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.DefaultKeyword: - case SyntaxKind.HiddenKeyword: break; - default: throw new ArgumentException(nameof(line)); - } - if (file != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); + if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); + if (line == null) throw new ArgumentNullException(nameof(line)); + switch (line.Kind) + { + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.DefaultKeyword: + case SyntaxKind.HiddenKeyword: break; + default: throw new ArgumentException(nameof(line)); + } + if (file != null) + { + switch (file.Kind) { - switch (file.Kind) - { - case SyntaxKind.StringLiteralToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(file)); - } + case SyntaxKind.StringLiteralToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(file)); } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive, this.context); - } + return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive, this.context); + } - public LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) - { + public LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (line == null) throw new ArgumentNullException(nameof(line)); - if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); - if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); - if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); - if (character == null) throw new ArgumentNullException(nameof(character)); - if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (line == null) throw new ArgumentNullException(nameof(line)); + if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); + if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); + if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); + if (character == null) throw new ArgumentNullException(nameof(character)); + if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken, this.context); - } + return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken, this.context); + } - public LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); - if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); - if (start == null) throw new ArgumentNullException(nameof(start)); - if (minusToken == null) throw new ArgumentNullException(nameof(minusToken)); - if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); - if (end == null) throw new ArgumentNullException(nameof(end)); - if (characterOffset != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); + if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); + if (start == null) throw new ArgumentNullException(nameof(start)); + if (minusToken == null) throw new ArgumentNullException(nameof(minusToken)); + if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); + if (end == null) throw new ArgumentNullException(nameof(end)); + if (characterOffset != null) + { + switch (characterOffset.Kind) { - switch (characterOffset.Kind) - { - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(characterOffset)); - } + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(characterOffset)); } - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive, this.context); - } + return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive, this.context); + } - public PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) - { + public PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); - if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); - if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); - if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); - if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword)); - switch (disableOrRestoreKeyword.Kind) - { - case SyntaxKind.DisableKeyword: - case SyntaxKind.RestoreKeyword: break; - default: throw new ArgumentException(nameof(disableOrRestoreKeyword)); - } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); + if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); + if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); + if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); + if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword)); + switch (disableOrRestoreKeyword.Kind) + { + case SyntaxKind.DisableKeyword: + case SyntaxKind.RestoreKeyword: break; + default: throw new ArgumentException(nameof(disableOrRestoreKeyword)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive, this.context); - } + return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive, this.context); + } - public PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) - { + public PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); - if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); - if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword)); - if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (guid == null) throw new ArgumentNullException(nameof(guid)); - if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); - if (bytes == null) throw new ArgumentNullException(nameof(bytes)); - if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); + if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); + if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword)); + if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (guid == null) throw new ArgumentNullException(nameof(guid)); + if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); + if (bytes == null) throw new ArgumentNullException(nameof(bytes)); + if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive, this.context); - } + return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive, this.context); + } - public ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword)); - if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword)); + if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive, this.context); - } + return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive, this.context); + } - public LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword)); - if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword)); + if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive, this.context); - } + return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive, this.context); + } - public ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) - { + public ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken)); - if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken)); + if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context); - } + return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context); + } - public NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) - { + public NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword)); - if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); - if (settingToken == null) throw new ArgumentNullException(nameof(settingToken)); - switch (settingToken.Kind) - { - case SyntaxKind.EnableKeyword: - case SyntaxKind.DisableKeyword: - case SyntaxKind.RestoreKeyword: break; - default: throw new ArgumentException(nameof(settingToken)); - } - if (targetToken != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword)); + if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); + if (settingToken == null) throw new ArgumentNullException(nameof(settingToken)); + switch (settingToken.Kind) + { + case SyntaxKind.EnableKeyword: + case SyntaxKind.DisableKeyword: + case SyntaxKind.RestoreKeyword: break; + default: throw new ArgumentException(nameof(settingToken)); + } + if (targetToken != null) + { + switch (targetToken.Kind) { - switch (targetToken.Kind) - { - case SyntaxKind.WarningsKeyword: - case SyntaxKind.AnnotationsKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(targetToken)); - } + case SyntaxKind.WarningsKeyword: + case SyntaxKind.AnnotationsKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(targetToken)); } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive, this.context); - } + return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive, this.context); } +} - internal static partial class SyntaxFactory - { +internal static partial class SyntaxFactory +{ - public static IdentifierNameSyntax IdentifierName(SyntaxToken identifier) - { + public static IdentifierNameSyntax IdentifierName(SyntaxToken identifier) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.GlobalKeyword: break; - default: throw new ArgumentException(nameof(identifier)); - } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + switch (identifier.Kind) + { + case SyntaxKind.IdentifierToken: + case SyntaxKind.GlobalKeyword: break; + default: throw new ArgumentException(nameof(identifier)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, out hash); - if (cached != null) return (IdentifierNameSyntax)cached; - - var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, out hash); + if (cached != null) return (IdentifierNameSyntax)cached; - return result; + var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) - { + return result; + } + + public static QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + { #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, out hash); - if (cached != null) return (QualifiedNameSyntax)cached; - - var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, out hash); + if (cached != null) return (QualifiedNameSyntax)cached; - return result; + var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) - { + return result; + } + + public static GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, out hash); - if (cached != null) return (GenericNameSyntax)cached; - - var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, out hash); + if (cached != null) return (GenericNameSyntax)cached; - return result; + var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) - { + return result; + } + + public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, out hash); - if (cached != null) return (TypeArgumentListSyntax)cached; - - var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, out hash); + if (cached != null) return (TypeArgumentListSyntax)cached; - return result; + var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) - { + return result; + } + + public static AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + { #if DEBUG - if (alias == null) throw new ArgumentNullException(nameof(alias)); - if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken)); - if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); + if (alias == null) throw new ArgumentNullException(nameof(alias)); + if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken)); + if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, out hash); - if (cached != null) return (AliasQualifiedNameSyntax)cached; - - var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, out hash); + if (cached != null) return (AliasQualifiedNameSyntax)cached; - return result; + var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) - { + return result; + } + + public static PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.BoolKeyword: - case SyntaxKind.ByteKeyword: - case SyntaxKind.SByteKeyword: - case SyntaxKind.IntKeyword: - case SyntaxKind.UIntKeyword: - case SyntaxKind.ShortKeyword: - case SyntaxKind.UShortKeyword: - case SyntaxKind.LongKeyword: - case SyntaxKind.ULongKeyword: - case SyntaxKind.FloatKeyword: - case SyntaxKind.DoubleKeyword: - case SyntaxKind.DecimalKeyword: - case SyntaxKind.StringKeyword: - case SyntaxKind.CharKeyword: - case SyntaxKind.ObjectKeyword: - case SyntaxKind.VoidKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.BoolKeyword: + case SyntaxKind.ByteKeyword: + case SyntaxKind.SByteKeyword: + case SyntaxKind.IntKeyword: + case SyntaxKind.UIntKeyword: + case SyntaxKind.ShortKeyword: + case SyntaxKind.UShortKeyword: + case SyntaxKind.LongKeyword: + case SyntaxKind.ULongKeyword: + case SyntaxKind.FloatKeyword: + case SyntaxKind.DoubleKeyword: + case SyntaxKind.DecimalKeyword: + case SyntaxKind.StringKeyword: + case SyntaxKind.CharKeyword: + case SyntaxKind.ObjectKeyword: + case SyntaxKind.VoidKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, out hash); - if (cached != null) return (PredefinedTypeSyntax)cached; - - var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, out hash); + if (cached != null) return (PredefinedTypeSyntax)cached; - return result; + var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList rankSpecifiers) - { + return result; + } + + public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, out hash); - if (cached != null) return (ArrayTypeSyntax)cached; - - var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, out hash); + if (cached != null) return (ArrayTypeSyntax)cached; - return result; + var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) - { + return result; + } + + public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, out hash); - if (cached != null) return (ArrayRankSpecifierSyntax)cached; - - var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, out hash); + if (cached != null) return (ArrayRankSpecifierSyntax)cached; - return result; + var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) - { + return result; + } + + public static PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); - if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); + if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, out hash); - if (cached != null) return (PointerTypeSyntax)cached; - - var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, out hash); + if (cached != null) return (PointerTypeSyntax)cached; - return result; + var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) - { + return result; + } + + public static FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); - if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); + if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); #endif - return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList); - } + return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList); + } - public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { + public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); - if (cached != null) return (FunctionPointerParameterListSyntax)cached; - - var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); + if (cached != null) return (FunctionPointerParameterListSyntax)cached; - return result; + var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) - { + return result; + } + + public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + { #if DEBUG - if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword)); - switch (managedOrUnmanagedKeyword.Kind) - { - case SyntaxKind.ManagedKeyword: - case SyntaxKind.UnmanagedKeyword: break; - default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword)); - } + if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword)); + switch (managedOrUnmanagedKeyword.Kind) + { + case SyntaxKind.ManagedKeyword: + case SyntaxKind.UnmanagedKeyword: break; + default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, out hash); - if (cached != null) return (FunctionPointerCallingConventionSyntax)cached; - - var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, out hash); + if (cached != null) return (FunctionPointerCallingConventionSyntax)cached; - return result; + var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) - { + return result; + } + + public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, out hash); - if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached; - - var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, out hash); + if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached; - return result; + var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name) - { + return result; + } + + public static FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, out hash); - if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached; - - var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, out hash); + if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached; - return result; + var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) - { + return result; + } + + public static NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); - if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); + if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, out hash); - if (cached != null) return (NullableTypeSyntax)cached; - - var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, out hash); + if (cached != null) return (NullableTypeSyntax)cached; - return result; + var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TupleTypeSyntax TupleType(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) - { + return result; + } + + public static TupleTypeSyntax TupleType(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, out hash); - if (cached != null) return (TupleTypeSyntax)cached; - - var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, out hash); + if (cached != null) return (TupleTypeSyntax)cached; - return result; + var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier) - { + return result; + } + + public static TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier != null) + { + switch (identifier.Kind) { - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(identifier)); - } + case SyntaxKind.IdentifierToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(identifier)); } + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, out hash); - if (cached != null) return (TupleElementSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, out hash); + if (cached != null) return (TupleElementSyntax)cached; - var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken) - { + return result; + } + + public static OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken) + { #if DEBUG - if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken)); - if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); + if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken)); + if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, out hash); - if (cached != null) return (OmittedTypeArgumentSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, out hash); + if (cached != null) return (OmittedTypeArgumentSyntax)cached; - var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - { + return result; + } + + public static RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + { #if DEBUG - if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); - if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); - if (readOnlyKeyword != null) + if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); + if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); + if (readOnlyKeyword != null) + { + switch (readOnlyKeyword.Kind) { - switch (readOnlyKeyword.Kind) - { - case SyntaxKind.ReadOnlyKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(readOnlyKeyword)); - } + case SyntaxKind.ReadOnlyKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(readOnlyKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, out hash); - if (cached != null) return (RefTypeSyntax)cached; - - var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, out hash); + if (cached != null) return (RefTypeSyntax)cached; - return result; + var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) - { + return result; + } + + public static ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) + { #if DEBUG - if (scopedKeyword == null) throw new ArgumentNullException(nameof(scopedKeyword)); - if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (scopedKeyword == null) throw new ArgumentNullException(nameof(scopedKeyword)); + if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, out hash); - if (cached != null) return (ScopedTypeSyntax)cached; - - var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, out hash); + if (cached != null) return (ScopedTypeSyntax)cached; - return result; + var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + return result; + } + + public static ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, out hash); - if (cached != null) return (ParenthesizedExpressionSyntax)cached; - - var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, out hash); + if (cached != null) return (ParenthesizedExpressionSyntax)cached; - return result; + var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public static TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, out hash); - if (cached != null) return (TupleExpressionSyntax)cached; - - var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, out hash); + if (cached != null) return (TupleExpressionSyntax)cached; - return result; + var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + return result; + } + + public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.UnaryPlusExpression: - case SyntaxKind.UnaryMinusExpression: - case SyntaxKind.BitwiseNotExpression: - case SyntaxKind.LogicalNotExpression: - case SyntaxKind.PreIncrementExpression: - case SyntaxKind.PreDecrementExpression: - case SyntaxKind.AddressOfExpression: - case SyntaxKind.PointerIndirectionExpression: - case SyntaxKind.IndexExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.UnaryPlusExpression: + case SyntaxKind.UnaryMinusExpression: + case SyntaxKind.BitwiseNotExpression: + case SyntaxKind.LogicalNotExpression: + case SyntaxKind.PreIncrementExpression: + case SyntaxKind.PreDecrementExpression: + case SyntaxKind.AddressOfExpression: + case SyntaxKind.PointerIndirectionExpression: + case SyntaxKind.IndexExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.TildeToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.CaretToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (operand == null) throw new ArgumentNullException(nameof(operand)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.TildeToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.CaretToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (operand == null) throw new ArgumentNullException(nameof(operand)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, out hash); - if (cached != null) return (PrefixUnaryExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, out hash); + if (cached != null) return (PrefixUnaryExpressionSyntax)cached; - var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression) - { + return result; + } + + public static AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression) + { #if DEBUG - if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword)); - if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword)); + if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, out hash); - if (cached != null) return (AwaitExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, out hash); + if (cached != null) return (AwaitExpressionSyntax)cached; - var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + return result; + } + + public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.PostIncrementExpression: - case SyntaxKind.PostDecrementExpression: - case SyntaxKind.SuppressNullableWarningExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.PostIncrementExpression: + case SyntaxKind.PostDecrementExpression: + case SyntaxKind.SuppressNullableWarningExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (operand == null) throw new ArgumentNullException(nameof(operand)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.ExclamationToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } + if (operand == null) throw new ArgumentNullException(nameof(operand)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.ExclamationToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, out hash); - if (cached != null) return (PostfixUnaryExpressionSyntax)cached; - - var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, out hash); + if (cached != null) return (PostfixUnaryExpressionSyntax)cached; - return result; + var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + return result; + } + + public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SimpleMemberAccessExpression: - case SyntaxKind.PointerMemberAccessExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SimpleMemberAccessExpression: + case SyntaxKind.PointerMemberAccessExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.DotToken: - case SyntaxKind.MinusGreaterThanToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (name == null) throw new ArgumentNullException(nameof(name)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.DotToken: + case SyntaxKind.MinusGreaterThanToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, out hash); - if (cached != null) return (MemberAccessExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, out hash); + if (cached != null) return (MemberAccessExpressionSyntax)cached; - var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) - { + return result; + } + + public static ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); - if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); + if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, out hash); - if (cached != null) return (ConditionalAccessExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, out hash); + if (cached != null) return (ConditionalAccessExpressionSyntax)cached; - var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name) - { + return result; + } + + public static MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, out hash); - if (cached != null) return (MemberBindingExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, out hash); + if (cached != null) return (MemberBindingExpressionSyntax)cached; - var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList) - { + return result; + } + + public static ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, out hash); - if (cached != null) return (ElementBindingExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, out hash); + if (cached != null) return (ElementBindingExpressionSyntax)cached; - var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) - { + return result; + } + + public static RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, out hash); - if (cached != null) return (RangeExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, out hash); + if (cached != null) return (RangeExpressionSyntax)cached; - var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList) - { + return result; + } + + public static ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, out hash); - if (cached != null) return (ImplicitElementAccessSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, out hash); + if (cached != null) return (ImplicitElementAccessSyntax)cached; - var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + return result; + } + + public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.AddExpression: - case SyntaxKind.SubtractExpression: - case SyntaxKind.MultiplyExpression: - case SyntaxKind.DivideExpression: - case SyntaxKind.ModuloExpression: - case SyntaxKind.LeftShiftExpression: - case SyntaxKind.RightShiftExpression: - case SyntaxKind.UnsignedRightShiftExpression: - case SyntaxKind.LogicalOrExpression: - case SyntaxKind.LogicalAndExpression: - case SyntaxKind.BitwiseOrExpression: - case SyntaxKind.BitwiseAndExpression: - case SyntaxKind.ExclusiveOrExpression: - case SyntaxKind.EqualsExpression: - case SyntaxKind.NotEqualsExpression: - case SyntaxKind.LessThanExpression: - case SyntaxKind.LessThanOrEqualExpression: - case SyntaxKind.GreaterThanExpression: - case SyntaxKind.GreaterThanOrEqualExpression: - case SyntaxKind.IsExpression: - case SyntaxKind.AsExpression: - case SyntaxKind.CoalesceExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.AddExpression: + case SyntaxKind.SubtractExpression: + case SyntaxKind.MultiplyExpression: + case SyntaxKind.DivideExpression: + case SyntaxKind.ModuloExpression: + case SyntaxKind.LeftShiftExpression: + case SyntaxKind.RightShiftExpression: + case SyntaxKind.UnsignedRightShiftExpression: + case SyntaxKind.LogicalOrExpression: + case SyntaxKind.LogicalAndExpression: + case SyntaxKind.BitwiseOrExpression: + case SyntaxKind.BitwiseAndExpression: + case SyntaxKind.ExclusiveOrExpression: + case SyntaxKind.EqualsExpression: + case SyntaxKind.NotEqualsExpression: + case SyntaxKind.LessThanExpression: + case SyntaxKind.LessThanOrEqualExpression: + case SyntaxKind.GreaterThanExpression: + case SyntaxKind.GreaterThanOrEqualExpression: + case SyntaxKind.IsExpression: + case SyntaxKind.AsExpression: + case SyntaxKind.CoalesceExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarBarToken: - case SyntaxKind.AmpersandAmpersandToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.IsKeyword: - case SyntaxKind.AsKeyword: - case SyntaxKind.QuestionQuestionToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarBarToken: + case SyntaxKind.AmpersandAmpersandToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.IsKeyword: + case SyntaxKind.AsKeyword: + case SyntaxKind.QuestionQuestionToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); - if (cached != null) return (BinaryExpressionSyntax)cached; - - var result = new BinaryExpressionSyntax(kind, left, operatorToken, right); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); + if (cached != null) return (BinaryExpressionSyntax)cached; - return result; + var result = new BinaryExpressionSyntax(kind, left, operatorToken, right); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + return result; + } + + public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SimpleAssignmentExpression: - case SyntaxKind.AddAssignmentExpression: - case SyntaxKind.SubtractAssignmentExpression: - case SyntaxKind.MultiplyAssignmentExpression: - case SyntaxKind.DivideAssignmentExpression: - case SyntaxKind.ModuloAssignmentExpression: - case SyntaxKind.AndAssignmentExpression: - case SyntaxKind.ExclusiveOrAssignmentExpression: - case SyntaxKind.OrAssignmentExpression: - case SyntaxKind.LeftShiftAssignmentExpression: - case SyntaxKind.RightShiftAssignmentExpression: - case SyntaxKind.UnsignedRightShiftAssignmentExpression: - case SyntaxKind.CoalesceAssignmentExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SimpleAssignmentExpression: + case SyntaxKind.AddAssignmentExpression: + case SyntaxKind.SubtractAssignmentExpression: + case SyntaxKind.MultiplyAssignmentExpression: + case SyntaxKind.DivideAssignmentExpression: + case SyntaxKind.ModuloAssignmentExpression: + case SyntaxKind.AndAssignmentExpression: + case SyntaxKind.ExclusiveOrAssignmentExpression: + case SyntaxKind.OrAssignmentExpression: + case SyntaxKind.LeftShiftAssignmentExpression: + case SyntaxKind.RightShiftAssignmentExpression: + case SyntaxKind.UnsignedRightShiftAssignmentExpression: + case SyntaxKind.CoalesceAssignmentExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.EqualsToken: - case SyntaxKind.PlusEqualsToken: - case SyntaxKind.MinusEqualsToken: - case SyntaxKind.AsteriskEqualsToken: - case SyntaxKind.SlashEqualsToken: - case SyntaxKind.PercentEqualsToken: - case SyntaxKind.AmpersandEqualsToken: - case SyntaxKind.CaretEqualsToken: - case SyntaxKind.BarEqualsToken: - case SyntaxKind.LessThanLessThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: - case SyntaxKind.QuestionQuestionEqualsToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.EqualsToken: + case SyntaxKind.PlusEqualsToken: + case SyntaxKind.MinusEqualsToken: + case SyntaxKind.AsteriskEqualsToken: + case SyntaxKind.SlashEqualsToken: + case SyntaxKind.PercentEqualsToken: + case SyntaxKind.AmpersandEqualsToken: + case SyntaxKind.CaretEqualsToken: + case SyntaxKind.BarEqualsToken: + case SyntaxKind.LessThanLessThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + case SyntaxKind.QuestionQuestionEqualsToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); - if (cached != null) return (AssignmentExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); + if (cached != null) return (AssignmentExpressionSyntax)cached; - var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) - { + return result; + } + + public static ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + { #if DEBUG - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); - if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); - if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); + if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); + if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse)); #endif - return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse); - } + return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse); + } - public static ThisExpressionSyntax ThisExpression(SyntaxToken token) - { + public static ThisExpressionSyntax ThisExpression(SyntaxToken token) + { #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); + if (token == null) throw new ArgumentNullException(nameof(token)); + if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, out hash); - if (cached != null) return (ThisExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, out hash); + if (cached != null) return (ThisExpressionSyntax)cached; - var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BaseExpressionSyntax BaseExpression(SyntaxToken token) - { + return result; + } + + public static BaseExpressionSyntax BaseExpression(SyntaxToken token) + { #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); + if (token == null) throw new ArgumentNullException(nameof(token)); + if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, out hash); - if (cached != null) return (BaseExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, out hash); + if (cached != null) return (BaseExpressionSyntax)cached; - var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) + return result; + } + + public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ArgListExpression: - case SyntaxKind.NumericLiteralExpression: - case SyntaxKind.StringLiteralExpression: - case SyntaxKind.Utf8StringLiteralExpression: - case SyntaxKind.CharacterLiteralExpression: - case SyntaxKind.TrueLiteralExpression: - case SyntaxKind.FalseLiteralExpression: - case SyntaxKind.NullLiteralExpression: - case SyntaxKind.DefaultLiteralExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ArgListExpression: + case SyntaxKind.NumericLiteralExpression: + case SyntaxKind.StringLiteralExpression: + case SyntaxKind.Utf8StringLiteralExpression: + case SyntaxKind.CharacterLiteralExpression: + case SyntaxKind.TrueLiteralExpression: + case SyntaxKind.FalseLiteralExpression: + case SyntaxKind.NullLiteralExpression: + case SyntaxKind.DefaultLiteralExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - switch (token.Kind) - { - case SyntaxKind.ArgListKeyword: - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.StringLiteralToken: - case SyntaxKind.Utf8StringLiteralToken: - case SyntaxKind.MultiLineRawStringLiteralToken: - case SyntaxKind.Utf8MultiLineRawStringLiteralToken: - case SyntaxKind.SingleLineRawStringLiteralToken: - case SyntaxKind.Utf8SingleLineRawStringLiteralToken: - case SyntaxKind.CharacterLiteralToken: - case SyntaxKind.TrueKeyword: - case SyntaxKind.FalseKeyword: - case SyntaxKind.NullKeyword: - case SyntaxKind.DefaultKeyword: break; - default: throw new ArgumentException(nameof(token)); - } + if (token == null) throw new ArgumentNullException(nameof(token)); + switch (token.Kind) + { + case SyntaxKind.ArgListKeyword: + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.StringLiteralToken: + case SyntaxKind.Utf8StringLiteralToken: + case SyntaxKind.MultiLineRawStringLiteralToken: + case SyntaxKind.Utf8MultiLineRawStringLiteralToken: + case SyntaxKind.SingleLineRawStringLiteralToken: + case SyntaxKind.Utf8SingleLineRawStringLiteralToken: + case SyntaxKind.CharacterLiteralToken: + case SyntaxKind.TrueKeyword: + case SyntaxKind.FalseKeyword: + case SyntaxKind.NullKeyword: + case SyntaxKind.DefaultKeyword: break; + default: throw new ArgumentException(nameof(token)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, token, out hash); - if (cached != null) return (LiteralExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, token, out hash); + if (cached != null) return (LiteralExpressionSyntax)cached; - var result = new LiteralExpressionSyntax(kind, token); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new LiteralExpressionSyntax(kind, token); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + return result; + } + + public static MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken); - } + return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken); + } - public static RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + public static RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken); - } + return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken); + } - public static RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) - { + public static RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (comma == null) throw new ArgumentNullException(nameof(comma)); - if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (comma == null) throw new ArgumentNullException(nameof(comma)); + if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken); - } + return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken); + } - public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.CheckedExpression: - case SyntaxKind.UncheckedExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.CheckedExpression: + case SyntaxKind.UncheckedExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.UncheckedKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.CheckedKeyword: + case SyntaxKind.UncheckedKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken); - } + return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken); + } - public static DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public static DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken); - } + return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken); + } - public static TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public static TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken); - } + return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken); + } - public static SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public static SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken); - } + return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken); + } - public static InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList) - { + public static InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, out hash); - if (cached != null) return (InvocationExpressionSyntax)cached; - - var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, out hash); + if (cached != null) return (InvocationExpressionSyntax)cached; - return result; + var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - { + return result; + } + + public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, out hash); - if (cached != null) return (ElementAccessExpressionSyntax)cached; - - var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, out hash); + if (cached != null) return (ElementAccessExpressionSyntax)cached; - return result; + var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); - if (cached != null) return (ArgumentListSyntax)cached; - - var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); + if (cached != null) return (ArgumentListSyntax)cached; - return result; + var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) - { + return result; + } + + public static BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, out hash); - if (cached != null) return (BracketedArgumentListSyntax)cached; - - var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, out hash); + if (cached != null) return (BracketedArgumentListSyntax)cached; - return result; + var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) - { + return result; + } + + public static ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) + { #if DEBUG - if (refKindKeyword != null) + if (refKindKeyword != null) + { + switch (refKindKeyword.Kind) { - switch (refKindKeyword.Kind) - { - case SyntaxKind.RefKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.InKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(refKindKeyword)); - } + case SyntaxKind.RefKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.InKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(refKindKeyword)); } - if (expression == null) throw new ArgumentNullException(nameof(expression)); + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, out hash); - if (cached != null) return (ArgumentSyntax)cached; - - var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, out hash); + if (cached != null) return (ArgumentSyntax)cached; - return result; + var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken) - { + return result; + } + + public static ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, out hash); - if (cached != null) return (ExpressionColonSyntax)cached; - - var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, out hash); + if (cached != null) return (ExpressionColonSyntax)cached; - return result; + var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken) - { + return result; + } + + public static NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, out hash); - if (cached != null) return (NameColonSyntax)cached; - - var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, out hash); + if (cached != null) return (NameColonSyntax)cached; - return result; + var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) - { + return result; + } + + public static DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, out hash); - if (cached != null) return (DeclarationExpressionSyntax)cached; - - var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, out hash); + if (cached != null) return (DeclarationExpressionSyntax)cached; - return result; + var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) - { + return result; + } + + public static CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression); - } + return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression); + } - public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) - { + public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody); - } + return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody); + } - public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { + public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (parameter == null) throw new ArgumentNullException(nameof(parameter)); - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (parameter == null) throw new ArgumentNullException(nameof(parameter)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); #endif - return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody); - } + return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody); + } - public static RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression) - { + public static RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression) + { #if DEBUG - if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); - if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); + if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, out hash); - if (cached != null) return (RefExpressionSyntax)cached; - - var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, out hash); + if (cached != null) return (RefExpressionSyntax)cached; - return result; + var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { + return result; + } + + public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); #endif - return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody); - } + return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody); + } - public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ObjectInitializerExpression: - case SyntaxKind.CollectionInitializerExpression: - case SyntaxKind.ArrayInitializerExpression: - case SyntaxKind.ComplexElementInitializerExpression: - case SyntaxKind.WithInitializerExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ObjectInitializerExpression: + case SyntaxKind.CollectionInitializerExpression: + case SyntaxKind.ArrayInitializerExpression: + case SyntaxKind.ComplexElementInitializerExpression: + case SyntaxKind.WithInitializerExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, out hash); - if (cached != null) return (InitializerExpressionSyntax)cached; - - var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, out hash); + if (cached != null) return (InitializerExpressionSyntax)cached; - return result; + var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) - { + return result; + } + + public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, out hash); - if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached; - - var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, out hash); + if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached; - return result; + var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) - { + return result; + } + + public static ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer); - } + return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer); + } - public static WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) - { + public static WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword)); - if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword)); + if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, out hash); - if (cached != null) return (WithExpressionSyntax)cached; - - var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, out hash); + if (cached != null) return (WithExpressionSyntax)cached; - return result; + var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) - { + return result; + } + + public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, out hash); - if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached; - - var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, out hash); + if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached; - return result; + var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) - { + return result; + } + + public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken); - } + return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken); + } - public static ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) - { + public static ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, out hash); - if (cached != null) return (ArrayCreationExpressionSyntax)cached; - - var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, out hash); + if (cached != null) return (ArrayCreationExpressionSyntax)cached; - return result; + var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { + return result; + } + + public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer); - } + return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer); + } - public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) - { + public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); - if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); + if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, out hash); - if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached; - - var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, out hash); + if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached; - return result; + var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { + return result; + } + + public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { #if DEBUG - if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); - if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); + if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer); - } + return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer); + } - public static CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) - { + public static CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, out hash); - if (cached != null) return (CollectionExpressionSyntax)cached; - - var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, out hash); + if (cached != null) return (CollectionExpressionSyntax)cached; - return result; + var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ExpressionElementSyntax ExpressionElement(ExpressionSyntax expression) - { + return result; + } + + public static ExpressionElementSyntax ExpressionElement(ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, out hash); - if (cached != null) return (ExpressionElementSyntax)cached; - - var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, out hash); + if (cached != null) return (ExpressionElementSyntax)cached; - return result; + var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SpreadElementSyntax SpreadElement(SyntaxToken operatorToken, ExpressionSyntax expression) - { + return result; + } + + public static SpreadElementSyntax SpreadElement(SyntaxToken operatorToken, ExpressionSyntax expression) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, out hash); - if (cached != null) return (SpreadElementSyntax)cached; - - var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, out hash); + if (cached != null) return (SpreadElementSyntax)cached; - return result; + var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body) - { + return result; + } + + public static QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body) + { #if DEBUG - if (fromClause == null) throw new ArgumentNullException(nameof(fromClause)); - if (body == null) throw new ArgumentNullException(nameof(body)); + if (fromClause == null) throw new ArgumentNullException(nameof(fromClause)); + if (body == null) throw new ArgumentNullException(nameof(body)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, out hash); - if (cached != null) return (QueryExpressionSyntax)cached; - - var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, out hash); + if (cached != null) return (QueryExpressionSyntax)cached; - return result; + var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static QueryBodySyntax QueryBody(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) - { + return result; + } + + public static QueryBodySyntax QueryBody(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + { #if DEBUG - if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); + if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, out hash); - if (cached != null) return (QueryBodySyntax)cached; - - var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, out hash); + if (cached != null) return (QueryBodySyntax)cached; - return result; + var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) - { + return result; + } + + public static FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + { #if DEBUG - if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword)); - if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword)); + if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression); - } + return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression); + } - public static LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) - { + public static LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + { #if DEBUG - if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword)); - if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword)); + if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression); - } + return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression); + } - public static JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) - { + public static JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + { #if DEBUG - if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword)); - if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (inExpression == null) throw new ArgumentNullException(nameof(inExpression)); - if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword)); - if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); - if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression)); - if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword)); - if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); - if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression)); + if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword)); + if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (inExpression == null) throw new ArgumentNullException(nameof(inExpression)); + if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword)); + if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); + if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression)); + if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword)); + if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); + if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression)); #endif - return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); - } + return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); + } - public static JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier) - { + public static JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier) + { #if DEBUG - if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); - if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); + if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, out hash); - if (cached != null) return (JoinIntoClauseSyntax)cached; - - var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, out hash); + if (cached != null) return (JoinIntoClauseSyntax)cached; - return result; + var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition) - { + return result; + } + + public static WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition) + { #if DEBUG - if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); - if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); + if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, out hash); - if (cached != null) return (WhereClauseSyntax)cached; - - var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, out hash); + if (cached != null) return (WhereClauseSyntax)cached; - return result; + var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList orderings) - { + return result; + } + + public static OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) + { #if DEBUG - if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword)); - if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); + if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword)); + if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, out hash); - if (cached != null) return (OrderByClauseSyntax)cached; - - var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, out hash); + if (cached != null) return (OrderByClauseSyntax)cached; - return result; + var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) + return result; + } + + public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.AscendingOrdering: - case SyntaxKind.DescendingOrdering: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.AscendingOrdering: + case SyntaxKind.DescendingOrdering: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (ascendingOrDescendingKeyword != null) + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (ascendingOrDescendingKeyword != null) + { + switch (ascendingOrDescendingKeyword.Kind) { - switch (ascendingOrDescendingKeyword.Kind) - { - case SyntaxKind.AscendingKeyword: - case SyntaxKind.DescendingKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword)); - } + case SyntaxKind.AscendingKeyword: + case SyntaxKind.DescendingKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword)); } + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, out hash); - if (cached != null) return (OrderingSyntax)cached; - - var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, out hash); + if (cached != null) return (OrderingSyntax)cached; - return result; + var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression) - { + return result; + } + + public static SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression) + { #if DEBUG - if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword)); - if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword)); + if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, out hash); - if (cached != null) return (SelectClauseSyntax)cached; - - var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, out hash); + if (cached != null) return (SelectClauseSyntax)cached; - return result; + var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) - { + return result; + } + + public static GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + { #if DEBUG - if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword)); - if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); - if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression)); - if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword)); - if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); - if (byExpression == null) throw new ArgumentNullException(nameof(byExpression)); + if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword)); + if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); + if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression)); + if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword)); + if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); + if (byExpression == null) throw new ArgumentNullException(nameof(byExpression)); #endif - return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression); - } + return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression); + } - public static QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) - { + public static QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + { #if DEBUG - if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); - if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (body == null) throw new ArgumentNullException(nameof(body)); + if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); + if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (body == null) throw new ArgumentNullException(nameof(body)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, out hash); - if (cached != null) return (QueryContinuationSyntax)cached; - - var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, out hash); + if (cached != null) return (QueryContinuationSyntax)cached; - return result; + var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken) - { + return result; + } + + public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken) + { #if DEBUG - if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken)); - if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); + if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken)); + if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, out hash); - if (cached != null) return (OmittedArraySizeExpressionSyntax)cached; - - var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, out hash); + if (cached != null) return (OmittedArraySizeExpressionSyntax)cached; - return result; + var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList contents, SyntaxToken stringEndToken) - { + return result; + } + + public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) + { #if DEBUG - if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken)); - switch (stringStartToken.Kind) - { - case SyntaxKind.InterpolatedStringStartToken: - case SyntaxKind.InterpolatedVerbatimStringStartToken: - case SyntaxKind.InterpolatedSingleLineRawStringStartToken: - case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; - default: throw new ArgumentException(nameof(stringStartToken)); - } - if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken)); - switch (stringEndToken.Kind) - { - case SyntaxKind.InterpolatedStringEndToken: - case SyntaxKind.InterpolatedRawStringEndToken: break; - default: throw new ArgumentException(nameof(stringEndToken)); - } + if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken)); + switch (stringStartToken.Kind) + { + case SyntaxKind.InterpolatedStringStartToken: + case SyntaxKind.InterpolatedVerbatimStringStartToken: + case SyntaxKind.InterpolatedSingleLineRawStringStartToken: + case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; + default: throw new ArgumentException(nameof(stringStartToken)); + } + if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken)); + switch (stringEndToken.Kind) + { + case SyntaxKind.InterpolatedStringEndToken: + case SyntaxKind.InterpolatedRawStringEndToken: break; + default: throw new ArgumentException(nameof(stringEndToken)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, out hash); - if (cached != null) return (InterpolatedStringExpressionSyntax)cached; - - var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, out hash); + if (cached != null) return (InterpolatedStringExpressionSyntax)cached; - return result; + var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) - { + return result; + } + + public static IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword)); - if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword)); + if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, out hash); - if (cached != null) return (IsPatternExpressionSyntax)cached; - - var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, out hash); + if (cached != null) return (IsPatternExpressionSyntax)cached; - return result; + var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression) - { + return result; + } + + public static ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression) + { #if DEBUG - if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); - if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); + if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, out hash); - if (cached != null) return (ThrowExpressionSyntax)cached; - - var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, out hash); + if (cached != null) return (ThrowExpressionSyntax)cached; - return result; + var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition) - { + return result; + } + + public static WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition) + { #if DEBUG - if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); - if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); + if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, out hash); - if (cached != null) return (WhenClauseSyntax)cached; - - var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, out hash); + if (cached != null) return (WhenClauseSyntax)cached; - return result; + var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken) - { + return result; + } + + public static DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken) + { #if DEBUG - if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); - if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); + if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); + if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, out hash); - if (cached != null) return (DiscardPatternSyntax)cached; - - var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, out hash); + if (cached != null) return (DiscardPatternSyntax)cached; - return result; + var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) - { + return result; + } + + public static DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, out hash); - if (cached != null) return (DeclarationPatternSyntax)cached; - - var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, out hash); + if (cached != null) return (DeclarationPatternSyntax)cached; - return result; + var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation) - { + return result; + } + + public static VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation) + { #if DEBUG - if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword)); - if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword)); + if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, out hash); - if (cached != null) return (VarPatternSyntax)cached; - - var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, out hash); + if (cached != null) return (VarPatternSyntax)cached; - return result; + var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) - { + return result; + } + + public static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) + { #if DEBUG #endif - return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation); - } + return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation); + } - public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) - { + public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, out hash); - if (cached != null) return (PositionalPatternClauseSyntax)cached; - - var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, out hash); + if (cached != null) return (PositionalPatternClauseSyntax)cached; - return result; + var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) - { + return result; + } + + public static PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, out hash); - if (cached != null) return (PropertyPatternClauseSyntax)cached; - - var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, out hash); + if (cached != null) return (PropertyPatternClauseSyntax)cached; - return result; + var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) - { + return result; + } + + public static SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) + { #if DEBUG - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, out hash); - if (cached != null) return (SubpatternSyntax)cached; - - var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, out hash); + if (cached != null) return (SubpatternSyntax)cached; - return result; + var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression) - { + return result; + } + + public static ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, out hash); - if (cached != null) return (ConstantPatternSyntax)cached; - - var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, out hash); + if (cached != null) return (ConstantPatternSyntax)cached; - return result; + var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) - { + return result; + } + + public static ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, out hash); - if (cached != null) return (ParenthesizedPatternSyntax)cached; - - var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, out hash); + if (cached != null) return (ParenthesizedPatternSyntax)cached; - return result; + var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression) - { + return result; + } + + public static RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, out hash); - if (cached != null) return (RelationalPatternSyntax)cached; - - var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, out hash); + if (cached != null) return (RelationalPatternSyntax)cached; - return result; + var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypePatternSyntax TypePattern(TypeSyntax type) - { + return result; + } + + public static TypePatternSyntax TypePattern(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, out hash); - if (cached != null) return (TypePatternSyntax)cached; - - var result = new TypePatternSyntax(SyntaxKind.TypePattern, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, out hash); + if (cached != null) return (TypePatternSyntax)cached; - return result; + var result = new TypePatternSyntax(SyntaxKind.TypePattern, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + return result; + } + + public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.OrPattern: - case SyntaxKind.AndPattern: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.OrPattern: + case SyntaxKind.AndPattern: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.OrKeyword: - case SyntaxKind.AndKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.OrKeyword: + case SyntaxKind.AndKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); - if (cached != null) return (BinaryPatternSyntax)cached; - - var result = new BinaryPatternSyntax(kind, left, operatorToken, right); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); + if (cached != null) return (BinaryPatternSyntax)cached; - return result; + var result = new BinaryPatternSyntax(kind, left, operatorToken, right); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern) - { + return result; + } + + public static UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, out hash); - if (cached != null) return (UnaryPatternSyntax)cached; - - var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, out hash); + if (cached != null) return (UnaryPatternSyntax)cached; - return result; + var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ListPatternSyntax ListPattern(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) - { + return result; + } + + public static ListPatternSyntax ListPattern(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation); - } + return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation); + } - public static SlicePatternSyntax SlicePattern(SyntaxToken dotDotToken, PatternSyntax? pattern) - { + public static SlicePatternSyntax SlicePattern(SyntaxToken dotDotToken, PatternSyntax? pattern) + { #if DEBUG - if (dotDotToken == null) throw new ArgumentNullException(nameof(dotDotToken)); - if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); + if (dotDotToken == null) throw new ArgumentNullException(nameof(dotDotToken)); + if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, out hash); - if (cached != null) return (SlicePatternSyntax)cached; - - var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, out hash); + if (cached != null) return (SlicePatternSyntax)cached; - return result; + var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken) - { + return result; + } + + public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken) + { #if DEBUG - if (textToken == null) throw new ArgumentNullException(nameof(textToken)); - if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); + if (textToken == null) throw new ArgumentNullException(nameof(textToken)); + if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, out hash); - if (cached != null) return (InterpolatedStringTextSyntax)cached; - - var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, out hash); + if (cached != null) return (InterpolatedStringTextSyntax)cached; - return result; + var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) - { + return result; + } + + public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); - } + return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); + } - public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value) - { + public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value) + { #if DEBUG - if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); - if (value == null) throw new ArgumentNullException(nameof(value)); + if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); + if (value == null) throw new ArgumentNullException(nameof(value)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, out hash); - if (cached != null) return (InterpolationAlignmentClauseSyntax)cached; - - var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, out hash); + if (cached != null) return (InterpolationAlignmentClauseSyntax)cached; - return result; + var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken) - { + return result; + } + + public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken) + { #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken)); - if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken)); + if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, out hash); - if (cached != null) return (InterpolationFormatClauseSyntax)cached; - - var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, out hash); + if (cached != null) return (InterpolationFormatClauseSyntax)cached; - return result; + var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static GlobalStatementSyntax GlobalStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, StatementSyntax statement) - { + return result; + } + + public static GlobalStatementSyntax GlobalStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) + { #if DEBUG - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, out hash); - if (cached != null) return (GlobalStatementSyntax)cached; - - var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, out hash); + if (cached != null) return (GlobalStatementSyntax)cached; - return result; + var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BlockSyntax Block(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements, SyntaxToken closeBraceToken) - { + return result; + } + + public static BlockSyntax Block(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken); - } + return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken); + } - public static LocalFunctionStatementSyntax LocalFunctionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public static LocalFunctionStatementSyntax LocalFunctionStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); - } + return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); + } - public static LocalDeclarationStatementSyntax LocalDeclarationStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + public static LocalDeclarationStatementSyntax LocalDeclarationStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (usingKeyword != null) + } + if (usingKeyword != null) + { + switch (usingKeyword.Kind) { - switch (usingKeyword.Kind) - { - case SyntaxKind.UsingKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(usingKeyword)); - } + case SyntaxKind.UsingKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(usingKeyword)); } - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken); - } + return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken); + } - public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables) - { + public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, out hash); - if (cached != null) return (VariableDeclarationSyntax)cached; - - var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, out hash); + if (cached != null) return (VariableDeclarationSyntax)cached; - return result; + var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) - { + return result; + } + + public static VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, out hash); - if (cached != null) return (VariableDeclaratorSyntax)cached; - - var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, out hash); + if (cached != null) return (VariableDeclaratorSyntax)cached; - return result; + var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value) - { + return result; + } + + public static EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value) + { #if DEBUG - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (value == null) throw new ArgumentNullException(nameof(value)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (value == null) throw new ArgumentNullException(nameof(value)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, out hash); - if (cached != null) return (EqualsValueClauseSyntax)cached; - - var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, out hash); + if (cached != null) return (EqualsValueClauseSyntax)cached; - return result; + var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier) - { + return result; + } + + public static SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, out hash); - if (cached != null) return (SingleVariableDesignationSyntax)cached; - - var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, out hash); + if (cached != null) return (SingleVariableDesignationSyntax)cached; - return result; + var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) - { + return result; + } + + public static DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) + { #if DEBUG - if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); - if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); + if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); + if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, out hash); - if (cached != null) return (DiscardDesignationSyntax)cached; - - var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, out hash); + if (cached != null) return (DiscardDesignationSyntax)cached; - return result; + var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) - { + return result; + } + + public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, out hash); - if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached; - - var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, out hash); + if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached; - return result; + var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ExpressionStatementSyntax ExpressionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) - { + return result; + } + + public static ExpressionStatementSyntax ExpressionStatement(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, out hash); - if (cached != null) return (ExpressionStatementSyntax)cached; - - var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, out hash); + if (cached != null) return (ExpressionStatementSyntax)cached; - return result; + var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static EmptyStatementSyntax EmptyStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) - { + return result; + } + + public static EmptyStatementSyntax EmptyStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + { #if DEBUG - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, out hash); - if (cached != null) return (EmptyStatementSyntax)cached; - - var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, out hash); + if (cached != null) return (EmptyStatementSyntax)cached; - return result; + var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static LabeledStatementSyntax LabeledStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) - { + return result; + } + + public static LabeledStatementSyntax LabeledStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement); - } + return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement); + } - public static GotoStatementSyntax GotoStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public static GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.GotoStatement: - case SyntaxKind.GotoCaseStatement: - case SyntaxKind.GotoDefaultStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.GotoStatement: + case SyntaxKind.GotoCaseStatement: + case SyntaxKind.GotoDefaultStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword)); - if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); - if (caseOrDefaultKeyword != null) + if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword)); + if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); + if (caseOrDefaultKeyword != null) + { + switch (caseOrDefaultKeyword.Kind) { - switch (caseOrDefaultKeyword.Kind) - { - case SyntaxKind.CaseKeyword: - case SyntaxKind.DefaultKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(caseOrDefaultKeyword)); - } + case SyntaxKind.CaseKeyword: + case SyntaxKind.DefaultKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(caseOrDefaultKeyword)); } - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); - } + return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); + } - public static BreakStatementSyntax BreakStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) - { + public static BreakStatementSyntax BreakStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + { #if DEBUG - if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword)); - if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword)); + if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, out hash); - if (cached != null) return (BreakStatementSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, out hash); + if (cached != null) return (BreakStatementSyntax)cached; - var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ContinueStatementSyntax ContinueStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) - { + return result; + } + + public static ContinueStatementSyntax ContinueStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + { #if DEBUG - if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword)); - if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword)); + if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, out hash); - if (cached != null) return (ContinueStatementSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, out hash); + if (cached != null) return (ContinueStatementSyntax)cached; - var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ReturnStatementSyntax ReturnStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { + return result; + } + + public static ReturnStatementSyntax ReturnStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { #if DEBUG - if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword)); - if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword)); + if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken); - } + return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken); + } - public static ThrowStatementSyntax ThrowStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { + public static ThrowStatementSyntax ThrowStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { #if DEBUG - if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); - if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); + if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken); - } + return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken); + } - public static YieldStatementSyntax YieldStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public static YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.YieldReturnStatement: - case SyntaxKind.YieldBreakStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.YieldReturnStatement: + case SyntaxKind.YieldBreakStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword)); - if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); - if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword)); - switch (returnOrBreakKeyword.Kind) - { - case SyntaxKind.ReturnKeyword: - case SyntaxKind.BreakKeyword: break; - default: throw new ArgumentException(nameof(returnOrBreakKeyword)); - } - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword)); + if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); + if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword)); + switch (returnOrBreakKeyword.Kind) + { + case SyntaxKind.ReturnKeyword: + case SyntaxKind.BreakKeyword: break; + default: throw new ArgumentException(nameof(returnOrBreakKeyword)); + } + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); - } + return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); + } - public static WhileStatementSyntax WhileStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static WhileStatementSyntax WhileStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); - if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); + if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement); - } + return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement); + } - public static DoStatementSyntax DoStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) - { + public static DoStatementSyntax DoStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + { #if DEBUG - if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword)); - if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); - if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword)); + if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); + if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); - } + return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); + } - public static ForStatementSyntax ForStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static ForStatementSyntax ForStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword)); - if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken)); - if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); - if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken)); - if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword)); + if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken)); + if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); + if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken)); + if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement); - } + return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement); + } - public static ForEachStatementSyntax ForEachStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static ForEachStatementSyntax ForEachStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); - if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); + if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); - } + return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); + } - public static ForEachVariableStatementSyntax ForEachVariableStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static ForEachVariableStatementSyntax ForEachVariableStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); - if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (variable == null) throw new ArgumentNullException(nameof(variable)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); + if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (variable == null) throw new ArgumentNullException(nameof(variable)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); - } + return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); + } - public static UsingStatementSyntax UsingStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static UsingStatementSyntax UsingStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); - if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); + if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); - } + return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); + } - public static FixedStatementSyntax FixedStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static FixedStatementSyntax FixedStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword)); - if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword)); + if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement); - } + return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement); + } - public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.CheckedStatement: - case SyntaxKind.UncheckedStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.CheckedStatement: + case SyntaxKind.UncheckedStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.UncheckedKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (block == null) throw new ArgumentNullException(nameof(block)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.CheckedKeyword: + case SyntaxKind.UncheckedKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, out hash); - if (cached != null) return (CheckedStatementSyntax)cached; - - var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, out hash); + if (cached != null) return (CheckedStatementSyntax)cached; - return result; + var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static UnsafeStatementSyntax UnsafeStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) - { + return result; + } + + public static UnsafeStatementSyntax UnsafeStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + { #if DEBUG - if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword)); - if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword)); + if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, out hash); - if (cached != null) return (UnsafeStatementSyntax)cached; - - var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, out hash); + if (cached != null) return (UnsafeStatementSyntax)cached; - return result; + var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static LockStatementSyntax LockStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + return result; + } + + public static LockStatementSyntax LockStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { +#if DEBUG + if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword)); + if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); +#endif + + return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement); + } + + public static IfStatementSyntax IfStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + { #if DEBUG - if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword)); - if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); + if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement); - } + return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); + } - public static IfStatementSyntax IfStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) - { + public static ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement) + { #if DEBUG - if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); - if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); + if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, out hash); + if (cached != null) return (ElseClauseSyntax)cached; - public static ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement) + var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement); + if (hash >= 0) { -#if DEBUG - if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); - if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); -#endif + SyntaxNodeCache.AddNode(result, hash); + } - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, out hash); - if (cached != null) return (ElseClauseSyntax)cached; + return result; + } - var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement); - if (hash >= 0) + public static SwitchStatementSyntax SwitchStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + { +#if DEBUG + if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); + if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); + if (openParenToken != null) + { + switch (openParenToken.Kind) { - SyntaxNodeCache.AddNode(result, hash); + case SyntaxKind.OpenParenToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openParenToken)); } - - return result; } - - public static SwitchStatementSyntax SwitchStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken != null) { -#if DEBUG - if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); - if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); - if (openParenToken != null) + switch (closeParenToken.Kind) { - switch (openParenToken.Kind) - { - case SyntaxKind.OpenParenToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openParenToken)); - } + case SyntaxKind.CloseParenToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeParenToken)); } - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken != null) - { - switch (closeParenToken.Kind) - { - case SyntaxKind.CloseParenToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeParenToken)); - } - } - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + } + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken); - } + return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken); + } - public static SwitchSectionSyntax SwitchSection(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements) - { + public static SwitchSectionSyntax SwitchSection(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) + { #if DEBUG #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, out hash); - if (cached != null) return (SwitchSectionSyntax)cached; - - var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, out hash); + if (cached != null) return (SwitchSectionSyntax)cached; - return result; + var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) - { + return result; + } + + public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken); - } + return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken); + } - public static CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) - { + public static CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); - if (value == null) throw new ArgumentNullException(nameof(value)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); + if (value == null) throw new ArgumentNullException(nameof(value)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, out hash); - if (cached != null) return (CaseSwitchLabelSyntax)cached; - - var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, out hash); + if (cached != null) return (CaseSwitchLabelSyntax)cached; - return result; + var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken) - { + return result; + } + + public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, out hash); - if (cached != null) return (DefaultSwitchLabelSyntax)cached; - - var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, out hash); + if (cached != null) return (DefaultSwitchLabelSyntax)cached; - return result; + var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) - { + return result; + } + + public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + { #if DEBUG - if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); - if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); - if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); + if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); + if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken); - } + return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken); + } - public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) - { + public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + { #if DEBUG - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken)); - if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken)); + if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression); - } + return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression); + } - public static TryStatementSyntax TryStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) - { + public static TryStatementSyntax TryStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) + { #if DEBUG - if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword)); - if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword)); + if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally); - } + return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally); + } - public static CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - { + public static CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) + { #if DEBUG - if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword)); - if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword)); + if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block); - } + return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block); + } - public static CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) - { + public static CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier != null) + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier != null) + { + switch (identifier.Kind) { - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(identifier)); - } + case SyntaxKind.IdentifierToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(identifier)); } - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + } + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken); - } + return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken); + } - public static CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) - { + public static CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + { #if DEBUG - if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); - if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); + if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken); - } + return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken); + } - public static FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block) - { + public static FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block) + { #if DEBUG - if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword)); - if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword)); + if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, out hash); - if (cached != null) return (FinallyClauseSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, out hash); + if (cached != null) return (FinallyClauseSyntax)cached; - var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static CompilationUnitSyntax CompilationUnit(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken endOfFileToken) - { + return result; + } + + public static CompilationUnitSyntax CompilationUnit(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) + { #if DEBUG - if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken)); - if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); + if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken)); + if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); #endif - return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken); - } + return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken); + } - public static ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) - { + public static ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + { #if DEBUG - if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword)); - if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); - if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword)); - if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword)); + if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); + if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword)); + if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken); - } + return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken); + } - public static UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) - { + public static UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + { #if DEBUG - if (globalKeyword != null) + if (globalKeyword != null) + { + switch (globalKeyword.Kind) { - switch (globalKeyword.Kind) - { - case SyntaxKind.GlobalKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(globalKeyword)); - } + case SyntaxKind.GlobalKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(globalKeyword)); } - if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); - if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); - if (staticKeyword != null) + } + if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); + if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); + if (staticKeyword != null) + { + switch (staticKeyword.Kind) { - switch (staticKeyword.Kind) - { - case SyntaxKind.StaticKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(staticKeyword)); - } + case SyntaxKind.StaticKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(staticKeyword)); } - if (unsafeKeyword != null) + } + if (unsafeKeyword != null) + { + switch (unsafeKeyword.Kind) { - switch (unsafeKeyword.Kind) - { - case SyntaxKind.UnsafeKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(unsafeKeyword)); - } + case SyntaxKind.UnsafeKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(unsafeKeyword)); } - if (namespaceOrType == null) throw new ArgumentNullException(nameof(namespaceOrType)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (namespaceOrType == null) throw new ArgumentNullException(nameof(namespaceOrType)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); - } + return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); + } - public static NamespaceDeclarationSyntax NamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) - { + public static NamespaceDeclarationSyntax NamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); - if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - if (semicolonToken != null) + if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); + if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken); - } + return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken); + } - public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members) - { + public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) + { #if DEBUG - if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); - if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); + if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node); - } + return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node); + } - public static AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) - { + public static AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken); - } + return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken); + } - public static AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken) - { + public static AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, out hash); - if (cached != null) return (AttributeTargetSpecifierSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, out hash); + if (cached != null) return (AttributeTargetSpecifierSyntax)cached; - var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList) - { + return result; + } + + public static AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, out hash); - if (cached != null) return (AttributeSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, out hash); + if (cached != null) return (AttributeSyntax)cached; - var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public static AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); - if (cached != null) return (AttributeArgumentListSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); + if (cached != null) return (AttributeArgumentListSyntax)cached; - var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) - { + return result; + } + + public static AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, out hash); - if (cached != null) return (AttributeArgumentSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, out hash); + if (cached != null) return (AttributeArgumentSyntax)cached; - var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken) - { + return result; + } + + public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, out hash); - if (cached != null) return (NameEqualsSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, out hash); + if (cached != null) return (NameEqualsSyntax)cached; - var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { + return result; + } + + public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); - if (cached != null) return (TypeParameterListSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); + if (cached != null) return (TypeParameterListSyntax)cached; - var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypeParameterSyntax TypeParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) - { + return result; + } + + public static TypeParameterSyntax TypeParameter(CoreSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) + { #if DEBUG - if (varianceKeyword != null) + if (varianceKeyword != null) + { + switch (varianceKeyword.Kind) { - switch (varianceKeyword.Kind) - { - case SyntaxKind.InKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(varianceKeyword)); - } + case SyntaxKind.InKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(varianceKeyword)); } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, out hash); - if (cached != null) return (TypeParameterSyntax)cached; - - var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, out hash); + if (cached != null) return (TypeParameterSyntax)cached; - return result; + var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ClassDeclarationSyntax ClassDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + return result; + } + + public static ClassDeclarationSyntax ClassDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); - } + return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); + } - public static StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public static StructDeclarationSyntax StructDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); - } + return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); + } - public static InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public static InterfaceDeclarationSyntax InterfaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); - } + return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); + } - public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.RecordDeclaration: - case SyntaxKind.RecordStructDeclaration: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.RecordDeclaration: + case SyntaxKind.RecordStructDeclaration: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (classOrStructKeyword != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (classOrStructKeyword != null) + { + switch (classOrStructKeyword.Kind) { - switch (classOrStructKeyword.Kind) - { - case SyntaxKind.ClassKeyword: - case SyntaxKind.StructKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(classOrStructKeyword)); - } + case SyntaxKind.ClassKeyword: + case SyntaxKind.StructKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(classOrStructKeyword)); } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); - } + return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); + } - public static EnumDeclarationSyntax EnumDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public static EnumDeclarationSyntax EnumDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword)); - if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword)); + if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken); - } + return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken); + } - public static DelegateDeclarationSyntax DelegateDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) - { + public static DelegateDeclarationSyntax DelegateDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken); - } + return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken); + } - public static EnumMemberDeclarationSyntax EnumMemberDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) - { + public static EnumMemberDeclarationSyntax EnumMemberDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue); - } + return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue); + } - public static BaseListSyntax BaseList(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList types) - { + public static BaseListSyntax BaseList(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) + { #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, out hash); - if (cached != null) return (BaseListSyntax)cached; - - var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, out hash); + if (cached != null) return (BaseListSyntax)cached; - return result; + var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) - { + return result; + } + + public static SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, out hash); - if (cached != null) return (SimpleBaseTypeSyntax)cached; - - var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, out hash); + if (cached != null) return (SimpleBaseTypeSyntax)cached; - return result; + var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) - { + return result; + } + + public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, out hash); - if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached; - - var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, out hash); + if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached; - return result; + var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList constraints) - { + return result; + } + + public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) + { #if DEBUG - if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); - if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); + if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node); - } + return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node); + } - public static ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) - { + public static ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, out hash); - if (cached != null) return (ConstructorConstraintSyntax)cached; - - var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, out hash); + if (cached != null) return (ConstructorConstraintSyntax)cached; - return result; + var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) + return result; + } + + public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ClassConstraint: - case SyntaxKind.StructConstraint: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ClassConstraint: + case SyntaxKind.StructConstraint: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword)); - switch (classOrStructKeyword.Kind) - { - case SyntaxKind.ClassKeyword: - case SyntaxKind.StructKeyword: break; - default: throw new ArgumentException(nameof(classOrStructKeyword)); - } - if (questionToken != null) + if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword)); + switch (classOrStructKeyword.Kind) + { + case SyntaxKind.ClassKeyword: + case SyntaxKind.StructKeyword: break; + default: throw new ArgumentException(nameof(classOrStructKeyword)); + } + if (questionToken != null) + { + switch (questionToken.Kind) { - switch (questionToken.Kind) - { - case SyntaxKind.QuestionToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(questionToken)); - } + case SyntaxKind.QuestionToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(questionToken)); } + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, out hash); - if (cached != null) return (ClassOrStructConstraintSyntax)cached; - - var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, out hash); + if (cached != null) return (ClassOrStructConstraintSyntax)cached; - return result; + var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypeConstraintSyntax TypeConstraint(TypeSyntax type) - { + return result; + } + + public static TypeConstraintSyntax TypeConstraint(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, out hash); - if (cached != null) return (TypeConstraintSyntax)cached; - - var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, out hash); + if (cached != null) return (TypeConstraintSyntax)cached; - return result; + var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) - { + return result; + } + + public static DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) + { #if DEBUG - if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword)); - if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); + if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword)); + if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, out hash); - if (cached != null) return (DefaultConstraintSyntax)cached; - - var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, out hash); + if (cached != null) return (DefaultConstraintSyntax)cached; - return result; + var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FieldDeclarationSyntax FieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + return result; + } + + public static FieldDeclarationSyntax FieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken); - } + return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken); + } - public static EventFieldDeclarationSyntax EventFieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + public static EventFieldDeclarationSyntax EventFieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); - if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); + if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken); - } + return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken); + } - public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken) - { + public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, out hash); - if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached; - - var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, out hash); + if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached; - return result; + var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static MethodDeclarationSyntax MethodDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + return result; + } + + public static MethodDeclarationSyntax MethodDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); - } + return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); + } - public static OperatorDeclarationSyntax OperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public static OperatorDeclarationSyntax OperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) - { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - } - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.TildeToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.FalseKeyword: - case SyntaxKind.TrueKeyword: - case SyntaxKind.IsKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + } + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.TildeToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: + case SyntaxKind.IsKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); - } + return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); + } - public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); - switch (implicitOrExplicitKeyword.Kind) - { - case SyntaxKind.ImplicitKeyword: - case SyntaxKind.ExplicitKeyword: break; - default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); - } - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) + if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); + switch (implicitOrExplicitKeyword.Kind) + { + case SyntaxKind.ImplicitKeyword: + case SyntaxKind.ExplicitKeyword: break; + default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); + } + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + } + if (type == null) throw new ArgumentNullException(nameof(type)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); - } + return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); + } - public static ConstructorDeclarationSyntax ConstructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public static ConstructorDeclarationSyntax ConstructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken); - } + return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken); + } - public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.BaseConstructorInitializer: - case SyntaxKind.ThisConstructorInitializer: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.BaseConstructorInitializer: + case SyntaxKind.ThisConstructorInitializer: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword)); - switch (thisOrBaseKeyword.Kind) - { - case SyntaxKind.BaseKeyword: - case SyntaxKind.ThisKeyword: break; - default: throw new ArgumentException(nameof(thisOrBaseKeyword)); - } - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword)); + switch (thisOrBaseKeyword.Kind) + { + case SyntaxKind.BaseKeyword: + case SyntaxKind.ThisKeyword: break; + default: throw new ArgumentException(nameof(thisOrBaseKeyword)); + } + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, out hash); - if (cached != null) return (ConstructorInitializerSyntax)cached; - - var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, out hash); + if (cached != null) return (ConstructorInitializerSyntax)cached; - return result; + var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DestructorDeclarationSyntax DestructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + return result; + } + + public static DestructorDeclarationSyntax DestructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken)); - if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken)); + if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); - } + return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); + } - public static PropertyDeclarationSyntax PropertyDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) - { + public static PropertyDeclarationSyntax PropertyDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); - } + return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); + } - public static ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression) - { + public static ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression) + { #if DEBUG - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, out hash); - if (cached != null) return (ArrowExpressionClauseSyntax)cached; - - var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, out hash); + if (cached != null) return (ArrowExpressionClauseSyntax)cached; - return result; + var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static EventDeclarationSyntax EventDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) - { + return result; + } + + public static EventDeclarationSyntax EventDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) + { #if DEBUG - if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); - if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken != null) + if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); + if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); - } + return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); + } - public static IndexerDeclarationSyntax IndexerDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public static IndexerDeclarationSyntax IndexerDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); - if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); + if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); - } + return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); + } - public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) - { + public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, out hash); - if (cached != null) return (AccessorListSyntax)cached; - - var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, out hash); + if (cached != null) return (AccessorListSyntax)cached; - return result; + var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + return result; + } + + public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.GetAccessorDeclaration: - case SyntaxKind.SetAccessorDeclaration: - case SyntaxKind.InitAccessorDeclaration: - case SyntaxKind.AddAccessorDeclaration: - case SyntaxKind.RemoveAccessorDeclaration: - case SyntaxKind.UnknownAccessorDeclaration: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.GetAccessorDeclaration: + case SyntaxKind.SetAccessorDeclaration: + case SyntaxKind.InitAccessorDeclaration: + case SyntaxKind.AddAccessorDeclaration: + case SyntaxKind.RemoveAccessorDeclaration: + case SyntaxKind.UnknownAccessorDeclaration: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - case SyntaxKind.InitKeyword: - case SyntaxKind.AddKeyword: - case SyntaxKind.RemoveKeyword: - case SyntaxKind.IdentifierToken: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (semicolonToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + case SyntaxKind.InitKeyword: + case SyntaxKind.AddKeyword: + case SyntaxKind.RemoveKeyword: + case SyntaxKind.IdentifierToken: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken); - } + return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken); + } - public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { + public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, out hash); - if (cached != null) return (ParameterListSyntax)cached; - - var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, out hash); + if (cached != null) return (ParameterListSyntax)cached; - return result; + var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { + return result; + } + + public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); - if (cached != null) return (BracketedParameterListSyntax)cached; - - var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); + if (cached != null) return (BracketedParameterListSyntax)cached; - return result; + var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ParameterSyntax Parameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) - { + return result; + } + + public static ParameterSyntax Parameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.ArgListKeyword: break; - default: throw new ArgumentException(nameof(identifier)); - } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + switch (identifier.Kind) + { + case SyntaxKind.IdentifierToken: + case SyntaxKind.ArgListKeyword: break; + default: throw new ArgumentException(nameof(identifier)); + } #endif - return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default); - } + return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default); + } - public static FunctionPointerParameterSyntax FunctionPointerParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type) - { + public static FunctionPointerParameterSyntax FunctionPointerParameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, out hash); - if (cached != null) return (FunctionPointerParameterSyntax)cached; - - var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, out hash); + if (cached != null) return (FunctionPointerParameterSyntax)cached; - return result; + var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static IncompleteMemberSyntax IncompleteMember(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? type) - { + return result; + } + + public static IncompleteMemberSyntax IncompleteMember(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type) + { #if DEBUG #endif - return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type); - } + return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type); + } - public static SkippedTokensTriviaSyntax SkippedTokensTrivia(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList tokens) - { + public static SkippedTokensTriviaSyntax SkippedTokensTrivia(CoreSyntax.SyntaxList tokens) + { #if DEBUG #endif - return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node); - } + return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node); + } - public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, SyntaxToken endOfComment) + public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList content, SyntaxToken endOfComment) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SingleLineDocumentationCommentTrivia: - case SyntaxKind.MultiLineDocumentationCommentTrivia: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SingleLineDocumentationCommentTrivia: + case SyntaxKind.MultiLineDocumentationCommentTrivia: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment)); - if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); + if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment)); + if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); #endif - return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment); - } + return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment); + } - public static TypeCrefSyntax TypeCref(TypeSyntax type) - { + public static TypeCrefSyntax TypeCref(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, out hash); - if (cached != null) return (TypeCrefSyntax)cached; - - var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, out hash); + if (cached != null) return (TypeCrefSyntax)cached; - return result; + var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) - { + return result; + } + + public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + { #if DEBUG - if (container == null) throw new ArgumentNullException(nameof(container)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - if (member == null) throw new ArgumentNullException(nameof(member)); + if (container == null) throw new ArgumentNullException(nameof(container)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (member == null) throw new ArgumentNullException(nameof(member)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, out hash); - if (cached != null) return (QualifiedCrefSyntax)cached; - - var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, out hash); + if (cached != null) return (QualifiedCrefSyntax)cached; - return result; + var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) - { + return result; + } + + public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, out hash); - if (cached != null) return (NameMemberCrefSyntax)cached; - - var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, out hash); + if (cached != null) return (NameMemberCrefSyntax)cached; - return result; + var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) - { + return result; + } + + public static IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + { #if DEBUG - if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); - if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); + if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); + if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, out hash); - if (cached != null) return (IndexerMemberCrefSyntax)cached; - - var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, out hash); + if (cached != null) return (IndexerMemberCrefSyntax)cached; - return result; + var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) - { + return result; + } + + public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + { #if DEBUG - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) - { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - } - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.TildeToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.FalseKeyword: - case SyntaxKind.TrueKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } + } + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.TildeToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } #endif - return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters); - } + return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters); + } - public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) - { + public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + { #if DEBUG - if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); - switch (implicitOrExplicitKeyword.Kind) - { - case SyntaxKind.ImplicitKeyword: - case SyntaxKind.ExplicitKeyword: break; - default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); - } - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) + if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); + switch (implicitOrExplicitKeyword.Kind) + { + case SyntaxKind.ImplicitKeyword: + case SyntaxKind.ExplicitKeyword: break; + default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); + } + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); - } + return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); + } - public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { + public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, out hash); - if (cached != null) return (CrefParameterListSyntax)cached; - - var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, out hash); + if (cached != null) return (CrefParameterListSyntax)cached; - return result; + var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { + return result; + } + + public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); - if (cached != null) return (CrefBracketedParameterListSyntax)cached; - - var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); + if (cached != null) return (CrefBracketedParameterListSyntax)cached; - return result; + var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - { + return result; + } + + public static CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + { #if DEBUG - if (refKindKeyword != null) + if (refKindKeyword != null) + { + switch (refKindKeyword.Kind) { - switch (refKindKeyword.Kind) - { - case SyntaxKind.RefKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.InKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(refKindKeyword)); - } + case SyntaxKind.RefKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.InKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(refKindKeyword)); } - if (readOnlyKeyword != null) + } + if (readOnlyKeyword != null) + { + switch (readOnlyKeyword.Kind) { - switch (readOnlyKeyword.Kind) - { - case SyntaxKind.ReadOnlyKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(readOnlyKeyword)); - } + case SyntaxKind.ReadOnlyKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(readOnlyKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, out hash); - if (cached != null) return (CrefParameterSyntax)cached; - - var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, out hash); + if (cached != null) return (CrefParameterSyntax)cached; - return result; + var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) - { + return result; + } + + public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + { #if DEBUG - if (startTag == null) throw new ArgumentNullException(nameof(startTag)); - if (endTag == null) throw new ArgumentNullException(nameof(endTag)); + if (startTag == null) throw new ArgumentNullException(nameof(startTag)); + if (endTag == null) throw new ArgumentNullException(nameof(endTag)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, out hash); - if (cached != null) return (XmlElementSyntax)cached; - - var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, out hash); + if (cached != null) return (XmlElementSyntax)cached; - return result; + var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) - { + return result; + } + + public static XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken); - } + return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken); + } - public static XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) - { + public static XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken)); - if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken)); + if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, out hash); - if (cached != null) return (XmlElementEndTagSyntax)cached; - - var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, out hash); + if (cached != null) return (XmlElementEndTagSyntax)cached; - return result; + var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) - { + return result; + } + + public static XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken)); - if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken)); + if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); #endif - return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken); - } + return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken); + } - public static XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName) - { + public static XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName) + { #if DEBUG - if (localName == null) throw new ArgumentNullException(nameof(localName)); - if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); + if (localName == null) throw new ArgumentNullException(nameof(localName)); + if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, out hash); - if (cached != null) return (XmlNameSyntax)cached; - - var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, out hash); + if (cached != null) return (XmlNameSyntax)cached; - return result; + var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) - { + return result; + } + + public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) + { #if DEBUG - if (prefix == null) throw new ArgumentNullException(nameof(prefix)); - if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (prefix == null) throw new ArgumentNullException(nameof(prefix)); + if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, out hash); - if (cached != null) return (XmlPrefixSyntax)cached; - - var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, out hash); + if (cached != null) return (XmlPrefixSyntax)cached; - return result; + var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) - { + return result; + } + + public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken); - } + return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken); + } - public static XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) - { + public static XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (cref == null) throw new ArgumentNullException(nameof(cref)); - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (cref == null) throw new ArgumentNullException(nameof(cref)); + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken); - } + return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken); + } - public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) - { + public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken); - } + return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken); + } - public static XmlTextSyntax XmlText(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens) - { + public static XmlTextSyntax XmlText(CoreSyntax.SyntaxList textTokens) + { #if DEBUG #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, out hash); - if (cached != null) return (XmlTextSyntax)cached; - - var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, out hash); + if (cached != null) return (XmlTextSyntax)cached; - return result; + var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) - { + return result; + } + + public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + { #if DEBUG - if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken)); - if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); - if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken)); - if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); + if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken)); + if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); + if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken)); + if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, out hash); - if (cached != null) return (XmlCDataSectionSyntax)cached; - - var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, out hash); + if (cached != null) return (XmlCDataSectionSyntax)cached; - return result; + var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) - { + return result; + } + + public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + { #if DEBUG - if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken)); - if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken)); - if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); + if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken)); + if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken)); + if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); #endif - return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken); - } + return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken); + } - public static XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) - { + public static XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) + { #if DEBUG - if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken)); - if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); - if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken)); - if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); + if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken)); + if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); + if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken)); + if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, out hash); - if (cached != null) return (XmlCommentSyntax)cached; - - var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, out hash); + if (cached != null) return (XmlCommentSyntax)cached; - return result; + var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { + return result; + } + + public static IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); - if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); + if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - } + return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + } - public static ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { + public static ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword)); - if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword)); + if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - } + return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + } - public static ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) - { + public static ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); - if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); + if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); - } + return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); + } - public static EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword)); - if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword)); + if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive); - } + return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive); + } - public static RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword)); - if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword)); + if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive); - } + return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive); + } - public static EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword)); - if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword)); + if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive); - } + return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive); + } - public static ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword)); - if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword)); + if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive); - } + return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive); + } - public static WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); - if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); + if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive); - } + return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive); + } - public static BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive); - } + return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive); + } - public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword)); - if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword)); + if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive); - } + return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive); + } - public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword)); - if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword)); + if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive); - } + return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive); + } - public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); - if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); - if (line == null) throw new ArgumentNullException(nameof(line)); - switch (line.Kind) - { - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.DefaultKeyword: - case SyntaxKind.HiddenKeyword: break; - default: throw new ArgumentException(nameof(line)); - } - if (file != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); + if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); + if (line == null) throw new ArgumentNullException(nameof(line)); + switch (line.Kind) + { + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.DefaultKeyword: + case SyntaxKind.HiddenKeyword: break; + default: throw new ArgumentException(nameof(line)); + } + if (file != null) + { + switch (file.Kind) { - switch (file.Kind) - { - case SyntaxKind.StringLiteralToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(file)); - } + case SyntaxKind.StringLiteralToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(file)); } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); - } + return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); + } - public static LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) - { + public static LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (line == null) throw new ArgumentNullException(nameof(line)); - if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); - if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); - if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); - if (character == null) throw new ArgumentNullException(nameof(character)); - if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (line == null) throw new ArgumentNullException(nameof(line)); + if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); + if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); + if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); + if (character == null) throw new ArgumentNullException(nameof(character)); + if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken); - } + return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken); + } - public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); - if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); - if (start == null) throw new ArgumentNullException(nameof(start)); - if (minusToken == null) throw new ArgumentNullException(nameof(minusToken)); - if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); - if (end == null) throw new ArgumentNullException(nameof(end)); - if (characterOffset != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); + if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); + if (start == null) throw new ArgumentNullException(nameof(start)); + if (minusToken == null) throw new ArgumentNullException(nameof(minusToken)); + if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); + if (end == null) throw new ArgumentNullException(nameof(end)); + if (characterOffset != null) + { + switch (characterOffset.Kind) { - switch (characterOffset.Kind) - { - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(characterOffset)); - } + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(characterOffset)); } - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); - } + return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); + } - public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); - if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); - if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); - if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); - if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword)); - switch (disableOrRestoreKeyword.Kind) - { - case SyntaxKind.DisableKeyword: - case SyntaxKind.RestoreKeyword: break; - default: throw new ArgumentException(nameof(disableOrRestoreKeyword)); - } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); + if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); + if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); + if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); + if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword)); + switch (disableOrRestoreKeyword.Kind) + { + case SyntaxKind.DisableKeyword: + case SyntaxKind.RestoreKeyword: break; + default: throw new ArgumentException(nameof(disableOrRestoreKeyword)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive); - } + return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive); + } - public static PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); - if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); - if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword)); - if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (guid == null) throw new ArgumentNullException(nameof(guid)); - if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); - if (bytes == null) throw new ArgumentNullException(nameof(bytes)); - if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); + if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); + if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword)); + if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (guid == null) throw new ArgumentNullException(nameof(guid)); + if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); + if (bytes == null) throw new ArgumentNullException(nameof(bytes)); + if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); - } + return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); + } - public static ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword)); - if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword)); + if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); - } + return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); + } - public static LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword)); - if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword)); + if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive); - } + return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive); + } - public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken)); - if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken)); + if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive); - } + return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive); + } - public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword)); - if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); - if (settingToken == null) throw new ArgumentNullException(nameof(settingToken)); - switch (settingToken.Kind) - { - case SyntaxKind.EnableKeyword: - case SyntaxKind.DisableKeyword: - case SyntaxKind.RestoreKeyword: break; - default: throw new ArgumentException(nameof(settingToken)); - } - if (targetToken != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword)); + if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); + if (settingToken == null) throw new ArgumentNullException(nameof(settingToken)); + switch (settingToken.Kind) + { + case SyntaxKind.EnableKeyword: + case SyntaxKind.DisableKeyword: + case SyntaxKind.RestoreKeyword: break; + default: throw new ArgumentException(nameof(settingToken)); + } + if (targetToken != null) + { + switch (targetToken.Kind) { - switch (targetToken.Kind) - { - case SyntaxKind.WarningsKeyword: - case SyntaxKind.AnnotationsKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(targetToken)); - } + case SyntaxKind.WarningsKeyword: + case SyntaxKind.AnnotationsKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(targetToken)); } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); - } + return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); } } diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs index 0ae229d498502..5fb422e45ba3f 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs @@ -7,6 +7,7 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.Syntax.InternalSyntax; using Roslyn.Utilities; +using CoreSyntax = Microsoft.CodeAnalysis.Syntax.InternalSyntax; namespace Microsoft.CodeAnalysis.CSharp { diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs index 52ff2c190949a..17651292e6e41 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs @@ -7,16330 +7,16329 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.Syntax.InternalSyntax; using Roslyn.Utilities; +using CoreSyntax = Microsoft.CodeAnalysis.Syntax.InternalSyntax; -namespace Microsoft.CodeAnalysis.CSharp.Syntax -{ +namespace Microsoft.CodeAnalysis.CSharp.Syntax; - /// Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. - public abstract partial class NameSyntax : TypeSyntax +/// Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. +public abstract partial class NameSyntax : TypeSyntax +{ + internal NameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal NameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } } +} - /// Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. - public abstract partial class SimpleNameSyntax : NameSyntax +/// Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. +public abstract partial class SimpleNameSyntax : NameSyntax +{ + internal SimpleNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal SimpleNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// SyntaxToken representing the identifier of the simple name. - public abstract SyntaxToken Identifier { get; } - public SimpleNameSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); - internal abstract SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier); } - /// Class which represents the syntax node for identifier name. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IdentifierNameSyntax : SimpleNameSyntax - { - - internal IdentifierNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// SyntaxToken representing the keyword for the kind of the identifier name. - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.IdentifierNameSyntax)this.Green).identifier, Position, 0); + /// SyntaxToken representing the identifier of the simple name. + public abstract SyntaxToken Identifier { get; } + public SimpleNameSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); + internal abstract SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier); +} - internal override SyntaxNode? GetNodeSlot(int index) => null; +/// Class which represents the syntax node for identifier name. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IdentifierNameSyntax : SimpleNameSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal IdentifierNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIdentifierName(this); + /// SyntaxToken representing the keyword for the kind of the identifier name. + public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.IdentifierNameSyntax)this.Green).identifier, Position, 0); - public IdentifierNameSyntax Update(SyntaxToken identifier) - { - if (identifier != this.Identifier) - { - var newNode = SyntaxFactory.IdentifierName(identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new IdentifierNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIdentifierName(this); - /// Class which represents the syntax node for qualified name. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class QualifiedNameSyntax : NameSyntax + public IdentifierNameSyntax Update(SyntaxToken identifier) { - private NameSyntax? left; - private SimpleNameSyntax? right; - - internal QualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (identifier != this.Identifier) { + var newNode = SyntaxFactory.IdentifierName(identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// NameSyntax node representing the name on the left side of the dot token of the qualified name. - public NameSyntax Left => GetRedAtZero(ref this.left)!; + return this; + } + + internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new IdentifierNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); +} - /// SyntaxToken representing the dot. - public SyntaxToken DotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.QualifiedNameSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); +/// Class which represents the syntax node for qualified name. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class QualifiedNameSyntax : NameSyntax +{ + private NameSyntax? left; + private SimpleNameSyntax? right; - /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. - public SimpleNameSyntax Right => GetRed(ref this.right, 2)!; + internal QualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + /// NameSyntax node representing the name on the left side of the dot token of the qualified name. + public NameSyntax Left => GetRedAtZero(ref this.left)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.left, - 2 => this.right, - _ => null, - }; + /// SyntaxToken representing the dot. + public SyntaxToken DotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.QualifiedNameSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedName(this); + /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. + public SimpleNameSyntax Right => GetRed(ref this.right, 2)!; - public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (left != this.Left || dotToken != this.DotToken || right != this.Right) - { - var newNode = SyntaxFactory.QualifiedName(left, dotToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.left, + 2 => this.right, + _ => null, + }; - public QualifiedNameSyntax WithLeft(NameSyntax left) => Update(left, this.DotToken, this.Right); - public QualifiedNameSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Left, dotToken, this.Right); - public QualifiedNameSyntax WithRight(SimpleNameSyntax right) => Update(this.Left, this.DotToken, right); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedName(this); - /// Class which represents the syntax node for generic name. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class GenericNameSyntax : SimpleNameSyntax + public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) { - private TypeArgumentListSyntax? typeArgumentList; - - internal GenericNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (left != this.Left || dotToken != this.DotToken || right != this.Right) { + var newNode = SyntaxFactory.QualifiedName(left, dotToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the name of the identifier of the generic name. - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.GenericNameSyntax)this.Green).identifier, Position, 0); + return this; + } - /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. - public TypeArgumentListSyntax TypeArgumentList => GetRed(ref this.typeArgumentList, 1)!; + public QualifiedNameSyntax WithLeft(NameSyntax left) => Update(left, this.DotToken, this.Right); + public QualifiedNameSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Left, dotToken, this.Right); + public QualifiedNameSyntax WithRight(SimpleNameSyntax right) => Update(this.Left, this.DotToken, right); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.typeArgumentList, 1)! : null; +/// Class which represents the syntax node for generic name. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class GenericNameSyntax : SimpleNameSyntax +{ + private TypeArgumentListSyntax? typeArgumentList; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.typeArgumentList : null; + internal GenericNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGenericName(this); + /// SyntaxToken representing the name of the identifier of the generic name. + public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.GenericNameSyntax)this.Green).identifier, Position, 0); - public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) - { - if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList) - { - var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. + public TypeArgumentListSyntax TypeArgumentList => GetRed(ref this.typeArgumentList, 1)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.typeArgumentList, 1)! : null; - internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new GenericNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.TypeArgumentList); - public GenericNameSyntax WithTypeArgumentList(TypeArgumentListSyntax typeArgumentList) => Update(this.Identifier, typeArgumentList); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.typeArgumentList : null; - public GenericNameSyntax AddTypeArgumentListArguments(params TypeSyntax[] items) => WithTypeArgumentList(this.TypeArgumentList.WithArguments(this.TypeArgumentList.Arguments.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGenericName(this); - /// Class which represents the syntax node for type argument list. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode + public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) { - private SyntaxNode? arguments; - - internal TypeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// SyntaxToken representing less than. - public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); - - /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. - public SeparatedSyntaxList Arguments + if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList) { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing greater than. - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeArgumentList(this); + return this; + } - public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) - { - if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new GenericNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.TypeArgumentList); + public GenericNameSyntax WithTypeArgumentList(TypeArgumentListSyntax typeArgumentList) => Update(this.Identifier, typeArgumentList); - return this; - } + public GenericNameSyntax AddTypeArgumentListArguments(params TypeSyntax[] items) => WithTypeArgumentList(this.TypeArgumentList.WithArguments(this.TypeArgumentList.Arguments.AddRange(items))); +} - public TypeArgumentListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Arguments, this.GreaterThanToken); - public TypeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.LessThanToken, arguments, this.GreaterThanToken); - public TypeArgumentListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Arguments, greaterThanToken); +/// Class which represents the syntax node for type argument list. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? arguments; - public TypeArgumentListSyntax AddArguments(params TypeSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); + internal TypeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents the syntax node for alias qualified name. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AliasQualifiedNameSyntax : NameSyntax - { - private IdentifierNameSyntax? alias; - private SimpleNameSyntax? name; + /// SyntaxToken representing less than. + public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); - internal AliasQualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. + public SeparatedSyntaxList Arguments + { + get { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// IdentifierNameSyntax node representing the name of the alias - public IdentifierNameSyntax Alias => GetRedAtZero(ref this.alias)!; - - /// SyntaxToken representing colon colon. - public SyntaxToken ColonColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AliasQualifiedNameSyntax)this.Green).colonColonToken, GetChildPosition(1), GetChildIndex(1)); - - /// SimpleNameSyntax node representing the name that is being alias qualified. - public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; + /// SyntaxToken representing greater than. + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.alias)!, - 2 => GetRed(ref this.name, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.alias, - 2 => this.name, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAliasQualifiedName(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeArgumentList(this); - public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) { - if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name) - { - var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AliasQualifiedNameSyntax WithAlias(IdentifierNameSyntax alias) => Update(alias, this.ColonColonToken, this.Name); - public AliasQualifiedNameSyntax WithColonColonToken(SyntaxToken colonColonToken) => Update(this.Alias, colonColonToken, this.Name); - public AliasQualifiedNameSyntax WithName(SimpleNameSyntax name) => Update(this.Alias, this.ColonColonToken, name); + return this; } - /// Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. - public abstract partial class TypeSyntax : ExpressionSyntax + public TypeArgumentListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Arguments, this.GreaterThanToken); + public TypeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.LessThanToken, arguments, this.GreaterThanToken); + public TypeArgumentListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Arguments, greaterThanToken); + + public TypeArgumentListSyntax AddArguments(params TypeSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +} + +/// Class which represents the syntax node for alias qualified name. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AliasQualifiedNameSyntax : NameSyntax +{ + private IdentifierNameSyntax? alias; + private SimpleNameSyntax? name; + + internal AliasQualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal TypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } } - /// Class which represents the syntax node for predefined types. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PredefinedTypeSyntax : TypeSyntax - { + /// IdentifierNameSyntax node representing the name of the alias + public IdentifierNameSyntax Alias => GetRedAtZero(ref this.alias)!; - internal PredefinedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing colon colon. + public SyntaxToken ColonColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AliasQualifiedNameSyntax)this.Green).colonColonToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken which represents the keyword corresponding to the predefined type. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PredefinedTypeSyntax)this.Green).keyword, Position, 0); + /// SimpleNameSyntax node representing the name that is being alias qualified. + public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.alias)!, + 2 => GetRed(ref this.name, 2)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.alias, + 2 => this.name, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPredefinedType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAliasQualifiedName(this); - public PredefinedTypeSyntax Update(SyntaxToken keyword) + public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + { + if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name) { - if (keyword != this.Keyword) - { - var newNode = SyntaxFactory.PredefinedType(keyword); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PredefinedTypeSyntax WithKeyword(SyntaxToken keyword) => Update(keyword); + return this; } - /// Class which represents the syntax node for the array type. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArrayTypeSyntax : TypeSyntax + public AliasQualifiedNameSyntax WithAlias(IdentifierNameSyntax alias) => Update(alias, this.ColonColonToken, this.Name); + public AliasQualifiedNameSyntax WithColonColonToken(SyntaxToken colonColonToken) => Update(this.Alias, colonColonToken, this.Name); + public AliasQualifiedNameSyntax WithName(SimpleNameSyntax name) => Update(this.Alias, this.ColonColonToken, name); +} + +/// Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. +public abstract partial class TypeSyntax : ExpressionSyntax +{ + internal TypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private TypeSyntax? elementType; - private SyntaxNode? rankSpecifiers; + } +} - internal ArrayTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for predefined types. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PredefinedTypeSyntax : TypeSyntax +{ - /// TypeSyntax node representing the type of the element of the array. - public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; + internal PredefinedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. - public SyntaxList RankSpecifiers => new SyntaxList(GetRed(ref this.rankSpecifiers, 1)); + /// SyntaxToken which represents the keyword corresponding to the predefined type. + public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PredefinedTypeSyntax)this.Green).keyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.elementType)!, - 1 => GetRed(ref this.rankSpecifiers, 1)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.elementType, - 1 => this.rankSpecifiers, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPredefinedType(this); - public ArrayTypeSyntax Update(TypeSyntax elementType, SyntaxList rankSpecifiers) + public PredefinedTypeSyntax Update(SyntaxToken keyword) + { + if (keyword != this.Keyword) { - if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) - { - var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.PredefinedType(keyword); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ArrayTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.RankSpecifiers); - public ArrayTypeSyntax WithRankSpecifiers(SyntaxList rankSpecifiers) => Update(this.ElementType, rankSpecifiers); - - public ArrayTypeSyntax AddRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithRankSpecifiers(this.RankSpecifiers.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode + public PredefinedTypeSyntax WithKeyword(SyntaxToken keyword) => Update(keyword); +} + +/// Class which represents the syntax node for the array type. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArrayTypeSyntax : TypeSyntax +{ + private TypeSyntax? elementType; + private SyntaxNode? rankSpecifiers; + + internal ArrayTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? sizes; + } - internal ArrayRankSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// TypeSyntax node representing the type of the element of the array. + public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); + /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. + public SyntaxList RankSpecifiers => new SyntaxList(GetRed(ref this.rankSpecifiers, 1)); - public SeparatedSyntaxList Sizes + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var red = GetRed(ref this.sizes, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + 0 => GetRedAtZero(ref this.elementType)!, + 1 => GetRed(ref this.rankSpecifiers, 1)!, + _ => null, + }; - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.elementType, + 1 => this.rankSpecifiers, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.sizes, 1)! : null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayType(this); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.sizes : null; + public ArrayTypeSyntax Update(TypeSyntax elementType, SyntaxList rankSpecifiers) + { + if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) + { + var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayRankSpecifier(this); + return this; + } - public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public ArrayTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.RankSpecifiers); + public ArrayTypeSyntax WithRankSpecifiers(SyntaxList rankSpecifiers) => Update(this.ElementType, rankSpecifiers); - return this; - } + public ArrayTypeSyntax AddRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithRankSpecifiers(this.RankSpecifiers.AddRange(items)); +} - public ArrayRankSpecifierSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Sizes, this.CloseBracketToken); - public ArrayRankSpecifierSyntax WithSizes(SeparatedSyntaxList sizes) => Update(this.OpenBracketToken, sizes, this.CloseBracketToken); - public ArrayRankSpecifierSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Sizes, closeBracketToken); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode +{ + private SyntaxNode? sizes; - public ArrayRankSpecifierSyntax AddSizes(params ExpressionSyntax[] items) => WithSizes(this.Sizes.AddRange(items)); + internal ArrayRankSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents the syntax node for pointer type. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PointerTypeSyntax : TypeSyntax - { - private TypeSyntax? elementType; + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); - internal PointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SeparatedSyntaxList Sizes + { + get { + var red = GetRed(ref this.sizes, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// TypeSyntax node that represents the element type of the pointer. - public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - - /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.sizes, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.sizes : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPointerType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayRankSpecifier(this); - public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) + public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) { - if (elementType != this.ElementType || asteriskToken != this.AsteriskToken) - { - var newNode = SyntaxFactory.PointerType(elementType, asteriskToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PointerTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.AsteriskToken); - public PointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.ElementType, asteriskToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerTypeSyntax : TypeSyntax - { - private FunctionPointerCallingConventionSyntax? callingConvention; - private FunctionPointerParameterListSyntax? parameterList; + public ArrayRankSpecifierSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Sizes, this.CloseBracketToken); + public ArrayRankSpecifierSyntax WithSizes(SeparatedSyntaxList sizes) => Update(this.OpenBracketToken, sizes, this.CloseBracketToken); + public ArrayRankSpecifierSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Sizes, closeBracketToken); - internal FunctionPointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public ArrayRankSpecifierSyntax AddSizes(params ExpressionSyntax[] items) => WithSizes(this.Sizes.AddRange(items)); +} - /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerTypeSyntax)this.Green).delegateKeyword, Position, 0); +/// Class which represents the syntax node for pointer type. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PointerTypeSyntax : TypeSyntax +{ + private TypeSyntax? elementType; - /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); + internal PointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Node representing the optional calling convention. - public FunctionPointerCallingConventionSyntax? CallingConvention => GetRed(ref this.callingConvention, 2); + /// TypeSyntax node that represents the element type of the pointer. + public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - /// List of the parameter types and return type of the function pointer. - public FunctionPointerParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; + /// SyntaxToken representing the asterisk. + public SyntaxToken AsteriskToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 2 => GetRed(ref this.callingConvention, 2), - 3 => GetRed(ref this.parameterList, 3)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.callingConvention, - 3 => this.parameterList, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPointerType(this); - public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) + { + if (elementType != this.ElementType || asteriskToken != this.AsteriskToken) { - if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList) - { - var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.PointerType(elementType, asteriskToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public FunctionPointerTypeSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(delegateKeyword, this.AsteriskToken, this.CallingConvention, this.ParameterList); - public FunctionPointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.DelegateKeyword, asteriskToken, this.CallingConvention, this.ParameterList); - public FunctionPointerTypeSyntax WithCallingConvention(FunctionPointerCallingConventionSyntax? callingConvention) => Update(this.DelegateKeyword, this.AsteriskToken, callingConvention, this.ParameterList); - public FunctionPointerTypeSyntax WithParameterList(FunctionPointerParameterListSyntax parameterList) => Update(this.DelegateKeyword, this.AsteriskToken, this.CallingConvention, parameterList); - - public FunctionPointerTypeSyntax AddParameterListParameters(params FunctionPointerParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + return this; } - /// Function pointer parameter list syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode - { - private SyntaxNode? parameters; - - internal FunctionPointerParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public PointerTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.AsteriskToken); + public PointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.ElementType, asteriskToken); +} - /// SyntaxToken representing the less than token. - public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerTypeSyntax : TypeSyntax +{ + private FunctionPointerCallingConventionSyntax? callingConvention; + private FunctionPointerParameterListSyntax? parameterList; - /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. - public SeparatedSyntaxList Parameters - { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + internal FunctionPointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the greater than token. - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + /// SyntaxToken representing the delegate keyword. + public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerTypeSyntax)this.Green).delegateKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + /// SyntaxToken representing the asterisk. + public SyntaxToken AsteriskToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + /// Node representing the optional calling convention. + public FunctionPointerCallingConventionSyntax? CallingConvention => GetRed(ref this.callingConvention, 2); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameterList(this); + /// List of the parameter types and return type of the function pointer. + public FunctionPointerParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 2 => GetRed(ref this.callingConvention, 2), + 3 => GetRed(ref this.parameterList, 3)!, + _ => null, + }; - return this; - } - - public FunctionPointerParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); - public FunctionPointerParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); - public FunctionPointerParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 2 => this.callingConvention, + 3 => this.parameterList, + _ => null, + }; - public FunctionPointerParameterListSyntax AddParameters(params FunctionPointerParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerType(this); - /// Function pointer calling convention syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode + public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) { - private FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList; - - internal FunctionPointerCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList) { + var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing whether the calling convention is managed or unmanaged. - public SyntaxToken ManagedOrUnmanagedKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerCallingConventionSyntax)this.Green).managedOrUnmanagedKeyword, Position, 0); - - /// Optional list of identifiers that will contribute to an unmanaged calling convention. - public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => GetRed(ref this.unmanagedCallingConventionList, 1); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.unmanagedCallingConventionList, 1) : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.unmanagedCallingConventionList : null; + public FunctionPointerTypeSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(delegateKeyword, this.AsteriskToken, this.CallingConvention, this.ParameterList); + public FunctionPointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.DelegateKeyword, asteriskToken, this.CallingConvention, this.ParameterList); + public FunctionPointerTypeSyntax WithCallingConvention(FunctionPointerCallingConventionSyntax? callingConvention) => Update(this.DelegateKeyword, this.AsteriskToken, callingConvention, this.ParameterList); + public FunctionPointerTypeSyntax WithParameterList(FunctionPointerParameterListSyntax parameterList) => Update(this.DelegateKeyword, this.AsteriskToken, this.CallingConvention, parameterList); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerCallingConvention(this); + public FunctionPointerTypeSyntax AddParameterListParameters(params FunctionPointerParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); +} - public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) - { - if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList) - { - var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// Function pointer parameter list syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? parameters; - return this; - } + internal FunctionPointerParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public FunctionPointerCallingConventionSyntax WithManagedOrUnmanagedKeyword(SyntaxToken managedOrUnmanagedKeyword) => Update(managedOrUnmanagedKeyword, this.UnmanagedCallingConventionList); - public FunctionPointerCallingConventionSyntax WithUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) => Update(this.ManagedOrUnmanagedKeyword, unmanagedCallingConventionList); + /// SyntaxToken representing the less than token. + public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); - public FunctionPointerCallingConventionSyntax AddUnmanagedCallingConventionListCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) + /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. + public SeparatedSyntaxList Parameters + { + get { - var unmanagedCallingConventionList = this.UnmanagedCallingConventionList ?? SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(); - return WithUnmanagedCallingConventionList(unmanagedCallingConventionList.WithCallingConventions(unmanagedCallingConventionList.CallingConventions.AddRange(items))); + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } } - /// Function pointer calling convention syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode - { - private SyntaxNode? callingConventions; + /// SyntaxToken representing the greater than token. + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - internal FunctionPointerUnmanagedCallingConventionListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - /// SeparatedSyntaxList of calling convention identifiers. - public SeparatedSyntaxList CallingConventions + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameterList(this); + + public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) { - get - { - var red = GetRed(ref this.callingConventions, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.callingConventions, 1)! : null; + public FunctionPointerParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); + public FunctionPointerParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); + public FunctionPointerParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.callingConventions : null; + public FunctionPointerParameterListSyntax AddParameters(params FunctionPointerParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); +/// Function pointer calling convention syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode +{ + private FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList; - public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal FunctionPointerCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + /// SyntaxToken representing whether the calling convention is managed or unmanaged. + public SyntaxToken ManagedOrUnmanagedKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerCallingConventionSyntax)this.Green).managedOrUnmanagedKeyword, Position, 0); - public FunctionPointerUnmanagedCallingConventionListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.CallingConventions, this.CloseBracketToken); - public FunctionPointerUnmanagedCallingConventionListSyntax WithCallingConventions(SeparatedSyntaxList callingConventions) => Update(this.OpenBracketToken, callingConventions, this.CloseBracketToken); - public FunctionPointerUnmanagedCallingConventionListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.CallingConventions, closeBracketToken); + /// Optional list of identifiers that will contribute to an unmanaged calling convention. + public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => GetRed(ref this.unmanagedCallingConventionList, 1); - public FunctionPointerUnmanagedCallingConventionListSyntax AddCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) => WithCallingConventions(this.CallingConventions.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.unmanagedCallingConventionList, 1) : null; - /// Individual function pointer unmanaged calling convention. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode - { + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.unmanagedCallingConventionList : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerCallingConvention(this); - internal FunctionPointerUnmanagedCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + { + if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList) { + var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the calling convention identifier. - public SyntaxToken Name => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionSyntax)this.Green).name, Position, 0); - - internal override SyntaxNode? GetNodeSlot(int index) => null; - - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); + public FunctionPointerCallingConventionSyntax WithManagedOrUnmanagedKeyword(SyntaxToken managedOrUnmanagedKeyword) => Update(managedOrUnmanagedKeyword, this.UnmanagedCallingConventionList); + public FunctionPointerCallingConventionSyntax WithUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) => Update(this.ManagedOrUnmanagedKeyword, unmanagedCallingConventionList); - public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name) - { - if (name != this.Name) - { - var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public FunctionPointerCallingConventionSyntax AddUnmanagedCallingConventionListCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) + { + var unmanagedCallingConventionList = this.UnmanagedCallingConventionList ?? SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(); + return WithUnmanagedCallingConventionList(unmanagedCallingConventionList.WithCallingConventions(unmanagedCallingConventionList.CallingConventions.AddRange(items))); + } +} - return this; - } +/// Function pointer calling convention syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? callingConventions; - public FunctionPointerUnmanagedCallingConventionSyntax WithName(SyntaxToken name) => Update(name); + internal FunctionPointerUnmanagedCallingConventionListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents the syntax node for a nullable type. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NullableTypeSyntax : TypeSyntax - { - private TypeSyntax? elementType; + /// SyntaxToken representing open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); - internal NullableTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// SeparatedSyntaxList of calling convention identifiers. + public SeparatedSyntaxList CallingConventions + { + get { + var red = GetRed(ref this.callingConventions, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// TypeSyntax node representing the type of the element. - public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableTypeSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.callingConventions, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.callingConventions : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) + public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) { - if (elementType != this.ElementType || questionToken != this.QuestionToken) - { - var newNode = SyntaxFactory.NullableType(elementType, questionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public NullableTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.QuestionToken); - public NullableTypeSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ElementType, questionToken); + return this; } - /// Class which represents the syntax node for tuple type. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TupleTypeSyntax : TypeSyntax - { - private SyntaxNode? elements; + public FunctionPointerUnmanagedCallingConventionListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.CallingConventions, this.CloseBracketToken); + public FunctionPointerUnmanagedCallingConventionListSyntax WithCallingConventions(SeparatedSyntaxList callingConventions) => Update(this.OpenBracketToken, callingConventions, this.CloseBracketToken); + public FunctionPointerUnmanagedCallingConventionListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.CallingConventions, closeBracketToken); - internal TupleTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public FunctionPointerUnmanagedCallingConventionListSyntax AddCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) => WithCallingConventions(this.CallingConventions.AddRange(items)); +} - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); +/// Individual function pointer unmanaged calling convention. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode +{ - public SeparatedSyntaxList Elements - { - get - { - var red = GetRed(ref this.elements, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + internal FunctionPointerUnmanagedCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + /// SyntaxToken representing the calling convention identifier. + public SyntaxToken Name => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionSyntax)this.Green).name, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - public TupleTypeSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList elements, SyntaxToken closeParenToken) + public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name) + { + if (name != this.Name) { - if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TupleTypeSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Elements, this.CloseParenToken); - public TupleTypeSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenParenToken, elements, this.CloseParenToken); - public TupleTypeSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Elements, closeParenToken); - - public TupleTypeSyntax AddElements(params TupleElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); + return this; } - /// Tuple type element. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TupleElementSyntax : CSharpSyntaxNode - { - private TypeSyntax? type; + public FunctionPointerUnmanagedCallingConventionSyntax WithName(SyntaxToken name) => Update(name); +} - internal TupleElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for a nullable type. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NullableTypeSyntax : TypeSyntax +{ + private TypeSyntax? elementType; - /// Gets the type of the tuple element. - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + internal NullableTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the name of the tuple element. - public SyntaxToken Identifier - { - get - { - var slot = ((Syntax.InternalSyntax.TupleElementSyntax)this.Green).identifier; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + /// TypeSyntax node representing the type of the element. + public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableTypeSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleElement(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; - public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) - { - if (type != this.Type || identifier != this.Identifier) - { - var newNode = SyntaxFactory.TupleElement(type, identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableType(this); - return this; + public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) + { + if (elementType != this.ElementType || questionToken != this.QuestionToken) + { + var newNode = SyntaxFactory.NullableType(elementType, questionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TupleElementSyntax WithType(TypeSyntax type) => Update(type, this.Identifier); - public TupleElementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.Type, identifier); + return this; } - /// Class which represents a placeholder in the type argument list of an unbound generic type. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class OmittedTypeArgumentSyntax : TypeSyntax + public NullableTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.QuestionToken); + public NullableTypeSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ElementType, questionToken); +} + +/// Class which represents the syntax node for tuple type. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TupleTypeSyntax : TypeSyntax +{ + private SyntaxNode? elements; + + internal TupleTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { + } - internal OmittedTypeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); + + public SeparatedSyntaxList Elements + { + get { + var red = GetRed(ref this.elements, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// SyntaxToken representing the omitted type argument. - public SyntaxToken OmittedTypeArgumentToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OmittedTypeArgumentSyntax)this.Green).omittedTypeArgumentToken, Position, 0); + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedTypeArgument(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleType(this); - public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken) + public TupleTypeSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList elements, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) { - if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken) - { - var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public OmittedTypeArgumentSyntax WithOmittedTypeArgumentToken(SyntaxToken omittedTypeArgumentToken) => Update(omittedTypeArgumentToken); + return this; } - /// The ref modifier of a method's return value or a local. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RefTypeSyntax : TypeSyntax - { - private TypeSyntax? type; + public TupleTypeSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Elements, this.CloseParenToken); + public TupleTypeSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenParenToken, elements, this.CloseParenToken); + public TupleTypeSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Elements, closeParenToken); - internal RefTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TupleTypeSyntax AddElements(params TupleElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); +} + +/// Tuple type element. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TupleElementSyntax : CSharpSyntaxNode +{ + private TypeSyntax? type; + + internal TupleElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken RefKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); + /// Gets the type of the tuple element. + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - /// Gets the optional "readonly" keyword. - public SyntaxToken ReadOnlyKeyword + /// Gets the name of the tuple element. + public SyntaxToken Identifier + { + get { - get - { - var slot = ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var slot = ((Syntax.InternalSyntax.TupleElementSyntax)this.Green).identifier; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public TypeSyntax Type => GetRed(ref this.type, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleElement(this); - public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) + { + if (type != this.Type || identifier != this.Identifier) { - if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) - { - var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TupleElement(type, identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public RefTypeSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.ReadOnlyKeyword, this.Type); - public RefTypeSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKeyword, readOnlyKeyword, this.Type); - public RefTypeSyntax WithType(TypeSyntax type) => Update(this.RefKeyword, this.ReadOnlyKeyword, type); + return this; } - /// The 'scoped' modifier of a local. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ScopedTypeSyntax : TypeSyntax - { - private TypeSyntax? type; + public TupleElementSyntax WithType(TypeSyntax type) => Update(type, this.Identifier); + public TupleElementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.Type, identifier); +} - internal ScopedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents a placeholder in the type argument list of an unbound generic type. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class OmittedTypeArgumentSyntax : TypeSyntax +{ - public SyntaxToken ScopedKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ScopedTypeSyntax)this.Green).scopedKeyword, Position, 0); + internal OmittedTypeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public TypeSyntax Type => GetRed(ref this.type, 1)!; + /// SyntaxToken representing the omitted type argument. + public SyntaxToken OmittedTypeArgumentToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OmittedTypeArgumentSyntax)this.Green).omittedTypeArgumentToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitScopedType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedTypeArgument(this); - public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) + public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken) + { + if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken) { - if (scopedKeyword != this.ScopedKeyword || type != this.Type) - { - var newNode = SyntaxFactory.ScopedType(scopedKeyword, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ScopedTypeSyntax WithScopedKeyword(SyntaxToken scopedKeyword) => Update(scopedKeyword, this.Type); - public ScopedTypeSyntax WithType(TypeSyntax type) => Update(this.ScopedKeyword, type); + return this; } - public abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode + public OmittedTypeArgumentSyntax WithOmittedTypeArgumentToken(SyntaxToken omittedTypeArgumentToken) => Update(omittedTypeArgumentToken); +} + +/// The ref modifier of a method's return value or a local. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RefTypeSyntax : TypeSyntax +{ + private TypeSyntax? type; + + internal RefTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal ExpressionOrPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } } - /// Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. - public abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax + public SyntaxToken RefKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); + + /// Gets the optional "readonly" keyword. + public SyntaxToken ReadOnlyKeyword { - internal ExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - /// Class which represents the syntax node for parenthesized expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; + public TypeSyntax Type => GetRed(ref this.type, 2)!; - internal ParenthesizedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefType(this); + + public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + { + if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) { + var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedExpressionSyntax)this.Green).openParenToken, Position, 0); + return this; + } - /// ExpressionSyntax node representing the expression enclosed within the parenthesis. - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public RefTypeSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.ReadOnlyKeyword, this.Type); + public RefTypeSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKeyword, readOnlyKeyword, this.Type); + public RefTypeSyntax WithType(TypeSyntax type) => Update(this.RefKeyword, this.ReadOnlyKeyword, type); +} - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); +/// The 'scoped' modifier of a local. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ScopedTypeSyntax : TypeSyntax +{ + private TypeSyntax? type; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + internal ScopedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + public SyntaxToken ScopedKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ScopedTypeSyntax)this.Green).scopedKeyword, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedExpression(this); + public TypeSyntax Type => GetRed(ref this.type, 1)!; - public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; - public ParenthesizedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Expression, this.CloseParenToken); - public ParenthesizedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, expression, this.CloseParenToken); - public ParenthesizedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Expression, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitScopedType(this); - /// Class which represents the syntax node for tuple expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TupleExpressionSyntax : ExpressionSyntax + public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) { - private SyntaxNode? arguments; - - internal TupleExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); - - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public SeparatedSyntaxList Arguments + if (scopedKeyword != this.ScopedKeyword || type != this.Type) { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ScopedType(scopedKeyword, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleExpression(this); - - public TupleExpressionSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + return this; + } - return this; - } + public ScopedTypeSyntax WithScopedKeyword(SyntaxToken scopedKeyword) => Update(scopedKeyword, this.Type); + public ScopedTypeSyntax WithType(TypeSyntax type) => Update(this.ScopedKeyword, type); +} - public TupleExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); - public TupleExpressionSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); - public TupleExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); +public abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode +{ + internal ExpressionOrPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public TupleExpressionSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +/// Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. +public abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax +{ + internal ExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } +} - /// Class which represents the syntax node for prefix unary expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax +/// Class which represents the syntax node for parenthesized expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + + internal ParenthesizedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? operand; + } - internal PrefixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedExpressionSyntax)this.Green).openParenToken, Position, 0); - /// SyntaxToken representing the kind of the operator of the prefix unary expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PrefixUnaryExpressionSyntax)this.Green).operatorToken, Position, 0); + /// ExpressionSyntax node representing the expression enclosed within the parenthesis. + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - /// ExpressionSyntax representing the operand of the prefix unary expression. - public ExpressionSyntax Operand => GetRed(ref this.operand, 1)!; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.operand, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.operand : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrefixUnaryExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedExpression(this); - public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand) + public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { - if (operatorToken != this.OperatorToken || operand != this.Operand) - { - var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind(), operatorToken, operand); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PrefixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Operand); - public PrefixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(this.OperatorToken, operand); + return this; } - /// Class which represents the syntax node for an "await" expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AwaitExpressionSyntax : ExpressionSyntax + public ParenthesizedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Expression, this.CloseParenToken); + public ParenthesizedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, expression, this.CloseParenToken); + public ParenthesizedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Expression, closeParenToken); +} + +/// Class which represents the syntax node for tuple expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TupleExpressionSyntax : ExpressionSyntax +{ + private SyntaxNode? arguments; + + internal TupleExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? expression; + } - internal AwaitExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); + + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public SeparatedSyntaxList Arguments + { + get { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// SyntaxToken representing the kind "await" keyword. - public SyntaxToken AwaitKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AwaitExpressionSyntax)this.Green).awaitKeyword, Position, 0); - - /// ExpressionSyntax representing the operand of the "await" operator. - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAwaitExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleExpression(this); - public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression) + public TupleExpressionSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { - if (awaitKeyword != this.AwaitKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AwaitExpressionSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(awaitKeyword, this.Expression); - public AwaitExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.AwaitKeyword, expression); + return this; } - /// Class which represents the syntax node for postfix unary expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - public sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? operand; + public TupleExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); + public TupleExpressionSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); + public TupleExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); - internal PostfixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TupleExpressionSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +} + +/// Class which represents the syntax node for prefix unary expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? operand; - /// ExpressionSyntax representing the operand of the postfix unary expression. - public ExpressionSyntax Operand => GetRedAtZero(ref this.operand)!; + internal PrefixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the kind of the operator of the postfix unary expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PostfixUnaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the kind of the operator of the prefix unary expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PrefixUnaryExpressionSyntax)this.Green).operatorToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.operand)! : null; + /// ExpressionSyntax representing the operand of the prefix unary expression. + public ExpressionSyntax Operand => GetRed(ref this.operand, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.operand : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.operand, 1)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPostfixUnaryExpression(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.operand : null; - public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken) - { - if (operand != this.Operand || operatorToken != this.OperatorToken) - { - var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind(), operand, operatorToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrefixUnaryExpression(this); - return this; + public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand) + { + if (operatorToken != this.OperatorToken || operand != this.Operand) + { + var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind(), operatorToken, operand); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PostfixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(operand, this.OperatorToken); - public PostfixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Operand, operatorToken); + return this; } - /// Class which represents the syntax node for member access expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; - private SimpleNameSyntax? name; + public PrefixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Operand); + public PrefixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(this.OperatorToken, operand); +} - internal MemberAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for an "await" expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AwaitExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - /// ExpressionSyntax node representing the object that the member belongs to. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal AwaitExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the kind of the operator in the member access expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MemberAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the kind "await" keyword. + public SyntaxToken AwaitKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AwaitExpressionSyntax)this.Green).awaitKeyword, Position, 0); - /// SimpleNameSyntax node representing the member being accessed. - public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; + /// ExpressionSyntax representing the operand of the "await" operator. + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.name, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.name, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberAccessExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAwaitExpression(this); - public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression) + { + if (awaitKeyword != this.AwaitKeyword || expression != this.Expression) { - if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name) - { - var newNode = SyntaxFactory.MemberAccessExpression(this.Kind(), expression, operatorToken, name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public MemberAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.Name); - public MemberAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.Name); - public MemberAccessExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.Expression, this.OperatorToken, name); + return this; } - /// Class which represents the syntax node for conditional access expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; - private ExpressionSyntax? whenNotNull; + public AwaitExpressionSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(awaitKeyword, this.Expression); + public AwaitExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.AwaitKeyword, expression); +} - internal ConditionalAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for postfix unary expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +public sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? operand; - /// ExpressionSyntax node representing the object conditionally accessed. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal PostfixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the question mark. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConditionalAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + /// ExpressionSyntax representing the operand of the postfix unary expression. + public ExpressionSyntax Operand => GetRedAtZero(ref this.operand)!; - /// ExpressionSyntax node representing the access expression to be executed when the object is not null. - public ExpressionSyntax WhenNotNull => GetRed(ref this.whenNotNull, 2)!; + /// SyntaxToken representing the kind of the operator of the postfix unary expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PostfixUnaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.whenNotNull, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.operand)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.whenNotNull, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.operand : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalAccessExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPostfixUnaryExpression(this); - public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken) + { + if (operand != this.Operand || operatorToken != this.OperatorToken) { - if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull) - { - var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind(), operand, operatorToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ConditionalAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.WhenNotNull); - public ConditionalAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.WhenNotNull); - public ConditionalAccessExpressionSyntax WithWhenNotNull(ExpressionSyntax whenNotNull) => Update(this.Expression, this.OperatorToken, whenNotNull); + return this; } - /// Class which represents the syntax node for member binding expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax - { - private SimpleNameSyntax? name; + public PostfixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(operand, this.OperatorToken); + public PostfixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Operand, operatorToken); +} - internal MemberBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for member access expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private SimpleNameSyntax? name; - /// SyntaxToken representing dot. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MemberBindingExpressionSyntax)this.Green).operatorToken, Position, 0); + internal MemberAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SimpleNameSyntax node representing the member being bound to. - public SimpleNameSyntax Name => GetRed(ref this.name, 1)!; + /// ExpressionSyntax node representing the object that the member belongs to. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; + /// SyntaxToken representing the kind of the operator in the member access expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MemberAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + /// SimpleNameSyntax node representing the member being accessed. + public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberBindingExpression(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.name, 2)!, + _ => null, + }; - public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (operatorToken != this.OperatorToken || name != this.Name) - { - var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.expression, + 2 => this.name, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberAccessExpression(this); - return this; + public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + { + if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name) + { + var newNode = SyntaxFactory.MemberAccessExpression(this.Kind(), expression, operatorToken, name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public MemberBindingExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Name); - public MemberBindingExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.OperatorToken, name); + return this; } - /// Class which represents the syntax node for element binding expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax - { - private BracketedArgumentListSyntax? argumentList; + public MemberAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.Name); + public MemberAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.Name); + public MemberAccessExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.Expression, this.OperatorToken, name); +} - internal ElementBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for conditional access expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private ExpressionSyntax? whenNotNull; - /// BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. - public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; + internal ConditionalAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; + /// ExpressionSyntax node representing the object conditionally accessed. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; + /// SyntaxToken representing the question mark. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConditionalAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementBindingExpression(this); + /// ExpressionSyntax node representing the access expression to be executed when the object is not null. + public ExpressionSyntax WhenNotNull => GetRed(ref this.whenNotNull, 2)!; - public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ElementBindingExpression(argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.whenNotNull, 2)!, + _ => null, + }; - public ElementBindingExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 2 => this.whenNotNull, + _ => null, + }; - public ElementBindingExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalAccessExpression(this); - /// Class which represents the syntax node for a range expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RangeExpressionSyntax : ExpressionSyntax + public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) { - private ExpressionSyntax? leftOperand; - private ExpressionSyntax? rightOperand; - - internal RangeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull) { + var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ExpressionSyntax node representing the expression on the left of the range operator. - public ExpressionSyntax? LeftOperand => GetRedAtZero(ref this.leftOperand); + return this; + } - /// SyntaxToken representing the operator of the range expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RangeExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public ConditionalAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.WhenNotNull); + public ConditionalAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.WhenNotNull); + public ConditionalAccessExpressionSyntax WithWhenNotNull(ExpressionSyntax whenNotNull) => Update(this.Expression, this.OperatorToken, whenNotNull); +} - /// ExpressionSyntax node representing the expression on the right of the range operator. - public ExpressionSyntax? RightOperand => GetRed(ref this.rightOperand, 2); +/// Class which represents the syntax node for member binding expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax +{ + private SimpleNameSyntax? name; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.leftOperand), - 2 => GetRed(ref this.rightOperand, 2), - _ => null, - }; + internal MemberBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.leftOperand, - 2 => this.rightOperand, - _ => null, - }; + /// SyntaxToken representing dot. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MemberBindingExpressionSyntax)this.Green).operatorToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRangeExpression(this); + /// SimpleNameSyntax node representing the member being bound to. + public SimpleNameSyntax Name => GetRed(ref this.name, 1)!; - public RangeExpressionSyntax Update(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) - { - if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand) - { - var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; - public RangeExpressionSyntax WithLeftOperand(ExpressionSyntax? leftOperand) => Update(leftOperand, this.OperatorToken, this.RightOperand); - public RangeExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.LeftOperand, operatorToken, this.RightOperand); - public RangeExpressionSyntax WithRightOperand(ExpressionSyntax? rightOperand) => Update(this.LeftOperand, this.OperatorToken, rightOperand); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberBindingExpression(this); - /// Class which represents the syntax node for implicit element access expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax + public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name) { - private BracketedArgumentListSyntax? argumentList; - - internal ImplicitElementAccessSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (operatorToken != this.OperatorToken || name != this.Name) { + var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. - public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; + public MemberBindingExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Name); + public MemberBindingExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.OperatorToken, name); +} - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; +/// Class which represents the syntax node for element binding expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax +{ + private BracketedArgumentListSyntax? argumentList; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitElementAccess(this); + internal ElementBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList) - { - if (argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ImplicitElementAccess(argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. + public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; - public ImplicitElementAccessSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; - public ImplicitElementAccessSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementBindingExpression(this); - /// Class which represents an expression that has a binary operator. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class BinaryExpressionSyntax : ExpressionSyntax + public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList) { - private ExpressionSyntax? left; - private ExpressionSyntax? right; - - internal BinaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (argumentList != this.ArgumentList) { + var newNode = SyntaxFactory.ElementBindingExpression(argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ExpressionSyntax node representing the expression on the left of the binary operator. - public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; + return this; + } - /// SyntaxToken representing the operator of the binary expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BinaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public ElementBindingExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); - /// ExpressionSyntax node representing the expression on the right of the binary operator. - public ExpressionSyntax Right => GetRed(ref this.right, 2)!; + public ElementBindingExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; +/// Class which represents the syntax node for a range expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RangeExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? leftOperand; + private ExpressionSyntax? rightOperand; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.left, - 2 => this.right, - _ => null, - }; + internal RangeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryExpression(this); + /// ExpressionSyntax node representing the expression on the left of the range operator. + public ExpressionSyntax? LeftOperand => GetRedAtZero(ref this.leftOperand); - public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) - { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.BinaryExpression(this.Kind(), left, operatorToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// SyntaxToken representing the operator of the range expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RangeExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - return this; - } + /// ExpressionSyntax node representing the expression on the right of the range operator. + public ExpressionSyntax? RightOperand => GetRed(ref this.rightOperand, 2); - public BinaryExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); - public BinaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); - public BinaryExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); - } - - /// Class which represents an expression that has an assignment operator. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class AssignmentExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? left; - private ExpressionSyntax? right; - - internal AssignmentExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// ExpressionSyntax node representing the expression on the left of the assignment operator. - public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; - - /// SyntaxToken representing the operator of the assignment expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AssignmentExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - - /// ExpressionSyntax node representing the expression on the right of the assignment operator. - public ExpressionSyntax Right => GetRed(ref this.right, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.leftOperand), + 2 => GetRed(ref this.rightOperand, 2), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.left, - 2 => this.right, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.leftOperand, + 2 => this.rightOperand, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAssignmentExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRangeExpression(this); - public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + public RangeExpressionSyntax Update(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) + { + if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand) { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.AssignmentExpression(this.Kind(), left, operatorToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AssignmentExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); - public AssignmentExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); - public AssignmentExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); + return this; } - /// Class which represents the syntax node for conditional expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConditionalExpressionSyntax : ExpressionSyntax + public RangeExpressionSyntax WithLeftOperand(ExpressionSyntax? leftOperand) => Update(leftOperand, this.OperatorToken, this.RightOperand); + public RangeExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.LeftOperand, operatorToken, this.RightOperand); + public RangeExpressionSyntax WithRightOperand(ExpressionSyntax? rightOperand) => Update(this.LeftOperand, this.OperatorToken, rightOperand); +} + +/// Class which represents the syntax node for implicit element access expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax +{ + private BracketedArgumentListSyntax? argumentList; + + internal ImplicitElementAccessSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? condition; - private ExpressionSyntax? whenTrue; - private ExpressionSyntax? whenFalse; + } + + /// BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. + public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; - internal ConditionalExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitElementAccess(this); + + public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList) + { + if (argumentList != this.ArgumentList) { + var newNode = SyntaxFactory.ImplicitElementAccess(argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ExpressionSyntax node representing the condition of the conditional expression. - public ExpressionSyntax Condition => GetRedAtZero(ref this.condition)!; + return this; + } - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConditionalExpressionSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); + public ImplicitElementAccessSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); - /// ExpressionSyntax node representing the expression to be executed when the condition is true. - public ExpressionSyntax WhenTrue => GetRed(ref this.whenTrue, 2)!; + public ImplicitElementAccessSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} - /// SyntaxToken representing the colon. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConditionalExpressionSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); +/// Class which represents an expression that has a binary operator. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class BinaryExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? left; + private ExpressionSyntax? right; - /// ExpressionSyntax node representing the expression to be executed when the condition is false. - public ExpressionSyntax WhenFalse => GetRed(ref this.whenFalse, 4)!; + internal BinaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.condition)!, - 2 => GetRed(ref this.whenTrue, 2)!, - 4 => GetRed(ref this.whenFalse, 4)!, - _ => null, - }; + /// ExpressionSyntax node representing the expression on the left of the binary operator. + public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.condition, - 2 => this.whenTrue, - 4 => this.whenFalse, - _ => null, - }; + /// SyntaxToken representing the operator of the binary expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BinaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalExpression(this); + /// ExpressionSyntax node representing the expression on the right of the binary operator. + public ExpressionSyntax Right => GetRed(ref this.right, 2)!; - public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse) - { - var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.left, + 2 => this.right, + _ => null, + }; - public ConditionalExpressionSyntax WithCondition(ExpressionSyntax condition) => Update(condition, this.QuestionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.Condition, questionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithWhenTrue(ExpressionSyntax whenTrue) => Update(this.Condition, this.QuestionToken, whenTrue, this.ColonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Condition, this.QuestionToken, this.WhenTrue, colonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithWhenFalse(ExpressionSyntax whenFalse) => Update(this.Condition, this.QuestionToken, this.WhenTrue, this.ColonToken, whenFalse); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryExpression(this); - /// Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. - public abstract partial class InstanceExpressionSyntax : ExpressionSyntax + public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) { - internal InstanceExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) { + var newNode = SyntaxFactory.BinaryExpression(this.Kind(), left, operatorToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// Class which represents the syntax node for a this expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax - { + public BinaryExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); + public BinaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); + public BinaryExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); +} - internal ThisExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents an expression that has an assignment operator. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class AssignmentExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? left; + private ExpressionSyntax? right; + + internal AssignmentExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the this keyword. - public SyntaxToken Token => new SyntaxToken(this, ((Syntax.InternalSyntax.ThisExpressionSyntax)this.Green).token, Position, 0); + /// ExpressionSyntax node representing the expression on the left of the assignment operator. + public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + /// SyntaxToken representing the operator of the assignment expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AssignmentExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + /// ExpressionSyntax node representing the expression on the right of the assignment operator. + public ExpressionSyntax Right => GetRed(ref this.right, 2)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThisExpression(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - public ThisExpressionSyntax Update(SyntaxToken token) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (token != this.Token) - { - var newNode = SyntaxFactory.ThisExpression(token); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.left, + 2 => this.right, + _ => null, + }; - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAssignmentExpression(this); + + public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + { + var newNode = SyntaxFactory.AssignmentExpression(this.Kind(), left, operatorToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ThisExpressionSyntax WithToken(SyntaxToken token) => Update(token); + return this; } - /// Class which represents the syntax node for a base expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax + public AssignmentExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); + public AssignmentExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); + public AssignmentExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); +} + +/// Class which represents the syntax node for conditional expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConditionalExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? condition; + private ExpressionSyntax? whenTrue; + private ExpressionSyntax? whenFalse; + + internal ConditionalExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { + } - internal BaseExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// ExpressionSyntax node representing the condition of the conditional expression. + public ExpressionSyntax Condition => GetRedAtZero(ref this.condition)!; - /// SyntaxToken representing the base keyword. - public SyntaxToken Token => new SyntaxToken(this, ((Syntax.InternalSyntax.BaseExpressionSyntax)this.Green).token, Position, 0); + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConditionalExpressionSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + /// ExpressionSyntax node representing the expression to be executed when the condition is true. + public ExpressionSyntax WhenTrue => GetRed(ref this.whenTrue, 2)!; - internal override SyntaxNode? GetCachedSlot(int index) => null; + /// SyntaxToken representing the colon. + public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConditionalExpressionSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseExpression(this); + /// ExpressionSyntax node representing the expression to be executed when the condition is false. + public ExpressionSyntax WhenFalse => GetRed(ref this.whenFalse, 4)!; - public BaseExpressionSyntax Update(SyntaxToken token) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (token != this.Token) - { - var newNode = SyntaxFactory.BaseExpression(token); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.condition)!, + 2 => GetRed(ref this.whenTrue, 2)!, + 4 => GetRed(ref this.whenFalse, 4)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.condition, + 2 => this.whenTrue, + 4 => this.whenFalse, + _ => null, + }; - public BaseExpressionSyntax WithToken(SyntaxToken token) => Update(token); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalExpression(this); - /// Class which represents the syntax node for a literal expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class LiteralExpressionSyntax : ExpressionSyntax + public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) { - - internal LiteralExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse) { + var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. - public SyntaxToken Token => new SyntaxToken(this, ((Syntax.InternalSyntax.LiteralExpressionSyntax)this.Green).token, Position, 0); + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public ConditionalExpressionSyntax WithCondition(ExpressionSyntax condition) => Update(condition, this.QuestionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.Condition, questionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithWhenTrue(ExpressionSyntax whenTrue) => Update(this.Condition, this.QuestionToken, whenTrue, this.ColonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Condition, this.QuestionToken, this.WhenTrue, colonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithWhenFalse(ExpressionSyntax whenFalse) => Update(this.Condition, this.QuestionToken, this.WhenTrue, this.ColonToken, whenFalse); +} - internal override SyntaxNode? GetCachedSlot(int index) => null; +/// Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. +public abstract partial class InstanceExpressionSyntax : ExpressionSyntax +{ + internal InstanceExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLiteralExpression(this); +/// Class which represents the syntax node for a this expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax +{ - public LiteralExpressionSyntax Update(SyntaxToken token) - { - if (token != this.Token) - { - var newNode = SyntaxFactory.LiteralExpression(this.Kind(), token); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal ThisExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + /// SyntaxToken representing the this keyword. + public SyntaxToken Token => new SyntaxToken(this, ((Syntax.InternalSyntax.ThisExpressionSyntax)this.Green).token, Position, 0); - public LiteralExpressionSyntax WithToken(SyntaxToken token) => Update(token); - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - /// Class which represents the syntax node for MakeRef expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class MakeRefExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThisExpression(this); - internal MakeRefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public ThisExpressionSyntax Update(SyntaxToken token) + { + if (token != this.Token) { + var newNode = SyntaxFactory.ThisExpression(token); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the MakeRefKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).keyword, Position, 0); - - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - - /// Argument of the primary function. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + return this; + } - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public ThisExpressionSyntax WithToken(SyntaxToken token) => Update(token); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; +/// Class which represents the syntax node for a base expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; + internal BaseExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMakeRefExpression(this); + /// SyntaxToken representing the base keyword. + public SyntaxToken Token => new SyntaxToken(this, ((Syntax.InternalSyntax.BaseExpressionSyntax)this.Green).token, Position, 0); - public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public MakeRefExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); - public MakeRefExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); - public MakeRefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); - public MakeRefExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseExpression(this); - /// Class which represents the syntax node for RefType expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RefTypeExpressionSyntax : ExpressionSyntax + public BaseExpressionSyntax Update(SyntaxToken token) { - private ExpressionSyntax? expression; - - internal RefTypeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (token != this.Token) { + var newNode = SyntaxFactory.BaseExpression(token); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the RefTypeKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).keyword, Position, 0); + return this; + } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public BaseExpressionSyntax WithToken(SyntaxToken token) => Update(token); +} - /// Argument of the primary function. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; +/// Class which represents the syntax node for a literal expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class LiteralExpressionSyntax : ExpressionSyntax +{ - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + internal LiteralExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; + /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. + public SyntaxToken Token => new SyntaxToken(this, ((Syntax.InternalSyntax.LiteralExpressionSyntax)this.Green).token, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefTypeExpression(this); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLiteralExpression(this); - return this; + public LiteralExpressionSyntax Update(SyntaxToken token) + { + if (token != this.Token) + { + var newNode = SyntaxFactory.LiteralExpression(this.Kind(), token); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public RefTypeExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); - public RefTypeExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); - public RefTypeExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); - public RefTypeExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); + return this; } - /// Class which represents the syntax node for RefValue expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RefValueExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; - private TypeSyntax? type; - - internal RefValueExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public LiteralExpressionSyntax WithToken(SyntaxToken token) => Update(token); +} - /// SyntaxToken representing the RefValueKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).keyword, Position, 0); +/// Class which represents the syntax node for MakeRef expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class MakeRefExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + internal MakeRefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Typed reference expression. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + /// SyntaxToken representing the MakeRefKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).keyword, Position, 0); - /// Comma separating the arguments. - public SyntaxToken Comma => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).comma, GetChildPosition(3), GetChildIndex(3)); + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - /// The type of the value. - public TypeSyntax Type => GetRed(ref this.type, 4)!; + /// Argument of the primary function. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).closeParenToken, GetChildPosition(5), GetChildIndex(5)); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 2 => GetRed(ref this.expression, 2)!, - 4 => GetRed(ref this.type, 4)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.expression, - 4 => this.type, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefValueExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMakeRefExpression(this); - public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public RefValueExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.Comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithComma(SyntaxToken comma) => Update(this.Keyword, this.OpenParenToken, this.Expression, comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, type, this.CloseParenToken); - public RefValueExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, closeParenToken); + return this; } - /// Class which represents the syntax node for Checked or Unchecked expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class CheckedExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; + public MakeRefExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); + public MakeRefExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); + public MakeRefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); + public MakeRefExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); +} - internal CheckedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for RefType expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RefTypeExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - /// SyntaxToken representing the checked or unchecked keyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).keyword, Position, 0); + internal RefTypeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the RefTypeKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).keyword, Position, 0); - /// Argument of the primary function. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// Argument of the primary function. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedExpression(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; - public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CheckedExpression(this.Kind(), keyword, openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefTypeExpression(this); - return this; + public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public CheckedExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); - public CheckedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); - public CheckedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); - public CheckedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); + return this; } - /// Class which represents the syntax node for Default expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DefaultExpressionSyntax : ExpressionSyntax - { - private TypeSyntax? type; + public RefTypeExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); + public RefTypeExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); + public RefTypeExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); + public RefTypeExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); +} - internal DefaultExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for RefValue expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RefValueExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private TypeSyntax? type; - /// SyntaxToken representing the DefaultKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).keyword, Position, 0); + internal RefValueExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the RefValueKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).keyword, Position, 0); - /// Argument of the primary function. - public TypeSyntax Type => GetRed(ref this.type, 2)!; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// Typed reference expression. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + /// Comma separating the arguments. + public SyntaxToken Comma => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).comma, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + /// The type of the value. + public TypeSyntax Type => GetRed(ref this.type, 4)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultExpression(this); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).closeParenToken, GetChildPosition(5), GetChildIndex(5)); - public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 2 => GetRed(ref this.expression, 2)!, + 4 => GetRed(ref this.type, 4)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 2 => this.expression, + 4 => this.type, + _ => null, + }; - public DefaultExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); - public DefaultExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); - public DefaultExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); - public DefaultExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefValueExpression(this); - /// Class which represents the syntax node for TypeOf expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeOfExpressionSyntax : ExpressionSyntax + public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) { - private TypeSyntax? type; - - internal TypeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the TypeOfKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).keyword, Position, 0); + return this; + } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public RefValueExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.Comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithComma(SyntaxToken comma) => Update(this.Keyword, this.OpenParenToken, this.Expression, comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, type, this.CloseParenToken); + public RefValueExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, closeParenToken); +} - /// The expression to return type of. - public TypeSyntax Type => GetRed(ref this.type, 2)!; +/// Class which represents the syntax node for Checked or Unchecked expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class CheckedExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + internal CheckedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + /// SyntaxToken representing the checked or unchecked keyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).keyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeOfExpression(this); + /// Argument of the primary function. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; - public TypeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); - public TypeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); - public TypeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); - public TypeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; - /// Class which represents the syntax node for SizeOf expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SizeOfExpressionSyntax : ExpressionSyntax - { - private TypeSyntax? type; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedExpression(this); - internal SizeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.CheckedExpression(this.Kind(), keyword, openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the SizeOfKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).keyword, Position, 0); + return this; + } + + public CheckedExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); + public CheckedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); + public CheckedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); + public CheckedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); +} - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); +/// Class which represents the syntax node for Default expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DefaultExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; - /// Argument of the primary function. - public TypeSyntax Type => GetRed(ref this.type, 2)!; + internal DefaultExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// SyntaxToken representing the DefaultKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).keyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + /// Argument of the primary function. + public TypeSyntax Type => GetRed(ref this.type, 2)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSizeOfExpression(this); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - public SizeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); - public SizeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); - public SizeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); - public SizeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultExpression(this); - /// Class which represents the syntax node for invocation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InvocationExpressionSyntax : ExpressionSyntax + public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) { - private ExpressionSyntax? expression; - private ArgumentListSyntax? argumentList; - - internal InvocationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ExpressionSyntax node representing the expression part of the invocation. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + return this; + } + + public DefaultExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); + public DefaultExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); + public DefaultExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); + public DefaultExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); +} + +/// Class which represents the syntax node for TypeOf expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeOfExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; - /// ArgumentListSyntax node representing the list of arguments of the invocation expression. - public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + internal TypeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 1 => GetRed(ref this.argumentList, 1)!, - _ => null, - }; + /// SyntaxToken representing the TypeOfKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).keyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.argumentList, - _ => null, - }; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInvocationExpression(this); + /// The expression to return type of. + public TypeSyntax Type => GetRed(ref this.type, 2)!; - public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList) - { - if (expression != this.Expression || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.InvocationExpression(expression, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - public InvocationExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); - public InvocationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Expression, argumentList); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - public InvocationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeOfExpression(this); - /// Class which represents the syntax node for element access expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax + public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) { - private ExpressionSyntax? expression; - private BracketedArgumentListSyntax? argumentList; - - internal ElementAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ExpressionSyntax node representing the expression which is accessing the element. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - - /// BracketedArgumentListSyntax node representing the list of arguments of the element access expression. - public BracketedArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 1 => GetRed(ref this.argumentList, 1)!, - _ => null, - }; + public TypeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); + public TypeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); + public TypeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); + public TypeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); +} - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.argumentList, - _ => null, - }; +/// Class which represents the syntax node for SizeOf expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SizeOfExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementAccessExpression(this); + internal SizeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - { - if (expression != this.Expression || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// SyntaxToken representing the SizeOfKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).keyword, Position, 0); - return this; - } + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - public ElementAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); - public ElementAccessExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(this.Expression, argumentList); + /// Argument of the primary function. + public TypeSyntax Type => GetRed(ref this.type, 2)!; - public ElementAccessExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); - } + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - /// Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. - public abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode - { - internal BaseArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. - public abstract SeparatedSyntaxList Arguments { get; } - public BaseArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => WithArgumentsCore(arguments); - internal abstract BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - public BaseArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => AddArgumentsCore(items); - internal abstract BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSizeOfExpression(this); - /// Class which represents the syntax node for the list of arguments. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArgumentListSyntax : BaseArgumentListSyntax + public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) { - private SyntaxNode? arguments; - - internal ArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); + return this; + } - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override SeparatedSyntaxList Arguments - { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public SizeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); + public SizeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); + public SizeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); + public SizeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); +} - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); +/// Class which represents the syntax node for invocation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InvocationExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private ArgumentListSyntax? argumentList; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + internal InvocationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + /// ExpressionSyntax node representing the expression part of the invocation. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgumentList(this); + /// ArgumentListSyntax node representing the list of arguments of the invocation expression. + public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - public ArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.expression)!, + 1 => GetRed(ref this.argumentList, 1)!, + _ => null, + }; - public ArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); - internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); - public new ArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); - public ArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 1 => this.argumentList, + _ => null, + }; - internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); - public new ArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInvocationExpression(this); - /// Class which represents the syntax node for bracketed argument list. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax + public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList) { - private SyntaxNode? arguments; - - internal BracketedArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression || argumentList != this.ArgumentList) { + var newNode = SyntaxFactory.InvocationExpression(expression, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); + return this; + } - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override SeparatedSyntaxList Arguments - { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public InvocationExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); + public InvocationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Expression, argumentList); + + public InvocationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} - /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); +/// Class which represents the syntax node for element access expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private BracketedArgumentListSyntax? argumentList; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + internal ElementAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + /// ExpressionSyntax node representing the expression which is accessing the element. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedArgumentList(this); + /// BracketedArgumentListSyntax node representing the list of arguments of the element access expression. + public BracketedArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.expression)!, + 1 => GetRed(ref this.argumentList, 1)!, + _ => null, + }; - public BracketedArgumentListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Arguments, this.CloseBracketToken); - internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); - public new BracketedArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenBracketToken, arguments, this.CloseBracketToken); - public BracketedArgumentListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Arguments, closeBracketToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 1 => this.argumentList, + _ => null, + }; - internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); - public new BracketedArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementAccessExpression(this); - /// Class which represents the syntax node for argument. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArgumentSyntax : CSharpSyntaxNode + public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) { - private NameColonSyntax? nameColon; - private ExpressionSyntax? expression; - - internal ArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression || argumentList != this.ArgumentList) { + var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// NameColonSyntax node representing the optional name arguments. - public NameColonSyntax? NameColon => GetRedAtZero(ref this.nameColon); - - /// SyntaxToken representing the optional ref or out keyword. - public SyntaxToken RefKindKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + return this; + } - /// ExpressionSyntax node representing the argument. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + public ElementAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); + public ElementAccessExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(this.Expression, argumentList); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.nameColon), - 2 => GetRed(ref this.expression, 2)!, - _ => null, - }; + public ElementAccessExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.nameColon, - 2 => this.expression, - _ => null, - }; +/// Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. +public abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode +{ + internal BaseArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgument(this); + /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. + public abstract SeparatedSyntaxList Arguments { get; } + public BaseArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => WithArgumentsCore(arguments); + internal abstract BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments); - public ArgumentSyntax Update(NameColonSyntax? nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) - { - if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public BaseArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => AddArgumentsCore(items); + internal abstract BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items); +} - return this; - } +/// Class which represents the syntax node for the list of arguments. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArgumentListSyntax : BaseArgumentListSyntax +{ + private SyntaxNode? arguments; - public ArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(nameColon, this.RefKindKeyword, this.Expression); - public ArgumentSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(this.NameColon, refKindKeyword, this.Expression); - public ArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameColon, this.RefKindKeyword, expression); + internal ArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - public abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); + + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public override SeparatedSyntaxList Arguments { - internal BaseExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } - - public abstract ExpressionSyntax Expression { get; } - public BaseExpressionColonSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); - internal abstract BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression); - - public abstract SyntaxToken ColonToken { get; } - public BaseExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); - internal abstract BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken); } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax - { - private ExpressionSyntax? expression; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal ExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - public override ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExpressionColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgumentList(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + public ArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionColon(this); + public ArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); + internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); + public new ArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); + public ArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); - public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken) - { - if (expression != this.Expression || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.ExpressionColon(expression, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); + public new ArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +} - return this; - } +/// Class which represents the syntax node for bracketed argument list. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax +{ + private SyntaxNode? arguments; - internal override BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); - public new ExpressionColonSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ColonToken); - internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new ExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Expression, colonToken); + internal BracketedArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents the syntax node for name colon syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NameColonSyntax : BaseExpressionColonSyntax - { - private IdentifierNameSyntax? name; + /// SyntaxToken representing open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); - internal NameColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public override SeparatedSyntaxList Arguments + { + get { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// IdentifierNameSyntax representing the identifier name. - public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; - - /// SyntaxToken representing colon. - public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NameColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameColon(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedArgumentList(this); - public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken) + public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) { - if (name != this.Name || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.NameColon(name, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public NameColonSyntax WithName(IdentifierNameSyntax name) => Update(name, this.ColonToken); - internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new NameColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Name, colonToken); + return this; } - /// Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DeclarationExpressionSyntax : ExpressionSyntax - { - private TypeSyntax? type; - private VariableDesignationSyntax? designation; + public BracketedArgumentListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Arguments, this.CloseBracketToken); + internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); + public new BracketedArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenBracketToken, arguments, this.CloseBracketToken); + public BracketedArgumentListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Arguments, closeBracketToken); - internal DeclarationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); + public new BracketedArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +} - public TypeSyntax Type => GetRedAtZero(ref this.type)!; +/// Class which represents the syntax node for argument. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArgumentSyntax : CSharpSyntaxNode +{ + private NameColonSyntax? nameColon; + private ExpressionSyntax? expression; - /// Declaration representing the variable declared in an out parameter or deconstruction. - public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; + internal ArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.designation, 1)!, - _ => null, - }; + /// NameColonSyntax node representing the optional name arguments. + public NameColonSyntax? NameColon => GetRedAtZero(ref this.nameColon); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.designation, - _ => null, - }; + /// SyntaxToken representing the optional ref or out keyword. + public SyntaxToken RefKindKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationExpression(this); + /// ExpressionSyntax node representing the argument. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (type != this.Type || designation != this.Designation) - { - var newNode = SyntaxFactory.DeclarationExpression(type, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.nameColon), + 2 => GetRed(ref this.expression, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.nameColon, + 2 => this.expression, + _ => null, + }; - public DeclarationExpressionSyntax WithType(TypeSyntax type) => Update(type, this.Designation); - public DeclarationExpressionSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgument(this); - /// Class which represents the syntax node for cast expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CastExpressionSyntax : ExpressionSyntax + public ArgumentSyntax Update(NameColonSyntax? nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) { - private TypeSyntax? type; - private ExpressionSyntax? expression; - - internal CastExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) { + var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CastExpressionSyntax)this.Green).openParenToken, Position, 0); + return this; + } + + public ArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(nameColon, this.RefKindKeyword, this.Expression); + public ArgumentSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(this.NameColon, refKindKeyword, this.Expression); + public ArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameColon, this.RefKindKeyword, expression); +} + +public abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode +{ + internal BaseExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// TypeSyntax node representing the type to which the expression is being cast. - public TypeSyntax Type => GetRed(ref this.type, 1)!; + public abstract ExpressionSyntax Expression { get; } + public BaseExpressionColonSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); + internal abstract BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression); - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CastExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public abstract SyntaxToken ColonToken { get; } + public BaseExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); + internal abstract BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken); +} - /// ExpressionSyntax node representing the expression that is being casted. - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax +{ + private ExpressionSyntax? expression; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1)!, - 3 => GetRed(ref this.expression, 3)!, - _ => null, - }; + internal ExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 3 => this.expression, - _ => null, - }; + public override ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCastExpression(this); + public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExpressionColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) - { - if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression) - { - var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public CastExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.CloseParenToken, this.Expression); - public CastExpressionSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.CloseParenToken, this.Expression); - public CastExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, closeParenToken, this.Expression); - public CastExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, this.Type, this.CloseParenToken, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionColon(this); - /// Provides the base class from which the classes that represent anonymous function expressions are derived. - public abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax + public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken) { - internal AnonymousFunctionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression || colonToken != this.ColonToken) { + var newNode = SyntaxFactory.ExpressionColon(expression, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxTokenList Modifiers { get; } - public AnonymousFunctionExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); - internal abstract AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers); + return this; + } + + internal override BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); + public new ExpressionColonSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ColonToken); + internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new ExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Expression, colonToken); +} - public AnonymousFunctionExpressionSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); - internal abstract AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items); +/// Class which represents the syntax node for name colon syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NameColonSyntax : BaseExpressionColonSyntax +{ + private IdentifierNameSyntax? name; - /// - /// BlockSyntax node representing the body of the anonymous function. - /// Only one of Block or ExpressionBody will be non-null. - /// - public abstract BlockSyntax? Block { get; } - public AnonymousFunctionExpressionSyntax WithBlock(BlockSyntax? block) => WithBlockCore(block); - internal abstract AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block); + internal NameColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); - internal abstract AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items); + /// IdentifierNameSyntax representing the identifier name. + public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; - public AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); - internal abstract AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items); + /// SyntaxToken representing colon. + public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NameColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - /// - /// ExpressionSyntax node representing the body of the anonymous function. - /// Only one of Block or ExpressionBody will be non-null. - /// - public abstract ExpressionSyntax? ExpressionBody { get; } - public AnonymousFunctionExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); - internal abstract AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - /// Class which represents the syntax node for anonymous method expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax - { - private ParameterListSyntax? parameterList; - private BlockSyntax? block; - private ExpressionSyntax? expressionBody; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - internal AnonymousMethodExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameColon(this); - public override SyntaxTokenList Modifiers + public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken) + { + if (name != this.Name || colonToken != this.ColonToken) { - get - { - var slot = this.Green.GetSlot(0); - return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; - } + var newNode = SyntaxFactory.NameColon(name, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); - - /// List of parameters of the anonymous method expression, or null if there no parameters are specified. - public ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 2); + return this; + } - /// - /// BlockSyntax node representing the body of the anonymous function. - /// This will never be null. - /// - public override BlockSyntax Block => GetRed(ref this.block, 3)!; + public NameColonSyntax WithName(IdentifierNameSyntax name) => Update(name, this.ColonToken); + internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new NameColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Name, colonToken); +} - /// - /// Inherited from AnonymousFunctionExpressionSyntax, but not used for - /// AnonymousMethodExpressionSyntax. This will always be null. - /// - public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); +/// Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DeclarationExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; + private VariableDesignationSyntax? designation; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 2 => GetRed(ref this.parameterList, 2), - 3 => GetRed(ref this.block, 3)!, - 4 => GetRed(ref this.expressionBody, 4), - _ => null, - }; + internal DeclarationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.parameterList, - 3 => this.block, - 4 => this.expressionBody, - _ => null, - }; + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousMethodExpression(this); + /// Declaration representing the variable declared in an out parameter or deconstruction. + public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; - public AnonymousMethodExpressionSyntax Update(SyntaxTokenList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.designation, 1)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.designation, + _ => null, + }; - internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new AnonymousMethodExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(modifiers, this.DelegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); - public AnonymousMethodExpressionSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.Modifiers, delegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); - public AnonymousMethodExpressionSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.Modifiers, this.DelegateKeyword, parameterList, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block ?? throw new ArgumentNullException(nameof(block))); - public new AnonymousMethodExpressionSyntax WithBlock(BlockSyntax block) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new AnonymousMethodExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, this.Block, expressionBody); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationExpression(this); - internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new AnonymousMethodExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public AnonymousMethodExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) + public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + { + if (type != this.Type || designation != this.Designation) { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + var newNode = SyntaxFactory.DeclarationExpression(type, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); - public new AnonymousMethodExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); - public new AnonymousMethodExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); + + return this; } - /// Provides the base class from which the classes that represent lambda expressions are derived. - public abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax - { - internal LambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public DeclarationExpressionSyntax WithType(TypeSyntax type) => Update(type, this.Designation); + public DeclarationExpressionSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); +} + +/// Class which represents the syntax node for cast expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CastExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; + private ExpressionSyntax? expression; - public abstract SyntaxList AttributeLists { get; } - public LambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists); + internal CastExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public LambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CastExpressionSyntax)this.Green).openParenToken, Position, 0); - /// SyntaxToken representing equals greater than. - public abstract SyntaxToken ArrowToken { get; } - public LambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => WithArrowTokenCore(arrowToken); - internal abstract LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken); + /// TypeSyntax node representing the type to which the expression is being cast. + public TypeSyntax Type => GetRed(ref this.type, 1)!; - public new LambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => (LambdaExpressionSyntax)WithModifiersCore(modifiers); - public new LambdaExpressionSyntax WithBlock(BlockSyntax? block) => (LambdaExpressionSyntax)WithBlockCore(block); - public new LambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => (LambdaExpressionSyntax)WithExpressionBodyCore(expressionBody); + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CastExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - public new LambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => (LambdaExpressionSyntax)AddModifiersCore(items); + /// ExpressionSyntax node representing the expression that is being casted. + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public new AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); - - public new AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); - } - - /// Class which represents the syntax node for a simple lambda expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax - { - private SyntaxNode? attributeLists; - private ParameterSyntax? parameter; - private BlockSyntax? block; - private ExpressionSyntax? expressionBody; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1)!, + 3 => GetRed(ref this.expression, 3)!, + _ => null, + }; - internal SimpleLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 1 => this.type, + 3 => this.expression, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCastExpression(this); - public override SyntaxTokenList Modifiers + public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + { + if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ParameterSyntax node representing the parameter of the lambda expression. - public ParameterSyntax Parameter => GetRed(ref this.parameter, 2)!; + return this; + } - /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SimpleLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(3), GetChildIndex(3)); + public CastExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.CloseParenToken, this.Expression); + public CastExpressionSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.CloseParenToken, this.Expression); + public CastExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, closeParenToken, this.Expression); + public CastExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, this.Type, this.CloseParenToken, expression); +} - /// - /// BlockSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override BlockSyntax? Block => GetRed(ref this.block, 4); +/// Provides the base class from which the classes that represent anonymous function expressions are derived. +public abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax +{ + internal AnonymousFunctionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// - /// ExpressionSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 5); + public abstract SyntaxTokenList Modifiers { get; } + public AnonymousFunctionExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); + internal abstract AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.parameter, 2)!, - 4 => GetRed(ref this.block, 4), - 5 => GetRed(ref this.expressionBody, 5), - _ => null, - }; + public AnonymousFunctionExpressionSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); + internal abstract AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.parameter, - 4 => this.block, - 5 => this.expressionBody, - _ => null, - }; + /// + /// BlockSyntax node representing the body of the anonymous function. + /// Only one of Block or ExpressionBody will be non-null. + /// + public abstract BlockSyntax? Block { get; } + public AnonymousFunctionExpressionSyntax WithBlock(BlockSyntax? block) => WithBlockCore(block); + internal abstract AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleLambdaExpression(this); + public AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); + internal abstract AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items); - public SimpleLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); + internal abstract AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items); - return this; - } + /// + /// ExpressionSyntax node representing the body of the anonymous function. + /// Only one of Block or ExpressionBody will be non-null. + /// + public abstract ExpressionSyntax? ExpressionBody { get; } + public AnonymousFunctionExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); + internal abstract AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody); +} - internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new SimpleLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new SimpleLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); - public SimpleLambdaExpressionSyntax WithParameter(ParameterSyntax parameter) => Update(this.AttributeLists, this.Modifiers, parameter, this.ArrowToken, this.Block, this.ExpressionBody); - internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); - public new SimpleLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.Parameter, arrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); - public new SimpleLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new SimpleLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, expressionBody); +/// Class which represents the syntax node for anonymous method expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax +{ + private ParameterListSyntax? parameterList; + private BlockSyntax? block; + private ExpressionSyntax? expressionBody; - internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new SimpleLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new SimpleLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public SimpleLambdaExpressionSyntax AddParameterAttributeLists(params AttributeListSyntax[] items) => WithParameter(this.Parameter.WithAttributeLists(this.Parameter.AttributeLists.AddRange(items))); - public SimpleLambdaExpressionSyntax AddParameterModifiers(params SyntaxToken[] items) => WithParameter(this.Parameter.WithModifiers(this.Parameter.Modifiers.AddRange(items))); - internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); - public new SimpleLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) - { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); - } - internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); - public new SimpleLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) - { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithStatements(block.Statements.AddRange(items))); - } + internal AnonymousMethodExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RefExpressionSyntax : ExpressionSyntax + public override SyntaxTokenList Modifiers { - private ExpressionSyntax? expression; - - internal RefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = this.Green.GetSlot(0); + return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; } + } - public SyntaxToken RefKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefExpressionSyntax)this.Green).refKeyword, Position, 0); + /// SyntaxToken representing the delegate keyword. + public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + /// List of parameters of the anonymous method expression, or null if there no parameters are specified. + public ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 2); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + /// + /// BlockSyntax node representing the body of the anonymous function. + /// This will never be null. + /// + public override BlockSyntax Block => GetRed(ref this.block, 3)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + /// + /// Inherited from AnonymousFunctionExpressionSyntax, but not used for + /// AnonymousMethodExpressionSyntax. This will always be null. + /// + public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefExpression(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 2 => GetRed(ref this.parameterList, 2), + 3 => GetRed(ref this.block, 3)!, + 4 => GetRed(ref this.expressionBody, 4), + _ => null, + }; - public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (refKeyword != this.RefKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.RefExpression(refKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 2 => this.parameterList, + 3 => this.block, + 4 => this.expressionBody, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousMethodExpression(this); - return this; + public AnonymousMethodExpressionSyntax Update(SyntaxTokenList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + { + if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) + { + var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public RefExpressionSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.Expression); - public RefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.RefKeyword, expression); + return this; } - /// Class which represents the syntax node for parenthesized lambda expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax + internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new AnonymousMethodExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(modifiers, this.DelegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); + public AnonymousMethodExpressionSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.Modifiers, delegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); + public AnonymousMethodExpressionSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.Modifiers, this.DelegateKeyword, parameterList, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block ?? throw new ArgumentNullException(nameof(block))); + public new AnonymousMethodExpressionSyntax WithBlock(BlockSyntax block) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new AnonymousMethodExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, this.Block, expressionBody); + + internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new AnonymousMethodExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public AnonymousMethodExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) { - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private ParameterListSyntax? parameterList; - private BlockSyntax? block; - private ExpressionSyntax? expressionBody; + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); + public new AnonymousMethodExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); + public new AnonymousMethodExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); +} - internal ParenthesizedLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Provides the base class from which the classes that represent lambda expressions are derived. +public abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax +{ + internal LambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public abstract SyntaxList AttributeLists { get; } + public LambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public LambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items); - public TypeSyntax? ReturnType => GetRed(ref this.returnType, 2); + /// SyntaxToken representing equals greater than. + public abstract SyntaxToken ArrowToken { get; } + public LambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => WithArrowTokenCore(arrowToken); + internal abstract LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken); - /// ParameterListSyntax node representing the list of parameters for the lambda expression. - public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; + public new LambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => (LambdaExpressionSyntax)WithModifiersCore(modifiers); + public new LambdaExpressionSyntax WithBlock(BlockSyntax? block) => (LambdaExpressionSyntax)WithBlockCore(block); + public new LambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => (LambdaExpressionSyntax)WithExpressionBodyCore(expressionBody); - /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(4), GetChildIndex(4)); + public new LambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => (LambdaExpressionSyntax)AddModifiersCore(items); - /// - /// BlockSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override BlockSyntax? Block => GetRed(ref this.block, 5); + public new AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); - /// - /// ExpressionSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); + public new AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2), - 3 => GetRed(ref this.parameterList, 3)!, - 5 => GetRed(ref this.block, 5), - 6 => GetRed(ref this.expressionBody, 6), - _ => null, - }; +/// Class which represents the syntax node for a simple lambda expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax +{ + private SyntaxNode? attributeLists; + private ParameterSyntax? parameter; + private BlockSyntax? block; + private ExpressionSyntax? expressionBody; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.returnType, - 3 => this.parameterList, - 5 => this.block, - 6 => this.expressionBody, - _ => null, - }; + internal SimpleLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedLambdaExpression(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public ParenthesizedLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + public override SyntaxTokenList Modifiers + { + get { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } + + /// ParameterSyntax node representing the parameter of the lambda expression. + public ParameterSyntax Parameter => GetRed(ref this.parameter, 2)!; + + /// SyntaxToken representing equals greater than. + public override SyntaxToken ArrowToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SimpleLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(3), GetChildIndex(3)); + + /// + /// BlockSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override BlockSyntax? Block => GetRed(ref this.block, 4); - internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ParenthesizedLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ParenthesizedLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); - public ParenthesizedLambdaExpressionSyntax WithReturnType(TypeSyntax? returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); - public ParenthesizedLambdaExpressionSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, parameterList, this.ArrowToken, this.Block, this.ExpressionBody); - internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); - public new ParenthesizedLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, arrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); - public new ParenthesizedLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new ParenthesizedLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, expressionBody); + /// + /// ExpressionSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 5); - internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ParenthesizedLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ParenthesizedLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public ParenthesizedLambdaExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); - public new ParenthesizedLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); - } - internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); - public new ParenthesizedLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.parameter, 2)!, + 4 => GetRed(ref this.block, 4), + 5 => GetRed(ref this.expressionBody, 5), + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithStatements(block.Statements.AddRange(items))); - } - } + 0 => this.attributeLists, + 2 => this.parameter, + 4 => this.block, + 5 => this.expressionBody, + _ => null, + }; - /// Class which represents the syntax node for initializer expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class InitializerExpressionSyntax : ExpressionSyntax - { - private SyntaxNode? expressions; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleLambdaExpression(this); - internal InitializerExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SimpleLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) { + var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); + return this; + } - /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. - public SeparatedSyntaxList Expressions - { - get - { - var red = GetRed(ref this.expressions, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new SimpleLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new SimpleLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); + public SimpleLambdaExpressionSyntax WithParameter(ParameterSyntax parameter) => Update(this.AttributeLists, this.Modifiers, parameter, this.ArrowToken, this.Block, this.ExpressionBody); + internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); + public new SimpleLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.Parameter, arrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); + public new SimpleLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new SimpleLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, expressionBody); - /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new SimpleLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new SimpleLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public SimpleLambdaExpressionSyntax AddParameterAttributeLists(params AttributeListSyntax[] items) => WithParameter(this.Parameter.WithAttributeLists(this.Parameter.AttributeLists.AddRange(items))); + public SimpleLambdaExpressionSyntax AddParameterModifiers(params SyntaxToken[] items) => WithParameter(this.Parameter.WithModifiers(this.Parameter.Modifiers.AddRange(items))); + internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); + public new SimpleLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) + { + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); + } + internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); + public new SimpleLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) + { + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithStatements(block.Statements.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expressions, 1)! : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RefExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expressions : null; + internal RefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInitializerExpression(this); + public SyntaxToken RefKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefExpressionSyntax)this.Green).refKeyword, Position, 0); - public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) - { - if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.InitializerExpression(this.Kind(), openBraceToken, expressions, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - public InitializerExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expressions, this.CloseBraceToken); - public InitializerExpressionSyntax WithExpressions(SeparatedSyntaxList expressions) => Update(this.OpenBraceToken, expressions, this.CloseBraceToken); - public InitializerExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expressions, closeBraceToken); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public InitializerExpressionSyntax AddExpressions(params ExpressionSyntax[] items) => WithExpressions(this.Expressions.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefExpression(this); - public abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax + public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression) { - internal BaseObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (refKeyword != this.RefKeyword || expression != this.Expression) { + var newNode = SyntaxFactory.RefExpression(refKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the new keyword. - public abstract SyntaxToken NewKeyword { get; } - public BaseObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => WithNewKeywordCore(newKeyword); - internal abstract BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword); + return this; + } - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public abstract ArgumentListSyntax? ArgumentList { get; } - public BaseObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => WithArgumentListCore(argumentList); - internal abstract BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList); + public RefExpressionSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.Expression); + public RefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.RefKeyword, expression); +} - public BaseObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => AddArgumentListArgumentsCore(items); - internal abstract BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items); +/// Class which represents the syntax node for parenthesized lambda expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private ParameterListSyntax? parameterList; + private BlockSyntax? block; + private ExpressionSyntax? expressionBody; - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public abstract InitializerExpressionSyntax? Initializer { get; } - public BaseObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => WithInitializerCore(initializer); - internal abstract BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer); + internal ParenthesizedLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents the syntax node for implicit object creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax - { - private ArgumentListSyntax? argumentList; - private InitializerExpressionSyntax? initializer; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal ImplicitObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public override ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + public TypeSyntax? ReturnType => GetRed(ref this.returnType, 2); - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); + /// ParameterListSyntax node representing the list of parameters for the lambda expression. + public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.argumentList, 1)!, - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; + /// SyntaxToken representing equals greater than. + public override SyntaxToken ArrowToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(4), GetChildIndex(4)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.argumentList, - 2 => this.initializer, - _ => null, - }; + /// + /// BlockSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override BlockSyntax? Block => GetRed(ref this.block, 5); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitObjectCreationExpression(this); + /// + /// ExpressionSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2), + 3 => GetRed(ref this.parameterList, 3)!, + 5 => GetRed(ref this.block, 5), + 6 => GetRed(ref this.expressionBody, 6), + _ => null, + }; - internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); - public new ImplicitObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.ArgumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList ?? throw new ArgumentNullException(nameof(argumentList))); - public new ImplicitObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.NewKeyword, argumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); - public new ImplicitObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.ArgumentList, initializer); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.returnType, + 3 => this.parameterList, + 5 => this.block, + 6 => this.expressionBody, + _ => null, + }; - internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); - public new ImplicitObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedLambdaExpression(this); - /// Class which represents the syntax node for object creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax + public ParenthesizedLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) { - private TypeSyntax? type; - private ArgumentListSyntax? argumentList; - private InitializerExpressionSyntax? initializer; - - internal ObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) { + var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - - /// TypeSyntax representing the type of the object being created. - public TypeSyntax Type => GetRed(ref this.type, 1)!; + return this; + } - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public override ArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 2); + internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ParenthesizedLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ParenthesizedLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); + public ParenthesizedLambdaExpressionSyntax WithReturnType(TypeSyntax? returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); + public ParenthesizedLambdaExpressionSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, parameterList, this.ArrowToken, this.Block, this.ExpressionBody); + internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); + public new ParenthesizedLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, arrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); + public new ParenthesizedLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new ParenthesizedLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, expressionBody); - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 3); + internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ParenthesizedLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ParenthesizedLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public ParenthesizedLambdaExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); + public new ParenthesizedLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) + { + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); + } + internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); + public new ParenthesizedLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) + { + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithStatements(block.Statements.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1)!, - 2 => GetRed(ref this.argumentList, 2), - 3 => GetRed(ref this.initializer, 3), - _ => null, - }; +/// Class which represents the syntax node for initializer expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class InitializerExpressionSyntax : ExpressionSyntax +{ + private SyntaxNode? expressions; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 2 => this.argumentList, - 3 => this.initializer, - _ => null, - }; + internal InitializerExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitObjectCreationExpression(this); + /// SyntaxToken representing the open brace. + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); - public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) + /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. + public SeparatedSyntaxList Expressions + { + get { - if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.expressions, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); - public new ObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.ArgumentList, this.Initializer); - public ObjectCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.NewKeyword, type, this.ArgumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList); - public new ObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => Update(this.NewKeyword, this.Type, argumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); - public new ObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, this.ArgumentList, initializer); + /// SyntaxToken representing the close brace. + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); - internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); - public new ObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) - { - var argumentList = this.ArgumentList ?? SyntaxFactory.ArgumentList(); - return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); - } - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expressions, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class WithExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; - private InitializerExpressionSyntax? initializer; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expressions : null; - internal WithExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInitializerExpression(this); + + public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) { + var newNode = SyntaxFactory.InitializerExpression(this.Kind(), openBraceToken, expressions, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + return this; + } - public SyntaxToken WithKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WithExpressionSyntax)this.Green).withKeyword, GetChildPosition(1), GetChildIndex(1)); + public InitializerExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expressions, this.CloseBraceToken); + public InitializerExpressionSyntax WithExpressions(SeparatedSyntaxList expressions) => Update(this.OpenBraceToken, expressions, this.CloseBraceToken); + public InitializerExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expressions, closeBraceToken); - /// InitializerExpressionSyntax representing the initializer expression for the with expression. - public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 2)!; + public InitializerExpressionSyntax AddExpressions(params ExpressionSyntax[] items) => WithExpressions(this.Expressions.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.initializer, 2)!, - _ => null, - }; +public abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax +{ + internal BaseObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.initializer, - _ => null, - }; + /// SyntaxToken representing the new keyword. + public abstract SyntaxToken NewKeyword { get; } + public BaseObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => WithNewKeywordCore(newKeyword); + internal abstract BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWithExpression(this); + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public abstract ArgumentListSyntax? ArgumentList { get; } + public BaseObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => WithArgumentListCore(argumentList); + internal abstract BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList); - public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) - { - if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer) - { - var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public BaseObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => AddArgumentListArgumentsCore(items); + internal abstract BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items); - return this; - } + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public abstract InitializerExpressionSyntax? Initializer { get; } + public BaseObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => WithInitializerCore(initializer); + internal abstract BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer); +} - public WithExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.WithKeyword, this.Initializer); - public WithExpressionSyntax WithWithKeyword(SyntaxToken withKeyword) => Update(this.Expression, withKeyword, this.Initializer); - public WithExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.Expression, this.WithKeyword, initializer); +/// Class which represents the syntax node for implicit object creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax +{ + private ArgumentListSyntax? argumentList; + private InitializerExpressionSyntax? initializer; - public WithExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); + internal ImplicitObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode - { - private NameEqualsSyntax? nameEquals; - private ExpressionSyntax? expression; + /// SyntaxToken representing the new keyword. + public override SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - internal AnonymousObjectMemberDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public override ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - /// NameEqualsSyntax representing the optional name of the member being initialized. - public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); - /// ExpressionSyntax representing the value the member is initialized with. - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.argumentList, 1)!, + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.nameEquals), - 1 => GetRed(ref this.expression, 1)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.nameEquals, - 1 => this.expression, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.argumentList, + 2 => this.initializer, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectMemberDeclarator(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitObjectCreationExpression(this); - public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) + public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + { + if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer) { - if (nameEquals != this.NameEquals || expression != this.Expression) - { - var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AnonymousObjectMemberDeclaratorSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.Expression); - public AnonymousObjectMemberDeclaratorSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, expression); + return this; } - /// Class which represents the syntax node for anonymous object creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax - { - private SyntaxNode? initializers; - - internal AnonymousObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); + public new ImplicitObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.ArgumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList ?? throw new ArgumentNullException(nameof(argumentList))); + public new ImplicitObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.NewKeyword, argumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); + public new ImplicitObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.ArgumentList, initializer); - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); + public new ImplicitObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} - /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); +/// Class which represents the syntax node for object creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax +{ + private TypeSyntax? type; + private ArgumentListSyntax? argumentList; + private InitializerExpressionSyntax? initializer; - /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. - public SeparatedSyntaxList Initializers - { - get - { - var red = GetRed(ref this.initializers, 2); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; - } - } + internal ObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); + /// SyntaxToken representing the new keyword. + public override SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.initializers, 2)! : null; + /// TypeSyntax representing the type of the object being created. + public TypeSyntax Type => GetRed(ref this.type, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.initializers : null; + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public override ArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 2); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectCreationExpression(this); + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 3); - public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 1 => GetRed(ref this.type, 1)!, + 2 => GetRed(ref this.argumentList, 2), + 3 => GetRed(ref this.initializer, 3), + _ => null, + }; - public AnonymousObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBraceToken, this.Initializers, this.CloseBraceToken); - public AnonymousObjectCreationExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.NewKeyword, openBraceToken, this.Initializers, this.CloseBraceToken); - public AnonymousObjectCreationExpressionSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.NewKeyword, this.OpenBraceToken, initializers, this.CloseBraceToken); - public AnonymousObjectCreationExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.NewKeyword, this.OpenBraceToken, this.Initializers, closeBraceToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 2 => this.argumentList, + 3 => this.initializer, + _ => null, + }; - public AnonymousObjectCreationExpressionSyntax AddInitializers(params AnonymousObjectMemberDeclaratorSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitObjectCreationExpression(this); - /// Class which represents the syntax node for array creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax + public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) { - private ArrayTypeSyntax? type; - private InitializerExpressionSyntax? initializer; - - internal ArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) { + var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + return this; + } - /// ArrayTypeSyntax node representing the type of the array. - public ArrayTypeSyntax Type => GetRed(ref this.type, 1)!; + internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); + public new ObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.ArgumentList, this.Initializer); + public ObjectCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.NewKeyword, type, this.ArgumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList); + public new ObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => Update(this.NewKeyword, this.Type, argumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); + public new ObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, this.ArgumentList, initializer); - /// InitializerExpressionSyntax node representing the initializer of the array creation expression. - public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); + internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); + public new ObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) + { + var argumentList = this.ArgumentList ?? SyntaxFactory.ArgumentList(); + return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1)!, - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class WithExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private InitializerExpressionSyntax? initializer; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 2 => this.initializer, - _ => null, - }; + internal WithExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayCreationExpression(this); + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) - { - if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken WithKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WithExpressionSyntax)this.Green).withKeyword, GetChildPosition(1), GetChildIndex(1)); - return this; - } + /// InitializerExpressionSyntax representing the initializer expression for the with expression. + public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 2)!; - public ArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.Initializer); - public ArrayCreationExpressionSyntax WithType(ArrayTypeSyntax type) => Update(this.NewKeyword, type, this.Initializer); - public ArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, initializer); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.initializer, 2)!, + _ => null, + }; - public ArrayCreationExpressionSyntax AddTypeRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithType(this.Type.WithRankSpecifiers(this.Type.RankSpecifiers.AddRange(items))); - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 2 => this.initializer, + _ => null, + }; - /// Class which represents the syntax node for implicit array creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax - { - private InitializerExpressionSyntax? initializer; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWithExpression(this); - internal ImplicitArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + { + if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer) { + var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - - /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); + return this; + } - /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. - public SyntaxTokenList Commas - { - get - { - var slot = this.Green.GetSlot(2); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public WithExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.WithKeyword, this.Initializer); + public WithExpressionSyntax WithWithKeyword(SyntaxToken withKeyword) => Update(this.Expression, withKeyword, this.Initializer); + public WithExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.Expression, this.WithKeyword, initializer); - /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + public WithExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); +} - /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. - public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 4)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode +{ + private NameEqualsSyntax? nameEquals; + private ExpressionSyntax? expression; - internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.initializer, 4)! : null; + internal AnonymousObjectMemberDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.initializer : null; + /// NameEqualsSyntax representing the optional name of the member being initialized. + public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitArrayCreationExpression(this); + /// ExpressionSyntax representing the value the member is initialized with. + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, SyntaxTokenList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.nameEquals), + 1 => GetRed(ref this.expression, 1)!, + _ => null, + }; - public ImplicitArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.NewKeyword, openBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithCommas(SyntaxTokenList commas) => Update(this.NewKeyword, this.OpenBracketToken, commas, this.CloseBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, closeBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, initializer); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.nameEquals, + 1 => this.expression, + _ => null, + }; - public ImplicitArrayCreationExpressionSyntax AddCommas(params SyntaxToken[] items) => WithCommas(this.Commas.AddRange(items)); - public ImplicitArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectMemberDeclarator(this); - /// Class which represents the syntax node for stackalloc array creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax + public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) { - private TypeSyntax? type; - private InitializerExpressionSyntax? initializer; - - internal StackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (nameEquals != this.NameEquals || expression != this.Expression) { + var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.StackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); + return this; + } - /// TypeSyntax node representing the type of the stackalloc array. - public TypeSyntax Type => GetRed(ref this.type, 1)!; + public AnonymousObjectMemberDeclaratorSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.Expression); + public AnonymousObjectMemberDeclaratorSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, expression); +} - /// InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. - public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); +/// Class which represents the syntax node for anonymous object creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax +{ + private SyntaxNode? initializers; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1)!, - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; + internal AnonymousObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 2 => this.initializer, - _ => null, - }; + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStackAllocArrayCreationExpression(this); + /// SyntaxToken representing the open brace. + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); - public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) + /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. + public SeparatedSyntaxList Initializers + { + get { - if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer) - { - var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.initializers, 2); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; } - - public StackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.Type, this.Initializer); - public StackAllocArrayCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.StackAllocKeyword, type, this.Initializer); - public StackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.StackAllocKeyword, this.Type, initializer); } - /// Class which represents the syntax node for implicit stackalloc array creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax - { - private InitializerExpressionSyntax? initializer; + /// SyntaxToken representing the close brace. + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); - internal ImplicitStackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.initializers, 2)! : null; - /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.initializers : null; - /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectCreationExpression(this); - /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + { + if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. - public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 3)!; + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.initializer, 3)! : null; + public AnonymousObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBraceToken, this.Initializers, this.CloseBraceToken); + public AnonymousObjectCreationExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.NewKeyword, openBraceToken, this.Initializers, this.CloseBraceToken); + public AnonymousObjectCreationExpressionSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.NewKeyword, this.OpenBraceToken, initializers, this.CloseBraceToken); + public AnonymousObjectCreationExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.NewKeyword, this.OpenBraceToken, this.Initializers, closeBraceToken); - internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.initializer : null; + public AnonymousObjectCreationExpressionSyntax AddInitializers(params AnonymousObjectMemberDeclaratorSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitStackAllocArrayCreationExpression(this); +/// Class which represents the syntax node for array creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax +{ + private ArrayTypeSyntax? type; + private InitializerExpressionSyntax? initializer; - public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { - if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal ArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - public ImplicitStackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, this.Initializer); - public ImplicitStackAllocArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.StackAllocKeyword, openBracketToken, this.CloseBracketToken, this.Initializer); - public ImplicitStackAllocArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.StackAllocKeyword, this.OpenBracketToken, closeBracketToken, this.Initializer); - public ImplicitStackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.StackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, initializer); + /// ArrayTypeSyntax node representing the type of the array. + public ArrayTypeSyntax Type => GetRed(ref this.type, 1)!; - public ImplicitStackAllocArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); - } + /// InitializerExpressionSyntax node representing the initializer of the array creation expression. + public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CollectionExpressionSyntax : ExpressionSyntax - { - private SyntaxNode? elements; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1)!, + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - internal CollectionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 1 => this.type, + 2 => this.initializer, + _ => null, + }; - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayCreationExpression(this); - /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. - public SeparatedSyntaxList Elements + public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + { + if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer) { - get - { - var red = GetRed(ref this.elements, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; + public ArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.Initializer); + public ArrayCreationExpressionSyntax WithType(ArrayTypeSyntax type) => Update(this.NewKeyword, type, this.Initializer); + public ArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, initializer); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCollectionExpression(this); + public ArrayCreationExpressionSyntax AddTypeRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithType(this.Type.WithRankSpecifiers(this.Type.RankSpecifiers.AddRange(items))); +} - public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList elements, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// Class which represents the syntax node for implicit array creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax +{ + private InitializerExpressionSyntax? initializer; - return this; - } + internal ImplicitArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public CollectionExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Elements, this.CloseBracketToken); - public CollectionExpressionSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenBracketToken, elements, this.CloseBracketToken); - public CollectionExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Elements, closeBracketToken); + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - public CollectionExpressionSyntax AddElements(params CollectionElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); - } + /// SyntaxToken representing the open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); - public abstract partial class CollectionElementSyntax : CSharpSyntaxNode + /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. + public SyntaxTokenList Commas { - internal CollectionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = this.Green.GetSlot(2); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ExpressionElementSyntax : CollectionElementSyntax - { - private ExpressionSyntax? expression; - - internal ExpressionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. + public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 4)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.initializer, 4)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.initializer : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionElement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitArrayCreationExpression(this); - public ExpressionElementSyntax Update(ExpressionSyntax expression) + public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, SyntaxTokenList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) { - if (expression != this.Expression) - { - var newNode = SyntaxFactory.ExpressionElement(expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ExpressionElementSyntax WithExpression(ExpressionSyntax expression) => Update(expression); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SpreadElementSyntax : CollectionElementSyntax - { - private ExpressionSyntax? expression; + public ImplicitArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.NewKeyword, openBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithCommas(SyntaxTokenList commas) => Update(this.NewKeyword, this.OpenBracketToken, commas, this.CloseBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, closeBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, initializer); - internal SpreadElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public ImplicitArrayCreationExpressionSyntax AddCommas(params SyntaxToken[] items) => WithCommas(this.Commas.AddRange(items)); + public ImplicitArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); +} - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SpreadElementSyntax)this.Green).operatorToken, Position, 0); +/// Class which represents the syntax node for stackalloc array creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; + private InitializerExpressionSyntax? initializer; - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + internal StackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + /// SyntaxToken representing the stackalloc keyword. + public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.StackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + /// TypeSyntax node representing the type of the stackalloc array. + public TypeSyntax Type => GetRed(ref this.type, 1)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSpreadElement(this); + /// InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. + public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); - public SpreadElementSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (operatorToken != this.OperatorToken || expression != this.Expression) - { - var newNode = SyntaxFactory.SpreadElement(operatorToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 1 => GetRed(ref this.type, 1)!, + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 2 => this.initializer, + _ => null, + }; - public SpreadElementSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); - public SpreadElementSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStackAllocArrayCreationExpression(this); - public abstract partial class QueryClauseSyntax : CSharpSyntaxNode + public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) { - internal QueryClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer) { + var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - } - public abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode - { - internal SelectOrGroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class QueryExpressionSyntax : ExpressionSyntax - { - private FromClauseSyntax? fromClause; - private QueryBodySyntax? body; - - internal QueryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public StackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.Type, this.Initializer); + public StackAllocArrayCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.StackAllocKeyword, type, this.Initializer); + public StackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.StackAllocKeyword, this.Type, initializer); +} - public FromClauseSyntax FromClause => GetRedAtZero(ref this.fromClause)!; +/// Class which represents the syntax node for implicit stackalloc array creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax +{ + private InitializerExpressionSyntax? initializer; - public QueryBodySyntax Body => GetRed(ref this.body, 1)!; + internal ImplicitStackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.fromClause)!, - 1 => GetRed(ref this.body, 1)!, - _ => null, - }; + /// SyntaxToken representing the stackalloc keyword. + public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.fromClause, - 1 => this.body, - _ => null, - }; + /// SyntaxToken representing the open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryExpression(this); + /// SyntaxToken representing the close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body) - { - if (fromClause != this.FromClause || body != this.Body) - { - var newNode = SyntaxFactory.QueryExpression(fromClause, body); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. + public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 3)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.initializer, 3)! : null; - public QueryExpressionSyntax WithFromClause(FromClauseSyntax fromClause) => Update(fromClause, this.Body); - public QueryExpressionSyntax WithBody(QueryBodySyntax body) => Update(this.FromClause, body); + internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.initializer : null; - public QueryExpressionSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitStackAllocArrayCreationExpression(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class QueryBodySyntax : CSharpSyntaxNode + public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) { - private SyntaxNode? clauses; - private SelectOrGroupClauseSyntax? selectOrGroup; - private QueryContinuationSyntax? continuation; - - internal QueryBodySyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) { + var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxList Clauses => new SyntaxList(GetRed(ref this.clauses, 0)); + return this; + } - public SelectOrGroupClauseSyntax SelectOrGroup => GetRed(ref this.selectOrGroup, 1)!; + public ImplicitStackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, this.Initializer); + public ImplicitStackAllocArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.StackAllocKeyword, openBracketToken, this.CloseBracketToken, this.Initializer); + public ImplicitStackAllocArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.StackAllocKeyword, this.OpenBracketToken, closeBracketToken, this.Initializer); + public ImplicitStackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.StackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, initializer); - public QueryContinuationSyntax? Continuation => GetRed(ref this.continuation, 2); + public ImplicitStackAllocArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.clauses)!, - 1 => GetRed(ref this.selectOrGroup, 1)!, - 2 => GetRed(ref this.continuation, 2), - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CollectionExpressionSyntax : ExpressionSyntax +{ + private SyntaxNode? elements; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.clauses, - 1 => this.selectOrGroup, - 2 => this.continuation, - _ => null, - }; + internal CollectionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryBody(this); + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); - public QueryBodySyntax Update(SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. + public SeparatedSyntaxList Elements + { + get { - if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) - { - var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.elements, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - public QueryBodySyntax WithClauses(SyntaxList clauses) => Update(clauses, this.SelectOrGroup, this.Continuation); - public QueryBodySyntax WithSelectOrGroup(SelectOrGroupClauseSyntax selectOrGroup) => Update(this.Clauses, selectOrGroup, this.Continuation); - public QueryBodySyntax WithContinuation(QueryContinuationSyntax? continuation) => Update(this.Clauses, this.SelectOrGroup, continuation); + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - public QueryBodySyntax AddClauses(params QueryClauseSyntax[] items) => WithClauses(this.Clauses.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FromClauseSyntax : QueryClauseSyntax - { - private TypeSyntax? type; - private ExpressionSyntax? expression; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCollectionExpression(this); - internal FromClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) { + var newNode = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken FromKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).fromKeyword, Position, 0); - - public TypeSyntax? Type => GetRed(ref this.type, 1); + return this; + } - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public CollectionExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Elements, this.CloseBracketToken); + public CollectionExpressionSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenBracketToken, elements, this.CloseBracketToken); + public CollectionExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Elements, closeBracketToken); - public SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); + public CollectionExpressionSyntax AddElements(params CollectionElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); +} - public ExpressionSyntax Expression => GetRed(ref this.expression, 4)!; +public abstract partial class CollectionElementSyntax : CSharpSyntaxNode +{ + internal CollectionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1), - 4 => GetRed(ref this.expression, 4)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ExpressionElementSyntax : CollectionElementSyntax +{ + private ExpressionSyntax? expression; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 4 => this.expression, - _ => null, - }; + internal ExpressionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFromClause(this); + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) - { - if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public FromClauseSyntax WithFromKeyword(SyntaxToken fromKeyword) => Update(fromKeyword, this.Type, this.Identifier, this.InKeyword, this.Expression); - public FromClauseSyntax WithType(TypeSyntax? type) => Update(this.FromKeyword, type, this.Identifier, this.InKeyword, this.Expression); - public FromClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.FromKeyword, this.Type, identifier, this.InKeyword, this.Expression); - public FromClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.FromKeyword, this.Type, this.Identifier, inKeyword, this.Expression); - public FromClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.FromKeyword, this.Type, this.Identifier, this.InKeyword, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionElement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LetClauseSyntax : QueryClauseSyntax + public ExpressionElementSyntax Update(ExpressionSyntax expression) { - private ExpressionSyntax? expression; - - internal LetClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression) { + var newNode = SyntaxFactory.ExpressionElement(expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken LetKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).letKeyword, Position, 0); - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + return this; + } - public SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).equalsToken, GetChildPosition(2), GetChildIndex(2)); + public ExpressionElementSyntax WithExpression(ExpressionSyntax expression) => Update(expression); +} - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SpreadElementSyntax : CollectionElementSyntax +{ + private ExpressionSyntax? expression; - internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.expression, 3)! : null; + internal SpreadElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.expression : null; + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SpreadElementSyntax)this.Green).operatorToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLetClause(this); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) - { - if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression) - { - var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public LetClauseSyntax WithLetKeyword(SyntaxToken letKeyword) => Update(letKeyword, this.Identifier, this.EqualsToken, this.Expression); - public LetClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.LetKeyword, identifier, this.EqualsToken, this.Expression); - public LetClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.LetKeyword, this.Identifier, equalsToken, this.Expression); - public LetClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.LetKeyword, this.Identifier, this.EqualsToken, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSpreadElement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class JoinClauseSyntax : QueryClauseSyntax + public SpreadElementSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) { - private TypeSyntax? type; - private ExpressionSyntax? inExpression; - private ExpressionSyntax? leftExpression; - private ExpressionSyntax? rightExpression; - private JoinIntoClauseSyntax? into; - - internal JoinClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (operatorToken != this.OperatorToken || expression != this.Expression) { + var newNode = SyntaxFactory.SpreadElement(operatorToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken JoinKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).joinKeyword, Position, 0); - - public TypeSyntax? Type => GetRed(ref this.type, 1); - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); + public SpreadElementSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); + public SpreadElementSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); +} - public ExpressionSyntax InExpression => GetRed(ref this.inExpression, 4)!; +public abstract partial class QueryClauseSyntax : CSharpSyntaxNode +{ + internal QueryClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public SyntaxToken OnKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).onKeyword, GetChildPosition(5), GetChildIndex(5)); +public abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode +{ + internal SelectOrGroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public ExpressionSyntax LeftExpression => GetRed(ref this.leftExpression, 6)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class QueryExpressionSyntax : ExpressionSyntax +{ + private FromClauseSyntax? fromClause; + private QueryBodySyntax? body; - public SyntaxToken EqualsKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).equalsKeyword, GetChildPosition(7), GetChildIndex(7)); + internal QueryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax RightExpression => GetRed(ref this.rightExpression, 8)!; + public FromClauseSyntax FromClause => GetRedAtZero(ref this.fromClause)!; - public JoinIntoClauseSyntax? Into => GetRed(ref this.into, 9); + public QueryBodySyntax Body => GetRed(ref this.body, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1), - 4 => GetRed(ref this.inExpression, 4)!, - 6 => GetRed(ref this.leftExpression, 6)!, - 8 => GetRed(ref this.rightExpression, 8)!, - 9 => GetRed(ref this.into, 9), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.fromClause)!, + 1 => GetRed(ref this.body, 1)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 4 => this.inExpression, - 6 => this.leftExpression, - 8 => this.rightExpression, - 9 => this.into, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.fromClause, + 1 => this.body, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryExpression(this); - public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body) + { + if (fromClause != this.FromClause || body != this.Body) { - if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into) - { - var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.QueryExpression(fromClause, body); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public JoinClauseSyntax WithJoinKeyword(SyntaxToken joinKeyword) => Update(joinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithType(TypeSyntax? type) => Update(this.JoinKeyword, type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.JoinKeyword, this.Type, identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, inKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithInExpression(ExpressionSyntax inExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, inExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithOnKeyword(SyntaxToken onKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, onKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithLeftExpression(ExpressionSyntax leftExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, leftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithEqualsKeyword(SyntaxToken equalsKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, equalsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithRightExpression(ExpressionSyntax rightExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, rightExpression, this.Into); - public JoinClauseSyntax WithInto(JoinIntoClauseSyntax? into) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, into); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode - { + public QueryExpressionSyntax WithFromClause(FromClauseSyntax fromClause) => Update(fromClause, this.Body); + public QueryExpressionSyntax WithBody(QueryBodySyntax body) => Update(this.FromClause, body); - internal JoinIntoClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public QueryExpressionSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); +} - public SyntaxToken IntoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinIntoClauseSyntax)this.Green).intoKeyword, Position, 0); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class QueryBodySyntax : CSharpSyntaxNode +{ + private SyntaxNode? clauses; + private SelectOrGroupClauseSyntax? selectOrGroup; + private QueryContinuationSyntax? continuation; - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinIntoClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + internal QueryBodySyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxList Clauses => new SyntaxList(GetRed(ref this.clauses, 0)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SelectOrGroupClauseSyntax SelectOrGroup => GetRed(ref this.selectOrGroup, 1)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinIntoClause(this); + public QueryContinuationSyntax? Continuation => GetRed(ref this.continuation, 2); - public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (intoKeyword != this.IntoKeyword || identifier != this.Identifier) - { - var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.clauses)!, + 1 => GetRed(ref this.selectOrGroup, 1)!, + 2 => GetRed(ref this.continuation, 2), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.clauses, + 1 => this.selectOrGroup, + 2 => this.continuation, + _ => null, + }; - public JoinIntoClauseSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier); - public JoinIntoClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryBody(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class WhereClauseSyntax : QueryClauseSyntax + public QueryBodySyntax Update(SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) { - private ExpressionSyntax? condition; - - internal WhereClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) { + var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken WhereKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WhereClauseSyntax)this.Green).whereKeyword, Position, 0); - - public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; + public QueryBodySyntax WithClauses(SyntaxList clauses) => Update(clauses, this.SelectOrGroup, this.Continuation); + public QueryBodySyntax WithSelectOrGroup(SelectOrGroupClauseSyntax selectOrGroup) => Update(this.Clauses, selectOrGroup, this.Continuation); + public QueryBodySyntax WithContinuation(QueryContinuationSyntax? continuation) => Update(this.Clauses, this.SelectOrGroup, continuation); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; + public QueryBodySyntax AddClauses(params QueryClauseSyntax[] items) => WithClauses(this.Clauses.AddRange(items)); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhereClause(this); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FromClauseSyntax : QueryClauseSyntax +{ + private TypeSyntax? type; + private ExpressionSyntax? expression; - public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition) - { - if (whereKeyword != this.WhereKeyword || condition != this.Condition) - { - var newNode = SyntaxFactory.WhereClause(whereKeyword, condition); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal FromClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + public SyntaxToken FromKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).fromKeyword, Position, 0); - public WhereClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Condition); - public WhereClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhereKeyword, condition); - } + public TypeSyntax? Type => GetRed(ref this.type, 1); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class OrderByClauseSyntax : QueryClauseSyntax - { - private SyntaxNode? orderings; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - internal OrderByClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken OrderByKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); + public ExpressionSyntax Expression => GetRed(ref this.expression, 4)!; - public SeparatedSyntaxList Orderings + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var red = GetRed(ref this.orderings, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + 1 => GetRed(ref this.type, 1), + 4 => GetRed(ref this.expression, 4)!, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.orderings, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.orderings : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 4 => this.expression, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrderByClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFromClause(this); - public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, SeparatedSyntaxList orderings) + public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + { + if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression) { - if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) - { - var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public OrderByClauseSyntax WithOrderByKeyword(SyntaxToken orderByKeyword) => Update(orderByKeyword, this.Orderings); - public OrderByClauseSyntax WithOrderings(SeparatedSyntaxList orderings) => Update(this.OrderByKeyword, orderings); - - public OrderByClauseSyntax AddOrderings(params OrderingSyntax[] items) => WithOrderings(this.Orderings.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class OrderingSyntax : CSharpSyntaxNode - { - private ExpressionSyntax? expression; + public FromClauseSyntax WithFromKeyword(SyntaxToken fromKeyword) => Update(fromKeyword, this.Type, this.Identifier, this.InKeyword, this.Expression); + public FromClauseSyntax WithType(TypeSyntax? type) => Update(this.FromKeyword, type, this.Identifier, this.InKeyword, this.Expression); + public FromClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.FromKeyword, this.Type, identifier, this.InKeyword, this.Expression); + public FromClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.FromKeyword, this.Type, this.Identifier, inKeyword, this.Expression); + public FromClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.FromKeyword, this.Type, this.Identifier, this.InKeyword, expression); +} - internal OrderingSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LetClauseSyntax : QueryClauseSyntax +{ + private ExpressionSyntax? expression; - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal LetClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken AscendingOrDescendingKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken LetKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).letKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + public SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).equalsToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrdering(this); + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) - { - if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword) - { - var newNode = SyntaxFactory.Ordering(this.Kind(), expression, ascendingOrDescendingKeyword); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.expression, 3)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.expression : null; - public OrderingSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.AscendingOrDescendingKeyword); - public OrderingSyntax WithAscendingOrDescendingKeyword(SyntaxToken ascendingOrDescendingKeyword) => Update(this.Expression, ascendingOrDescendingKeyword); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLetClause(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax + public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) { - private ExpressionSyntax? expression; - - internal SelectClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression) { + var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken SelectKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SelectClauseSyntax)this.Green).selectKeyword, Position, 0); + return this; + } - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public LetClauseSyntax WithLetKeyword(SyntaxToken letKeyword) => Update(letKeyword, this.Identifier, this.EqualsToken, this.Expression); + public LetClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.LetKeyword, identifier, this.EqualsToken, this.Expression); + public LetClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.LetKeyword, this.Identifier, equalsToken, this.Expression); + public LetClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.LetKeyword, this.Identifier, this.EqualsToken, expression); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class JoinClauseSyntax : QueryClauseSyntax +{ + private TypeSyntax? type; + private ExpressionSyntax? inExpression; + private ExpressionSyntax? leftExpression; + private ExpressionSyntax? rightExpression; + private JoinIntoClauseSyntax? into; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal JoinClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSelectClause(this); + public SyntaxToken JoinKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).joinKeyword, Position, 0); - public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression) - { - if (selectKeyword != this.SelectKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.SelectClause(selectKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public TypeSyntax? Type => GetRed(ref this.type, 1); - return this; - } + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public SelectClauseSyntax WithSelectKeyword(SyntaxToken selectKeyword) => Update(selectKeyword, this.Expression); - public SelectClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.SelectKeyword, expression); - } + public SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax - { - private ExpressionSyntax? groupExpression; - private ExpressionSyntax? byExpression; + public ExpressionSyntax InExpression => GetRed(ref this.inExpression, 4)!; - internal GroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OnKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).onKeyword, GetChildPosition(5), GetChildIndex(5)); - public SyntaxToken GroupKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.GroupClauseSyntax)this.Green).groupKeyword, Position, 0); + public ExpressionSyntax LeftExpression => GetRed(ref this.leftExpression, 6)!; - public ExpressionSyntax GroupExpression => GetRed(ref this.groupExpression, 1)!; + public SyntaxToken EqualsKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).equalsKeyword, GetChildPosition(7), GetChildIndex(7)); - public SyntaxToken ByKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.GroupClauseSyntax)this.Green).byKeyword, GetChildPosition(2), GetChildIndex(2)); + public ExpressionSyntax RightExpression => GetRed(ref this.rightExpression, 8)!; - public ExpressionSyntax ByExpression => GetRed(ref this.byExpression, 3)!; + public JoinIntoClauseSyntax? Into => GetRed(ref this.into, 9); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.groupExpression, 1)!, - 3 => GetRed(ref this.byExpression, 3)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1), + 4 => GetRed(ref this.inExpression, 4)!, + 6 => GetRed(ref this.leftExpression, 6)!, + 8 => GetRed(ref this.rightExpression, 8)!, + 9 => GetRed(ref this.into, 9), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.groupExpression, - 3 => this.byExpression, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 4 => this.inExpression, + 6 => this.leftExpression, + 8 => this.rightExpression, + 9 => this.into, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGroupClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinClause(this); - public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + { + if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into) { - if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression) - { - var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public GroupClauseSyntax WithGroupKeyword(SyntaxToken groupKeyword) => Update(groupKeyword, this.GroupExpression, this.ByKeyword, this.ByExpression); - public GroupClauseSyntax WithGroupExpression(ExpressionSyntax groupExpression) => Update(this.GroupKeyword, groupExpression, this.ByKeyword, this.ByExpression); - public GroupClauseSyntax WithByKeyword(SyntaxToken byKeyword) => Update(this.GroupKeyword, this.GroupExpression, byKeyword, this.ByExpression); - public GroupClauseSyntax WithByExpression(ExpressionSyntax byExpression) => Update(this.GroupKeyword, this.GroupExpression, this.ByKeyword, byExpression); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class QueryContinuationSyntax : CSharpSyntaxNode - { - private QueryBodySyntax? body; + public JoinClauseSyntax WithJoinKeyword(SyntaxToken joinKeyword) => Update(joinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithType(TypeSyntax? type) => Update(this.JoinKeyword, type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.JoinKeyword, this.Type, identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, inKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithInExpression(ExpressionSyntax inExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, inExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithOnKeyword(SyntaxToken onKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, onKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithLeftExpression(ExpressionSyntax leftExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, leftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithEqualsKeyword(SyntaxToken equalsKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, equalsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithRightExpression(ExpressionSyntax rightExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, rightExpression, this.Into); + public JoinClauseSyntax WithInto(JoinIntoClauseSyntax? into) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, into); +} - internal QueryContinuationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode +{ - public SyntaxToken IntoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.QueryContinuationSyntax)this.Green).intoKeyword, Position, 0); + internal JoinIntoClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.QueryContinuationSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken IntoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinIntoClauseSyntax)this.Green).intoKeyword, Position, 0); - public QueryBodySyntax Body => GetRed(ref this.body, 2)!; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinIntoClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.body, 2)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.body : null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryContinuation(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinIntoClause(this); - public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier) + { + if (intoKeyword != this.IntoKeyword || identifier != this.Identifier) { - if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body) - { - var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public QueryContinuationSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier, this.Body); - public QueryContinuationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier, this.Body); - public QueryContinuationSyntax WithBody(QueryBodySyntax body) => Update(this.IntoKeyword, this.Identifier, body); - - public QueryContinuationSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); + return this; } - /// Class which represents a placeholder in an array size list. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax + public JoinIntoClauseSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier); + public JoinIntoClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class WhereClauseSyntax : QueryClauseSyntax +{ + private ExpressionSyntax? condition; + + internal WhereClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { + } - internal OmittedArraySizeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken WhereKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WhereClauseSyntax)this.Green).whereKeyword, Position, 0); - /// SyntaxToken representing the omitted array size expression. - public SyntaxToken OmittedArraySizeExpressionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OmittedArraySizeExpressionSyntax)this.Green).omittedArraySizeExpressionToken, Position, 0); + public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedArraySizeExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhereClause(this); - public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken) + public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition) + { + if (whereKeyword != this.WhereKeyword || condition != this.Condition) { - if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken) - { - var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.WhereClause(whereKeyword, condition); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public OmittedArraySizeExpressionSyntax WithOmittedArraySizeExpressionToken(SyntaxToken omittedArraySizeExpressionToken) => Update(omittedArraySizeExpressionToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax + public WhereClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Condition); + public WhereClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhereKeyword, condition); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class OrderByClauseSyntax : QueryClauseSyntax +{ + private SyntaxNode? orderings; + + internal OrderByClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? contents; + } + + public SyntaxToken OrderByKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); - internal InterpolatedStringExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SeparatedSyntaxList Orderings + { + get { + var red = GetRed(ref this.orderings, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// The first part of an interpolated string, $" or $@" or $""" - public SyntaxToken StringStartToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringStartToken, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.orderings, 1)! : null; - /// List of parts of the interpolated string, each one is either a literal part or an interpolation. - public SyntaxList Contents => new SyntaxList(GetRed(ref this.contents, 1)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.orderings : null; - /// The closing quote of the interpolated string. - public SyntaxToken StringEndToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringEndToken, GetChildPosition(2), GetChildIndex(2)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrderByClause(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.contents, 1)! : null; + public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, SeparatedSyntaxList orderings) + { + if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) + { + var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.contents : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringExpression(this); + public OrderByClauseSyntax WithOrderByKeyword(SyntaxToken orderByKeyword) => Update(orderByKeyword, this.Orderings); + public OrderByClauseSyntax WithOrderings(SeparatedSyntaxList orderings) => Update(this.OrderByKeyword, orderings); - public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, SyntaxList contents, SyntaxToken stringEndToken) - { - if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) - { - var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + public OrderByClauseSyntax AddOrderings(params OrderingSyntax[] items) => WithOrderings(this.Orderings.AddRange(items)); +} - public InterpolatedStringExpressionSyntax WithStringStartToken(SyntaxToken stringStartToken) => Update(stringStartToken, this.Contents, this.StringEndToken); - public InterpolatedStringExpressionSyntax WithContents(SyntaxList contents) => Update(this.StringStartToken, contents, this.StringEndToken); - public InterpolatedStringExpressionSyntax WithStringEndToken(SyntaxToken stringEndToken) => Update(this.StringStartToken, this.Contents, stringEndToken); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class OrderingSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? expression; - public InterpolatedStringExpressionSyntax AddContents(params InterpolatedStringContentSyntax[] items) => WithContents(this.Contents.AddRange(items)); + internal OrderingSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents a simple pattern-matching expression using the "is" keyword. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IsPatternExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; - private PatternSyntax? pattern; + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal IsPatternExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SyntaxToken AscendingOrDescendingKeyword + { + get { + var slot = ((Syntax.InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// ExpressionSyntax node representing the expression on the left of the "is" operator. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - - public SyntaxToken IsKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IsPatternExpressionSyntax)this.Green).isKeyword, GetChildPosition(1), GetChildIndex(1)); - - /// PatternSyntax node representing the pattern on the right of the "is" operator. - public PatternSyntax Pattern => GetRed(ref this.pattern, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.pattern, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.pattern, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIsPatternExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrdering(this); - public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) + { + if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword) { - if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern) - { - var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.Ordering(this.Kind(), expression, ascendingOrDescendingKeyword); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public IsPatternExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.IsKeyword, this.Pattern); - public IsPatternExpressionSyntax WithIsKeyword(SyntaxToken isKeyword) => Update(this.Expression, isKeyword, this.Pattern); - public IsPatternExpressionSyntax WithPattern(PatternSyntax pattern) => Update(this.Expression, this.IsKeyword, pattern); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ThrowExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; + public OrderingSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.AscendingOrDescendingKeyword); + public OrderingSyntax WithAscendingOrDescendingKeyword(SyntaxToken ascendingOrDescendingKeyword) => Update(this.Expression, ascendingOrDescendingKeyword); +} - internal ThrowExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax +{ + private ExpressionSyntax? expression; + + internal SelectClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ThrowExpressionSyntax)this.Green).throwKeyword, Position, 0); + public SyntaxToken SelectKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SelectClauseSyntax)this.Green).selectKeyword, Position, 0); - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSelectClause(this); - public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression) + public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression) + { + if (selectKeyword != this.SelectKeyword || expression != this.Expression) { - if (throwKeyword != this.ThrowKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.SelectClause(selectKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ThrowExpressionSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(throwKeyword, this.Expression); - public ThrowExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.ThrowKeyword, expression); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class WhenClauseSyntax : CSharpSyntaxNode - { - private ExpressionSyntax? condition; + public SelectClauseSyntax WithSelectKeyword(SyntaxToken selectKeyword) => Update(selectKeyword, this.Expression); + public SelectClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.SelectKeyword, expression); +} - internal WhenClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax +{ + private ExpressionSyntax? groupExpression; + private ExpressionSyntax? byExpression; - public SyntaxToken WhenKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WhenClauseSyntax)this.Green).whenKeyword, Position, 0); + internal GroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; + public SyntaxToken GroupKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.GroupClauseSyntax)this.Green).groupKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; + public ExpressionSyntax GroupExpression => GetRed(ref this.groupExpression, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; + public SyntaxToken ByKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.GroupClauseSyntax)this.Green).byKeyword, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhenClause(this); + public ExpressionSyntax ByExpression => GetRed(ref this.byExpression, 3)!; - public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (whenKeyword != this.WhenKeyword || condition != this.Condition) - { - var newNode = SyntaxFactory.WhenClause(whenKeyword, condition); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 1 => GetRed(ref this.groupExpression, 1)!, + 3 => GetRed(ref this.byExpression, 3)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.groupExpression, + 3 => this.byExpression, + _ => null, + }; - public WhenClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.Condition); - public WhenClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhenKeyword, condition); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGroupClause(this); - public abstract partial class PatternSyntax : ExpressionOrPatternSyntax + public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) { - internal PatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression) { + var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DiscardPatternSyntax : PatternSyntax - { + public GroupClauseSyntax WithGroupKeyword(SyntaxToken groupKeyword) => Update(groupKeyword, this.GroupExpression, this.ByKeyword, this.ByExpression); + public GroupClauseSyntax WithGroupExpression(ExpressionSyntax groupExpression) => Update(this.GroupKeyword, groupExpression, this.ByKeyword, this.ByExpression); + public GroupClauseSyntax WithByKeyword(SyntaxToken byKeyword) => Update(this.GroupKeyword, this.GroupExpression, byKeyword, this.ByExpression); + public GroupClauseSyntax WithByExpression(ExpressionSyntax byExpression) => Update(this.GroupKeyword, this.GroupExpression, this.ByKeyword, byExpression); +} - internal DiscardPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class QueryContinuationSyntax : CSharpSyntaxNode +{ + private QueryBodySyntax? body; - public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DiscardPatternSyntax)this.Green).underscoreToken, Position, 0); + internal QueryContinuationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken IntoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.QueryContinuationSyntax)this.Green).intoKeyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => null; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.QueryContinuationSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardPattern(this); + public QueryBodySyntax Body => GetRed(ref this.body, 2)!; - public DiscardPatternSyntax Update(SyntaxToken underscoreToken) - { - if (underscoreToken != this.UnderscoreToken) - { - var newNode = SyntaxFactory.DiscardPattern(underscoreToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.body, 2)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.body : null; - public DiscardPatternSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryContinuation(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DeclarationPatternSyntax : PatternSyntax + public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) { - private TypeSyntax? type; - private VariableDesignationSyntax? designation; - - internal DeclarationPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body) { + var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + return this; + } + + public QueryContinuationSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier, this.Body); + public QueryContinuationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier, this.Body); + public QueryContinuationSyntax WithBody(QueryBodySyntax body) => Update(this.IntoKeyword, this.Identifier, body); - public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; + public QueryContinuationSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.designation, 1)!, - _ => null, - }; +/// Class which represents a placeholder in an array size list. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.designation, - _ => null, - }; + internal OmittedArraySizeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationPattern(this); + /// SyntaxToken representing the omitted array size expression. + public SyntaxToken OmittedArraySizeExpressionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OmittedArraySizeExpressionSyntax)this.Green).omittedArraySizeExpressionToken, Position, 0); - public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) - { - if (type != this.Type || designation != this.Designation) - { - var newNode = SyntaxFactory.DeclarationPattern(type, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public DeclarationPatternSyntax WithType(TypeSyntax type) => Update(type, this.Designation); - public DeclarationPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedArraySizeExpression(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class VarPatternSyntax : PatternSyntax + public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken) { - private VariableDesignationSyntax? designation; - - internal VarPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken) { + var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken VarKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.VarPatternSyntax)this.Green).varKeyword, Position, 0); + return this; + } - public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; + public OmittedArraySizeExpressionSyntax WithOmittedArraySizeExpressionToken(SyntaxToken omittedArraySizeExpressionToken) => Update(omittedArraySizeExpressionToken); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.designation, 1)! : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax +{ + private SyntaxNode? contents; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.designation : null; + internal InterpolatedStringExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVarPattern(this); + /// The first part of an interpolated string, $" or $@" or $""" + public SyntaxToken StringStartToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringStartToken, Position, 0); - public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation) - { - if (varKeyword != this.VarKeyword || designation != this.Designation) - { - var newNode = SyntaxFactory.VarPattern(varKeyword, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// List of parts of the interpolated string, each one is either a literal part or an interpolation. + public SyntaxList Contents => new SyntaxList(GetRed(ref this.contents, 1)); - return this; - } + /// The closing quote of the interpolated string. + public SyntaxToken StringEndToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringEndToken, GetChildPosition(2), GetChildIndex(2)); - public VarPatternSyntax WithVarKeyword(SyntaxToken varKeyword) => Update(varKeyword, this.Designation); - public VarPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.VarKeyword, designation); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.contents, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RecursivePatternSyntax : PatternSyntax - { - private TypeSyntax? type; - private PositionalPatternClauseSyntax? positionalPatternClause; - private PropertyPatternClauseSyntax? propertyPatternClause; - private VariableDesignationSyntax? designation; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.contents : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringExpression(this); - internal RecursivePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, SyntaxList contents, SyntaxToken stringEndToken) + { + if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) { + var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TypeSyntax? Type => GetRedAtZero(ref this.type); + return this; + } + + public InterpolatedStringExpressionSyntax WithStringStartToken(SyntaxToken stringStartToken) => Update(stringStartToken, this.Contents, this.StringEndToken); + public InterpolatedStringExpressionSyntax WithContents(SyntaxList contents) => Update(this.StringStartToken, contents, this.StringEndToken); + public InterpolatedStringExpressionSyntax WithStringEndToken(SyntaxToken stringEndToken) => Update(this.StringStartToken, this.Contents, stringEndToken); - public PositionalPatternClauseSyntax? PositionalPatternClause => GetRed(ref this.positionalPatternClause, 1); + public InterpolatedStringExpressionSyntax AddContents(params InterpolatedStringContentSyntax[] items) => WithContents(this.Contents.AddRange(items)); +} - public PropertyPatternClauseSyntax? PropertyPatternClause => GetRed(ref this.propertyPatternClause, 2); +/// Class which represents a simple pattern-matching expression using the "is" keyword. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IsPatternExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private PatternSyntax? pattern; - public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); + internal IsPatternExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type), - 1 => GetRed(ref this.positionalPatternClause, 1), - 2 => GetRed(ref this.propertyPatternClause, 2), - 3 => GetRed(ref this.designation, 3), - _ => null, - }; + /// ExpressionSyntax node representing the expression on the left of the "is" operator. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.positionalPatternClause, - 2 => this.propertyPatternClause, - 3 => this.designation, - _ => null, - }; + public SyntaxToken IsKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IsPatternExpressionSyntax)this.Green).isKeyword, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecursivePattern(this); + /// PatternSyntax node representing the pattern on the right of the "is" operator. + public PatternSyntax Pattern => GetRed(ref this.pattern, 2)!; - public RecursivePatternSyntax Update(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation) - { - var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.pattern, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 2 => this.pattern, + _ => null, + }; - public RecursivePatternSyntax WithType(TypeSyntax? type) => Update(type, this.PositionalPatternClause, this.PropertyPatternClause, this.Designation); - public RecursivePatternSyntax WithPositionalPatternClause(PositionalPatternClauseSyntax? positionalPatternClause) => Update(this.Type, positionalPatternClause, this.PropertyPatternClause, this.Designation); - public RecursivePatternSyntax WithPropertyPatternClause(PropertyPatternClauseSyntax? propertyPatternClause) => Update(this.Type, this.PositionalPatternClause, propertyPatternClause, this.Designation); - public RecursivePatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.Type, this.PositionalPatternClause, this.PropertyPatternClause, designation); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIsPatternExpression(this); - public RecursivePatternSyntax AddPositionalPatternClauseSubpatterns(params SubpatternSyntax[] items) - { - var positionalPatternClause = this.PositionalPatternClause ?? SyntaxFactory.PositionalPatternClause(); - return WithPositionalPatternClause(positionalPatternClause.WithSubpatterns(positionalPatternClause.Subpatterns.AddRange(items))); - } - public RecursivePatternSyntax AddPropertyPatternClauseSubpatterns(params SubpatternSyntax[] items) + public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + { + if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern) { - var propertyPatternClause = this.PropertyPatternClause ?? SyntaxFactory.PropertyPatternClause(); - return WithPropertyPatternClause(propertyPatternClause.WithSubpatterns(propertyPatternClause.Subpatterns.AddRange(items))); + var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode - { - private SyntaxNode? subpatterns; + public IsPatternExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.IsKeyword, this.Pattern); + public IsPatternExpressionSyntax WithIsKeyword(SyntaxToken isKeyword) => Update(this.Expression, isKeyword, this.Pattern); + public IsPatternExpressionSyntax WithPattern(PatternSyntax pattern) => Update(this.Expression, this.IsKeyword, pattern); +} - internal PositionalPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ThrowExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); + internal ThrowExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SeparatedSyntaxList Subpatterns - { - get - { - var red = GetRed(ref this.subpatterns, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ThrowExpressionSyntax)this.Green).throwKeyword, Position, 0); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPositionalPatternClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowExpression(this); - public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression) + { + if (throwKeyword != this.ThrowKeyword || expression != this.Expression) { - if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PositionalPatternClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Subpatterns, this.CloseParenToken); - public PositionalPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenParenToken, subpatterns, this.CloseParenToken); - public PositionalPatternClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Subpatterns, closeParenToken); - - public PositionalPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode - { - private SyntaxNode? subpatterns; + public ThrowExpressionSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(throwKeyword, this.Expression); + public ThrowExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.ThrowKeyword, expression); +} - internal PropertyPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class WhenClauseSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? condition; - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); + internal WhenClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SeparatedSyntaxList Subpatterns - { - get - { - var red = GetRed(ref this.subpatterns, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public SyntaxToken WhenKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WhenClauseSyntax)this.Green).whenKeyword, Position, 0); - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyPatternClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhenClause(this); - public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition) + { + if (whenKeyword != this.WhenKeyword || condition != this.Condition) { - if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.WhenClause(whenKeyword, condition); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PropertyPatternClauseSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Subpatterns, this.CloseBraceToken); - public PropertyPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenBraceToken, subpatterns, this.CloseBraceToken); - public PropertyPatternClauseSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Subpatterns, closeBraceToken); - - public PropertyPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SubpatternSyntax : CSharpSyntaxNode + public WhenClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.Condition); + public WhenClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhenKeyword, condition); +} + +public abstract partial class PatternSyntax : ExpressionOrPatternSyntax +{ + internal PatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private BaseExpressionColonSyntax? expressionColon; - private PatternSyntax? pattern; + } +} - internal SubpatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DiscardPatternSyntax : PatternSyntax +{ - public BaseExpressionColonSyntax? ExpressionColon => GetRedAtZero(ref this.expressionColon); + internal DiscardPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DiscardPatternSyntax)this.Green).underscoreToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expressionColon), - 1 => GetRed(ref this.pattern, 1)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expressionColon, - 1 => this.pattern, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSubpattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardPattern(this); - public SubpatternSyntax Update(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) + public DiscardPatternSyntax Update(SyntaxToken underscoreToken) + { + if (underscoreToken != this.UnderscoreToken) { - if (expressionColon != this.ExpressionColon || pattern != this.Pattern) - { - var newNode = SyntaxFactory.Subpattern(expressionColon, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.DiscardPattern(underscoreToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SubpatternSyntax WithExpressionColon(BaseExpressionColonSyntax? expressionColon) => Update(expressionColon, this.Pattern); - public SubpatternSyntax WithPattern(PatternSyntax pattern) => Update(this.ExpressionColon, pattern); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConstantPatternSyntax : PatternSyntax - { - private ExpressionSyntax? expression; + public DiscardPatternSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); +} - internal ConstantPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DeclarationPatternSyntax : PatternSyntax +{ + private TypeSyntax? type; + private VariableDesignationSyntax? designation; - /// ExpressionSyntax node representing the constant expression. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal DeclarationPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstantPattern(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.designation, 1)!, + _ => null, + }; - public ConstantPatternSyntax Update(ExpressionSyntax expression) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (expression != this.Expression) - { - var newNode = SyntaxFactory.ConstantPattern(expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.type, + 1 => this.designation, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationPattern(this); - return this; + public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + { + if (type != this.Type || designation != this.Designation) + { + var newNode = SyntaxFactory.DeclarationPattern(type, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ConstantPatternSyntax WithExpression(ExpressionSyntax expression) => Update(expression); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParenthesizedPatternSyntax : PatternSyntax - { - private PatternSyntax? pattern; + public DeclarationPatternSyntax WithType(TypeSyntax type) => Update(type, this.Designation); + public DeclarationPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); +} - internal ParenthesizedPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class VarPatternSyntax : PatternSyntax +{ + private VariableDesignationSyntax? designation; - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedPatternSyntax)this.Green).openParenToken, Position, 0); + internal VarPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + public SyntaxToken VarKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.VarPatternSyntax)this.Green).varKeyword, Position, 0); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedPatternSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.designation, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.designation : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVarPattern(this); - public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation) + { + if (varKeyword != this.VarKeyword || designation != this.Designation) { - if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.VarPattern(varKeyword, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ParenthesizedPatternSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Pattern, this.CloseParenToken); - public ParenthesizedPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OpenParenToken, pattern, this.CloseParenToken); - public ParenthesizedPatternSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Pattern, closeParenToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RelationalPatternSyntax : PatternSyntax - { - private ExpressionSyntax? expression; + public VarPatternSyntax WithVarKeyword(SyntaxToken varKeyword) => Update(varKeyword, this.Designation); + public VarPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.VarKeyword, designation); +} - internal RelationalPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RecursivePatternSyntax : PatternSyntax +{ + private TypeSyntax? type; + private PositionalPatternClauseSyntax? positionalPatternClause; + private PropertyPatternClauseSyntax? propertyPatternClause; + private VariableDesignationSyntax? designation; - /// SyntaxToken representing the operator of the relational pattern. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RelationalPatternSyntax)this.Green).operatorToken, Position, 0); + internal RecursivePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public TypeSyntax? Type => GetRedAtZero(ref this.type); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + public PositionalPatternClauseSyntax? PositionalPatternClause => GetRed(ref this.positionalPatternClause, 1); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + public PropertyPatternClauseSyntax? PropertyPatternClause => GetRed(ref this.propertyPatternClause, 2); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRelationalPattern(this); + public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); - public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (operatorToken != this.OperatorToken || expression != this.Expression) - { - var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.type), + 1 => GetRed(ref this.positionalPatternClause, 1), + 2 => GetRed(ref this.propertyPatternClause, 2), + 3 => GetRed(ref this.designation, 3), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.positionalPatternClause, + 2 => this.propertyPatternClause, + 3 => this.designation, + _ => null, + }; - public RelationalPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); - public RelationalPatternSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecursivePattern(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypePatternSyntax : PatternSyntax + public RecursivePatternSyntax Update(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) { - private TypeSyntax? type; - - internal TypePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation) { + var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// The type for the type pattern. - public TypeSyntax Type => GetRedAtZero(ref this.type)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypePattern(this); + public RecursivePatternSyntax WithType(TypeSyntax? type) => Update(type, this.PositionalPatternClause, this.PropertyPatternClause, this.Designation); + public RecursivePatternSyntax WithPositionalPatternClause(PositionalPatternClauseSyntax? positionalPatternClause) => Update(this.Type, positionalPatternClause, this.PropertyPatternClause, this.Designation); + public RecursivePatternSyntax WithPropertyPatternClause(PropertyPatternClauseSyntax? propertyPatternClause) => Update(this.Type, this.PositionalPatternClause, propertyPatternClause, this.Designation); + public RecursivePatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.Type, this.PositionalPatternClause, this.PropertyPatternClause, designation); - public TypePatternSyntax Update(TypeSyntax type) - { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypePattern(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public RecursivePatternSyntax AddPositionalPatternClauseSubpatterns(params SubpatternSyntax[] items) + { + var positionalPatternClause = this.PositionalPatternClause ?? SyntaxFactory.PositionalPatternClause(); + return WithPositionalPatternClause(positionalPatternClause.WithSubpatterns(positionalPatternClause.Subpatterns.AddRange(items))); + } + public RecursivePatternSyntax AddPropertyPatternClauseSubpatterns(params SubpatternSyntax[] items) + { + var propertyPatternClause = this.PropertyPatternClause ?? SyntaxFactory.PropertyPatternClause(); + return WithPropertyPatternClause(propertyPatternClause.WithSubpatterns(propertyPatternClause.Subpatterns.AddRange(items))); + } +} - return this; - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode +{ + private SyntaxNode? subpatterns; - public TypePatternSyntax WithType(TypeSyntax type) => Update(type); + internal PositionalPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class BinaryPatternSyntax : PatternSyntax - { - private PatternSyntax? left; - private PatternSyntax? right; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); - internal BinaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SeparatedSyntaxList Subpatterns + { + get { + var red = GetRed(ref this.subpatterns, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - public PatternSyntax Left => GetRedAtZero(ref this.left)!; - - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BinaryPatternSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - - public PatternSyntax Right => GetRed(ref this.right, 2)!; + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.left, - 2 => this.right, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPositionalPatternClause(this); - public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.BinaryPattern(this.Kind(), left, operatorToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public BinaryPatternSyntax WithLeft(PatternSyntax left) => Update(left, this.OperatorToken, this.Right); - public BinaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); - public BinaryPatternSyntax WithRight(PatternSyntax right) => Update(this.Left, this.OperatorToken, right); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class UnaryPatternSyntax : PatternSyntax - { - private PatternSyntax? pattern; + public PositionalPatternClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Subpatterns, this.CloseParenToken); + public PositionalPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenParenToken, subpatterns, this.CloseParenToken); + public PositionalPatternClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Subpatterns, closeParenToken); - internal UnaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public PositionalPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); +} - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UnaryPatternSyntax)this.Green).operatorToken, Position, 0); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode +{ + private SyntaxNode? subpatterns; - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + internal PropertyPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; + public SeparatedSyntaxList Subpatterns + { + get + { + var red = GetRed(ref this.subpatterns, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnaryPattern(this); + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); - public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern) - { - if (operatorToken != this.OperatorToken || pattern != this.Pattern) - { - var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; - public UnaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Pattern); - public UnaryPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OperatorToken, pattern); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyPatternClause(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ListPatternSyntax : PatternSyntax + public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) { - private SyntaxNode? patterns; - private VariableDesignationSyntax? designation; - - internal ListPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) { + var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); + return this; + } - public SeparatedSyntaxList Patterns - { - get - { - var red = GetRed(ref this.patterns, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public PropertyPatternClauseSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Subpatterns, this.CloseBraceToken); + public PropertyPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenBraceToken, subpatterns, this.CloseBraceToken); + public PropertyPatternClauseSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Subpatterns, closeBraceToken); - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public PropertyPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); +} - public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SubpatternSyntax : CSharpSyntaxNode +{ + private BaseExpressionColonSyntax? expressionColon; + private PatternSyntax? pattern; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.patterns, 1)!, - 3 => GetRed(ref this.designation, 3), - _ => null, - }; + internal SubpatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.patterns, - 3 => this.designation, - _ => null, - }; + public BaseExpressionColonSyntax? ExpressionColon => GetRedAtZero(ref this.expressionColon); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitListPattern(this); + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - public ListPatternSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) - { - var newNode = SyntaxFactory.ListPattern(openBracketToken, patterns, closeBracketToken, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.expressionColon), + 1 => GetRed(ref this.pattern, 1)!, + _ => null, + }; - public ListPatternSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Patterns, this.CloseBracketToken, this.Designation); - public ListPatternSyntax WithPatterns(SeparatedSyntaxList patterns) => Update(this.OpenBracketToken, patterns, this.CloseBracketToken, this.Designation); - public ListPatternSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Patterns, closeBracketToken, this.Designation); - public ListPatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.OpenBracketToken, this.Patterns, this.CloseBracketToken, designation); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expressionColon, + 1 => this.pattern, + _ => null, + }; - public ListPatternSyntax AddPatterns(params PatternSyntax[] items) => WithPatterns(this.Patterns.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSubpattern(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SlicePatternSyntax : PatternSyntax + public SubpatternSyntax Update(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) { - private PatternSyntax? pattern; - - internal SlicePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expressionColon != this.ExpressionColon || pattern != this.Pattern) { + var newNode = SyntaxFactory.Subpattern(expressionColon, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken DotDotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SlicePatternSyntax)this.Green).dotDotToken, Position, 0); + return this; + } - public PatternSyntax? Pattern => GetRed(ref this.pattern, 1); + public SubpatternSyntax WithExpressionColon(BaseExpressionColonSyntax? expressionColon) => Update(expressionColon, this.Pattern); + public SubpatternSyntax WithPattern(PatternSyntax pattern) => Update(this.ExpressionColon, pattern); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1) : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConstantPatternSyntax : PatternSyntax +{ + private ExpressionSyntax? expression; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; + internal ConstantPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSlicePattern(this); + /// ExpressionSyntax node representing the constant expression. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax? pattern) - { - if (dotDotToken != this.DotDotToken || pattern != this.Pattern) - { - var newNode = SyntaxFactory.SlicePattern(dotDotToken, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public SlicePatternSyntax WithDotDotToken(SyntaxToken dotDotToken) => Update(dotDotToken, this.Pattern); - public SlicePatternSyntax WithPattern(PatternSyntax? pattern) => Update(this.DotDotToken, pattern); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstantPattern(this); - public abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode + public ConstantPatternSyntax Update(ExpressionSyntax expression) { - internal InterpolatedStringContentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression) { + var newNode = SyntaxFactory.ConstantPattern(expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax - { + public ConstantPatternSyntax WithExpression(ExpressionSyntax expression) => Update(expression); +} - internal InterpolatedStringTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParenthesizedPatternSyntax : PatternSyntax +{ + private PatternSyntax? pattern; - /// The text contents of a part of the interpolated string. - public SyntaxToken TextToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolatedStringTextSyntax)this.Green).textToken, Position, 0); + internal ParenthesizedPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedPatternSyntax)this.Green).openParenToken, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringText(this); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedPatternSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - public InterpolatedStringTextSyntax Update(SyntaxToken textToken) - { - if (textToken != this.TextToken) - { - var newNode = SyntaxFactory.InterpolatedStringText(textToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; - public InterpolatedStringTextSyntax WithTextToken(SyntaxToken textToken) => Update(textToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedPattern(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax + public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) { - private ExpressionSyntax? expression; - private InterpolationAlignmentClauseSyntax? alignmentClause; - private InterpolationFormatClauseSyntax? formatClause; - - internal InterpolationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationSyntax)this.Green).openBraceToken, Position, 0); + return this; + } + + public ParenthesizedPatternSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Pattern, this.CloseParenToken); + public ParenthesizedPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OpenParenToken, pattern, this.CloseParenToken); + public ParenthesizedPatternSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Pattern, closeParenToken); +} - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RelationalPatternSyntax : PatternSyntax +{ + private ExpressionSyntax? expression; - public InterpolationAlignmentClauseSyntax? AlignmentClause => GetRed(ref this.alignmentClause, 2); + internal RelationalPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public InterpolationFormatClauseSyntax? FormatClause => GetRed(ref this.formatClause, 3); + /// SyntaxToken representing the operator of the relational pattern. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RelationalPatternSyntax)this.Green).operatorToken, Position, 0); - /// - /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). - /// - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.expression, 1)!, - 2 => GetRed(ref this.alignmentClause, 2), - 3 => GetRed(ref this.formatClause, 3), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.expression, - 2 => this.alignmentClause, - 3 => this.formatClause, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolation(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRelationalPattern(this); - public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + { + if (operatorToken != this.OperatorToken || expression != this.Expression) { - if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public InterpolationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); - public InterpolationSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenBraceToken, expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); - public InterpolationSyntax WithAlignmentClause(InterpolationAlignmentClauseSyntax? alignmentClause) => Update(this.OpenBraceToken, this.Expression, alignmentClause, this.FormatClause, this.CloseBraceToken); - public InterpolationSyntax WithFormatClause(InterpolationFormatClauseSyntax? formatClause) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, formatClause, this.CloseBraceToken); - public InterpolationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, closeBraceToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode - { - private ExpressionSyntax? value; + public RelationalPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); + public RelationalPatternSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); +} - internal InterpolationAlignmentClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypePatternSyntax : PatternSyntax +{ + private TypeSyntax? type; - public SyntaxToken CommaToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationAlignmentClauseSyntax)this.Green).commaToken, Position, 0); + internal TypePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Value => GetRed(ref this.value, 1)!; + /// The type for the type pattern. + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationAlignmentClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypePattern(this); - public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value) + public TypePatternSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - if (commaToken != this.CommaToken || value != this.Value) - { - var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TypePattern(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public InterpolationAlignmentClauseSyntax WithCommaToken(SyntaxToken commaToken) => Update(commaToken, this.Value); - public InterpolationAlignmentClauseSyntax WithValue(ExpressionSyntax value) => Update(this.CommaToken, value); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode - { - - internal InterpolationFormatClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TypePatternSyntax WithType(TypeSyntax type) => Update(type); +} - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationFormatClauseSyntax)this.Green).colonToken, Position, 0); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class BinaryPatternSyntax : PatternSyntax +{ + private PatternSyntax? left; + private PatternSyntax? right; - /// The text contents of the format specifier for an interpolation. - public SyntaxToken FormatStringToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationFormatClauseSyntax)this.Green).formatStringToken, GetChildPosition(1), GetChildIndex(1)); + internal BinaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public PatternSyntax Left => GetRedAtZero(ref this.left)!; - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BinaryPatternSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationFormatClause(this); + public PatternSyntax Right => GetRed(ref this.right, 2)!; - public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken) - { - var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.left, + 2 => this.right, + _ => null, + }; - public InterpolationFormatClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.FormatStringToken); - public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken) => Update(this.ColonToken, formatStringToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryPattern(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax + public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) { - private SyntaxNode? attributeLists; - private StatementSyntax? statement; - - internal GlobalStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) { + var newNode = SyntaxFactory.BinaryPattern(this.Kind(), left, operatorToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + return this; + } - public StatementSyntax Statement => GetRed(ref this.statement, 2)!; + public BinaryPatternSyntax WithLeft(PatternSyntax left) => Update(left, this.OperatorToken, this.Right); + public BinaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); + public BinaryPatternSyntax WithRight(PatternSyntax right) => Update(this.Left, this.OperatorToken, right); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.statement, 2)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class UnaryPatternSyntax : PatternSyntax +{ + private PatternSyntax? pattern; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.statement, - _ => null, - }; + internal UnaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGlobalStatement(this); + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UnaryPatternSyntax)this.Green).operatorToken, Position, 0); - public GlobalStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) - { - var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new GlobalStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Statement); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new GlobalStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Statement); - public GlobalStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Modifiers, statement); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new GlobalStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new GlobalStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnaryPattern(this); - /// Represents the base class for all statements syntax classes. - public abstract partial class StatementSyntax : CSharpSyntaxNode + public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern) { - internal StatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (operatorToken != this.OperatorToken || pattern != this.Pattern) { + var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxList AttributeLists { get; } - public StatementSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract StatementSyntax WithAttributeListsCore(SyntaxList attributeLists); - - public StatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BlockSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private SyntaxNode? statements; + public UnaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Pattern); + public UnaryPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OperatorToken, pattern); +} - internal BlockSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BlockSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); - - public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 2)); - - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BlockSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.statements, 2)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ListPatternSyntax : PatternSyntax +{ + private SyntaxNode? patterns; + private VariableDesignationSyntax? designation; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.statements, - _ => null, - }; + internal ListPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBlock(this); + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); - public BlockSyntax Update(SyntaxList attributeLists, SyntaxToken openBraceToken, SyntaxList statements, SyntaxToken closeBraceToken) + public SeparatedSyntaxList Patterns + { + get { - if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.patterns, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new BlockSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.OpenBraceToken, this.Statements, this.CloseBraceToken); - public BlockSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, openBraceToken, this.Statements, this.CloseBraceToken); - public BlockSyntax WithStatements(SyntaxList statements) => Update(this.AttributeLists, this.OpenBraceToken, statements, this.CloseBraceToken); - public BlockSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.OpenBraceToken, this.Statements, closeBraceToken); + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new BlockSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public BlockSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); - } + public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LocalFunctionStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private SyntaxNode? constraintClauses; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.patterns, 1)!, + 3 => GetRed(ref this.designation, 3), + _ => null, + }; - internal LocalFunctionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 1 => this.patterns, + 3 => this.designation, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitListPattern(this); - public SyntaxTokenList Modifiers + public ListPatternSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + { + if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ListPattern(openBracketToken, patterns, closeBracketToken, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + return this; + } - public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + public ListPatternSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Patterns, this.CloseBracketToken, this.Designation); + public ListPatternSyntax WithPatterns(SeparatedSyntaxList patterns) => Update(this.OpenBracketToken, patterns, this.CloseBracketToken, this.Designation); + public ListPatternSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Patterns, closeBracketToken, this.Designation); + public ListPatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.OpenBracketToken, this.Patterns, this.CloseBracketToken, designation); - public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; + public ListPatternSyntax AddPatterns(params PatternSyntax[] items) => WithPatterns(this.Patterns.AddRange(items)); +} - public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 6)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SlicePatternSyntax : PatternSyntax +{ + private PatternSyntax? pattern; - public BlockSyntax? Body => GetRed(ref this.body, 7); + internal SlicePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 8); + public SyntaxToken DotDotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SlicePatternSyntax)this.Green).dotDotToken, Position, 0); - /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken - { - get - { - var slot = ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; - } - } + public PatternSyntax? Pattern => GetRed(ref this.pattern, 1); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5)!, - 6 => GetRed(ref this.constraintClauses, 6)!, - 7 => GetRed(ref this.body, 7), - 8 => GetRed(ref this.expressionBody, 8), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1) : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.returnType, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.constraintClauses, - 7 => this.body, - 8 => this.expressionBody, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalFunctionStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSlicePattern(this); - public LocalFunctionStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax? pattern) + { + if (dotDotToken != this.DotDotToken || pattern != this.Pattern) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.SlicePattern(dotDotToken, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LocalFunctionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); + return this; + } - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LocalFunctionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public LocalFunctionStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public LocalFunctionStatementSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) - { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - public LocalFunctionStatementSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - public LocalFunctionStatementSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - public LocalFunctionStatementSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - public LocalFunctionStatementSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } + public SlicePatternSyntax WithDotDotToken(SyntaxToken dotDotToken) => Update(dotDotToken, this.Pattern); + public SlicePatternSyntax WithPattern(PatternSyntax? pattern) => Update(this.DotDotToken, pattern); +} + +public abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode +{ + internal InterpolatedStringContentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax +{ - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LocalDeclarationStatementSyntax : StatementSyntax + internal InterpolatedStringTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; + } - internal LocalDeclarationStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// The text contents of a part of the interpolated string. + public SyntaxToken TextToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolatedStringTextSyntax)this.Green).textToken, Position, 0); - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public SyntaxToken AwaitKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public SyntaxToken UsingKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringText(this); - /// Gets the modifier list. - public SyntaxTokenList Modifiers + public InterpolatedStringTextSyntax Update(SyntaxToken textToken) + { + if (textToken != this.TextToken) { - get - { - var slot = this.Green.GetSlot(3); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } + var newNode = SyntaxFactory.InterpolatedStringText(textToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 4)!; + return this; + } - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).semicolonToken, GetChildPosition(5), GetChildIndex(5)); + public InterpolatedStringTextSyntax WithTextToken(SyntaxToken textToken) => Update(textToken); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.declaration, 4)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax +{ + private ExpressionSyntax? expression; + private InterpolationAlignmentClauseSyntax? alignmentClause; + private InterpolationFormatClauseSyntax? formatClause; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.declaration, - _ => null, - }; + internal InterpolationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalDeclarationStatement(this); + /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationSyntax)this.Green).openBraceToken, Position, 0); - public LocalDeclarationStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - return this; - } + public InterpolationAlignmentClauseSyntax? AlignmentClause => GetRed(ref this.alignmentClause, 2); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LocalDeclarationStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, semicolonToken); + public InterpolationFormatClauseSyntax? FormatClause => GetRed(ref this.formatClause, 3); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LocalDeclarationStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public LocalDeclarationStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public LocalDeclarationStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); - } + /// + /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). + /// + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode - { - private TypeSyntax? type; - private SyntaxNode? variables; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.expression, 1)!, + 2 => GetRed(ref this.alignmentClause, 2), + 3 => GetRed(ref this.formatClause, 3), + _ => null, + }; - internal VariableDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 1 => this.expression, + 2 => this.alignmentClause, + 3 => this.formatClause, + _ => null, + }; - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolation(this); - public SeparatedSyntaxList Variables + public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken) { - get - { - var red = GetRed(ref this.variables, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.variables, 1)!, - _ => null, - }; + return this; + } + + public InterpolationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); + public InterpolationSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenBraceToken, expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); + public InterpolationSyntax WithAlignmentClause(InterpolationAlignmentClauseSyntax? alignmentClause) => Update(this.OpenBraceToken, this.Expression, alignmentClause, this.FormatClause, this.CloseBraceToken); + public InterpolationSyntax WithFormatClause(InterpolationFormatClauseSyntax? formatClause) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, formatClause, this.CloseBraceToken); + public InterpolationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, closeBraceToken); +} - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.variables, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? value; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclaration(this); + internal InterpolationAlignmentClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public VariableDeclarationSyntax Update(TypeSyntax type, SeparatedSyntaxList variables) - { - if (type != this.Type || variables != this.Variables) - { - var newNode = SyntaxFactory.VariableDeclaration(type, variables); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken CommaToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationAlignmentClauseSyntax)this.Green).commaToken, Position, 0); - return this; - } + public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - public VariableDeclarationSyntax WithType(TypeSyntax type) => Update(type, this.Variables); - public VariableDeclarationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.Type, variables); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; - public VariableDeclarationSyntax AddVariables(params VariableDeclaratorSyntax[] items) => WithVariables(this.Variables.AddRange(items)); - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode - { - private BracketedArgumentListSyntax? argumentList; - private EqualsValueClauseSyntax? initializer; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationAlignmentClause(this); - internal VariableDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value) + { + if (commaToken != this.CommaToken || value != this.Value) { + var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.VariableDeclaratorSyntax)this.Green).identifier, Position, 0); + return this; + } - public BracketedArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); + public InterpolationAlignmentClauseSyntax WithCommaToken(SyntaxToken commaToken) => Update(commaToken, this.Value); + public InterpolationAlignmentClauseSyntax WithValue(ExpressionSyntax value) => Update(this.CommaToken, value); +} - public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 2); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode +{ - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.argumentList, 1), - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; + internal InterpolationFormatClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.argumentList, - 2 => this.initializer, - _ => null, - }; + public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationFormatClauseSyntax)this.Green).colonToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclarator(this); + /// The text contents of the format specifier for an interpolation. + public SyntaxToken FormatStringToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationFormatClauseSyntax)this.Green).formatStringToken, GetChildPosition(1), GetChildIndex(1)); - public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) - { - if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public VariableDeclaratorSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ArgumentList, this.Initializer); - public VariableDeclaratorSyntax WithArgumentList(BracketedArgumentListSyntax? argumentList) => Update(this.Identifier, argumentList, this.Initializer); - public VariableDeclaratorSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.Identifier, this.ArgumentList, initializer); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationFormatClause(this); - public VariableDeclaratorSyntax AddArgumentListArguments(params ArgumentSyntax[] items) + public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken) + { + if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken) { - var argumentList = this.ArgumentList ?? SyntaxFactory.BracketedArgumentList(); - return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); + var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode + public InterpolationFormatClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.FormatStringToken); + public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken) => Update(this.ColonToken, formatStringToken); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private StatementSyntax? statement; + + internal GlobalStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? value; + } - internal EqualsValueClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EqualsValueClauseSyntax)this.Green).equalsToken, Position, 0); - - public ExpressionSyntax Value => GetRed(ref this.value, 1)!; + public StatementSyntax Statement => GetRed(ref this.statement, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.statement, 2)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.statement, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEqualsValueClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGlobalStatement(this); - public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value) + public GlobalStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) { - if (equalsToken != this.EqualsToken || value != this.Value) - { - var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public EqualsValueClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(equalsToken, this.Value); - public EqualsValueClauseSyntax WithValue(ExpressionSyntax value) => Update(this.EqualsToken, value); + return this; } - public abstract partial class VariableDesignationSyntax : CSharpSyntaxNode + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new GlobalStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Statement); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new GlobalStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Statement); + public GlobalStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Modifiers, statement); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new GlobalStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new GlobalStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); +} + +/// Represents the base class for all statements syntax classes. +public abstract partial class StatementSyntax : CSharpSyntaxNode +{ + internal StatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal VariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax - { + public abstract SyntaxList AttributeLists { get; } + public StatementSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract StatementSyntax WithAttributeListsCore(SyntaxList attributeLists); - internal SingleVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public StatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BlockSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private SyntaxNode? statements; - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.SingleVariableDesignationSyntax)this.Green).identifier, Position, 0); + internal BlockSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BlockSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSingleVariableDesignation(this); + public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 2)); - public SingleVariableDesignationSyntax Update(SyntaxToken identifier) + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BlockSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (identifier != this.Identifier) - { - var newNode = SyntaxFactory.SingleVariableDesignation(identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.statements, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.statements, + _ => null, + }; - public SingleVariableDesignationSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBlock(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax + public BlockSyntax Update(SyntaxList attributeLists, SyntaxToken openBraceToken, SyntaxList statements, SyntaxToken closeBraceToken) { - - internal DiscardDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) { + var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DiscardDesignationSyntax)this.Green).underscoreToken, Position, 0); - - internal override SyntaxNode? GetNodeSlot(int index) => null; - - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardDesignation(this); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new BlockSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.OpenBraceToken, this.Statements, this.CloseBraceToken); + public BlockSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, openBraceToken, this.Statements, this.CloseBraceToken); + public BlockSyntax WithStatements(SyntaxList statements) => Update(this.AttributeLists, this.OpenBraceToken, statements, this.CloseBraceToken); + public BlockSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.OpenBraceToken, this.Statements, closeBraceToken); - public DiscardDesignationSyntax Update(SyntaxToken underscoreToken) - { - if (underscoreToken != this.UnderscoreToken) - { - var newNode = SyntaxFactory.DiscardDesignation(underscoreToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new BlockSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public BlockSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); +} - return this; - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LocalFunctionStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private SyntaxNode? constraintClauses; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public DiscardDesignationSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); + internal LocalFunctionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax - { - private SyntaxNode? variables; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal ParenthesizedVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); + public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - public SeparatedSyntaxList Variables - { - get - { - var red = GetRed(ref this.variables, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.variables, 1)! : null; + public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.variables : null; + public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 6)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedVariableDesignation(this); + public BlockSyntax? Body => GetRed(ref this.body, 7); - public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList variables, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 8); - return this; + /// Gets the optional semicolon token. + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; } + } - public ParenthesizedVariableDesignationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Variables, this.CloseParenToken); - public ParenthesizedVariableDesignationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.OpenParenToken, variables, this.CloseParenToken); - public ParenthesizedVariableDesignationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Variables, closeParenToken); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5)!, + 6 => GetRed(ref this.constraintClauses, 6)!, + 7 => GetRed(ref this.body, 7), + 8 => GetRed(ref this.expressionBody, 8), + _ => null, + }; - public ParenthesizedVariableDesignationSyntax AddVariables(params VariableDesignationSyntax[] items) => WithVariables(this.Variables.AddRange(items)); - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.returnType, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.constraintClauses, + 7 => this.body, + 8 => this.expressionBody, + _ => null, + }; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ExpressionStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalFunctionStatement(this); - internal ExpressionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public LocalFunctionStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LocalFunctionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExpressionStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LocalFunctionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public LocalFunctionStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public LocalFunctionStatementSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + public LocalFunctionStatementSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + public LocalFunctionStatementSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + public LocalFunctionStatementSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + public LocalFunctionStatementSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 1 => GetRed(ref this.expression, 1)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LocalDeclarationStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.expression, - _ => null, - }; + internal LocalDeclarationStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionStatement(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public ExpressionStatementSyntax Update(SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + public SyntaxToken AwaitKeyword + { + get { - if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ExpressionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Expression, this.SemicolonToken); - public ExpressionStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, expression, this.SemicolonToken); - public ExpressionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Expression, semicolonToken); - - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ExpressionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EmptyStatementSyntax : StatementSyntax + public SyntaxToken UsingKeyword { - private SyntaxNode? attributeLists; - - internal EmptyStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } + } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EmptyStatementSyntax)this.Green).semicolonToken, GetChildPosition(1), GetChildIndex(1)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + /// Gets the modifier list. + public SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(3); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 4)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEmptyStatement(this); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).semicolonToken, GetChildPosition(5), GetChildIndex(5)); - public EmptyStatementSyntax Update(SyntaxList attributeLists, SyntaxToken semicolonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.declaration, 4)!, + _ => null, + }; - return this; - } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EmptyStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SemicolonToken); - public EmptyStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.declaration, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EmptyStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalDeclarationStatement(this); - /// Represents a labeled statement syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LabeledStatementSyntax : StatementSyntax + public LocalDeclarationStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { - private SyntaxNode? attributeLists; - private StatementSyntax? statement; - - internal LabeledStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.LabeledStatementSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + return this; + } - /// Gets a SyntaxToken that represents the colon following the statement's label. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LabeledStatementSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LocalDeclarationStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, semicolonToken); - public StatementSyntax Statement => GetRed(ref this.statement, 3)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LocalDeclarationStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public LocalDeclarationStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public LocalDeclarationStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.statement, 3)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode +{ + private TypeSyntax? type; + private SyntaxNode? variables; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.statement, - _ => null, - }; + internal VariableDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLabeledStatement(this); + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public LabeledStatementSyntax Update(SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + public SeparatedSyntaxList Variables + { + get { - if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) - { - var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.variables, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LabeledStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Identifier, this.ColonToken, this.Statement); - public LabeledStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, identifier, this.ColonToken, this.Statement); - public LabeledStatementSyntax WithColonToken(SyntaxToken colonToken) => Update(this.AttributeLists, this.Identifier, colonToken, this.Statement); - public LabeledStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Identifier, this.ColonToken, statement); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.variables, 1)!, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LabeledStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.variables, + _ => null, + }; - /// - /// Represents a goto statement syntax - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - public sealed partial class GotoStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclaration(this); - internal GotoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public VariableDeclarationSyntax Update(TypeSyntax type, SeparatedSyntaxList variables) + { + if (type != this.Type || variables != this.Variables) { + var newNode = SyntaxFactory.VariableDeclaration(type, variables); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - /// - /// Gets a SyntaxToken that represents the goto keyword. - /// - public SyntaxToken GotoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).gotoKeyword, GetChildPosition(1), GetChildIndex(1)); + public VariableDeclarationSyntax WithType(TypeSyntax type) => Update(type, this.Variables); + public VariableDeclarationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.Type, variables); - /// - /// Gets a SyntaxToken that represents the case or default keywords if any exists. - /// - public SyntaxToken CaseOrDefaultKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public VariableDeclarationSyntax AddVariables(params VariableDeclaratorSyntax[] items) => WithVariables(this.Variables.AddRange(items)); +} - /// - /// Gets a constant expression for a goto case statement. - /// - public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode +{ + private BracketedArgumentListSyntax? argumentList; + private EqualsValueClauseSyntax? initializer; - /// - /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. - /// - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + internal VariableDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3), - _ => null, - }; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.VariableDeclaratorSyntax)this.Green).identifier, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.expression, - _ => null, - }; + public BracketedArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGotoStatement(this); + public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 2); - public GotoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.GotoStatement(this.Kind(), attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 1 => GetRed(ref this.argumentList, 1), + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - return this; - } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new GotoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); - public GotoStatementSyntax WithGotoKeyword(SyntaxToken gotoKeyword) => Update(this.AttributeLists, gotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); - public GotoStatementSyntax WithCaseOrDefaultKeyword(SyntaxToken caseOrDefaultKeyword) => Update(this.AttributeLists, this.GotoKeyword, caseOrDefaultKeyword, this.Expression, this.SemicolonToken); - public GotoStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, expression, this.SemicolonToken); - public GotoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.argumentList, + 2 => this.initializer, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new GotoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclarator(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BreakStatementSyntax : StatementSyntax + public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) { - private SyntaxNode? attributeLists; - - internal BreakStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer) { + var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken BreakKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.BreakStatementSyntax)this.Green).breakKeyword, GetChildPosition(1), GetChildIndex(1)); + public VariableDeclaratorSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ArgumentList, this.Initializer); + public VariableDeclaratorSyntax WithArgumentList(BracketedArgumentListSyntax? argumentList) => Update(this.Identifier, argumentList, this.Initializer); + public VariableDeclaratorSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.Identifier, this.ArgumentList, initializer); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BreakStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public VariableDeclaratorSyntax AddArgumentListArguments(params ArgumentSyntax[] items) + { + var argumentList = this.ArgumentList ?? SyntaxFactory.BracketedArgumentList(); + return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? value; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + internal EqualsValueClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBreakStatement(this); + public SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EqualsValueClauseSyntax)this.Green).equalsToken, Position, 0); - public BreakStatementSyntax Update(SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new BreakStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.BreakKeyword, this.SemicolonToken); - public BreakStatementSyntax WithBreakKeyword(SyntaxToken breakKeyword) => Update(this.AttributeLists, breakKeyword, this.SemicolonToken); - public BreakStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.BreakKeyword, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new BreakStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEqualsValueClause(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ContinueStatementSyntax : StatementSyntax + public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value) { - private SyntaxNode? attributeLists; - - internal ContinueStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (equalsToken != this.EqualsToken || value != this.Value) { + var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken ContinueKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ContinueStatementSyntax)this.Green).continueKeyword, GetChildPosition(1), GetChildIndex(1)); + return this; + } - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ContinueStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public EqualsValueClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(equalsToken, this.Value); + public EqualsValueClauseSyntax WithValue(ExpressionSyntax value) => Update(this.EqualsToken, value); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; +public abstract partial class VariableDesignationSyntax : CSharpSyntaxNode +{ + internal VariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax +{ - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitContinueStatement(this); + internal SingleVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ContinueStatementSyntax Update(SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.SingleVariableDesignationSyntax)this.Green).identifier, Position, 0); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ContinueStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ContinueKeyword, this.SemicolonToken); - public ContinueStatementSyntax WithContinueKeyword(SyntaxToken continueKeyword) => Update(this.AttributeLists, continueKeyword, this.SemicolonToken); - public ContinueStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ContinueKeyword, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ContinueStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSingleVariableDesignation(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ReturnStatementSyntax : StatementSyntax + public SingleVariableDesignationSyntax Update(SyntaxToken identifier) { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - - internal ReturnStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (identifier != this.Identifier) { + var newNode = SyntaxFactory.SingleVariableDesignation(identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken ReturnKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ReturnStatementSyntax)this.Green).returnKeyword, GetChildPosition(1), GetChildIndex(1)); - - public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); - - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ReturnStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.expression, 2), - _ => null, - }; + public SingleVariableDesignationSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); +} - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.expression, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax +{ - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReturnStatement(this); + internal DiscardDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ReturnStatementSyntax Update(SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DiscardDesignationSyntax)this.Green).underscoreToken, Position, 0); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ReturnStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ReturnKeyword, this.Expression, this.SemicolonToken); - public ReturnStatementSyntax WithReturnKeyword(SyntaxToken returnKeyword) => Update(this.AttributeLists, returnKeyword, this.Expression, this.SemicolonToken); - public ReturnStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ReturnKeyword, expression, this.SemicolonToken); - public ReturnStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ReturnKeyword, this.Expression, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ReturnStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardDesignation(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ThrowStatementSyntax : StatementSyntax + public DiscardDesignationSyntax Update(SyntaxToken underscoreToken) { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - - internal ThrowStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (underscoreToken != this.UnderscoreToken) { + var newNode = SyntaxFactory.DiscardDesignation(underscoreToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ThrowStatementSyntax)this.Green).throwKeyword, GetChildPosition(1), GetChildIndex(1)); - - public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); + return this; + } - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ThrowStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public DiscardDesignationSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.expression, 2), - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax +{ + private SyntaxNode? variables; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.expression, - _ => null, - }; + internal ParenthesizedVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowStatement(this); + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); - public ThrowStatementSyntax Update(SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public SeparatedSyntaxList Variables + { + get { - if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.variables, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ThrowStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ThrowKeyword, this.Expression, this.SemicolonToken); - public ThrowStatementSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(this.AttributeLists, throwKeyword, this.Expression, this.SemicolonToken); - public ThrowStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ThrowKeyword, expression, this.SemicolonToken); - public ThrowStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ThrowKeyword, this.Expression, semicolonToken); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ThrowStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.variables, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class YieldStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.variables : null; - internal YieldStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedVariableDesignation(this); + + public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList variables, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken YieldKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).yieldKeyword, GetChildPosition(1), GetChildIndex(1)); + public ParenthesizedVariableDesignationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Variables, this.CloseParenToken); + public ParenthesizedVariableDesignationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.OpenParenToken, variables, this.CloseParenToken); + public ParenthesizedVariableDesignationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Variables, closeParenToken); - public SyntaxToken ReturnOrBreakKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).returnOrBreakKeyword, GetChildPosition(2), GetChildIndex(2)); + public ParenthesizedVariableDesignationSyntax AddVariables(params VariableDesignationSyntax[] items) => WithVariables(this.Variables.AddRange(items)); +} - public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ExpressionStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + internal ExpressionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3), - _ => null, - }; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.expression, - _ => null, - }; + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitYieldStatement(this); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExpressionStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); - public YieldStatementSyntax Update(SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.YieldStatement(this.Kind(), attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 1 => GetRed(ref this.expression, 1)!, + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new YieldStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); - public YieldStatementSyntax WithYieldKeyword(SyntaxToken yieldKeyword) => Update(this.AttributeLists, yieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); - public YieldStatementSyntax WithReturnOrBreakKeyword(SyntaxToken returnOrBreakKeyword) => Update(this.AttributeLists, this.YieldKeyword, returnOrBreakKeyword, this.Expression, this.SemicolonToken); - public YieldStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, expression, this.SemicolonToken); - public YieldStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.expression, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new YieldStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class WhileStatementSyntax : StatementSyntax + public ExpressionStatementSyntax Update(SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) { - private SyntaxNode? attributeLists; - private ExpressionSyntax? condition; - private StatementSyntax? statement; - - internal WhileStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken WhileKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).whileKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ExpressionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Expression, this.SemicolonToken); + public ExpressionStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, expression, this.SemicolonToken); + public ExpressionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Expression, semicolonToken); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ExpressionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; - - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.condition, 3)!, - 5 => GetRed(ref this.statement, 5)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EmptyStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.condition, - 5 => this.statement, - _ => null, - }; + internal EmptyStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhileStatement(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public WhileStatementSyntax Update(SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EmptyStatementSyntax)this.Green).semicolonToken, GetChildPosition(1), GetChildIndex(1)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new WhileStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement); - public WhileStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new WhileStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEmptyStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DoStatementSyntax : StatementSyntax + public EmptyStatementSyntax Update(SyntaxList attributeLists, SyntaxToken semicolonToken) { - private SyntaxNode? attributeLists; - private StatementSyntax? statement; - private ExpressionSyntax? condition; - - internal DoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken DoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).doKeyword, GetChildPosition(1), GetChildIndex(1)); - - public StatementSyntax Statement => GetRed(ref this.statement, 2)!; + return this; + } - public SyntaxToken WhileKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).whileKeyword, GetChildPosition(3), GetChildIndex(3)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EmptyStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SemicolonToken); + public EmptyStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, semicolonToken); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).openParenToken, GetChildPosition(4), GetChildIndex(4)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EmptyStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public ExpressionSyntax Condition => GetRed(ref this.condition, 5)!; +/// Represents a labeled statement syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LabeledStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private StatementSyntax? statement; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); + internal LabeledStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).semicolonToken, GetChildPosition(7), GetChildIndex(7)); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.statement, 2)!, - 5 => GetRed(ref this.condition, 5)!, - _ => null, - }; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.LabeledStatementSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.statement, - 5 => this.condition, - _ => null, - }; + /// Gets a SyntaxToken that represents the colon following the statement's label. + public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LabeledStatementSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDoStatement(this); + public StatementSyntax Statement => GetRed(ref this.statement, 3)!; - public DoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.statement, 3)!, + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new DoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithDoKeyword(SyntaxToken doKeyword) => Update(this.AttributeLists, doKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.DoKeyword, statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, this.DoKeyword, this.Statement, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.SemicolonToken); - public DoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.statement, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new DoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLabeledStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ForStatementSyntax : StatementSyntax + public LabeledStatementSyntax Update(SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - private SyntaxNode? initializers; - private ExpressionSyntax? condition; - private SyntaxNode? incrementors; - private StatementSyntax? statement; - - internal ForStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) { + var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken ForKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).forKeyword, GetChildPosition(1), GetChildIndex(1)); + return this; + } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LabeledStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Identifier, this.ColonToken, this.Statement); + public LabeledStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, identifier, this.ColonToken, this.Statement); + public LabeledStatementSyntax WithColonToken(SyntaxToken colonToken) => Update(this.AttributeLists, this.Identifier, colonToken, this.Statement); + public LabeledStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Identifier, this.ColonToken, statement); - public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 3); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LabeledStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public SeparatedSyntaxList Initializers - { - get - { - var red = GetRed(ref this.initializers, 4); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; - } - } +/// +/// Represents a goto statement syntax +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +public sealed partial class GotoStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - public SyntaxToken FirstSemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); + internal GotoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax? Condition => GetRed(ref this.condition, 6); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public SyntaxToken SecondSemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); + /// + /// Gets a SyntaxToken that represents the goto keyword. + /// + public SyntaxToken GotoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).gotoKeyword, GetChildPosition(1), GetChildIndex(1)); - public SeparatedSyntaxList Incrementors + /// + /// Gets a SyntaxToken that represents the case or default keywords if any exists. + /// + public SyntaxToken CaseOrDefaultKeyword + { + get { - get - { - var red = GetRed(ref this.incrementors, 8); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(8)) : default; - } + var slot = ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } + } - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); - - public StatementSyntax Statement => GetRed(ref this.statement, 10)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.declaration, 3), - 4 => GetRed(ref this.initializers, 4)!, - 6 => GetRed(ref this.condition, 6), - 8 => GetRed(ref this.incrementors, 8)!, - 10 => GetRed(ref this.statement, 10)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.declaration, - 4 => this.initializers, - 6 => this.condition, - 8 => this.incrementors, - 10 => this.statement, - _ => null, - }; + /// + /// Gets a constant expression for a goto case statement. + /// + public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForStatement(this); + /// + /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. + /// + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - public ForStatementSyntax Update(SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3), + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ForStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithForKeyword(SyntaxToken forKeyword) => Update(this.AttributeLists, forKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.ForKeyword, openParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithFirstSemicolonToken(SyntaxToken firstSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, firstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithCondition(ExpressionSyntax? condition) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithSecondSemicolonToken(SyntaxToken secondSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, secondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithIncrementors(SeparatedSyntaxList incrementors) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, closeParenToken, this.Statement); - public ForStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, statement); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ForStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public ForStatementSyntax AddInitializers(params ExpressionSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); - public ForStatementSyntax AddIncrementors(params ExpressionSyntax[] items) => WithIncrementors(this.Incrementors.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGotoStatement(this); - public abstract partial class CommonForEachStatementSyntax : StatementSyntax + public GotoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { - internal CommonForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.GotoStatement(this.Kind(), attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxToken AwaitKeyword { get; } - public CommonForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => WithAwaitKeywordCore(awaitKeyword); - internal abstract CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword); - - public abstract SyntaxToken ForEachKeyword { get; } - public CommonForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => WithForEachKeywordCore(forEachKeyword); - internal abstract CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword); + return this; + } - public abstract SyntaxToken OpenParenToken { get; } - public CommonForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => WithOpenParenTokenCore(openParenToken); - internal abstract CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new GotoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); + public GotoStatementSyntax WithGotoKeyword(SyntaxToken gotoKeyword) => Update(this.AttributeLists, gotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); + public GotoStatementSyntax WithCaseOrDefaultKeyword(SyntaxToken caseOrDefaultKeyword) => Update(this.AttributeLists, this.GotoKeyword, caseOrDefaultKeyword, this.Expression, this.SemicolonToken); + public GotoStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, expression, this.SemicolonToken); + public GotoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, semicolonToken); - public abstract SyntaxToken InKeyword { get; } - public CommonForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => WithInKeywordCore(inKeyword); - internal abstract CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new GotoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public abstract ExpressionSyntax Expression { get; } - public CommonForEachStatementSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); - internal abstract CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BreakStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; - public abstract SyntaxToken CloseParenToken { get; } - public CommonForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => WithCloseParenTokenCore(closeParenToken); - internal abstract CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken); + internal BreakStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public abstract StatementSyntax Statement { get; } - public CommonForEachStatementSyntax WithStatement(StatementSyntax statement) => WithStatementCore(statement); - internal abstract CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public new CommonForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => (CommonForEachStatementSyntax)WithAttributeListsCore(attributeLists); + public SyntaxToken BreakKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.BreakStatementSyntax)this.Green).breakKeyword, GetChildPosition(1), GetChildIndex(1)); - public new CommonForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => (CommonForEachStatementSyntax)AddAttributeListsCore(items); - } + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BreakStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExpressionSyntax? expression; - private StatementSyntax? statement; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; - internal ForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBreakStatement(this); - public override SyntaxToken AwaitKeyword + public BreakStatementSyntax Update(SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) { - get - { - var slot = ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new BreakStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.BreakKeyword, this.SemicolonToken); + public BreakStatementSyntax WithBreakKeyword(SyntaxToken breakKeyword) => Update(this.AttributeLists, breakKeyword, this.SemicolonToken); + public BreakStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.BreakKeyword, semicolonToken); - public TypeSyntax Type => GetRed(ref this.type, 4)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new BreakStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ContinueStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; - public override SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).inKeyword, GetChildPosition(6), GetChildIndex(6)); + internal ContinueStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override ExpressionSyntax Expression => GetRed(ref this.expression, 7)!; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).closeParenToken, GetChildPosition(8), GetChildIndex(8)); + public SyntaxToken ContinueKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ContinueStatementSyntax)this.Green).continueKeyword, GetChildPosition(1), GetChildIndex(1)); - public override StatementSyntax Statement => GetRed(ref this.statement, 9)!; + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ContinueStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.type, 4)!, - 7 => GetRed(ref this.expression, 7)!, - 9 => GetRed(ref this.statement, 9)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.type, - 7 => this.expression, - 9 => this.statement, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitContinueStatement(this); - public ForEachStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public ContinueStatementSyntax Update(SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); - public new ForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); - public new ForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); - public new ForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - public ForEachStatementSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - public ForEachStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); - public new ForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, inKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); - public new ForEachStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); - public new ForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, closeParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); - public new ForEachStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, statement); - - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? variable; - private ExpressionSyntax? expression; - private StatementSyntax? statement; - - internal ForEachVariableStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxToken AwaitKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - - public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); - - /// - /// The variable(s) of the loop. In correct code this is a tuple - /// literal, declaration expression with a tuple designator, or - /// a discard syntax in the form of a simple identifier. In broken - /// code it could be something else. - /// - public ExpressionSyntax Variable => GetRed(ref this.variable, 4)!; - - public override SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).inKeyword, GetChildPosition(5), GetChildIndex(5)); - - public override ExpressionSyntax Expression => GetRed(ref this.expression, 6)!; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ContinueStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ContinueKeyword, this.SemicolonToken); + public ContinueStatementSyntax WithContinueKeyword(SyntaxToken continueKeyword) => Update(this.AttributeLists, continueKeyword, this.SemicolonToken); + public ContinueStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ContinueKeyword, semicolonToken); - public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).closeParenToken, GetChildPosition(7), GetChildIndex(7)); - - public override StatementSyntax Statement => GetRed(ref this.statement, 8)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ContinueStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.variable, 4)!, - 6 => GetRed(ref this.expression, 6)!, - 8 => GetRed(ref this.statement, 8)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ReturnStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.variable, - 6 => this.expression, - 8 => this.statement, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachVariableStatement(this); + internal ReturnStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ForEachVariableStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - return this; - } + public SyntaxToken ReturnKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ReturnStatementSyntax)this.Green).returnKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ForEachVariableStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); - public new ForEachVariableStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); - public new ForEachVariableStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); - public new ForEachVariableStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - public ForEachVariableStatementSyntax WithVariable(ExpressionSyntax variable) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); - public new ForEachVariableStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, inKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); - public new ForEachVariableStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); - public new ForEachVariableStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, closeParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); - public new ForEachVariableStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, statement); + public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ForEachVariableStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ReturnStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class UsingStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - private ExpressionSyntax? expression; - private StatementSyntax? statement; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.expression, 2), + _ => null, + }; - internal UsingStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 0 => this.attributeLists, + 2 => this.expression, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReturnStatement(this); - public SyntaxToken AwaitKeyword + public ReturnStatementSyntax Update(SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { - get - { - var slot = ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken UsingKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ReturnStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ReturnKeyword, this.Expression, this.SemicolonToken); + public ReturnStatementSyntax WithReturnKeyword(SyntaxToken returnKeyword) => Update(this.AttributeLists, returnKeyword, this.Expression, this.SemicolonToken); + public ReturnStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ReturnKeyword, expression, this.SemicolonToken); + public ReturnStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ReturnKeyword, this.Expression, semicolonToken); - public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 4); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ReturnStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public ExpressionSyntax? Expression => GetRed(ref this.expression, 5); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ThrowStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); + internal ThrowStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public StatementSyntax Statement => GetRed(ref this.statement, 7)!; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.declaration, 4), - 5 => GetRed(ref this.expression, 5), - 7 => GetRed(ref this.statement, 7)!, - _ => null, - }; + public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ThrowStatementSyntax)this.Green).throwKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.declaration, - 5 => this.expression, - 7 => this.statement, - _ => null, - }; + public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingStatement(this); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ThrowStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - public UsingStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.expression, 2), + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new UsingStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, openParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, closeParenToken, this.Statement); - public UsingStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, statement); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.expression, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new UsingStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FixedStatementSyntax : StatementSyntax + public ThrowStatementSyntax Update(SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - private StatementSyntax? statement; - - internal FixedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ThrowStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ThrowKeyword, this.Expression, this.SemicolonToken); + public ThrowStatementSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(this.AttributeLists, throwKeyword, this.Expression, this.SemicolonToken); + public ThrowStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ThrowKeyword, expression, this.SemicolonToken); + public ThrowStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ThrowKeyword, this.Expression, semicolonToken); - public SyntaxToken FixedKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).fixedKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ThrowStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class YieldStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; + internal YieldStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + public SyntaxToken YieldKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).yieldKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.declaration, 3)!, - 5 => GetRed(ref this.statement, 5)!, - _ => null, - }; + public SyntaxToken ReturnOrBreakKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).returnOrBreakKeyword, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.declaration, - 5 => this.statement, - _ => null, - }; + public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFixedStatement(this); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - public FixedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3), + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FixedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithFixedKeyword(SyntaxToken fixedKeyword) => Update(this.AttributeLists, fixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.FixedKeyword, openParenToken, this.Declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, closeParenToken, this.Statement); - public FixedStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, statement); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FixedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public FixedStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitYieldStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class CheckedStatementSyntax : StatementSyntax + public YieldStatementSyntax Update(SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { - private SyntaxNode? attributeLists; - private BlockSyntax? block; - - internal CheckedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.YieldStatement(this.Kind(), attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedStatementSyntax)this.Green).keyword, GetChildPosition(1), GetChildIndex(1)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new YieldStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); + public YieldStatementSyntax WithYieldKeyword(SyntaxToken yieldKeyword) => Update(this.AttributeLists, yieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); + public YieldStatementSyntax WithReturnOrBreakKeyword(SyntaxToken returnOrBreakKeyword) => Update(this.AttributeLists, this.YieldKeyword, returnOrBreakKeyword, this.Expression, this.SemicolonToken); + public YieldStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, expression, this.SemicolonToken); + public YieldStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, semicolonToken); - public BlockSyntax Block => GetRed(ref this.block, 2)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new YieldStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.block, 2)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class WhileStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? condition; + private StatementSyntax? statement; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.block, - _ => null, - }; + internal WhileStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedStatement(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public CheckedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) - { - if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) - { - var newNode = SyntaxFactory.CheckedStatement(this.Kind(), attributeLists, keyword, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken WhileKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).whileKeyword, GetChildPosition(1), GetChildIndex(1)); - return this; - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new CheckedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Keyword, this.Block); - public CheckedStatementSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, keyword, this.Block); - public CheckedStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.Keyword, block); + public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new CheckedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public CheckedStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public CheckedStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); - } + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class UnsafeStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private BlockSyntax? block; + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - internal UnsafeStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.condition, 3)!, + 5 => GetRed(ref this.statement, 5)!, + _ => null, + }; - public SyntaxToken UnsafeKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UnsafeStatementSyntax)this.Green).unsafeKeyword, GetChildPosition(1), GetChildIndex(1)); - - public BlockSyntax Block => GetRed(ref this.block, 2)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.condition, + 5 => this.statement, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.block, 2)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhileStatement(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.block, - _ => null, - }; + public WhileStatementSyntax Update(SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnsafeStatement(this); + return this; + } - public UnsafeStatementSyntax Update(SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) - { - if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) - { - var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new WhileStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement); + public WhileStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement); - return this; - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new WhileStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new UnsafeStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.UnsafeKeyword, this.Block); - public UnsafeStatementSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.AttributeLists, unsafeKeyword, this.Block); - public UnsafeStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.UnsafeKeyword, block); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DoStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private StatementSyntax? statement; + private ExpressionSyntax? condition; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new UnsafeStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public UnsafeStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public UnsafeStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); + internal DoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LockStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - private StatementSyntax? statement; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal LockStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken DoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).doKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public StatementSyntax Statement => GetRed(ref this.statement, 2)!; - public SyntaxToken LockKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).lockKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken WhileKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).whileKeyword, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).openParenToken, GetChildPosition(4), GetChildIndex(4)); - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + public ExpressionSyntax Condition => GetRed(ref this.condition, 5)!; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).semicolonToken, GetChildPosition(7), GetChildIndex(7)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3)!, - 5 => GetRed(ref this.statement, 5)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.statement, 2)!, + 5 => GetRed(ref this.condition, 5)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.expression, - 5 => this.statement, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.statement, + 5 => this.condition, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLockStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDoStatement(this); - public LockStatementSyntax Update(SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public DoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LockStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithLockKeyword(SyntaxToken lockKeyword) => Update(this.AttributeLists, lockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.LockKeyword, openParenToken, this.Expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.Statement); - public LockStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, statement); - - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LockStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + return this; } - /// - /// Represents an if statement syntax. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IfStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? condition; - private StatementSyntax? statement; - private ElseClauseSyntax? @else; - - internal IfStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - /// - /// Gets a SyntaxToken that represents the if keyword. - /// - public SyntaxToken IfKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); - - /// - /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. - /// - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new DoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithDoKeyword(SyntaxToken doKeyword) => Update(this.AttributeLists, doKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.DoKeyword, statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, this.DoKeyword, this.Statement, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.SemicolonToken); + public DoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, semicolonToken); - /// - /// Gets an ExpressionSyntax that represents the condition of the if statement. - /// - public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new DoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - /// - /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. - /// - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ForStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + private SyntaxNode? initializers; + private ExpressionSyntax? condition; + private SyntaxNode? incrementors; + private StatementSyntax? statement; - /// - /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. - /// - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + internal ForStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// - /// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. - /// - public ElseClauseSyntax? Else => GetRed(ref this.@else, 6); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.condition, 3)!, - 5 => GetRed(ref this.statement, 5)!, - 6 => GetRed(ref this.@else, 6), - _ => null, - }; + public SyntaxToken ForKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).forKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.condition, - 5 => this.statement, - 6 => this.@else, - _ => null, - }; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfStatement(this); + public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 3); - public IfStatementSyntax Update(SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + public SeparatedSyntaxList Initializers + { + get { - if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) - { - var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.initializers, 4); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; } + } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new IfStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.AttributeLists, ifKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.IfKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement, this.Else); - public IfStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement, this.Else); - public IfStatementSyntax WithElse(ElseClauseSyntax? @else) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, @else); + public SyntaxToken FirstSemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new IfStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public ExpressionSyntax? Condition => GetRed(ref this.condition, 6); - /// Represents an else statement syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ElseClauseSyntax : CSharpSyntaxNode - { - private StatementSyntax? statement; + public SyntaxToken SecondSemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); - internal ElseClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SeparatedSyntaxList Incrementors + { + get { + var red = GetRed(ref this.incrementors, 8); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(8)) : default; } + } - /// - /// Gets a syntax token - /// - public SyntaxToken ElseKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseClauseSyntax)this.Green).elseKeyword, Position, 0); - - public StatementSyntax Statement => GetRed(ref this.statement, 1)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.statement, 1)! : null; + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.statement : null; + public StatementSyntax Statement => GetRed(ref this.statement, 10)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseClause(this); - - public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement) - { - if (elseKeyword != this.ElseKeyword || statement != this.Statement) - { - var newNode = SyntaxFactory.ElseClause(elseKeyword, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.declaration, 3), + 4 => GetRed(ref this.initializers, 4)!, + 6 => GetRed(ref this.condition, 6), + 8 => GetRed(ref this.incrementors, 8)!, + 10 => GetRed(ref this.statement, 10)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.declaration, + 4 => this.initializers, + 6 => this.condition, + 8 => this.incrementors, + 10 => this.statement, + _ => null, + }; - public ElseClauseSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(elseKeyword, this.Statement); - public ElseClauseSyntax WithStatement(StatementSyntax statement) => Update(this.ElseKeyword, statement); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForStatement(this); - /// Represents a switch statement syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SwitchStatementSyntax : StatementSyntax + public ForStatementSyntax Update(SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - private SyntaxNode? sections; - - internal SwitchStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) { + var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - /// - /// Gets a SyntaxToken that represents the switch keyword. - /// - public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ForStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithForKeyword(SyntaxToken forKeyword) => Update(this.AttributeLists, forKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.ForKeyword, openParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithFirstSemicolonToken(SyntaxToken firstSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, firstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithCondition(ExpressionSyntax? condition) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithSecondSemicolonToken(SyntaxToken secondSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, secondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithIncrementors(SeparatedSyntaxList incrementors) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, closeParenToken, this.Statement); + public ForStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, statement); - /// - /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. - /// - public SyntaxToken OpenParenToken - { - get - { - var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ForStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public ForStatementSyntax AddInitializers(params ExpressionSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); + public ForStatementSyntax AddIncrementors(params ExpressionSyntax[] items) => WithIncrementors(this.Incrementors.AddRange(items)); +} + +public abstract partial class CommonForEachStatementSyntax : StatementSyntax +{ + internal CommonForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// - /// Gets an ExpressionSyntax representing the expression of the switch statement. - /// - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + public abstract SyntaxToken AwaitKeyword { get; } + public CommonForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => WithAwaitKeywordCore(awaitKeyword); + internal abstract CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword); - /// - /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. - /// - public SyntaxToken CloseParenToken - { - get - { - var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; - } - } + public abstract SyntaxToken ForEachKeyword { get; } + public CommonForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => WithForEachKeywordCore(forEachKeyword); + internal abstract CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword); - /// - /// Gets a SyntaxToken that represents the open braces preceding the switch sections. - /// - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openBraceToken, GetChildPosition(5), GetChildIndex(5)); + public abstract SyntaxToken OpenParenToken { get; } + public CommonForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => WithOpenParenTokenCore(openParenToken); + internal abstract CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken); - /// - /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. - /// - public SyntaxList Sections => new SyntaxList(GetRed(ref this.sections, 6)); + public abstract SyntaxToken InKeyword { get; } + public CommonForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => WithInKeywordCore(inKeyword); + internal abstract CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword); - /// - /// Gets a SyntaxToken that represents the open braces following the switch sections. - /// - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeBraceToken, GetChildPosition(7), GetChildIndex(7)); + public abstract ExpressionSyntax Expression { get; } + public CommonForEachStatementSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); + internal abstract CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3)!, - 6 => GetRed(ref this.sections, 6)!, - _ => null, - }; + public abstract SyntaxToken CloseParenToken { get; } + public CommonForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => WithCloseParenTokenCore(closeParenToken); + internal abstract CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.expression, - 6 => this.sections, - _ => null, - }; + public abstract StatementSyntax Statement { get; } + public CommonForEachStatementSyntax WithStatement(StatementSyntax statement) => WithStatementCore(statement); + internal abstract CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchStatement(this); + public new CommonForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => (CommonForEachStatementSyntax)WithAttributeListsCore(attributeLists); - public SwitchStatementSyntax Update(SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, SyntaxList sections, SyntaxToken closeBraceToken) - { - if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public new CommonForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => (CommonForEachStatementSyntax)AddAttributeListsCore(items); +} - return this; - } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new SwitchStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.AttributeLists, switchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.SwitchKeyword, openParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, openBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithSections(SyntaxList sections) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, sections, this.CloseBraceToken); - public SwitchStatementSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, closeBraceToken); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExpressionSyntax? expression; + private StatementSyntax? statement; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new SwitchStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public SwitchStatementSyntax AddSections(params SwitchSectionSyntax[] items) => WithSections(this.Sections.AddRange(items)); + internal ForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Represents a switch section syntax of a switch statement. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SwitchSectionSyntax : CSharpSyntaxNode - { - private SyntaxNode? labels; - private SyntaxNode? statements; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal SwitchSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxToken AwaitKeyword + { + get { + var slot = ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// - /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. - /// - public SyntaxList Labels => new SyntaxList(GetRed(ref this.labels, 0)); + public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - /// - /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. - /// - public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 1)); + public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.labels)!, - 1 => GetRed(ref this.statements, 1)!, - _ => null, - }; + public TypeSyntax Type => GetRed(ref this.type, 4)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.labels, - 1 => this.statements, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchSection(this); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); - public SwitchSectionSyntax Update(SyntaxList labels, SyntaxList statements) - { - if (labels != this.Labels || statements != this.Statements) - { - var newNode = SyntaxFactory.SwitchSection(labels, statements); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).inKeyword, GetChildPosition(6), GetChildIndex(6)); - return this; - } + public override ExpressionSyntax Expression => GetRed(ref this.expression, 7)!; - public SwitchSectionSyntax WithLabels(SyntaxList labels) => Update(labels, this.Statements); - public SwitchSectionSyntax WithStatements(SyntaxList statements) => Update(this.Labels, statements); + public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).closeParenToken, GetChildPosition(8), GetChildIndex(8)); - public SwitchSectionSyntax AddLabels(params SwitchLabelSyntax[] items) => WithLabels(this.Labels.AddRange(items)); - public SwitchSectionSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); - } + public override StatementSyntax Statement => GetRed(ref this.statement, 9)!; + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.type, 4)!, + 7 => GetRed(ref this.expression, 7)!, + 9 => GetRed(ref this.statement, 9)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.type, + 7 => this.expression, + 9 => this.statement, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachStatement(this); - /// Represents a switch label within a switch statement. - public abstract partial class SwitchLabelSyntax : CSharpSyntaxNode + public ForEachStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { - internal SwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { + var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// - /// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. - /// - public abstract SyntaxToken Keyword { get; } - public SwitchLabelSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); - internal abstract SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword); - - /// - /// Gets a SyntaxToken that represents the colon that terminates the switch label. - /// - public abstract SyntaxToken ColonToken { get; } - public SwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); - internal abstract SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken); + return this; } - /// Represents a case label within a switch statement. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); + public new ForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); + public new ForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); + public new ForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + public ForEachStatementSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + public ForEachStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); + public new ForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, inKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); + public new ForEachStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); + public new ForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, closeParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); + public new ForEachStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, statement); + + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? variable; + private ExpressionSyntax? expression; + private StatementSyntax? statement; + + internal ForEachVariableStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private PatternSyntax? pattern; - private WhenClauseSyntax? whenClause; + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal CasePatternSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxToken AwaitKeyword + { + get { + var slot = ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the case keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).keyword, Position, 0); + public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - /// - /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. - /// - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); - public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 2); + /// + /// The variable(s) of the loop. In correct code this is a tuple + /// literal, declaration expression with a tuple designator, or + /// a discard syntax in the form of a simple identifier. In broken + /// code it could be something else. + /// + public ExpressionSyntax Variable => GetRed(ref this.variable, 4)!; - public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).inKeyword, GetChildPosition(5), GetChildIndex(5)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.pattern, 1)!, - 2 => GetRed(ref this.whenClause, 2), - _ => null, - }; + public override ExpressionSyntax Expression => GetRed(ref this.expression, 6)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.pattern, - 2 => this.whenClause, - _ => null, - }; + public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).closeParenToken, GetChildPosition(7), GetChildIndex(7)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCasePatternSwitchLabel(this); + public override StatementSyntax Statement => GetRed(ref this.statement, 8)!; - public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.variable, 4)!, + 6 => GetRed(ref this.expression, 6)!, + 8 => GetRed(ref this.statement, 8)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.variable, + 6 => this.expression, + 8 => this.statement, + _ => null, + }; - internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new CasePatternSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Pattern, this.WhenClause, this.ColonToken); - public CasePatternSwitchLabelSyntax WithPattern(PatternSyntax pattern) => Update(this.Keyword, pattern, this.WhenClause, this.ColonToken); - public CasePatternSwitchLabelSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Keyword, this.Pattern, whenClause, this.ColonToken); - internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new CasePatternSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Pattern, this.WhenClause, colonToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachVariableStatement(this); - /// Represents a case label within a switch statement. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax + public ForEachVariableStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { - private ExpressionSyntax? value; - - internal CaseSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { + var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the case keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CaseSwitchLabelSyntax)this.Green).keyword, Position, 0); + return this; + } - /// - /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. - /// - public ExpressionSyntax Value => GetRed(ref this.value, 1)!; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ForEachVariableStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); + public new ForEachVariableStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); + public new ForEachVariableStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); + public new ForEachVariableStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + public ForEachVariableStatementSyntax WithVariable(ExpressionSyntax variable) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); + public new ForEachVariableStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, inKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); + public new ForEachVariableStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); + public new ForEachVariableStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, closeParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); + public new ForEachVariableStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, statement); - public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CaseSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ForEachVariableStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class UsingStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + private ExpressionSyntax? expression; + private StatementSyntax? statement; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; + internal UsingStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCaseSwitchLabel(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + public SyntaxToken AwaitKeyword + { + get { - if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } - - internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new CaseSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Value, this.ColonToken); - public CaseSwitchLabelSyntax WithValue(ExpressionSyntax value) => Update(this.Keyword, value, this.ColonToken); - internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new CaseSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Value, colonToken); } - /// Represents a default label within a switch statement. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax - { + public SyntaxToken UsingKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); - internal DefaultSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); - /// Gets the default keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultSwitchLabelSyntax)this.Green).keyword, Position, 0); + public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 4); - public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public ExpressionSyntax? Expression => GetRed(ref this.expression, 5); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public StatementSyntax Statement => GetRed(ref this.statement, 7)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultSwitchLabel(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.declaration, 4), + 5 => GetRed(ref this.expression, 5), + 7 => GetRed(ref this.statement, 7)!, + _ => null, + }; - public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (keyword != this.Keyword || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.attributeLists, + 4 => this.declaration, + 5 => this.expression, + 7 => this.statement, + _ => null, + }; - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingStatement(this); + + public UsingStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new DefaultSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.ColonToken); - internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new DefaultSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, colonToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SwitchExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? governingExpression; - private SyntaxNode? arms; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new UsingStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, openParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, closeParenToken, this.Statement); + public UsingStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, statement); - internal SwitchExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new UsingStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public ExpressionSyntax GoverningExpression => GetRedAtZero(ref this.governingExpression)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FixedStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + private StatementSyntax? statement; - public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); + internal FixedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public SeparatedSyntaxList Arms - { - get - { - var red = GetRed(ref this.arms, 3); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; - } - } + public SyntaxToken FixedKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).fixedKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.governingExpression)!, - 3 => GetRed(ref this.arms, 3)!, - _ => null, - }; + public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.governingExpression, - 3 => this.arms, - _ => null, - }; + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpression(this); + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.declaration, 3)!, + 5 => GetRed(ref this.statement, 5)!, + _ => null, + }; - public SwitchExpressionSyntax WithGoverningExpression(ExpressionSyntax governingExpression) => Update(governingExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.GoverningExpression, switchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, openBraceToken, this.Arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithArms(SeparatedSyntaxList arms) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, closeBraceToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.declaration, + 5 => this.statement, + _ => null, + }; - public SwitchExpressionSyntax AddArms(params SwitchExpressionArmSyntax[] items) => WithArms(this.Arms.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFixedStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode + public FixedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) { - private PatternSyntax? pattern; - private WhenClauseSyntax? whenClause; - private ExpressionSyntax? expression; - - internal SwitchExpressionArmSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) { + var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PatternSyntax Pattern => GetRedAtZero(ref this.pattern)!; + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FixedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithFixedKeyword(SyntaxToken fixedKeyword) => Update(this.AttributeLists, fixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.FixedKeyword, openParenToken, this.Declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, closeParenToken, this.Statement); + public FixedStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, statement); - public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 1); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FixedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public FixedStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); +} - public SyntaxToken EqualsGreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionArmSyntax)this.Green).equalsGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class CheckedStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private BlockSyntax? block; - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + internal CheckedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.pattern)!, - 1 => GetRed(ref this.whenClause, 1), - 3 => GetRed(ref this.expression, 3)!, - _ => null, - }; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.pattern, - 1 => this.whenClause, - 3 => this.expression, - _ => null, - }; + public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedStatementSyntax)this.Green).keyword, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpressionArm(this); + public BlockSyntax Block => GetRed(ref this.block, 2)!; - public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression) - { - var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.block, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.block, + _ => null, + }; - public SwitchExpressionArmSyntax WithPattern(PatternSyntax pattern) => Update(pattern, this.WhenClause, this.EqualsGreaterThanToken, this.Expression); - public SwitchExpressionArmSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Pattern, whenClause, this.EqualsGreaterThanToken, this.Expression); - public SwitchExpressionArmSyntax WithEqualsGreaterThanToken(SyntaxToken equalsGreaterThanToken) => Update(this.Pattern, this.WhenClause, equalsGreaterThanToken, this.Expression); - public SwitchExpressionArmSyntax WithExpression(ExpressionSyntax expression) => Update(this.Pattern, this.WhenClause, this.EqualsGreaterThanToken, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TryStatementSyntax : StatementSyntax + public CheckedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) { - private SyntaxNode? attributeLists; - private BlockSyntax? block; - private SyntaxNode? catches; - private FinallyClauseSyntax? @finally; - - internal TryStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) { + var newNode = SyntaxFactory.CheckedStatement(this.Kind(), attributeLists, keyword, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken TryKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.TryStatementSyntax)this.Green).tryKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new CheckedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Keyword, this.Block); + public CheckedStatementSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, keyword, this.Block); + public CheckedStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.Keyword, block); - public BlockSyntax Block => GetRed(ref this.block, 2)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new CheckedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public CheckedStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public CheckedStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); +} - public SyntaxList Catches => new SyntaxList(GetRed(ref this.catches, 3)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class UnsafeStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private BlockSyntax? block; - public FinallyClauseSyntax? Finally => GetRed(ref this.@finally, 4); + internal UnsafeStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.block, 2)!, - 3 => GetRed(ref this.catches, 3)!, - 4 => GetRed(ref this.@finally, 4), - _ => null, - }; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.block, - 3 => this.catches, - 4 => this.@finally, - _ => null, - }; + public SyntaxToken UnsafeKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UnsafeStatementSyntax)this.Green).unsafeKeyword, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTryStatement(this); + public BlockSyntax Block => GetRed(ref this.block, 2)!; - public TryStatementSyntax Update(SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, SyntaxList catches, FinallyClauseSyntax? @finally) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) - { - var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.block, 2)!, + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new TryStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.TryKeyword, this.Block, this.Catches, this.Finally); - public TryStatementSyntax WithTryKeyword(SyntaxToken tryKeyword) => Update(this.AttributeLists, tryKeyword, this.Block, this.Catches, this.Finally); - public TryStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.TryKeyword, block, this.Catches, this.Finally); - public TryStatementSyntax WithCatches(SyntaxList catches) => Update(this.AttributeLists, this.TryKeyword, this.Block, catches, this.Finally); - public TryStatementSyntax WithFinally(FinallyClauseSyntax? @finally) => Update(this.AttributeLists, this.TryKeyword, this.Block, this.Catches, @finally); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.block, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new TryStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public TryStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public TryStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); - public TryStatementSyntax AddCatches(params CatchClauseSyntax[] items) => WithCatches(this.Catches.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnsafeStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CatchClauseSyntax : CSharpSyntaxNode + public UnsafeStatementSyntax Update(SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) { - private CatchDeclarationSyntax? declaration; - private CatchFilterClauseSyntax? filter; - private BlockSyntax? block; - - internal CatchClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) { + var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken CatchKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchClauseSyntax)this.Green).catchKeyword, Position, 0); - - public CatchDeclarationSyntax? Declaration => GetRed(ref this.declaration, 1); + return this; + } - public CatchFilterClauseSyntax? Filter => GetRed(ref this.filter, 2); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new UnsafeStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.UnsafeKeyword, this.Block); + public UnsafeStatementSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.AttributeLists, unsafeKeyword, this.Block); + public UnsafeStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.UnsafeKeyword, block); - public BlockSyntax Block => GetRed(ref this.block, 3)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new UnsafeStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public UnsafeStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public UnsafeStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.declaration, 1), - 2 => GetRed(ref this.filter, 2), - 3 => GetRed(ref this.block, 3)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LockStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; + private StatementSyntax? statement; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.declaration, - 2 => this.filter, - 3 => this.block, - _ => null, - }; + internal LockStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchClause(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - { - if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block) - { - var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken LockKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).lockKeyword, GetChildPosition(1), GetChildIndex(1)); - return this; - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - public CatchClauseSyntax WithCatchKeyword(SyntaxToken catchKeyword) => Update(catchKeyword, this.Declaration, this.Filter, this.Block); - public CatchClauseSyntax WithDeclaration(CatchDeclarationSyntax? declaration) => Update(this.CatchKeyword, declaration, this.Filter, this.Block); - public CatchClauseSyntax WithFilter(CatchFilterClauseSyntax? filter) => Update(this.CatchKeyword, this.Declaration, filter, this.Block); - public CatchClauseSyntax WithBlock(BlockSyntax block) => Update(this.CatchKeyword, this.Declaration, this.Filter, block); + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public CatchClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public CatchClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); - } + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode - { - private TypeSyntax? type; + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - internal CatchDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3)!, + 5 => GetRed(ref this.statement, 5)!, + _ => null, + }; - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).openParenToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + 5 => this.statement, + _ => null, + }; - public TypeSyntax Type => GetRed(ref this.type, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLockStatement(this); - public SyntaxToken Identifier + public LockStatementSyntax Update(SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { - get - { - var slot = ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).identifier; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } + var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchDeclaration(this); + return this; + } - public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LockStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithLockKeyword(SyntaxToken lockKeyword) => Update(this.AttributeLists, lockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.LockKeyword, openParenToken, this.Expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.Statement); + public LockStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, statement); - return this; - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LockStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public CatchDeclarationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.Identifier, this.CloseParenToken); - public CatchDeclarationSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.Identifier, this.CloseParenToken); - public CatchDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.OpenParenToken, this.Type, identifier, this.CloseParenToken); - public CatchDeclarationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, this.Identifier, closeParenToken); - } +/// +/// Represents an if statement syntax. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IfStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? condition; + private StatementSyntax? statement; + private ElseClauseSyntax? @else; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode + internal IfStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? filterExpression; - - internal CatchFilterClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - public SyntaxToken WhenKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).whenKeyword, Position, 0); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + /// + /// Gets a SyntaxToken that represents the if keyword. + /// + public SyntaxToken IfKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); - public ExpressionSyntax FilterExpression => GetRed(ref this.filterExpression, 2)!; + /// + /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. + /// + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// + /// Gets an ExpressionSyntax that represents the condition of the if statement. + /// + public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.filterExpression, 2)! : null; + /// + /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. + /// + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.filterExpression : null; + /// + /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. + /// + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchFilterClause(this); + /// + /// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. + /// + public ElseClauseSyntax? Else => GetRed(ref this.@else, 6); - public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.condition, 3)!, + 5 => GetRed(ref this.statement, 5)!, + 6 => GetRed(ref this.@else, 6), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.condition, + 5 => this.statement, + 6 => this.@else, + _ => null, + }; - public CatchFilterClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.OpenParenToken, this.FilterExpression, this.CloseParenToken); - public CatchFilterClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.WhenKeyword, openParenToken, this.FilterExpression, this.CloseParenToken); - public CatchFilterClauseSyntax WithFilterExpression(ExpressionSyntax filterExpression) => Update(this.WhenKeyword, this.OpenParenToken, filterExpression, this.CloseParenToken); - public CatchFilterClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.WhenKeyword, this.OpenParenToken, this.FilterExpression, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FinallyClauseSyntax : CSharpSyntaxNode + public IfStatementSyntax Update(SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) { - private BlockSyntax? block; - - internal FinallyClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) { + var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken FinallyKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FinallyClauseSyntax)this.Green).finallyKeyword, Position, 0); + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new IfStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.AttributeLists, ifKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.IfKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement, this.Else); + public IfStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement, this.Else); + public IfStatementSyntax WithElse(ElseClauseSyntax? @else) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, @else); - public BlockSyntax Block => GetRed(ref this.block, 1)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new IfStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.block, 1)! : null; +/// Represents an else statement syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ElseClauseSyntax : CSharpSyntaxNode +{ + private StatementSyntax? statement; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.block : null; + internal ElseClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFinallyClause(this); + /// + /// Gets a syntax token + /// + public SyntaxToken ElseKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseClauseSyntax)this.Green).elseKeyword, Position, 0); - public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block) - { - if (finallyKeyword != this.FinallyKeyword || block != this.Block) - { - var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public StatementSyntax Statement => GetRed(ref this.statement, 1)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.statement, 1)! : null; - public FinallyClauseSyntax WithFinallyKeyword(SyntaxToken finallyKeyword) => Update(finallyKeyword, this.Block); - public FinallyClauseSyntax WithBlock(BlockSyntax block) => Update(this.FinallyKeyword, block); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.statement : null; - public FinallyClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public FinallyClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseClause(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CompilationUnitSyntax : CSharpSyntaxNode + public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement) { - private SyntaxNode? externs; - private SyntaxNode? usings; - private SyntaxNode? attributeLists; - private SyntaxNode? members; - - internal CompilationUnitSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (elseKeyword != this.ElseKeyword || statement != this.Statement) { + var newNode = SyntaxFactory.ElseClause(elseKeyword, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 0)); - - public SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 1)); - - /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 2)); + return this; + } - public SyntaxList Members => new SyntaxList(GetRed(ref this.members, 3)); + public ElseClauseSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(elseKeyword, this.Statement); + public ElseClauseSyntax WithStatement(StatementSyntax statement) => Update(this.ElseKeyword, statement); +} - public SyntaxToken EndOfFileToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CompilationUnitSyntax)this.Green).endOfFileToken, GetChildPosition(4), GetChildIndex(4)); +/// Represents a switch statement syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SwitchStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; + private SyntaxNode? sections; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.externs)!, - 1 => GetRed(ref this.usings, 1)!, - 2 => GetRed(ref this.attributeLists, 2)!, - 3 => GetRed(ref this.members, 3)!, - _ => null, - }; + internal SwitchStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.externs, - 1 => this.usings, - 2 => this.attributeLists, - 3 => this.members, - _ => null, - }; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCompilationUnit(this); + /// + /// Gets a SyntaxToken that represents the switch keyword. + /// + public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); - public CompilationUnitSyntax Update(SyntaxList externs, SyntaxList usings, SyntaxList attributeLists, SyntaxList members, SyntaxToken endOfFileToken) + /// + /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. + /// + public SyntaxToken OpenParenToken + { + get { - if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) - { - var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } - - public CompilationUnitSyntax WithExterns(SyntaxList externs) => Update(externs, this.Usings, this.AttributeLists, this.Members, this.EndOfFileToken); - public CompilationUnitSyntax WithUsings(SyntaxList usings) => Update(this.Externs, usings, this.AttributeLists, this.Members, this.EndOfFileToken); - public CompilationUnitSyntax WithAttributeLists(SyntaxList attributeLists) => Update(this.Externs, this.Usings, attributeLists, this.Members, this.EndOfFileToken); - public CompilationUnitSyntax WithMembers(SyntaxList members) => Update(this.Externs, this.Usings, this.AttributeLists, members, this.EndOfFileToken); - public CompilationUnitSyntax WithEndOfFileToken(SyntaxToken endOfFileToken) => Update(this.Externs, this.Usings, this.AttributeLists, this.Members, endOfFileToken); - - public CompilationUnitSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); - public CompilationUnitSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); - public CompilationUnitSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public CompilationUnitSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); } /// - /// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. + /// Gets an ExpressionSyntax representing the expression of the switch statement. /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode - { + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - internal ExternAliasDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. + /// + public SyntaxToken CloseParenToken + { + get { + var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; } + } - /// SyntaxToken representing the extern keyword. - public SyntaxToken ExternKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).externKeyword, Position, 0); - - /// SyntaxToken representing the alias keyword. - public SyntaxToken AliasKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).aliasKeyword, GetChildPosition(1), GetChildIndex(1)); + /// + /// Gets a SyntaxToken that represents the open braces preceding the switch sections. + /// + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openBraceToken, GetChildPosition(5), GetChildIndex(5)); - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + /// + /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. + /// + public SyntaxList Sections => new SyntaxList(GetRed(ref this.sections, 6)); - /// SyntaxToken representing the semicolon token. - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + /// + /// Gets a SyntaxToken that represents the open braces following the switch sections. + /// + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeBraceToken, GetChildPosition(7), GetChildIndex(7)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3)!, + 6 => GetRed(ref this.sections, 6)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + 6 => this.sections, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExternAliasDirective(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchStatement(this); - public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + public SwitchStatementSyntax Update(SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, SyntaxList sections, SyntaxToken closeBraceToken) + { + if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) { - if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ExternAliasDirectiveSyntax WithExternKeyword(SyntaxToken externKeyword) => Update(externKeyword, this.AliasKeyword, this.Identifier, this.SemicolonToken); - public ExternAliasDirectiveSyntax WithAliasKeyword(SyntaxToken aliasKeyword) => Update(this.ExternKeyword, aliasKeyword, this.Identifier, this.SemicolonToken); - public ExternAliasDirectiveSyntax WithIdentifier(SyntaxToken identifier) => Update(this.ExternKeyword, this.AliasKeyword, identifier, this.SemicolonToken); - public ExternAliasDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.ExternKeyword, this.AliasKeyword, this.Identifier, semicolonToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new SwitchStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.AttributeLists, switchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.SwitchKeyword, openParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, openBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithSections(SyntaxList sections) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, sections, this.CloseBraceToken); + public SwitchStatementSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, closeBraceToken); + + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new SwitchStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public SwitchStatementSyntax AddSections(params SwitchSectionSyntax[] items) => WithSections(this.Sections.AddRange(items)); +} + +/// Represents a switch section syntax of a switch statement. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SwitchSectionSyntax : CSharpSyntaxNode +{ + private SyntaxNode? labels; + private SyntaxNode? statements; + + internal SwitchSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private NameEqualsSyntax? alias; - private TypeSyntax? namespaceOrType; + } + + /// + /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. + /// + public SyntaxList Labels => new SyntaxList(GetRed(ref this.labels, 0)); + + /// + /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. + /// + public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 1)); - internal UsingDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } + 0 => GetRedAtZero(ref this.labels)!, + 1 => GetRed(ref this.statements, 1)!, + _ => null, + }; - public SyntaxToken GlobalKeyword + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - get - { - var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword; - return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; - } - } + 0 => this.labels, + 1 => this.statements, + _ => null, + }; - public SyntaxToken UsingKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchSection(this); - public SyntaxToken StaticKeyword + public SwitchSectionSyntax Update(SyntaxList labels, SyntaxList statements) + { + if (labels != this.Labels || statements != this.Statements) { - get - { - var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } + var newNode = SyntaxFactory.SwitchSection(labels, statements); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken UnsafeKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } - } + return this; + } - public NameEqualsSyntax? Alias => GetRed(ref this.alias, 4); + public SwitchSectionSyntax WithLabels(SyntaxList labels) => Update(labels, this.Statements); + public SwitchSectionSyntax WithStatements(SyntaxList statements) => Update(this.Labels, statements); - public TypeSyntax NamespaceOrType => GetRed(ref this.namespaceOrType, 5)!; + public SwitchSectionSyntax AddLabels(params SwitchLabelSyntax[] items) => WithLabels(this.Labels.AddRange(items)); + public SwitchSectionSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); +} - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(6), GetChildIndex(6)); +/// Represents a switch label within a switch statement. +public abstract partial class SwitchLabelSyntax : CSharpSyntaxNode +{ + internal SwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 4 => GetRed(ref this.alias, 4), - 5 => GetRed(ref this.namespaceOrType, 5)!, - _ => null, - }; + /// + /// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. + /// + public abstract SyntaxToken Keyword { get; } + public SwitchLabelSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); + internal abstract SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 4 => this.alias, - 5 => this.namespaceOrType, - _ => null, - }; + /// + /// Gets a SyntaxToken that represents the colon that terminates the switch label. + /// + public abstract SyntaxToken ColonToken { get; } + public SwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); + internal abstract SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingDirective(this); +/// Represents a case label within a switch statement. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax +{ + private PatternSyntax? pattern; + private WhenClauseSyntax? whenClause; - public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) - { - if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || unsafeKeyword != this.UnsafeKeyword || alias != this.Alias || namespaceOrType != this.NamespaceOrType || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal CasePatternSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + /// Gets the case keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).keyword, Position, 0); - public UsingDirectiveSyntax WithGlobalKeyword(SyntaxToken globalKeyword) => Update(globalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.GlobalKeyword, usingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithStaticKeyword(SyntaxToken staticKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, staticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, unsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithAlias(NameEqualsSyntax? alias) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithNamespaceOrType(TypeSyntax namespaceOrType) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, namespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, semicolonToken); - } + /// + /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. + /// + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - /// Member declaration syntax. - public abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode - { - internal MemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 2); - /// Gets the attribute declaration list. - public abstract SyntaxList AttributeLists { get; } - public MemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists); + public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); - public MemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.pattern, 1)!, + 2 => GetRed(ref this.whenClause, 2), + _ => null, + }; - /// Gets the modifier list. - public abstract SyntaxTokenList Modifiers { get; } - public MemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); - internal abstract MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.pattern, + 2 => this.whenClause, + _ => null, + }; - public MemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); - internal abstract MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCasePatternSwitchLabel(this); - public abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax + public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) { - internal BaseNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken) { + var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxToken NamespaceKeyword { get; } - public BaseNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => WithNamespaceKeywordCore(namespaceKeyword); - internal abstract BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword); - - public abstract NameSyntax Name { get; } - public BaseNamespaceDeclarationSyntax WithName(NameSyntax name) => WithNameCore(name); - internal abstract BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name); + return this; + } - public abstract SyntaxList Externs { get; } - public BaseNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => WithExternsCore(externs); - internal abstract BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs); + internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new CasePatternSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Pattern, this.WhenClause, this.ColonToken); + public CasePatternSwitchLabelSyntax WithPattern(PatternSyntax pattern) => Update(this.Keyword, pattern, this.WhenClause, this.ColonToken); + public CasePatternSwitchLabelSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Keyword, this.Pattern, whenClause, this.ColonToken); + internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new CasePatternSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Pattern, this.WhenClause, colonToken); +} - public BaseNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => AddExternsCore(items); - internal abstract BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items); +/// Represents a case label within a switch statement. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax +{ + private ExpressionSyntax? value; - public abstract SyntaxList Usings { get; } - public BaseNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => WithUsingsCore(usings); - internal abstract BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings); + internal CaseSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public BaseNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => AddUsingsCore(items); - internal abstract BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items); + /// Gets the case keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CaseSwitchLabelSyntax)this.Green).keyword, Position, 0); - public abstract SyntaxList Members { get; } - public BaseNamespaceDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); - internal abstract BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members); + /// + /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. + /// + public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - public BaseNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); - internal abstract BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); + public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CaseSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); - public new BaseNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseNamespaceDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseNamespaceDeclarationSyntax)WithModifiersCore(modifiers); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; - public new BaseNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseNamespaceDeclarationSyntax)AddAttributeListsCore(items); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; - public new BaseNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseNamespaceDeclarationSyntax)AddModifiersCore(items); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCaseSwitchLabel(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax + public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) { - private SyntaxNode? attributeLists; - private NameSyntax? name; - private SyntaxNode? externs; - private SyntaxNode? usings; - private SyntaxNode? members; - - internal NamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken) { + var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new CaseSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Value, this.ColonToken); + public CaseSwitchLabelSyntax WithValue(ExpressionSyntax value) => Update(this.Keyword, value, this.ColonToken); + internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new CaseSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Value, colonToken); +} - public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); +/// Represents a default label within a switch statement. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax +{ - public override NameSyntax Name => GetRed(ref this.name, 3)!; + internal DefaultSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).openBraceToken, GetChildPosition(4), GetChildIndex(4)); + /// Gets the default keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultSwitchLabelSyntax)this.Green).keyword, Position, 0); - public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); + public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultSwitchLabel(this); - /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken + public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken) + { + if (keyword != this.Keyword || colonToken != this.ColonToken) { - get - { - var slot = ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; - } + var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.name, 3)!, - 5 => GetRed(ref this.externs, 5)!, - 6 => GetRed(ref this.usings, 6)!, - 7 => GetRed(ref this.members, 7)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.name, - 5 => this.externs, - 6 => this.usings, - 7 => this.members, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNamespaceDeclaration(this); + internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new DefaultSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.ColonToken); + internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new DefaultSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, colonToken); +} - public NamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, SyntaxList externs, SyntaxList usings, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SwitchExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? governingExpression; + private SyntaxNode? arms; - return this; - } + internal SwitchExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new NamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new NamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); - public new NamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); - public new NamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - public NamespaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, openBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); - public new NamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); - public new NamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new NamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, members, this.CloseBraceToken, this.SemicolonToken); - public NamespaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, closeBraceToken, this.SemicolonToken); - public NamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, semicolonToken); + public ExpressionSyntax GoverningExpression => GetRedAtZero(ref this.governingExpression)!; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new NamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new NamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); - public new NamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); - public new NamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new NamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax - { - private SyntaxNode? attributeLists; - private NameSyntax? name; - private SyntaxNode? externs; - private SyntaxNode? usings; - private SyntaxNode? members; - - internal FileScopedNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); - - public override NameSyntax Name => GetRed(ref this.name, 3)!; - - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - - public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); - - public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); - - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.name, 3)!, - 5 => GetRed(ref this.externs, 5)!, - 6 => GetRed(ref this.usings, 6)!, - 7 => GetRed(ref this.members, 7)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.name, - 5 => this.externs, - 6 => this.usings, - 7 => this.members, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFileScopedNamespaceDeclaration(this); - - public FileScopedNamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, SyntaxList externs, SyntaxList usings, SyntaxList members) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) - { - var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FileScopedNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new FileScopedNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); - public new FileScopedNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); - public new FileScopedNamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - public FileScopedNamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, semicolonToken, this.Externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); - public new FileScopedNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); - public new FileScopedNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new FileScopedNamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, members); + public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FileScopedNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new FileScopedNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); - public new FileScopedNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); - public new FileScopedNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new FileScopedNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); - /// Class representing one or more attributes applied to a language construct. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AttributeListSyntax : CSharpSyntaxNode + public SeparatedSyntaxList Arms { - private AttributeTargetSpecifierSyntax? target; - private SyntaxNode? attributes; - - internal AttributeListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var red = GetRed(ref this.arms, 3); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; } + } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeListSyntax)this.Green).openBracketToken, Position, 0); - - /// Gets the optional construct targeted by the attribute. - public AttributeTargetSpecifierSyntax? Target => GetRed(ref this.target, 1); + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); - /// Gets the attribute declaration list. - public SeparatedSyntaxList Attributes + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var red = GetRed(ref this.attributes, 2); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; - } - } + 0 => GetRedAtZero(ref this.governingExpression)!, + 3 => GetRed(ref this.arms, 3)!, + _ => null, + }; - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.target, 1), - 2 => GetRed(ref this.attributes, 2)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.target, - 2 => this.attributes, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.governingExpression, + 3 => this.arms, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpression(this); - public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + { + if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) { - if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AttributeListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Target, this.Attributes, this.CloseBracketToken); - public AttributeListSyntax WithTarget(AttributeTargetSpecifierSyntax? target) => Update(this.OpenBracketToken, target, this.Attributes, this.CloseBracketToken); - public AttributeListSyntax WithAttributes(SeparatedSyntaxList attributes) => Update(this.OpenBracketToken, this.Target, attributes, this.CloseBracketToken); - public AttributeListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Target, this.Attributes, closeBracketToken); - - public AttributeListSyntax AddAttributes(params AttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); + return this; } - /// Class representing what language construct an attribute targets. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode - { + public SwitchExpressionSyntax WithGoverningExpression(ExpressionSyntax governingExpression) => Update(governingExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.GoverningExpression, switchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, openBraceToken, this.Arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithArms(SeparatedSyntaxList arms) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, closeBraceToken); - internal AttributeTargetSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SwitchExpressionSyntax AddArms(params SwitchExpressionArmSyntax[] items) => WithArms(this.Arms.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode +{ + private PatternSyntax? pattern; + private WhenClauseSyntax? whenClause; + private ExpressionSyntax? expression; - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).identifier, Position, 0); + internal SwitchExpressionArmSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public PatternSyntax Pattern => GetRedAtZero(ref this.pattern)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 1); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken EqualsGreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionArmSyntax)this.Green).equalsGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeTargetSpecifier(this); + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (identifier != this.Identifier || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.pattern)!, + 1 => GetRed(ref this.whenClause, 1), + 3 => GetRed(ref this.expression, 3)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.pattern, + 1 => this.whenClause, + 3 => this.expression, + _ => null, + }; - public AttributeTargetSpecifierSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ColonToken); - public AttributeTargetSpecifierSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Identifier, colonToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpressionArm(this); - /// Attribute syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AttributeSyntax : CSharpSyntaxNode + public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) { - private NameSyntax? name; - private AttributeArgumentListSyntax? argumentList; - - internal AttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression) { + var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the name. - public NameSyntax Name => GetRedAtZero(ref this.name)!; - - public AttributeArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 1 => GetRed(ref this.argumentList, 1), - _ => null, - }; + public SwitchExpressionArmSyntax WithPattern(PatternSyntax pattern) => Update(pattern, this.WhenClause, this.EqualsGreaterThanToken, this.Expression); + public SwitchExpressionArmSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Pattern, whenClause, this.EqualsGreaterThanToken, this.Expression); + public SwitchExpressionArmSyntax WithEqualsGreaterThanToken(SyntaxToken equalsGreaterThanToken) => Update(this.Pattern, this.WhenClause, equalsGreaterThanToken, this.Expression); + public SwitchExpressionArmSyntax WithExpression(ExpressionSyntax expression) => Update(this.Pattern, this.WhenClause, this.EqualsGreaterThanToken, expression); +} - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.argumentList, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TryStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private BlockSyntax? block; + private SyntaxNode? catches; + private FinallyClauseSyntax? @finally; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttribute(this); + internal TryStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax? argumentList) - { - if (name != this.Name || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.Attribute(name, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - return this; - } + public SyntaxToken TryKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.TryStatementSyntax)this.Green).tryKeyword, GetChildPosition(1), GetChildIndex(1)); - public AttributeSyntax WithName(NameSyntax name) => Update(name, this.ArgumentList); - public AttributeSyntax WithArgumentList(AttributeArgumentListSyntax? argumentList) => Update(this.Name, argumentList); + public BlockSyntax Block => GetRed(ref this.block, 2)!; - public AttributeSyntax AddArgumentListArguments(params AttributeArgumentSyntax[] items) - { - var argumentList = this.ArgumentList ?? SyntaxFactory.AttributeArgumentList(); - return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); - } - } + public SyntaxList Catches => new SyntaxList(GetRed(ref this.catches, 3)); - /// Attribute argument list syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode - { - private SyntaxNode? arguments; + public FinallyClauseSyntax? Finally => GetRed(ref this.@finally, 4); - internal AttributeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } - - /// Gets the open paren token. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.block, 2)!, + 3 => GetRed(ref this.catches, 3)!, + 4 => GetRed(ref this.@finally, 4), + _ => null, + }; - /// Gets the arguments syntax list. - public SeparatedSyntaxList Arguments + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } - - /// Gets the close paren token. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + 0 => this.attributeLists, + 2 => this.block, + 3 => this.catches, + 4 => this.@finally, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgumentList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTryStatement(this); - public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public TryStatementSyntax Update(SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, SyntaxList catches, FinallyClauseSyntax? @finally) + { + if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AttributeArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); - public AttributeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); - public AttributeArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); - - public AttributeArgumentListSyntax AddArguments(params AttributeArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); + return this; } - /// Attribute argument syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode - { - private NameEqualsSyntax? nameEquals; - private NameColonSyntax? nameColon; - private ExpressionSyntax? expression; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new TryStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.TryKeyword, this.Block, this.Catches, this.Finally); + public TryStatementSyntax WithTryKeyword(SyntaxToken tryKeyword) => Update(this.AttributeLists, tryKeyword, this.Block, this.Catches, this.Finally); + public TryStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.TryKeyword, block, this.Catches, this.Finally); + public TryStatementSyntax WithCatches(SyntaxList catches) => Update(this.AttributeLists, this.TryKeyword, this.Block, catches, this.Finally); + public TryStatementSyntax WithFinally(FinallyClauseSyntax? @finally) => Update(this.AttributeLists, this.TryKeyword, this.Block, this.Catches, @finally); - internal AttributeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new TryStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public TryStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public TryStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); + public TryStatementSyntax AddCatches(params CatchClauseSyntax[] items) => WithCatches(this.Catches.AddRange(items)); +} - public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CatchClauseSyntax : CSharpSyntaxNode +{ + private CatchDeclarationSyntax? declaration; + private CatchFilterClauseSyntax? filter; + private BlockSyntax? block; - public NameColonSyntax? NameColon => GetRed(ref this.nameColon, 1); + internal CatchClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the expression. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + public SyntaxToken CatchKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchClauseSyntax)this.Green).catchKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.nameEquals), - 1 => GetRed(ref this.nameColon, 1), - 2 => GetRed(ref this.expression, 2)!, - _ => null, - }; + public CatchDeclarationSyntax? Declaration => GetRed(ref this.declaration, 1); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.nameEquals, - 1 => this.nameColon, - 2 => this.expression, - _ => null, - }; + public CatchFilterClauseSyntax? Filter => GetRed(ref this.filter, 2); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgument(this); + public BlockSyntax Block => GetRed(ref this.block, 3)!; - public AttributeArgumentSyntax Update(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression) - { - var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 1 => GetRed(ref this.declaration, 1), + 2 => GetRed(ref this.filter, 2), + 3 => GetRed(ref this.block, 3)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.declaration, + 2 => this.filter, + 3 => this.block, + _ => null, + }; - public AttributeArgumentSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.NameColon, this.Expression); - public AttributeArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(this.NameEquals, nameColon, this.Expression); - public AttributeArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, this.NameColon, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchClause(this); - /// Class representing an identifier name followed by an equals token. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NameEqualsSyntax : CSharpSyntaxNode + public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) { - private IdentifierNameSyntax? name; - - internal NameEqualsSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block) { + var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the identifier name. - public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; - - public SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NameEqualsSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameEquals(this); + return this; + } - public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken) - { - if (name != this.Name || equalsToken != this.EqualsToken) - { - var newNode = SyntaxFactory.NameEquals(name, equalsToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public CatchClauseSyntax WithCatchKeyword(SyntaxToken catchKeyword) => Update(catchKeyword, this.Declaration, this.Filter, this.Block); + public CatchClauseSyntax WithDeclaration(CatchDeclarationSyntax? declaration) => Update(this.CatchKeyword, declaration, this.Filter, this.Block); + public CatchClauseSyntax WithFilter(CatchFilterClauseSyntax? filter) => Update(this.CatchKeyword, this.Declaration, filter, this.Block); + public CatchClauseSyntax WithBlock(BlockSyntax block) => Update(this.CatchKeyword, this.Declaration, this.Filter, block); - return this; - } + public CatchClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public CatchClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); +} - public NameEqualsSyntax WithName(IdentifierNameSyntax name) => Update(name, this.EqualsToken); - public NameEqualsSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken); - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode +{ + private TypeSyntax? type; - /// Type parameter list syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeParameterListSyntax : CSharpSyntaxNode + internal CatchDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? parameters; + } - internal TypeParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).openParenToken, Position, 0); - /// Gets the < token. - public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); + public TypeSyntax Type => GetRed(ref this.type, 1)!; - /// Gets the parameter list. - public SeparatedSyntaxList Parameters + public SyntaxToken Identifier + { + get { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var slot = ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).identifier; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } + } - /// Gets the > token. - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchDeclaration(this); - public TypeParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken) { - if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TypeParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); - public TypeParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); - public TypeParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); - - public TypeParameterListSyntax AddParameters(params TypeParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); + return this; } - /// Type parameter syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeParameterSyntax : CSharpSyntaxNode - { - private SyntaxNode? attributeLists; - - internal TypeParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public CatchDeclarationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.Identifier, this.CloseParenToken); + public CatchDeclarationSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.Identifier, this.CloseParenToken); + public CatchDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.OpenParenToken, this.Type, identifier, this.CloseParenToken); + public CatchDeclarationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, this.Identifier, closeParenToken); +} - public SyntaxToken VarianceKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? filterExpression; - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + internal CatchFilterClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + public SyntaxToken WhenKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).whenKeyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameter(this); + public ExpressionSyntax FilterExpression => GetRed(ref this.filterExpression, 2)!; - public TypeParameterSyntax Update(SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) - { - if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) - { - var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.filterExpression, 2)! : null; - public TypeParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.VarianceKeyword, this.Identifier); - public TypeParameterSyntax WithVarianceKeyword(SyntaxToken varianceKeyword) => Update(this.AttributeLists, varianceKeyword, this.Identifier); - public TypeParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.VarianceKeyword, identifier); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.filterExpression : null; - public TypeParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchFilterClause(this); - /// Base class for type declaration syntax. - public abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax + public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) { - internal BaseTypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the identifier. - public abstract SyntaxToken Identifier { get; } - public BaseTypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); - internal abstract BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier); + return this; + } - /// Gets the base type list. - public abstract BaseListSyntax? BaseList { get; } - public BaseTypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => WithBaseListCore(baseList); - internal abstract BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList); + public CatchFilterClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.OpenParenToken, this.FilterExpression, this.CloseParenToken); + public CatchFilterClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.WhenKeyword, openParenToken, this.FilterExpression, this.CloseParenToken); + public CatchFilterClauseSyntax WithFilterExpression(ExpressionSyntax filterExpression) => Update(this.WhenKeyword, this.OpenParenToken, filterExpression, this.CloseParenToken); + public CatchFilterClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.WhenKeyword, this.OpenParenToken, this.FilterExpression, closeParenToken); +} - public BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); - internal abstract BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FinallyClauseSyntax : CSharpSyntaxNode +{ + private BlockSyntax? block; - /// Gets the open brace token. - public abstract SyntaxToken OpenBraceToken { get; } - public BaseTypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => WithOpenBraceTokenCore(openBraceToken); - internal abstract BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken); + internal FinallyClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the close brace token. - public abstract SyntaxToken CloseBraceToken { get; } - public BaseTypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => WithCloseBraceTokenCore(closeBraceToken); - internal abstract BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken); + public SyntaxToken FinallyKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FinallyClauseSyntax)this.Green).finallyKeyword, Position, 0); - /// Gets the optional semicolon token. - public abstract SyntaxToken SemicolonToken { get; } - public BaseTypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); - internal abstract BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); + public BlockSyntax Block => GetRed(ref this.block, 1)!; - public new BaseTypeDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseTypeDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseTypeDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseTypeDeclarationSyntax)WithModifiersCore(modifiers); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.block, 1)! : null; - public new BaseTypeDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseTypeDeclarationSyntax)AddAttributeListsCore(items); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.block : null; - public new BaseTypeDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseTypeDeclarationSyntax)AddModifiersCore(items); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFinallyClause(this); - /// Base class for type declaration syntax (class, struct, interface, record). - public abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax + public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block) { - internal TypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (finallyKeyword != this.FinallyKeyword || block != this.Block) { + var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the type keyword token ("class", "struct", "interface", "record"). - public abstract SyntaxToken Keyword { get; } - public TypeDeclarationSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); - internal abstract TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword); - - public abstract TypeParameterListSyntax? TypeParameterList { get; } - public TypeDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => WithTypeParameterListCore(typeParameterList); - internal abstract TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList); + return this; + } - public TypeDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) => AddTypeParameterListParametersCore(items); - internal abstract TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items); + public FinallyClauseSyntax WithFinallyKeyword(SyntaxToken finallyKeyword) => Update(finallyKeyword, this.Block); + public FinallyClauseSyntax WithBlock(BlockSyntax block) => Update(this.FinallyKeyword, block); - public abstract ParameterListSyntax? ParameterList { get; } - public TypeDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => WithParameterListCore(parameterList); - internal abstract TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList); + public FinallyClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public FinallyClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); +} - public TypeDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); - internal abstract TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CompilationUnitSyntax : CSharpSyntaxNode +{ + private SyntaxNode? externs; + private SyntaxNode? usings; + private SyntaxNode? attributeLists; + private SyntaxNode? members; - /// Gets the type constraint list. - public abstract SyntaxList ConstraintClauses { get; } - public TypeDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => WithConstraintClausesCore(constraintClauses); - internal abstract TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses); + internal CompilationUnitSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public TypeDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClausesCore(items); - internal abstract TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items); + public SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 0)); - /// Gets the member declarations. - public abstract SyntaxList Members { get; } - public TypeDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); - internal abstract TypeDeclarationSyntax WithMembersCore(SyntaxList members); + public SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 1)); - public TypeDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); - internal abstract TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); + /// Gets the attribute declaration list. + public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 2)); - public new TypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => (TypeDeclarationSyntax)WithIdentifierCore(identifier); - public new TypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => (TypeDeclarationSyntax)WithBaseListCore(baseList); - public new TypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => (TypeDeclarationSyntax)WithOpenBraceTokenCore(openBraceToken); - public new TypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => (TypeDeclarationSyntax)WithCloseBraceTokenCore(closeBraceToken); - public new TypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => (TypeDeclarationSyntax)WithSemicolonTokenCore(semicolonToken); + public SyntaxList Members => new SyntaxList(GetRed(ref this.members, 3)); - public new BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); - } + public SyntaxToken EndOfFileToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CompilationUnitSyntax)this.Green).endOfFileToken, GetChildPosition(4), GetChildIndex(4)); - /// Class type declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.externs)!, + 1 => GetRed(ref this.usings, 1)!, + 2 => GetRed(ref this.attributeLists, 2)!, + 3 => GetRed(ref this.members, 3)!, + _ => null, + }; - internal ClassDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 0 => this.externs, + 1 => this.usings, + 2 => this.attributeLists, + 3 => this.members, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCompilationUnit(this); - public override SyntaxTokenList Modifiers + public CompilationUnitSyntax Update(SyntaxList externs, SyntaxList usings, SyntaxList attributeLists, SyntaxList members, SyntaxToken endOfFileToken) + { + if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the class keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public CompilationUnitSyntax WithExterns(SyntaxList externs) => Update(externs, this.Usings, this.AttributeLists, this.Members, this.EndOfFileToken); + public CompilationUnitSyntax WithUsings(SyntaxList usings) => Update(this.Externs, usings, this.AttributeLists, this.Members, this.EndOfFileToken); + public CompilationUnitSyntax WithAttributeLists(SyntaxList attributeLists) => Update(this.Externs, this.Usings, attributeLists, this.Members, this.EndOfFileToken); + public CompilationUnitSyntax WithMembers(SyntaxList members) => Update(this.Externs, this.Usings, this.AttributeLists, members, this.EndOfFileToken); + public CompilationUnitSyntax WithEndOfFileToken(SyntaxToken endOfFileToken) => Update(this.Externs, this.Usings, this.AttributeLists, this.Members, endOfFileToken); - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + public CompilationUnitSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); + public CompilationUnitSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); + public CompilationUnitSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public CompilationUnitSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); +/// +/// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode +{ - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + internal ExternAliasDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + /// SyntaxToken representing the extern keyword. + public SyntaxToken ExternKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).externKeyword, Position, 0); - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } + /// SyntaxToken representing the alias keyword. + public SyntaxToken AliasKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).aliasKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } + /// SyntaxToken representing the semicolon token. + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } - } - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5), - 6 => GetRed(ref this.baseList, 6), - 7 => GetRed(ref this.constraintClauses, 7)!, - 9 => GetRed(ref this.members, 9)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 9 => this.members, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExternAliasDirective(this); - public ClassDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + { + if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ClassDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ClassDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new ClassDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new ClassDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new ClassDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new ClassDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new ClassDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new ClassDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new ClassDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new ClassDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new ClassDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new ClassDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + return this; + } - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ClassDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ClassDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new ClassDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + public ExternAliasDirectiveSyntax WithExternKeyword(SyntaxToken externKeyword) => Update(externKeyword, this.AliasKeyword, this.Identifier, this.SemicolonToken); + public ExternAliasDirectiveSyntax WithAliasKeyword(SyntaxToken aliasKeyword) => Update(this.ExternKeyword, aliasKeyword, this.Identifier, this.SemicolonToken); + public ExternAliasDirectiveSyntax WithIdentifier(SyntaxToken identifier) => Update(this.ExternKeyword, this.AliasKeyword, identifier, this.SemicolonToken); + public ExternAliasDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.ExternKeyword, this.AliasKeyword, this.Identifier, semicolonToken); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode +{ + private NameEqualsSyntax? alias; + private TypeSyntax? namespaceOrType; + + internal UsingDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public SyntaxToken GlobalKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword; + return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; + } + } + + public SyntaxToken UsingKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); + + public SyntaxToken StaticKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + } + } + + public SyntaxToken UnsafeKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } + + public NameEqualsSyntax? Alias => GetRed(ref this.alias, 4); + + public TypeSyntax NamespaceOrType => GetRed(ref this.namespaceOrType, 5)!; + + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(6), GetChildIndex(6)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 4 => GetRed(ref this.alias, 4), + 5 => GetRed(ref this.namespaceOrType, 5)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 4 => this.alias, + 5 => this.namespaceOrType, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingDirective(this); + + public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + { + if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || unsafeKeyword != this.UnsafeKeyword || alias != this.Alias || namespaceOrType != this.NamespaceOrType || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public UsingDirectiveSyntax WithGlobalKeyword(SyntaxToken globalKeyword) => Update(globalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.GlobalKeyword, usingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithStaticKeyword(SyntaxToken staticKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, staticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, unsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithAlias(NameEqualsSyntax? alias) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithNamespaceOrType(TypeSyntax namespaceOrType) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, namespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, semicolonToken); +} + +/// Member declaration syntax. +public abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode +{ + internal MemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the attribute declaration list. + public abstract SyntaxList AttributeLists { get; } + public MemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists); + + public MemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + + /// Gets the modifier list. + public abstract SyntaxTokenList Modifiers { get; } + public MemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); + internal abstract MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers); + + public MemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); + internal abstract MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items); +} + +public abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public abstract SyntaxToken NamespaceKeyword { get; } + public BaseNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => WithNamespaceKeywordCore(namespaceKeyword); + internal abstract BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword); + + public abstract NameSyntax Name { get; } + public BaseNamespaceDeclarationSyntax WithName(NameSyntax name) => WithNameCore(name); + internal abstract BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name); + + public abstract SyntaxList Externs { get; } + public BaseNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => WithExternsCore(externs); + internal abstract BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs); + + public BaseNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => AddExternsCore(items); + internal abstract BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items); + + public abstract SyntaxList Usings { get; } + public BaseNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => WithUsingsCore(usings); + internal abstract BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings); + + public BaseNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => AddUsingsCore(items); + internal abstract BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items); + + public abstract SyntaxList Members { get; } + public BaseNamespaceDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); + internal abstract BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members); + + public BaseNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); + internal abstract BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); + + public new BaseNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseNamespaceDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseNamespaceDeclarationSyntax)WithModifiersCore(modifiers); + + public new BaseNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseNamespaceDeclarationSyntax)AddAttributeListsCore(items); + + public new BaseNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseNamespaceDeclarationSyntax)AddModifiersCore(items); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private NameSyntax? name; + private SyntaxNode? externs; + private SyntaxNode? usings; + private SyntaxNode? members; + + internal NamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + + public override NameSyntax Name => GetRed(ref this.name, 3)!; + + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).openBraceToken, GetChildPosition(4), GetChildIndex(4)); + + public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); + + public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); + + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); + + /// Gets the optional semicolon token. + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.name, 3)!, + 5 => GetRed(ref this.externs, 5)!, + 6 => GetRed(ref this.usings, 6)!, + 7 => GetRed(ref this.members, 7)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.name, + 5 => this.externs, + 6 => this.usings, + 7 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNamespaceDeclaration(this); + + public NamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, SyntaxList externs, SyntaxList usings, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new NamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new NamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); + public new NamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); + public new NamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + public NamespaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, openBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); + public new NamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); + public new NamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new NamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, members, this.CloseBraceToken, this.SemicolonToken); + public NamespaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, closeBraceToken, this.SemicolonToken); + public NamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new NamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new NamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); + public new NamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); + public new NamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new NamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private NameSyntax? name; + private SyntaxNode? externs; + private SyntaxNode? usings; + private SyntaxNode? members; + + internal FileScopedNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + + public override NameSyntax Name => GetRed(ref this.name, 3)!; + + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + + public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); + + public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.name, 3)!, + 5 => GetRed(ref this.externs, 5)!, + 6 => GetRed(ref this.usings, 6)!, + 7 => GetRed(ref this.members, 7)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.name, + 5 => this.externs, + 6 => this.usings, + 7 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFileScopedNamespaceDeclaration(this); + + public FileScopedNamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, SyntaxList externs, SyntaxList usings, SyntaxList members) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) + { + var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FileScopedNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new FileScopedNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); + public new FileScopedNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); + public new FileScopedNamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + public FileScopedNamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, semicolonToken, this.Externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); + public new FileScopedNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); + public new FileScopedNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new FileScopedNamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, members); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FileScopedNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new FileScopedNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); + public new FileScopedNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); + public new FileScopedNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new FileScopedNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// Class representing one or more attributes applied to a language construct. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AttributeListSyntax : CSharpSyntaxNode +{ + private AttributeTargetSpecifierSyntax? target; + private SyntaxNode? attributes; + + internal AttributeListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeListSyntax)this.Green).openBracketToken, Position, 0); + + /// Gets the optional construct targeted by the attribute. + public AttributeTargetSpecifierSyntax? Target => GetRed(ref this.target, 1); + + /// Gets the attribute declaration list. + public SeparatedSyntaxList Attributes + { + get + { + var red = GetRed(ref this.attributes, 2); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; + } + } + + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.target, 1), + 2 => GetRed(ref this.attributes, 2)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.target, + 2 => this.attributes, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeList(this); + + public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) + { + var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Target, this.Attributes, this.CloseBracketToken); + public AttributeListSyntax WithTarget(AttributeTargetSpecifierSyntax? target) => Update(this.OpenBracketToken, target, this.Attributes, this.CloseBracketToken); + public AttributeListSyntax WithAttributes(SeparatedSyntaxList attributes) => Update(this.OpenBracketToken, this.Target, attributes, this.CloseBracketToken); + public AttributeListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Target, this.Attributes, closeBracketToken); + + public AttributeListSyntax AddAttributes(params AttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); +} + +/// Class representing what language construct an attribute targets. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode +{ + + internal AttributeTargetSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).identifier, Position, 0); + + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + + internal override SyntaxNode? GetNodeSlot(int index) => null; + + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeTargetSpecifier(this); + + public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken) + { + if (identifier != this.Identifier || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeTargetSpecifierSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ColonToken); + public AttributeTargetSpecifierSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Identifier, colonToken); +} + +/// Attribute syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AttributeSyntax : CSharpSyntaxNode +{ + private NameSyntax? name; + private AttributeArgumentListSyntax? argumentList; + + internal AttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the name. + public NameSyntax Name => GetRedAtZero(ref this.name)!; + + public AttributeArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.name)!, + 1 => GetRed(ref this.argumentList, 1), + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.argumentList, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttribute(this); + + public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax? argumentList) + { + if (name != this.Name || argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.Attribute(name, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeSyntax WithName(NameSyntax name) => Update(name, this.ArgumentList); + public AttributeSyntax WithArgumentList(AttributeArgumentListSyntax? argumentList) => Update(this.Name, argumentList); + + public AttributeSyntax AddArgumentListArguments(params AttributeArgumentSyntax[] items) + { + var argumentList = this.ArgumentList ?? SyntaxFactory.AttributeArgumentList(); + return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); + } +} + +/// Attribute argument list syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? arguments; + + internal AttributeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the open paren token. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); + + /// Gets the arguments syntax list. + public SeparatedSyntaxList Arguments + { + get + { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } + + /// Gets the close paren token. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgumentList(this); + + public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); + public AttributeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); + public AttributeArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); + + public AttributeArgumentListSyntax AddArguments(params AttributeArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +} + +/// Attribute argument syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode +{ + private NameEqualsSyntax? nameEquals; + private NameColonSyntax? nameColon; + private ExpressionSyntax? expression; + + internal AttributeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); + + public NameColonSyntax? NameColon => GetRed(ref this.nameColon, 1); + + /// Gets the expression. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.nameEquals), + 1 => GetRed(ref this.nameColon, 1), + 2 => GetRed(ref this.expression, 2)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.nameEquals, + 1 => this.nameColon, + 2 => this.expression, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgument(this); + + public AttributeArgumentSyntax Update(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + { + if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression) + { + var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeArgumentSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.NameColon, this.Expression); + public AttributeArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(this.NameEquals, nameColon, this.Expression); + public AttributeArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, this.NameColon, expression); +} + +/// Class representing an identifier name followed by an equals token. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NameEqualsSyntax : CSharpSyntaxNode +{ + private IdentifierNameSyntax? name; + + internal NameEqualsSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the identifier name. + public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; + + public SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NameEqualsSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameEquals(this); + + public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken) + { + if (name != this.Name || equalsToken != this.EqualsToken) + { + var newNode = SyntaxFactory.NameEquals(name, equalsToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public NameEqualsSyntax WithName(IdentifierNameSyntax name) => Update(name, this.EqualsToken); + public NameEqualsSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken); +} + +/// Type parameter list syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeParameterListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? parameters; + + internal TypeParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the < token. + public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); + + /// Gets the parameter list. + public SeparatedSyntaxList Parameters + { + get + { + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } + + /// Gets the > token. + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterList(this); + + public TypeParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) + { + var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public TypeParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); + public TypeParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); + public TypeParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); + + public TypeParameterListSyntax AddParameters(params TypeParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} + +/// Type parameter syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeParameterSyntax : CSharpSyntaxNode +{ + private SyntaxNode? attributeLists; + + internal TypeParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the attribute declaration list. + public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public SyntaxToken VarianceKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameter(this); + + public TypeParameterSyntax Update(SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) + { + if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) + { + var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public TypeParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.VarianceKeyword, this.Identifier); + public TypeParameterSyntax WithVarianceKeyword(SyntaxToken varianceKeyword) => Update(this.AttributeLists, varianceKeyword, this.Identifier); + public TypeParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.VarianceKeyword, identifier); + + public TypeParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} + +/// Base class for type declaration syntax. +public abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseTypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the identifier. + public abstract SyntaxToken Identifier { get; } + public BaseTypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); + internal abstract BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier); + + /// Gets the base type list. + public abstract BaseListSyntax? BaseList { get; } + public BaseTypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => WithBaseListCore(baseList); + internal abstract BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList); + + public BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); + internal abstract BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items); + + /// Gets the open brace token. + public abstract SyntaxToken OpenBraceToken { get; } + public BaseTypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => WithOpenBraceTokenCore(openBraceToken); + internal abstract BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken); + + /// Gets the close brace token. + public abstract SyntaxToken CloseBraceToken { get; } + public BaseTypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => WithCloseBraceTokenCore(closeBraceToken); + internal abstract BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken); + + /// Gets the optional semicolon token. + public abstract SyntaxToken SemicolonToken { get; } + public BaseTypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); + internal abstract BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); + + public new BaseTypeDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseTypeDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseTypeDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseTypeDeclarationSyntax)WithModifiersCore(modifiers); + + public new BaseTypeDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseTypeDeclarationSyntax)AddAttributeListsCore(items); + + public new BaseTypeDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseTypeDeclarationSyntax)AddModifiersCore(items); +} + +/// Base class for type declaration syntax (class, struct, interface, record). +public abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax +{ + internal TypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the type keyword token ("class", "struct", "interface", "record"). + public abstract SyntaxToken Keyword { get; } + public TypeDeclarationSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); + internal abstract TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword); + + public abstract TypeParameterListSyntax? TypeParameterList { get; } + public TypeDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => WithTypeParameterListCore(typeParameterList); + internal abstract TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList); + + public TypeDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) => AddTypeParameterListParametersCore(items); + internal abstract TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items); + + public abstract ParameterListSyntax? ParameterList { get; } + public TypeDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => WithParameterListCore(parameterList); + internal abstract TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList); + + public TypeDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); + internal abstract TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); + + /// Gets the type constraint list. + public abstract SyntaxList ConstraintClauses { get; } + public TypeDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => WithConstraintClausesCore(constraintClauses); + internal abstract TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses); + + public TypeDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClausesCore(items); + internal abstract TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items); + + /// Gets the member declarations. + public abstract SyntaxList Members { get; } + public TypeDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); + internal abstract TypeDeclarationSyntax WithMembersCore(SyntaxList members); + + public TypeDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); + internal abstract TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); + + public new TypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => (TypeDeclarationSyntax)WithIdentifierCore(identifier); + public new TypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => (TypeDeclarationSyntax)WithBaseListCore(baseList); + public new TypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => (TypeDeclarationSyntax)WithOpenBraceTokenCore(openBraceToken); + public new TypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => (TypeDeclarationSyntax)WithCloseBraceTokenCore(closeBraceToken); + public new TypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => (TypeDeclarationSyntax)WithSemicolonTokenCore(semicolonToken); + + public new BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); +} + +/// Class type declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal ClassDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the class keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } + + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5), + 6 => GetRed(ref this.baseList, 6), + 7 => GetRed(ref this.constraintClauses, 7)!, + 9 => GetRed(ref this.members, 9)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 9 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassDeclaration(this); + + public ClassDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ClassDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ClassDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new ClassDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new ClassDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new ClassDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new ClassDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new ClassDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new ClassDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new ClassDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new ClassDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new ClassDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new ClassDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ClassDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ClassDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new ClassDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new ClassDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + { + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new ClassDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new ClassDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new ClassDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// Struct type declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal StructDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the struct keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } + + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5), + 6 => GetRed(ref this.baseList, 6), + 7 => GetRed(ref this.constraintClauses, 7)!, + 9 => GetRed(ref this.members, 9)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 9 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStructDeclaration(this); + + public StructDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new StructDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new StructDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new StructDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new StructDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new StructDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new StructDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new StructDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new StructDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new StructDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new StructDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new StructDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new StructDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new StructDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new StructDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new StructDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new StructDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + { + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new StructDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new StructDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new StructDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// Interface type declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal InterfaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the interface keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } + + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5), + 6 => GetRed(ref this.baseList, 6), + 7 => GetRed(ref this.constraintClauses, 7)!, + 9 => GetRed(ref this.members, 9)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 9 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterfaceDeclaration(this); + + public InterfaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new InterfaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new InterfaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new InterfaceDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new InterfaceDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new InterfaceDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new InterfaceDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new InterfaceDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new InterfaceDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new InterfaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new InterfaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new InterfaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new InterfaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new InterfaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new InterfaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new InterfaceDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new InterfaceDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + { + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new InterfaceDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new InterfaceDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new InterfaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal RecordDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public SyntaxToken ClassOrStructKeyword + { + get { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new ClassDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + } + + public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 6); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 7); + + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 8)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 10)); + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } + + public override SyntaxToken SemicolonToken + { + get { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new ClassDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new ClassDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new ClassDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// Struct type declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; - - internal StructDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the struct keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); - - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); - - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); - - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); - - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } - - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); - - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } - - public override SyntaxToken SemicolonToken + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } - } - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5), - 6 => GetRed(ref this.baseList, 6), - 7 => GetRed(ref this.constraintClauses, 7)!, - 9 => GetRed(ref this.members, 9)!, - _ => null, - }; + 0 => GetRedAtZero(ref this.attributeLists)!, + 5 => GetRed(ref this.typeParameterList, 5), + 6 => GetRed(ref this.parameterList, 6), + 7 => GetRed(ref this.baseList, 7), + 8 => GetRed(ref this.constraintClauses, 8)!, + 10 => GetRed(ref this.members, 10)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 9 => this.members, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.baseList, + 8 => this.constraintClauses, + 10 => this.members, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStructDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecordDeclaration(this); - public StructDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public RecordDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + var newNode = SyntaxFactory.RecordDeclaration(this.Kind(), attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new RecordDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new RecordDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new RecordDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + public RecordDeclarationSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(this.AttributeLists, this.Modifiers, this.Keyword, classOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new RecordDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new RecordDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new RecordDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new RecordDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new RecordDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new RecordDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new RecordDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new RecordDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new RecordDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new RecordDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new RecordDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new RecordDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new RecordDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + { + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new RecordDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new RecordDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new RecordDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// Enum type declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private BaseListSyntax? baseList; + private SyntaxNode? members; + + internal EnumDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new StructDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new StructDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new StructDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new StructDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new StructDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new StructDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new StructDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new StructDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new StructDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new StructDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new StructDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new StructDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + /// Gets the enum keyword token. + public SyntaxToken EnumKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new StructDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new StructDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new StructDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 4); + + public override SyntaxToken OpenBraceToken + { + get { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new StructDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + } + + /// Gets the members declaration list. + public SeparatedSyntaxList Members + { + get { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + var red = GetRed(ref this.members, 6); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(6)) : default; } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new StructDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new StructDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new StructDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// Interface type declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; - - internal InterfaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the interface keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); - - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); - - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); - - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); - - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } - - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); - - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } - - public override SyntaxToken SemicolonToken + } + + public override SyntaxToken CloseBraceToken + { + get { - get - { - var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } - } - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5), - 6 => GetRed(ref this.baseList, 6), - 7 => GetRed(ref this.constraintClauses, 7)!, - 9 => GetRed(ref this.members, 9)!, - _ => null, - }; + var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + } + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 9 => this.members, - _ => null, - }; + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterfaceDeclaration(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.baseList, 4), + 6 => GetRed(ref this.members, 6)!, + _ => null, + }; - public InterfaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.attributeLists, + 4 => this.baseList, + 6 => this.members, + _ => null, + }; - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumDeclaration(this); + + public EnumDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new InterfaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new InterfaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new InterfaceDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new InterfaceDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new InterfaceDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new InterfaceDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new InterfaceDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new InterfaceDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new InterfaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new InterfaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new InterfaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new InterfaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EnumDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EnumDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + public EnumDeclarationSyntax WithEnumKeyword(SyntaxToken enumKeyword) => Update(this.AttributeLists, this.Modifiers, enumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new EnumDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new EnumDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, baseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new EnumDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + public EnumDeclarationSyntax WithMembers(SeparatedSyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new EnumDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new EnumDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EnumDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EnumDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new EnumDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + public EnumDeclarationSyntax AddMembers(params EnumMemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// Delegate declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private SyntaxNode? constraintClauses; + + internal DelegateDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new InterfaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new InterfaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new InterfaceDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new InterfaceDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + } + + /// Gets the "delegate" keyword. + public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); + + /// Gets the return type. + public TypeSyntax ReturnType => GetRed(ref this.returnType, 3)!; + + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + + public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); + + /// Gets the parameter list. + public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; + + /// Gets the constraint clause list. + public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + /// Gets the semicolon token. + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(8), GetChildIndex(8)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.returnType, 3)!, + 5 => GetRed(ref this.typeParameterList, 5), + 6 => GetRed(ref this.parameterList, 6)!, + 7 => GetRed(ref this.constraintClauses, 7)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.returnType, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.constraintClauses, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDelegateDeclaration(this); + + public DelegateDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new InterfaceDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new DelegateDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new DelegateDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.AttributeLists, this.Modifiers, delegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new DelegateDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new DelegateDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public DelegateDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + public DelegateDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + public DelegateDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private EqualsValueClauseSyntax? equalsValue; + + internal EnumMemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new InterfaceDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new InterfaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; - - internal RecordDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + } + + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + + public EqualsValueClauseSyntax? EqualsValue => GetRed(ref this.equalsValue, 3); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.equalsValue, 3), + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.equalsValue, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumMemberDeclaration(this); + + public EnumMemberDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) + { + var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EnumMemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.EqualsValue); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EnumMemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.EqualsValue); + public EnumMemberDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.EqualsValue); + public EnumMemberDeclarationSyntax WithEqualsValue(EqualsValueClauseSyntax? equalsValue) => Update(this.AttributeLists, this.Modifiers, this.Identifier, equalsValue); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EnumMemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EnumMemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); +} + +/// Base list syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BaseListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? types; + + internal BaseListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxTokenList Modifiers + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); + + /// Gets the base type references. + public SeparatedSyntaxList Types + { + get { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var red = GetRed(ref this.types, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } + + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.types, 1)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.types : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseList(this); - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - - public SyntaxToken ClassOrStructKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } - } - - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); - - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 6); - - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 7); - - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 8)); - - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; - } - } - - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 10)); - - public override SyntaxToken CloseBraceToken + public BaseListSyntax Update(SyntaxToken colonToken, SeparatedSyntaxList types) + { + if (colonToken != this.ColonToken || types != this.Types) { - get - { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } + var newNode = SyntaxFactory.BaseList(colonToken, types); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken SemicolonToken + return this; + } + + public BaseListSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.Types); + public BaseListSyntax WithTypes(SeparatedSyntaxList types) => Update(this.ColonToken, types); + + public BaseListSyntax AddTypes(params BaseTypeSyntax[] items) => WithTypes(this.Types.AddRange(items)); +} + +/// Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. +public abstract partial class BaseTypeSyntax : CSharpSyntaxNode +{ + internal BaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public abstract TypeSyntax Type { get; } + public BaseTypeSyntax WithType(TypeSyntax type) => WithTypeCore(type); + internal abstract BaseTypeSyntax WithTypeCore(TypeSyntax type); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax +{ + private TypeSyntax? type; + + internal SimpleBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override TypeSyntax Type => GetRedAtZero(ref this.type)!; + + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleBaseType(this); + + public SimpleBaseTypeSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - get - { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; - } + var newNode = SyntaxFactory.SimpleBaseType(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 5 => GetRed(ref this.typeParameterList, 5), - 6 => GetRed(ref this.parameterList, 6), - 7 => GetRed(ref this.baseList, 7), - 8 => GetRed(ref this.constraintClauses, 8)!, - 10 => GetRed(ref this.members, 10)!, - _ => null, - }; + return this; + } + + internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new SimpleBaseTypeSyntax WithType(TypeSyntax type) => Update(type); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax +{ + private TypeSyntax? type; + private ArgumentListSyntax? argumentList; + + internal PrimaryConstructorBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override TypeSyntax Type => GetRedAtZero(ref this.type)!; + + public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.baseList, - 8 => this.constraintClauses, - 10 => this.members, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.argumentList, 1)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.argumentList, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecordDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrimaryConstructorBaseType(this); - public RecordDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) + { + if (type != this.Type || argumentList != this.ArgumentList) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.RecordDeclaration(this.Kind(), attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new PrimaryConstructorBaseTypeSyntax WithType(TypeSyntax type) => Update(type, this.ArgumentList); + public PrimaryConstructorBaseTypeSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Type, argumentList); + + public PrimaryConstructorBaseTypeSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} + +/// Type parameter constraint clause. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode +{ + private IdentifierNameSyntax? name; + private SyntaxNode? constraints; - return this; + internal TypeParameterConstraintClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public SyntaxToken WhereKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).whereKeyword, Position, 0); + + /// Gets the identifier. + public IdentifierNameSyntax Name => GetRed(ref this.name, 1)!; + + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + + /// Gets the constraints list. + public SeparatedSyntaxList Constraints + { + get + { + var red = GetRed(ref this.constraints, 3); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; } + } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new RecordDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new RecordDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new RecordDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - public RecordDeclarationSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(this.AttributeLists, this.Modifiers, this.Keyword, classOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new RecordDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new RecordDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new RecordDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new RecordDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new RecordDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new RecordDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new RecordDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new RecordDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new RecordDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.name, 1)!, + 3 => GetRed(ref this.constraints, 3)!, + _ => null, + }; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new RecordDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new RecordDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new RecordDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new RecordDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + 1 => this.name, + 3 => this.constraints, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterConstraintClause(this); + + public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, SeparatedSyntaxList constraints) + { + if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); - } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new RecordDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new RecordDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new RecordDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// Enum type declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax - { - private SyntaxNode? attributeLists; - private BaseListSyntax? baseList; - private SyntaxNode? members; - - internal EnumDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the enum keyword token. - public SyntaxToken EnumKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); - - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 4); - - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } - - /// Gets the members declaration list. - public SeparatedSyntaxList Members - { - get - { - var red = GetRed(ref this.members, 6); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(6)) : default; - } - } - - public override SyntaxToken CloseBraceToken + var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public TypeParameterConstraintClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Name, this.ColonToken, this.Constraints); + public TypeParameterConstraintClauseSyntax WithName(IdentifierNameSyntax name) => Update(this.WhereKeyword, name, this.ColonToken, this.Constraints); + public TypeParameterConstraintClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(this.WhereKeyword, this.Name, colonToken, this.Constraints); + public TypeParameterConstraintClauseSyntax WithConstraints(SeparatedSyntaxList constraints) => Update(this.WhereKeyword, this.Name, this.ColonToken, constraints); + + public TypeParameterConstraintClauseSyntax AddConstraints(params TypeParameterConstraintSyntax[] items) => WithConstraints(this.Constraints.AddRange(items)); +} + +/// Base type for type parameter constraint syntax. +public abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode +{ + internal TypeParameterConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} + +/// Constructor constraint syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax +{ + + internal ConstructorConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the "new" keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).newKeyword, Position, 0); + + /// Gets the open paren keyword. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + + /// Gets the close paren keyword. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + + internal override SyntaxNode? GetNodeSlot(int index) => null; + + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorConstraint(this); + + public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + { + if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken) { - get - { - var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } + var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken + return this; + } + + public ConstructorConstraintSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenParenToken, this.CloseParenToken); + public ConstructorConstraintSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.NewKeyword, openParenToken, this.CloseParenToken); + public ConstructorConstraintSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.NewKeyword, this.OpenParenToken, closeParenToken); +} + +/// Class or struct constraint syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax +{ + + internal ClassOrStructConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the constraint keyword ("class" or "struct"). + public SyntaxToken ClassOrStructKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); + + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken + { + get { - get - { - var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } + var slot = ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.baseList, 4), - 6 => GetRed(ref this.members, 6)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.baseList, - 6 => this.members, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassOrStructConstraint(this); - public EnumDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken) + { + if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind(), classOrStructKeyword, questionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EnumDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EnumDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - public EnumDeclarationSyntax WithEnumKeyword(SyntaxToken enumKeyword) => Update(this.AttributeLists, this.Modifiers, enumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new EnumDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new EnumDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, baseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new EnumDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - public EnumDeclarationSyntax WithMembers(SeparatedSyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new EnumDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new EnumDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + return this; + } - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EnumDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EnumDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new EnumDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - public EnumDeclarationSyntax AddMembers(params EnumMemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// Delegate declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private SyntaxNode? constraintClauses; - - internal DelegateDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the "delegate" keyword. - public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); - - /// Gets the return type. - public TypeSyntax ReturnType => GetRed(ref this.returnType, 3)!; - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - - public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); - - /// Gets the parameter list. - public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; + public ClassOrStructConstraintSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(classOrStructKeyword, this.QuestionToken); + public ClassOrStructConstraintSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ClassOrStructKeyword, questionToken); +} - /// Gets the constraint clause list. - public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); +/// Type constraint syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax +{ + private TypeSyntax? type; - /// Gets the semicolon token. - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(8), GetChildIndex(8)); + internal TypeConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.returnType, 3)!, - 5 => GetRed(ref this.typeParameterList, 5), - 6 => GetRed(ref this.parameterList, 6)!, - 7 => GetRed(ref this.constraintClauses, 7)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.returnType, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.constraintClauses, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDelegateDeclaration(this); + /// Gets the type syntax. + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public DelegateDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new DelegateDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new DelegateDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.AttributeLists, this.Modifiers, delegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, semicolonToken); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeConstraint(this); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new DelegateDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new DelegateDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public DelegateDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + public TypeConstraintSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + var newNode = SyntaxFactory.TypeConstraint(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public DelegateDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - public DelegateDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax + public TypeConstraintSyntax WithType(TypeSyntax type) => Update(type); +} + +/// Default constraint syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax +{ + + internal DefaultConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? attributeLists; - private EqualsValueClauseSyntax? equalsValue; + } - internal EnumMemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the "default" keyword. + public SyntaxToken DefaultKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultConstraintSyntax)this.Green).defaultKeyword, Position, 0); - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxTokenList Modifiers + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultConstraint(this); + + public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword) + { + if (defaultKeyword != this.DefaultKeyword) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public EqualsValueClauseSyntax? EqualsValue => GetRed(ref this.equalsValue, 3); + public DefaultConstraintSyntax WithDefaultKeyword(SyntaxToken defaultKeyword) => Update(defaultKeyword); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.equalsValue, 3), - _ => null, - }; +public abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.equalsValue, - _ => null, - }; + public abstract VariableDeclarationSyntax Declaration { get; } + public BaseFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => WithDeclarationCore(declaration); + internal abstract BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumMemberDeclaration(this); + public BaseFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => AddDeclarationVariablesCore(items); + internal abstract BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items); - public EnumMemberDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) - { - var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public abstract SyntaxToken SemicolonToken { get; } + public BaseFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); + internal abstract BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); - return this; - } + public new BaseFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseFieldDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseFieldDeclarationSyntax)WithModifiersCore(modifiers); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EnumMemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.EqualsValue); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EnumMemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.EqualsValue); - public EnumMemberDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.EqualsValue); - public EnumMemberDeclarationSyntax WithEqualsValue(EqualsValueClauseSyntax? equalsValue) => Update(this.AttributeLists, this.Modifiers, this.Identifier, equalsValue); + public new BaseFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseFieldDeclarationSyntax)AddAttributeListsCore(items); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EnumMemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EnumMemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - } + public new BaseFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseFieldDeclarationSyntax)AddModifiersCore(items); +} - /// Base list syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BaseListSyntax : CSharpSyntaxNode - { - private SyntaxNode? types; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; - internal BaseListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal FieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - /// Gets the base type references. - public SeparatedSyntaxList Types + public override SyntaxTokenList Modifiers + { + get { - get - { - var red = GetRed(ref this.types, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.types, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.types : null; + public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 2)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseList(this); + public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - public BaseListSyntax Update(SyntaxToken colonToken, SeparatedSyntaxList types) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (colonToken != this.ColonToken || types != this.Types) - { - var newNode = SyntaxFactory.BaseList(colonToken, types); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.declaration, 2)!, + _ => null, + }; - public BaseListSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.Types); - public BaseListSyntax WithTypes(SeparatedSyntaxList types) => Update(this.ColonToken, types); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.declaration, + _ => null, + }; - public BaseListSyntax AddTypes(params BaseTypeSyntax[] items) => WithTypes(this.Types.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFieldDeclaration(this); - /// Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. - public abstract partial class BaseTypeSyntax : CSharpSyntaxNode + public FieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { - internal BaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract TypeSyntax Type { get; } - public BaseTypeSyntax WithType(TypeSyntax type) => WithTypeCore(type); - internal abstract BaseTypeSyntax WithTypeCore(TypeSyntax type); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Declaration, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new FieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); + public new FieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new FieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Declaration, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new FieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); + public new FieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + + internal EventFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private TypeSyntax? type; + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal SimpleBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public override TypeSyntax Type => GetRedAtZero(ref this.type)!; + public SyntaxToken EventKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EventFieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleBaseType(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.declaration, 3)!, + _ => null, + }; - public SimpleBaseTypeSyntax Update(TypeSyntax type) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (type != this.Type) - { - var newNode = SyntaxFactory.SimpleBaseType(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.attributeLists, + 3 => this.declaration, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventFieldDeclaration(this); - return this; + public EventFieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new SimpleBaseTypeSyntax WithType(TypeSyntax type) => Update(type); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax - { - private TypeSyntax? type; - private ArgumentListSyntax? argumentList; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EventFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EventFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); + public EventFieldDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); + public new EventFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new EventFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Declaration, semicolonToken); - internal PrimaryConstructorBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EventFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EventFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); + public new EventFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode +{ + private NameSyntax? name; - public override TypeSyntax Type => GetRedAtZero(ref this.type)!; + internal ExplicitInterfaceSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + public NameSyntax Name => GetRedAtZero(ref this.name)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.argumentList, 1)!, - _ => null, - }; + public SyntaxToken DotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.argumentList, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrimaryConstructorBaseType(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) - { - if (type != this.Type || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExplicitInterfaceSpecifier(this); - return this; + public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken) + { + if (name != this.Name || dotToken != this.DotToken) + { + var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new PrimaryConstructorBaseTypeSyntax WithType(TypeSyntax type) => Update(type, this.ArgumentList); - public PrimaryConstructorBaseTypeSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Type, argumentList); - - public PrimaryConstructorBaseTypeSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); + return this; } - /// Type parameter constraint clause. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode + public ExplicitInterfaceSpecifierSyntax WithName(NameSyntax name) => Update(name, this.DotToken); + public ExplicitInterfaceSpecifierSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Name, dotToken); +} + +/// Base type for method declaration syntax. +public abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseMethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private IdentifierNameSyntax? name; - private SyntaxNode? constraints; + } - internal TypeParameterConstraintClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the parameter list. + public abstract ParameterListSyntax ParameterList { get; } + public BaseMethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => WithParameterListCore(parameterList); + internal abstract BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList); - public SyntaxToken WhereKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).whereKeyword, Position, 0); + public BaseMethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); + internal abstract BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); - /// Gets the identifier. - public IdentifierNameSyntax Name => GetRed(ref this.name, 1)!; + public abstract BlockSyntax? Body { get; } + public BaseMethodDeclarationSyntax WithBody(BlockSyntax? body) => WithBodyCore(body); + internal abstract BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body); - /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + public BaseMethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) => AddBodyAttributeListsCore(items); + internal abstract BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items); - /// Gets the constraints list. - public SeparatedSyntaxList Constraints - { - get - { - var red = GetRed(ref this.constraints, 3); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; - } - } + public BaseMethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) => AddBodyStatementsCore(items); + internal abstract BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.name, 1)!, - 3 => GetRed(ref this.constraints, 3)!, - _ => null, - }; + public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; } + public BaseMethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); + internal abstract BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.name, - 3 => this.constraints, - _ => null, - }; + /// Gets the optional semicolon token. + public abstract SyntaxToken SemicolonToken { get; } + public BaseMethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); + internal abstract BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterConstraintClause(this); + public new BaseMethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseMethodDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseMethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseMethodDeclarationSyntax)WithModifiersCore(modifiers); - public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, SeparatedSyntaxList constraints) - { - if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) - { - var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public new BaseMethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseMethodDeclarationSyntax)AddAttributeListsCore(items); - return this; - } + public new BaseMethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseMethodDeclarationSyntax)AddModifiersCore(items); +} - public TypeParameterConstraintClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Name, this.ColonToken, this.Constraints); - public TypeParameterConstraintClauseSyntax WithName(IdentifierNameSyntax name) => Update(this.WhereKeyword, name, this.ColonToken, this.Constraints); - public TypeParameterConstraintClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(this.WhereKeyword, this.Name, colonToken, this.Constraints); - public TypeParameterConstraintClauseSyntax WithConstraints(SeparatedSyntaxList constraints) => Update(this.WhereKeyword, this.Name, this.ColonToken, constraints); +/// Method declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private SyntaxNode? constraintClauses; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public TypeParameterConstraintClauseSyntax AddConstraints(params TypeParameterConstraintSyntax[] items) => WithConstraints(this.Constraints.AddRange(items)); + internal MethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Base type for type parameter constraint syntax. - public abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers { - internal TypeParameterConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - /// Constructor constraint syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax - { + /// Gets the return type syntax. + public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - internal ConstructorConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - /// Gets the "new" keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).newKeyword, Position, 0); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - /// Gets the open paren keyword. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); - /// Gets the close paren keyword. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + /// Gets the constraint clause list. + public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override BlockSyntax? Body => GetRed(ref this.body, 8); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorConstraint(this); + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get { - if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } - - public ConstructorConstraintSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenParenToken, this.CloseParenToken); - public ConstructorConstraintSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.NewKeyword, openParenToken, this.CloseParenToken); - public ConstructorConstraintSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.NewKeyword, this.OpenParenToken, closeParenToken); } - /// Class or struct constraint syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax - { + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 5 => GetRed(ref this.typeParameterList, 5), + 6 => GetRed(ref this.parameterList, 6)!, + 7 => GetRed(ref this.constraintClauses, 7)!, + 8 => GetRed(ref this.body, 8), + 9 => GetRed(ref this.expressionBody, 9), + _ => null, + }; - internal ClassOrStructConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 0 => this.attributeLists, + 2 => this.returnType, + 3 => this.explicitInterfaceSpecifier, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.constraintClauses, + 8 => this.body, + 9 => this.expressionBody, + _ => null, + }; - /// Gets the constraint keyword ("class" or "struct"). - public SyntaxToken ClassOrStructKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMethodDeclaration(this); - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken + public MethodDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - get - { - var slot = ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) => null; - - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassOrStructConstraint(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new MethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new MethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new MethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new MethodDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new MethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new MethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); - public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken) - { - if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken) - { - var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind(), classOrStructKeyword, questionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new MethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new MethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public MethodDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new MethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + public MethodDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new MethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new MethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - return this; - } +/// Operator declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private ParameterListSyntax? parameterList; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public ClassOrStructConstraintSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(classOrStructKeyword, this.QuestionToken); - public ClassOrStructConstraintSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ClassOrStructKeyword, questionToken); + internal OperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Type constraint syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax - { - private TypeSyntax? type; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal TypeConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the type syntax. - public TypeSyntax Type => GetRedAtZero(ref this.type)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + /// Gets the return type. + public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeConstraint(this); + /// Gets the "operator" keyword. + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); - public TypeConstraintSyntax Update(TypeSyntax type) + /// Gets the "checked" keyword. + public SyntaxToken CheckedKeyword + { + get { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypeConstraint(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } - - public TypeConstraintSyntax WithType(TypeSyntax type) => Update(type); } - /// Default constraint syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax - { - - internal DefaultConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the operator token. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); - /// Gets the "default" keyword. - public SyntaxToken DefaultKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultConstraintSyntax)this.Green).defaultKeyword, Position, 0); + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override BlockSyntax? Body => GetRed(ref this.body, 8); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultConstraint(this); + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } - public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (defaultKeyword != this.DefaultKeyword) - { - var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 7 => GetRed(ref this.parameterList, 7)!, + 8 => GetRed(ref this.body, 8), + 9 => GetRed(ref this.expressionBody, 9), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.returnType, + 3 => this.explicitInterfaceSpecifier, + 7 => this.parameterList, + 8 => this.body, + 9 => this.expressionBody, + _ => null, + }; - public DefaultConstraintSyntax WithDefaultKeyword(SyntaxToken defaultKeyword) => Update(defaultKeyword); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorDeclaration(this); - public abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax + public OperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) { - internal BaseFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract VariableDeclarationSyntax Declaration { get; } - public BaseFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => WithDeclarationCore(declaration); - internal abstract BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration); - - public BaseFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => AddDeclarationVariablesCore(items); - internal abstract BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items); + return this; + } - public abstract SyntaxToken SemicolonToken { get; } - public BaseFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); - internal abstract BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new OperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new OperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new OperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new OperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new OperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new OperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - public new BaseFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseFieldDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseFieldDeclarationSyntax)WithModifiersCore(modifiers); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new OperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new OperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new OperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new OperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new OperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - public new BaseFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseFieldDeclarationSyntax)AddAttributeListsCore(items); +/// Conversion operator declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private TypeSyntax? type; + private ParameterListSyntax? parameterList; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public new BaseFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseFieldDeclarationSyntax)AddModifiersCore(items); + internal ConversionOperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax - { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal FieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } + + /// Gets the "implicit" or "explicit" token. + public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - public override SyntaxTokenList Modifiers + /// Gets the "operator" token. + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); + + /// Gets the "checked" keyword. + public SyntaxToken CheckedKeyword + { + get { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } + } - public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 2)!; - - public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + /// Gets the type. + public TypeSyntax Type => GetRed(ref this.type, 6)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.declaration, 2)!, - _ => null, - }; + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.declaration, - _ => null, - }; + public override BlockSyntax? Body => GetRed(ref this.body, 8); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFieldDeclaration(this); + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - public FieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Declaration, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new FieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); - public new FieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new FieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Declaration, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new FieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); - public new FieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax - { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 6 => GetRed(ref this.type, 6)!, + 7 => GetRed(ref this.parameterList, 7)!, + 8 => GetRed(ref this.body, 8), + 9 => GetRed(ref this.expressionBody, 9), + _ => null, + }; - internal EventFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 0 => this.attributeLists, + 3 => this.explicitInterfaceSpecifier, + 6 => this.type, + 7 => this.parameterList, + 8 => this.body, + 9 => this.expressionBody, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorDeclaration(this); - public override SyntaxTokenList Modifiers + public ConversionOperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken EventKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ConversionOperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ConversionOperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(this.AttributeLists, this.Modifiers, implicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new ConversionOperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new ConversionOperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new ConversionOperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new ConversionOperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EventFieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ConversionOperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ConversionOperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new ConversionOperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new ConversionOperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new ConversionOperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.declaration, 3)!, - _ => null, - }; +/// Constructor declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private ParameterListSyntax? parameterList; + private ConstructorInitializerSyntax? initializer; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.declaration, - _ => null, - }; + internal ConstructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventFieldDeclaration(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public EventFieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public override SyntaxTokenList Modifiers + { + get { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EventFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EventFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); - public EventFieldDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); - public new EventFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new EventFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Declaration, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EventFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EventFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); - public new EventFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode - { - private NameSyntax? name; - - internal ExplicitInterfaceSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public NameSyntax Name => GetRedAtZero(ref this.name)!; + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - public SyntaxToken DotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); + public ConstructorInitializerSyntax? Initializer => GetRed(ref this.initializer, 4); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + public override BlockSyntax? Body => GetRed(ref this.body, 5); - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExplicitInterfaceSpecifier(this); + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + } + } - public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (name != this.Name || dotToken != this.DotToken) - { - var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.parameterList, 3)!, + 4 => GetRed(ref this.initializer, 4), + 5 => GetRed(ref this.body, 5), + 6 => GetRed(ref this.expressionBody, 6), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.parameterList, + 4 => this.initializer, + 5 => this.body, + 6 => this.expressionBody, + _ => null, + }; - public ExplicitInterfaceSpecifierSyntax WithName(NameSyntax name) => Update(name, this.DotToken); - public ExplicitInterfaceSpecifierSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Name, dotToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorDeclaration(this); - /// Base type for method declaration syntax. - public abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax + public ConstructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) { - internal BaseMethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the parameter list. - public abstract ParameterListSyntax ParameterList { get; } - public BaseMethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => WithParameterListCore(parameterList); - internal abstract BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList); - - public BaseMethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); - internal abstract BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); - - public abstract BlockSyntax? Body { get; } - public BaseMethodDeclarationSyntax WithBody(BlockSyntax? body) => WithBodyCore(body); - internal abstract BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body); + return this; + } - public BaseMethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) => AddBodyAttributeListsCore(items); - internal abstract BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ConstructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ConstructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConstructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new ConstructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Identifier, parameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConstructorDeclarationSyntax WithInitializer(ConstructorInitializerSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new ConstructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new ConstructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new ConstructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, semicolonToken); - public BaseMethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) => AddBodyStatementsCore(items); - internal abstract BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ConstructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ConstructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new ConstructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new ConstructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new ConstructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; } - public BaseMethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); - internal abstract BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody); +/// Constructor initializer syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode +{ + private ArgumentListSyntax? argumentList; - /// Gets the optional semicolon token. - public abstract SyntaxToken SemicolonToken { get; } - public BaseMethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); - internal abstract BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); + internal ConstructorInitializerSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public new BaseMethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseMethodDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseMethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseMethodDeclarationSyntax)WithModifiersCore(modifiers); + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorInitializerSyntax)this.Green).colonToken, Position, 0); - public new BaseMethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseMethodDeclarationSyntax)AddAttributeListsCore(items); + /// Gets the "this" or "base" keyword. + public SyntaxToken ThisOrBaseKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorInitializerSyntax)this.Green).thisOrBaseKeyword, GetChildPosition(1), GetChildIndex(1)); - public new BaseMethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseMethodDeclarationSyntax)AddModifiersCore(items); - } + public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 2)!; - /// Method declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private SyntaxNode? constraintClauses; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.argumentList, 2)! : null; - internal MethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.argumentList : null; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorInitializer(this); - public override SyntaxTokenList Modifiers + public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + { + if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ConstructorInitializer(this.Kind(), colonToken, thisOrBaseKeyword, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the return type syntax. - public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + return this; + } - public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); + public ConstructorInitializerSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.ThisOrBaseKeyword, this.ArgumentList); + public ConstructorInitializerSyntax WithThisOrBaseKeyword(SyntaxToken thisOrBaseKeyword) => Update(this.ColonToken, thisOrBaseKeyword, this.ArgumentList); + public ConstructorInitializerSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.ColonToken, this.ThisOrBaseKeyword, argumentList); - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; + public ConstructorInitializerSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} - /// Gets the constraint clause list. - public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); +/// Destructor declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private ParameterListSyntax? parameterList; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public override BlockSyntax? Body => GetRed(ref this.body, 8); + internal DestructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken + public override SyntaxTokenList Modifiers + { + get { - get - { - var slot = ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 5 => GetRed(ref this.typeParameterList, 5), - 6 => GetRed(ref this.parameterList, 6)!, - 7 => GetRed(ref this.constraintClauses, 7)!, - 8 => GetRed(ref this.body, 8), - 9 => GetRed(ref this.expressionBody, 9), - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.returnType, - 3 => this.explicitInterfaceSpecifier, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.constraintClauses, - 8 => this.body, - 9 => this.expressionBody, - _ => null, - }; + /// Gets the tilde token. + public SyntaxToken TildeToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMethodDeclaration(this); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - public MethodDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 4)!; - return this; - } + public override BlockSyntax? Body => GetRed(ref this.body, 5); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new MethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new MethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new MethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new MethodDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new MethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new MethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new MethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new MethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public MethodDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new MethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - public MethodDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new MethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new MethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } - } - - /// Operator declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private ParameterListSyntax? parameterList; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; - - internal OperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the return type. - public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - - /// Gets the "operator" keyword. - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); - - /// Gets the "checked" keyword. - public SyntaxToken CheckedKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } - - /// Gets the operator token. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); - - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; - - public override BlockSyntax? Body => GetRed(ref this.body, 8); - - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } + var slot = ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 7 => GetRed(ref this.parameterList, 7)!, - 8 => GetRed(ref this.body, 8), - 9 => GetRed(ref this.expressionBody, 9), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.parameterList, 4)!, + 5 => GetRed(ref this.body, 5), + 6 => GetRed(ref this.expressionBody, 6), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.returnType, - 3 => this.explicitInterfaceSpecifier, - 7 => this.parameterList, - 8 => this.body, - 9 => this.expressionBody, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.parameterList, + 5 => this.body, + 6 => this.expressionBody, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDestructorDeclaration(this); - public OperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + public DestructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new OperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new OperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new OperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new OperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new OperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new OperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); + return this; + } - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new OperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new OperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new OperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new OperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new OperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } - } - - /// Conversion operator declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax - { - private SyntaxNode? attributeLists; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private TypeSyntax? type; - private ParameterListSyntax? parameterList; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; - - internal ConversionOperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the "implicit" or "explicit" token. - public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); - - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - - /// Gets the "operator" token. - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); - - /// Gets the "checked" keyword. - public SyntaxToken CheckedKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } - - /// Gets the type. - public TypeSyntax Type => GetRed(ref this.type, 6)!; - - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; - - public override BlockSyntax? Body => GetRed(ref this.body, 8); - - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 6 => GetRed(ref this.type, 6)!, - 7 => GetRed(ref this.parameterList, 7)!, - 8 => GetRed(ref this.body, 8), - 9 => GetRed(ref this.expressionBody, 9), - _ => null, - }; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new DestructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new DestructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public DestructorDeclarationSyntax WithTildeToken(SyntaxToken tildeToken) => Update(this.AttributeLists, this.Modifiers, tildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public DestructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new DestructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new DestructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new DestructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new DestructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.explicitInterfaceSpecifier, - 6 => this.type, - 7 => this.parameterList, - 8 => this.body, - 9 => this.expressionBody, - _ => null, - }; + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new DestructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new DestructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new DestructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new DestructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new DestructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorDeclaration(this); +/// Base type for property declaration syntax. +public abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax +{ + internal BasePropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ConversionOperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// Gets the type syntax. + public abstract TypeSyntax Type { get; } + public BasePropertyDeclarationSyntax WithType(TypeSyntax type) => WithTypeCore(type); + internal abstract BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type); - return this; - } + /// Gets the optional explicit interface specifier. + public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; } + public BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifierCore(explicitInterfaceSpecifier); + internal abstract BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ConversionOperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ConversionOperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(this.AttributeLists, this.Modifiers, implicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new ConversionOperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new ConversionOperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new ConversionOperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new ConversionOperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); + public abstract AccessorListSyntax? AccessorList { get; } + public BasePropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => WithAccessorListCore(accessorList); + internal abstract BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ConversionOperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ConversionOperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new ConversionOperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new ConversionOperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new ConversionOperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } - } - - /// Constructor declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax - { - private SyntaxNode? attributeLists; - private ParameterListSyntax? parameterList; - private ConstructorInitializerSyntax? initializer; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; - - internal ConstructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - - public ConstructorInitializerSyntax? Initializer => GetRed(ref this.initializer, 4); - - public override BlockSyntax? Body => GetRed(ref this.body, 5); - - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } - } + public BasePropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessorsCore(items); + internal abstract BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.parameterList, 3)!, - 4 => GetRed(ref this.initializer, 4), - 5 => GetRed(ref this.body, 5), - 6 => GetRed(ref this.expressionBody, 6), - _ => null, - }; + public new BasePropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BasePropertyDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BasePropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BasePropertyDeclarationSyntax)WithModifiersCore(modifiers); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.parameterList, - 4 => this.initializer, - 5 => this.body, - 6 => this.expressionBody, - _ => null, - }; + public new BasePropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BasePropertyDeclarationSyntax)AddAttributeListsCore(items); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorDeclaration(this); + public new BasePropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BasePropertyDeclarationSyntax)AddModifiersCore(items); +} - public ConstructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private AccessorListSyntax? accessorList; + private ArrowExpressionClauseSyntax? expressionBody; + private EqualsValueClauseSyntax? initializer; - return this; - } + internal PropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ConstructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ConstructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConstructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new ConstructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Identifier, parameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConstructorDeclarationSyntax WithInitializer(ConstructorInitializerSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new ConstructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new ConstructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new ConstructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, semicolonToken); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ConstructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ConstructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new ConstructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new ConstructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new ConstructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + public override SyntaxTokenList Modifiers + { + get { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - /// Constructor initializer syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode - { - private ArgumentListSyntax? argumentList; + public override TypeSyntax Type => GetRed(ref this.type, 2)!; - internal ConstructorInitializerSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorInitializerSyntax)this.Green).colonToken, Position, 0); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - /// Gets the "this" or "base" keyword. - public SyntaxToken ThisOrBaseKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorInitializerSyntax)this.Green).thisOrBaseKeyword, GetChildPosition(1), GetChildIndex(1)); + public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 5); - public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 2)!; + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.argumentList, 2)! : null; + public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 7); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.argumentList : null; + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorInitializer(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 5 => GetRed(ref this.accessorList, 5), + 6 => GetRed(ref this.expressionBody, 6), + 7 => GetRed(ref this.initializer, 7), + _ => null, + }; - public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ConstructorInitializer(this.Kind(), colonToken, thisOrBaseKeyword, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.attributeLists, + 2 => this.type, + 3 => this.explicitInterfaceSpecifier, + 5 => this.accessorList, + 6 => this.expressionBody, + 7 => this.initializer, + _ => null, + }; - return this; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyDeclaration(this); - public ConstructorInitializerSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.ThisOrBaseKeyword, this.ArgumentList); - public ConstructorInitializerSyntax WithThisOrBaseKeyword(SyntaxToken thisOrBaseKeyword) => Update(this.ColonToken, thisOrBaseKeyword, this.ArgumentList); - public ConstructorInitializerSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.ColonToken, this.ThisOrBaseKeyword, argumentList); + public PropertyDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public ConstructorInitializerSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); + return this; } - /// Destructor declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax - { - private SyntaxNode? attributeLists; - private ParameterListSyntax? parameterList; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new PropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new PropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new PropertyDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); + public new PropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); + public new PropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, expressionBody, this.Initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, semicolonToken); - internal DestructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new PropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new PropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); + public new PropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) + { + var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); + return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); + } +} - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); +/// The syntax for the expression body of an expression-bodied member. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? expression; - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + internal ArrowExpressionClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the tilde token. - public SyntaxToken TildeToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ArrowToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrowExpressionClauseSyntax)this.Green).arrowToken, Position, 0); - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 4)!; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - public override BlockSyntax? Body => GetRed(ref this.body, 5); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrowExpressionClause(this); - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken + public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression) + { + if (arrowToken != this.ArrowToken || expression != this.Expression) { - get - { - var slot = ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } + var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.parameterList, 4)!, - 5 => GetRed(ref this.body, 5), - 6 => GetRed(ref this.expressionBody, 6), - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.parameterList, - 5 => this.body, - 6 => this.expressionBody, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDestructorDeclaration(this); - - public DestructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + return this; + } - return this; - } + public ArrowExpressionClauseSyntax WithArrowToken(SyntaxToken arrowToken) => Update(arrowToken, this.Expression); + public ArrowExpressionClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.ArrowToken, expression); +} - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new DestructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new DestructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public DestructorDeclarationSyntax WithTildeToken(SyntaxToken tildeToken) => Update(this.AttributeLists, this.Modifiers, tildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public DestructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new DestructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new DestructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new DestructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new DestructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private AccessorListSyntax? accessorList; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new DestructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new DestructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new DestructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new DestructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new DestructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } + internal EventDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Base type for property declaration syntax. - public abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers { - internal BasePropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the type syntax. - public abstract TypeSyntax Type { get; } - public BasePropertyDeclarationSyntax WithType(TypeSyntax type) => WithTypeCore(type); - internal abstract BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type); - - /// Gets the optional explicit interface specifier. - public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; } - public BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifierCore(explicitInterfaceSpecifier); - internal abstract BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier); + public SyntaxToken EventKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); - public abstract AccessorListSyntax? AccessorList { get; } - public BasePropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => WithAccessorListCore(accessorList); - internal abstract BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList); + public override TypeSyntax Type => GetRed(ref this.type, 3)!; - public BasePropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessorsCore(items); - internal abstract BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items); + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 4); - public new BasePropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BasePropertyDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BasePropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BasePropertyDeclarationSyntax)WithModifiersCore(modifiers); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); - public new BasePropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BasePropertyDeclarationSyntax)AddAttributeListsCore(items); + public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); - public new BasePropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BasePropertyDeclarationSyntax)AddModifiersCore(items); + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + } } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private AccessorListSyntax? accessorList; - private ArrowExpressionClauseSyntax? expressionBody; - private EqualsValueClauseSyntax? initializer; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.type, 3)!, + 4 => GetRed(ref this.explicitInterfaceSpecifier, 4), + 6 => GetRed(ref this.accessorList, 6), + _ => null, + }; - internal PropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 0 => this.attributeLists, + 3 => this.type, + 4 => this.explicitInterfaceSpecifier, + 6 => this.accessorList, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventDeclaration(this); - public override SyntaxTokenList Modifiers + public EventDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override TypeSyntax Type => GetRed(ref this.type, 2)!; + return this; + } - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EventDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EventDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + public EventDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new EventDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); + public new EventDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + public EventDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); + public new EventDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.SemicolonToken); + public EventDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, semicolonToken); - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EventDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EventDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); + public new EventDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) + { + var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); + return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); + } +} - public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 5); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private BracketedParameterListSyntax? parameterList; + private AccessorListSyntax? accessorList; + private ArrowExpressionClauseSyntax? expressionBody; - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); + internal IndexerDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 7); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public SyntaxToken SemicolonToken + public override SyntaxTokenList Modifiers + { + get { - get - { - var slot = ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 5 => GetRed(ref this.accessorList, 5), - 6 => GetRed(ref this.expressionBody, 6), - 7 => GetRed(ref this.initializer, 7), - _ => null, - }; + public override TypeSyntax Type => GetRed(ref this.type, 2)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - 3 => this.explicitInterfaceSpecifier, - 5 => this.accessorList, - 6 => this.expressionBody, - 7 => this.initializer, - _ => null, - }; + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyDeclaration(this); + public SyntaxToken ThisKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).thisKeyword, GetChildPosition(4), GetChildIndex(4)); - public PropertyDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// Gets the parameter list. + public BracketedParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; - return this; - } + public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new PropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new PropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new PropertyDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); - public new PropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); - public new PropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, expressionBody, this.Initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, semicolonToken); + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 7); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new PropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new PropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); - public new PropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) + public SyntaxToken SemicolonToken + { + get { - var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); - return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); + var slot = ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } - /// The syntax for the expression body of an expression-bodied member. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode - { - private ExpressionSyntax? expression; - - internal ArrowExpressionClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } - - public SyntaxToken ArrowToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrowExpressionClauseSyntax)this.Green).arrowToken, Position, 0); + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 5 => GetRed(ref this.parameterList, 5)!, + 6 => GetRed(ref this.accessorList, 6), + 7 => GetRed(ref this.expressionBody, 7), + _ => null, + }; - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + 3 => this.explicitInterfaceSpecifier, + 5 => this.parameterList, + 6 => this.accessorList, + 7 => this.expressionBody, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrowExpressionClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerDeclaration(this); - public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression) + public IndexerDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (arrowToken != this.ArrowToken || expression != this.Expression) - { - var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ArrowExpressionClauseSyntax WithArrowToken(SyntaxToken arrowToken) => Update(arrowToken, this.Expression); - public ArrowExpressionClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.ArrowToken, expression); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new IndexerDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new IndexerDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new IndexerDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); + public new IndexerDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, thisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithParameterList(BracketedParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, parameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); + public new IndexerDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, accessorList, this.ExpressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, expressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new IndexerDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new IndexerDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public IndexerDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); + public new IndexerDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) { - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private AccessorListSyntax? accessorList; + var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); + return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); + } +} - internal EventDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AccessorListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? accessors; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + internal AccessorListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AccessorListSyntax)this.Green).openBraceToken, Position, 0); - public SyntaxToken EventKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxList Accessors => new SyntaxList(GetRed(ref this.accessors, 1)); - public override TypeSyntax Type => GetRed(ref this.type, 3)!; + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AccessorListSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 4); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.accessors, 1)! : null; - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.accessors : null; - public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorList(this); - public SyntaxToken SemicolonToken + public AccessorListSyntax Update(SyntaxToken openBraceToken, SyntaxList accessors, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) { - get - { - var slot = ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } + var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.type, 3)!, - 4 => GetRed(ref this.explicitInterfaceSpecifier, 4), - 6 => GetRed(ref this.accessorList, 6), - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.type, - 4 => this.explicitInterfaceSpecifier, - 6 => this.accessorList, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventDeclaration(this); + return this; + } - public EventDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public AccessorListSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Accessors, this.CloseBraceToken); + public AccessorListSyntax WithAccessors(SyntaxList accessors) => Update(this.OpenBraceToken, accessors, this.CloseBraceToken); + public AccessorListSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Accessors, closeBraceToken); - return this; - } + public AccessorListSyntax AddAccessors(params AccessorDeclarationSyntax[] items) => WithAccessors(this.Accessors.AddRange(items)); +} - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EventDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EventDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - public EventDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new EventDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); - public new EventDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - public EventDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); - public new EventDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.SemicolonToken); - public EventDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, semicolonToken); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode +{ + private SyntaxNode? attributeLists; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EventDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EventDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); - public new EventDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) - { - var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); - return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); - } + internal AccessorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax + /// Gets the attribute declaration list. + public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + /// Gets the modifier list. + public SyntaxTokenList Modifiers { - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private BracketedParameterListSyntax? parameterList; - private AccessorListSyntax? accessorList; - private ArrowExpressionClauseSyntax? expressionBody; - - internal IndexerDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - public override TypeSyntax Type => GetRed(ref this.type, 2)!; - - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - - public SyntaxToken ThisKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).thisKeyword, GetChildPosition(4), GetChildIndex(4)); + /// Gets the keyword token, or identifier if an erroneous accessor declaration. + public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - /// Gets the parameter list. - public BracketedParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; - - public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); + /// Gets the optional body block which may be empty, but it is null if there are no braces. + public BlockSyntax? Body => GetRed(ref this.body, 3); - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 7); + /// Gets the optional expression body. + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); - public SyntaxToken SemicolonToken + /// Gets the optional semicolon token. + public SyntaxToken SemicolonToken + { + get { - get - { - var slot = ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } + var slot = ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 5 => GetRed(ref this.parameterList, 5)!, - 6 => GetRed(ref this.accessorList, 6), - 7 => GetRed(ref this.expressionBody, 7), - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - 3 => this.explicitInterfaceSpecifier, - 5 => this.parameterList, - 6 => this.accessorList, - 7 => this.expressionBody, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerDeclaration(this); - - public IndexerDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new IndexerDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new IndexerDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new IndexerDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); - public new IndexerDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, thisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithParameterList(BracketedParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, parameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); - public new IndexerDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, accessorList, this.ExpressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, expressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, semicolonToken); + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.body, 3), + 4 => GetRed(ref this.expressionBody, 4), + _ => null, + }; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new IndexerDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new IndexerDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public IndexerDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); - public new IndexerDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); - return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); - } - } + 0 => this.attributeLists, + 3 => this.body, + 4 => this.expressionBody, + _ => null, + }; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AccessorListSyntax : CSharpSyntaxNode - { - private SyntaxNode? accessors; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorDeclaration(this); - internal AccessorListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public AccessorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.AccessorDeclaration(this.Kind(), attributeLists, modifiers, keyword, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AccessorListSyntax)this.Green).openBraceToken, Position, 0); - - public SyntaxList Accessors => new SyntaxList(GetRed(ref this.accessors, 1)); - - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AccessorListSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.accessors, 1)! : null; + public AccessorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Keyword, body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, expressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, semicolonToken); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.accessors : null; + public AccessorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public AccessorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public AccessorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + public AccessorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorList(this); +/// Base type for parameter list syntax. +public abstract partial class BaseParameterListSyntax : CSharpSyntaxNode +{ + internal BaseParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public AccessorListSyntax Update(SyntaxToken openBraceToken, SyntaxList accessors, SyntaxToken closeBraceToken) - { - if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// Gets the parameter list. + public abstract SeparatedSyntaxList Parameters { get; } + public BaseParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); + internal abstract BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); - return this; - } + public BaseParameterListSyntax AddParameters(params ParameterSyntax[] items) => AddParametersCore(items); + internal abstract BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items); +} - public AccessorListSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Accessors, this.CloseBraceToken); - public AccessorListSyntax WithAccessors(SyntaxList accessors) => Update(this.OpenBraceToken, accessors, this.CloseBraceToken); - public AccessorListSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Accessors, closeBraceToken); +/// Parameter list syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParameterListSyntax : BaseParameterListSyntax +{ + private SyntaxNode? parameters; - public AccessorListSyntax AddAccessors(params AccessorDeclarationSyntax[] items) => WithAccessors(this.Accessors.AddRange(items)); + internal ParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode - { - private SyntaxNode? attributeLists; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + /// Gets the open paren token. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); - internal AccessorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SeparatedSyntaxList Parameters + { + get { + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - /// Gets the modifier list. - public SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + /// Gets the close paren token. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - /// Gets the keyword token, or identifier if an erroneous accessor declaration. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - /// Gets the optional body block which may be empty, but it is null if there are no braces. - public BlockSyntax? Body => GetRed(ref this.body, 3); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - /// Gets the optional expression body. - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameterList(this); - /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken + public ParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) { - get - { - var slot = ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } + var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.body, 3), - 4 => GetRed(ref this.expressionBody, 4), - _ => null, - }; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.body, - 4 => this.expressionBody, - _ => null, - }; + public ParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); + internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new ParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); + public ParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorDeclaration(this); + internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); + public new ParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} - public AccessorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.AccessorDeclaration(this.Kind(), attributeLists, modifiers, keyword, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// Parameter list syntax with surrounding brackets. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax +{ + private SyntaxNode? parameters; - return this; - } + internal BracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public AccessorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Keyword, body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, expressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, semicolonToken); + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); - public AccessorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public AccessorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public AccessorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - public AccessorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + public override SeparatedSyntaxList Parameters + { + get { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } } - /// Base type for parameter list syntax. - public abstract partial class BaseParameterListSyntax : CSharpSyntaxNode - { - internal BaseParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - /// Gets the parameter list. - public abstract SeparatedSyntaxList Parameters { get; } - public BaseParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); - internal abstract BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - public BaseParameterListSyntax AddParameters(params ParameterSyntax[] items) => AddParametersCore(items); - internal abstract BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items); - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - /// Parameter list syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParameterListSyntax : BaseParameterListSyntax - { - private SyntaxNode? parameters; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedParameterList(this); - internal ParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) { + var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the open paren token. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); + return this; + } - public override SeparatedSyntaxList Parameters - { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public BracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); + internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new BracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); + public BracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); - /// Gets the close paren token. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); + public new BracketedParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; +/// Base parameter syntax. +public abstract partial class BaseParameterSyntax : CSharpSyntaxNode +{ + internal BaseParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + /// Gets the attribute declaration list. + public abstract SyntaxList AttributeLists { get; } + public BaseParameterSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameterList(this); + public BaseParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items); - public ParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// Gets the modifier list. + public abstract SyntaxTokenList Modifiers { get; } + public BaseParameterSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); + internal abstract BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers); - return this; - } + public BaseParameterSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); + internal abstract BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items); - public ParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); - internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new ParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); - public ParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); + public abstract TypeSyntax? Type { get; } + public BaseParameterSyntax WithType(TypeSyntax? type) => WithTypeCore(type); + internal abstract BaseParameterSyntax WithTypeCore(TypeSyntax? type); +} - internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); - public new ParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); - } +/// Parameter syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParameterSyntax : BaseParameterSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private EqualsValueClauseSyntax? @default; - /// Parameter list syntax with surrounding brackets. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax + internal ParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? parameters; - - internal BracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); + /// Gets the attribute declaration list. + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override SeparatedSyntaxList Parameters + /// Gets the modifier list. + public override SyntaxTokenList Modifiers + { + get { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + public override TypeSyntax? Type => GetRed(ref this.type, 2); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ParameterSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedParameterList(this); + public EqualsValueClauseSyntax? Default => GetRed(ref this.@default, 4); - public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2), + 4 => GetRed(ref this.@default, 4), + _ => null, + }; - public BracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); - internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new BracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); - public BracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + 4 => this.@default, + _ => null, + }; - internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); - public new BracketedParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameter(this); - /// Base parameter syntax. - public abstract partial class BaseParameterSyntax : CSharpSyntaxNode + public ParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) { - internal BaseParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) { + var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the attribute declaration list. - public abstract SyntaxList AttributeLists { get; } - public BaseParameterSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists); + return this; + } - public BaseParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.Identifier, this.Default); + internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.Identifier, this.Default); + internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type); + public new ParameterSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type, this.Identifier, this.Default); + public ParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, identifier, this.Default); + public ParameterSyntax WithDefault(EqualsValueClauseSyntax? @default) => Update(this.AttributeLists, this.Modifiers, this.Type, this.Identifier, @default); - /// Gets the modifier list. - public abstract SyntaxTokenList Modifiers { get; } - public BaseParameterSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); - internal abstract BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers); + internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); +} - public BaseParameterSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); - internal abstract BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items); +/// Parameter syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; - public abstract TypeSyntax? Type { get; } - public BaseParameterSyntax WithType(TypeSyntax? type) => WithTypeCore(type); - internal abstract BaseParameterSyntax WithTypeCore(TypeSyntax? type); + internal FunctionPointerParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Parameter syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParameterSyntax : BaseParameterSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private EqualsValueClauseSyntax? @default; + /// Gets the attribute declaration list. + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal ParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Gets the modifier list. + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the attribute declaration list. - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override TypeSyntax Type => GetRed(ref this.type, 2)!; - /// Gets the modifier list. - public override SyntaxTokenList Modifiers + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - public override TypeSyntax? Type => GetRed(ref this.type, 2); - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ParameterSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2)!, + _ => null, + }; - public EqualsValueClauseSyntax? Default => GetRed(ref this.@default, 4); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2), - 4 => GetRed(ref this.@default, 4), - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameter(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - 4 => this.@default, - _ => null, - }; + public FunctionPointerParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) + { + var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameter(this); + return this; + } - public ParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) - { - var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FunctionPointerParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); + internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new FunctionPointerParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); + internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type ?? throw new ArgumentNullException(nameof(type))); + public new FunctionPointerParameterSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type); - return this; - } + internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FunctionPointerParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new FunctionPointerParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); +} - internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.Identifier, this.Default); - internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.Identifier, this.Default); - internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type); - public new ParameterSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type, this.Identifier, this.Default); - public ParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, identifier, this.Default); - public ParameterSyntax WithDefault(EqualsValueClauseSyntax? @default) => Update(this.AttributeLists, this.Modifiers, this.Type, this.Identifier, @default); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; - internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal IncompleteMemberSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Parameter syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? type; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal FunctionPointerParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the attribute declaration list. - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public TypeSyntax? Type => GetRed(ref this.type, 2); - /// Gets the modifier list. - public override SyntaxTokenList Modifiers + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - public override TypeSyntax Type => GetRed(ref this.type, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2)!, - _ => null, - }; + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameter(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIncompleteMember(this); - public FunctionPointerParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type) + public IncompleteMemberSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) - { - var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FunctionPointerParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); - internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new FunctionPointerParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); - internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type ?? throw new ArgumentNullException(nameof(type))); - public new FunctionPointerParameterSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type); - - internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FunctionPointerParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new FunctionPointerParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? type; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new IncompleteMemberSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new IncompleteMemberSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); + public IncompleteMemberSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type); - internal IncompleteMemberSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new IncompleteMemberSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new IncompleteMemberSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); +} - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax +{ + + internal SkippedTokensTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxTokenList Modifiers + public SyntaxTokenList Tokens + { + get { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var slot = this.Green.GetSlot(0); + return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; } + } - public TypeSyntax? Type => GetRed(ref this.type, 2); - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIncompleteMember(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSkippedTokensTrivia(this); - public IncompleteMemberSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type) + public SkippedTokensTriviaSyntax Update(SyntaxTokenList tokens) + { + if (tokens != this.Tokens) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) - { - var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.SkippedTokensTrivia(tokens); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new IncompleteMemberSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new IncompleteMemberSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); - public IncompleteMemberSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new IncompleteMemberSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new IncompleteMemberSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax - { - - internal SkippedTokensTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SkippedTokensTriviaSyntax WithTokens(SyntaxTokenList tokens) => Update(tokens); - public SyntaxTokenList Tokens - { - get - { - var slot = this.Green.GetSlot(0); - return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; - } - } + public SkippedTokensTriviaSyntax AddTokens(params SyntaxToken[] items) => WithTokens(this.Tokens.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax +{ + private SyntaxNode? content; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal DocumentationCommentTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSkippedTokensTrivia(this); + public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 0)); - public SkippedTokensTriviaSyntax Update(SyntaxTokenList tokens) - { - if (tokens != this.Tokens) - { - var newNode = SyntaxFactory.SkippedTokensTrivia(tokens); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken EndOfComment => new SyntaxToken(this, ((Syntax.InternalSyntax.DocumentationCommentTriviaSyntax)this.Green).endOfComment, GetChildPosition(1), GetChildIndex(1)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.content)! : null; - public SkippedTokensTriviaSyntax WithTokens(SyntaxTokenList tokens) => Update(tokens); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.content : null; - public SkippedTokensTriviaSyntax AddTokens(params SyntaxToken[] items) => WithTokens(this.Tokens.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDocumentationCommentTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax + public DocumentationCommentTriviaSyntax Update(SyntaxList content, SyntaxToken endOfComment) { - private SyntaxNode? content; - - internal DocumentationCommentTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (content != this.Content || endOfComment != this.EndOfComment) { + var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind(), content, endOfComment); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 0)); + return this; + } - public SyntaxToken EndOfComment => new SyntaxToken(this, ((Syntax.InternalSyntax.DocumentationCommentTriviaSyntax)this.Green).endOfComment, GetChildPosition(1), GetChildIndex(1)); + public DocumentationCommentTriviaSyntax WithContent(SyntaxList content) => Update(content, this.EndOfComment); + public DocumentationCommentTriviaSyntax WithEndOfComment(SyntaxToken endOfComment) => Update(this.Content, endOfComment); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.content)! : null; + public DocumentationCommentTriviaSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); +} - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.content : null; +/// +/// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). +/// For example, the M in <see cref="M" />. +/// +public abstract partial class CrefSyntax : CSharpSyntaxNode +{ + internal CrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDocumentationCommentTrivia(this); +/// +/// A symbol reference that definitely refers to a type. +/// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeCrefSyntax : CrefSyntax +{ + private TypeSyntax? type; - public DocumentationCommentTriviaSyntax Update(SyntaxList content, SyntaxToken endOfComment) - { - if (content != this.Content || endOfComment != this.EndOfComment) - { - var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind(), content, endOfComment); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal TypeCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public DocumentationCommentTriviaSyntax WithContent(SyntaxList content) => Update(content, this.EndOfComment); - public DocumentationCommentTriviaSyntax WithEndOfComment(SyntaxToken endOfComment) => Update(this.Content, endOfComment); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - public DocumentationCommentTriviaSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - /// - /// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). - /// For example, the M in <see cref="M" />. - /// - public abstract partial class CrefSyntax : CSharpSyntaxNode + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeCref(this); + + public TypeCrefSyntax Update(TypeSyntax type) { - internal CrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (type != this.Type) { + var newNode = SyntaxFactory.TypeCref(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// A symbol reference that definitely refers to a type. - /// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeCrefSyntax : CrefSyntax - { - private TypeSyntax? type; + public TypeCrefSyntax WithType(TypeSyntax type) => Update(type); +} - internal TypeCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. +/// For example, cref="System.String.ToString()". +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class QualifiedCrefSyntax : CrefSyntax +{ + private TypeSyntax? container; + private MemberCrefSyntax? member; - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + internal QualifiedCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + public TypeSyntax Container => GetRedAtZero(ref this.container)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + public SyntaxToken DotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.QualifiedCrefSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeCref(this); + public MemberCrefSyntax Member => GetRed(ref this.member, 2)!; - public TypeCrefSyntax Update(TypeSyntax type) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypeCref(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.container)!, + 2 => GetRed(ref this.member, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.container, + 2 => this.member, + _ => null, + }; - public TypeCrefSyntax WithType(TypeSyntax type) => Update(type); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedCref(this); - /// - /// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. - /// For example, cref="System.String.ToString()". - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class QualifiedCrefSyntax : CrefSyntax + public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) { - private TypeSyntax? container; - private MemberCrefSyntax? member; - - internal QualifiedCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (container != this.Container || dotToken != this.DotToken || member != this.Member) { + var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TypeSyntax Container => GetRedAtZero(ref this.container)!; + return this; + } + + public QualifiedCrefSyntax WithContainer(TypeSyntax container) => Update(container, this.DotToken, this.Member); + public QualifiedCrefSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Container, dotToken, this.Member); + public QualifiedCrefSyntax WithMember(MemberCrefSyntax member) => Update(this.Container, this.DotToken, member); +} - public SyntaxToken DotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.QualifiedCrefSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); +/// +/// The unqualified part of a CrefSyntax. +/// For example, "ToString()" in "object.ToString()". +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +public abstract partial class MemberCrefSyntax : CrefSyntax +{ + internal MemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public MemberCrefSyntax Member => GetRed(ref this.member, 2)!; +/// +/// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, +/// with an optional type parameter list) and an optional parameter list. +/// For example, "M", "M<T>" or "M(int)". +/// Also, "A::B()" or "string()". +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NameMemberCrefSyntax : MemberCrefSyntax +{ + private TypeSyntax? name; + private CrefParameterListSyntax? parameters; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.container)!, - 2 => GetRed(ref this.member, 2)!, - _ => null, - }; + internal NameMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.container, - 2 => this.member, - _ => null, - }; + public TypeSyntax Name => GetRedAtZero(ref this.name)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedCref(this); + public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); - public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (container != this.Container || dotToken != this.DotToken || member != this.Member) - { - var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.name)!, + 1 => GetRed(ref this.parameters, 1), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.parameters, + _ => null, + }; - public QualifiedCrefSyntax WithContainer(TypeSyntax container) => Update(container, this.DotToken, this.Member); - public QualifiedCrefSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Container, dotToken, this.Member); - public QualifiedCrefSyntax WithMember(MemberCrefSyntax member) => Update(this.Container, this.DotToken, member); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameMemberCref(this); - /// - /// The unqualified part of a CrefSyntax. - /// For example, "ToString()" in "object.ToString()". - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - public abstract partial class MemberCrefSyntax : CrefSyntax + public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax? parameters) { - internal MemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (name != this.Name || parameters != this.Parameters) { + var newNode = SyntaxFactory.NameMemberCref(name, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, - /// with an optional type parameter list) and an optional parameter list. - /// For example, "M", "M<T>" or "M(int)". - /// Also, "A::B()" or "string()". - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NameMemberCrefSyntax : MemberCrefSyntax + public NameMemberCrefSyntax WithName(TypeSyntax name) => Update(name, this.Parameters); + public NameMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.Name, parameters); + + public NameMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) { - private TypeSyntax? name; - private CrefParameterListSyntax? parameters; + var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); + } +} - internal NameMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// A MemberCrefSyntax specified by a this keyword and an optional parameter list. +/// For example, "this" or "this[int]". +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax +{ + private CrefBracketedParameterListSyntax? parameters; + + internal IndexerMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public TypeSyntax Name => GetRedAtZero(ref this.name)!; + public SyntaxToken ThisKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IndexerMemberCrefSyntax)this.Green).thisKeyword, Position, 0); - public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); + public CrefBracketedParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 1 => GetRed(ref this.parameters, 1), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1) : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.parameters, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerMemberCref(this); - public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax? parameters) + public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + { + if (thisKeyword != this.ThisKeyword || parameters != this.Parameters) { - if (name != this.Name || parameters != this.Parameters) - { - var newNode = SyntaxFactory.NameMemberCref(name, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public NameMemberCrefSyntax WithName(TypeSyntax name) => Update(name, this.Parameters); - public NameMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.Name, parameters); + return this; + } - public NameMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) - { - var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } + public IndexerMemberCrefSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(thisKeyword, this.Parameters); + public IndexerMemberCrefSyntax WithParameters(CrefBracketedParameterListSyntax? parameters) => Update(this.ThisKeyword, parameters); + + public IndexerMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + { + var parameters = this.Parameters ?? SyntaxFactory.CrefBracketedParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); } +} - /// - /// A MemberCrefSyntax specified by a this keyword and an optional parameter list. - /// For example, "this" or "this[int]". - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax +/// +/// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. +/// For example, "operator +" or "operator -[int]". +/// NOTE: the operator must be overloadable. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax +{ + private CrefParameterListSyntax? parameters; + + internal OperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private CrefBracketedParameterListSyntax? parameters; + } + + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); - internal IndexerMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SyntaxToken CheckedKeyword + { + get { + var slot = ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public SyntaxToken ThisKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IndexerMemberCrefSyntax)this.Green).thisKeyword, Position, 0); + /// Gets the operator token. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); - public CrefBracketedParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); + public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 3); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1) : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.parameters, 3) : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.parameters : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorMemberCref(this); - public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + { + if (operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters) { - if (thisKeyword != this.ThisKeyword || parameters != this.Parameters) - { - var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, operatorToken, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public IndexerMemberCrefSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(thisKeyword, this.Parameters); - public IndexerMemberCrefSyntax WithParameters(CrefBracketedParameterListSyntax? parameters) => Update(this.ThisKeyword, parameters); + return this; + } - public IndexerMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) - { - var parameters = this.Parameters ?? SyntaxFactory.CrefBracketedParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } + public OperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.Parameters); + public OperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.Parameters); + public OperatorMemberCrefSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.Parameters); + public OperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameters); + + public OperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + { + var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); } +} - /// - /// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. - /// For example, "operator +" or "operator -[int]". - /// NOTE: the operator must be overloadable. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax +/// +/// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. +/// For example, "implicit operator int" or "explicit operator MyType(int)". +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax +{ + private TypeSyntax? type; + private CrefParameterListSyntax? parameters; + + internal ConversionOperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private CrefParameterListSyntax? parameters; + } - internal OperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).implicitOrExplicitKeyword, Position, 0); - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken CheckedKeyword + public SyntaxToken CheckedKeyword + { + get { - get - { - var slot = ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var slot = ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } + } - /// Gets the operator token. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); + public TypeSyntax Type => GetRed(ref this.type, 3)!; - public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 3); + public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 4); - internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.parameters, 3) : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 3 => GetRed(ref this.type, 3)!, + 4 => GetRed(ref this.parameters, 4), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.parameters : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 3 => this.type, + 4 => this.parameters, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorMemberCref(this); - public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + { + if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameters != this.Parameters) { - if (operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters) - { - var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, operatorToken, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public OperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.Parameters); - public OperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.Parameters); - public OperatorMemberCrefSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.Parameters); - public OperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameters); + return this; + } + + public ConversionOperatorMemberCrefSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(implicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.ImplicitOrExplicitKeyword, operatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, checkedKeyword, this.Type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithType(TypeSyntax type) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameters); - public OperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) - { - var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } + public ConversionOperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + { + var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); } +} - /// - /// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. - /// For example, "implicit operator int" or "explicit operator MyType(int)". - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax +/// +/// A list of cref parameters with surrounding punctuation. +/// Unlike regular parameters, cref parameters do not have names. +/// +public abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode +{ + internal BaseCrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private TypeSyntax? type; - private CrefParameterListSyntax? parameters; + } - internal ConversionOperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the parameter list. + public abstract SeparatedSyntaxList Parameters { get; } + public BaseCrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); + internal abstract BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); + + public BaseCrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => AddParametersCore(items); + internal abstract BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items); +} + +/// +/// A parenthesized list of cref parameters. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax +{ + private SyntaxNode? parameters; - public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).implicitOrExplicitKeyword, Position, 0); + internal CrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); + /// Gets the open paren token. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); - public SyntaxToken CheckedKeyword + public override SeparatedSyntaxList Parameters + { + get { - get - { - var slot = ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - public TypeSyntax Type => GetRed(ref this.type, 3)!; - - public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 4); + /// Gets the close paren token. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 3 => GetRed(ref this.type, 3)!, - 4 => GetRed(ref this.parameters, 4), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 3 => this.type, - 4 => this.parameters, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameterList(this); - public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + public CrefParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) { - if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameters != this.Parameters) - { - var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ConversionOperatorMemberCrefSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(implicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.ImplicitOrExplicitKeyword, operatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, checkedKeyword, this.Type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithType(TypeSyntax type) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameters); - - public ConversionOperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) - { - var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } + return this; } - /// - /// A list of cref parameters with surrounding punctuation. - /// Unlike regular parameters, cref parameters do not have names. - /// - public abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode - { - internal BaseCrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public CrefParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); + internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new CrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); + public CrefParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); - /// Gets the parameter list. - public abstract SeparatedSyntaxList Parameters { get; } - public BaseCrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); - internal abstract BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); + internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); + public new CrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} - public BaseCrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => AddParametersCore(items); - internal abstract BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items); - } +/// +/// A bracketed list of cref parameters. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax +{ + private SyntaxNode? parameters; - /// - /// A parenthesized list of cref parameters. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax + internal CrefBracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? parameters; - - internal CrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - /// Gets the open paren token. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); - public override SeparatedSyntaxList Parameters + public override SeparatedSyntaxList Parameters + { + get { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// Gets the close paren token. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefBracketedParameterList(this); - public CrefParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) { - if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public CrefParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); - internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new CrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); - public CrefParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); - - internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); - public new CrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); + return this; } - /// - /// A bracketed list of cref parameters. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax + public CrefBracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); + internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new CrefBracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); + public CrefBracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); + + internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); + public new CrefBracketedParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} + +/// +/// An element of a BaseCrefParameterListSyntax. +/// Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, +/// an optional readonly keyword, and a type - +/// there is no name and there are no attributes or other modifiers. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CrefParameterSyntax : CSharpSyntaxNode +{ + private TypeSyntax? type; + + internal CrefParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? parameters; + } - internal CrefBracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SyntaxToken RefKindKeyword + { + get { + var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword; + return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; } + } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); - - public override SeparatedSyntaxList Parameters + public SyntaxToken ReadOnlyKeyword + { + get { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public TypeSyntax Type => GetRed(ref this.type, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefBracketedParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameter(this); - public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + { + if (refKindKeyword != this.RefKindKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) { - if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.CrefParameter(refKindKeyword, readOnlyKeyword, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public CrefBracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); - internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new CrefBracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); - public CrefBracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); - - internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); - public new CrefBracketedParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); + return this; } - /// - /// An element of a BaseCrefParameterListSyntax. - /// Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, - /// an optional readonly keyword, and a type - - /// there is no name and there are no attributes or other modifiers. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CrefParameterSyntax : CSharpSyntaxNode - { - private TypeSyntax? type; - - internal CrefParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public CrefParameterSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(refKindKeyword, this.ReadOnlyKeyword, this.Type); + public CrefParameterSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKindKeyword, readOnlyKeyword, this.Type); + public CrefParameterSyntax WithType(TypeSyntax type) => Update(this.RefKindKeyword, this.ReadOnlyKeyword, type); +} - public SyntaxToken RefKindKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword; - return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; - } - } +public abstract partial class XmlNodeSyntax : CSharpSyntaxNode +{ + internal XmlNodeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public SyntaxToken ReadOnlyKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlElementSyntax : XmlNodeSyntax +{ + private XmlElementStartTagSyntax? startTag; + private SyntaxNode? content; + private XmlElementEndTagSyntax? endTag; - public TypeSyntax Type => GetRed(ref this.type, 2)!; + internal XmlElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + public XmlElementStartTagSyntax StartTag => GetRedAtZero(ref this.startTag)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameter(this); + public XmlElementEndTagSyntax EndTag => GetRed(ref this.endTag, 2)!; - public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (refKindKeyword != this.RefKindKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) - { - var newNode = SyntaxFactory.CrefParameter(refKindKeyword, readOnlyKeyword, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.startTag)!, + 1 => GetRed(ref this.content, 1)!, + 2 => GetRed(ref this.endTag, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.startTag, + 1 => this.content, + 2 => this.endTag, + _ => null, + }; - public CrefParameterSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(refKindKeyword, this.ReadOnlyKeyword, this.Type); - public CrefParameterSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKindKeyword, readOnlyKeyword, this.Type); - public CrefParameterSyntax WithType(TypeSyntax type) => Update(this.RefKindKeyword, this.ReadOnlyKeyword, type); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElement(this); - public abstract partial class XmlNodeSyntax : CSharpSyntaxNode + public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, SyntaxList content, XmlElementEndTagSyntax endTag) { - internal XmlNodeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) { + var newNode = SyntaxFactory.XmlElement(startTag, content, endTag); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlElementSyntax : XmlNodeSyntax - { - private XmlElementStartTagSyntax? startTag; - private SyntaxNode? content; - private XmlElementEndTagSyntax? endTag; + public XmlElementSyntax WithStartTag(XmlElementStartTagSyntax startTag) => Update(startTag, this.Content, this.EndTag); + public XmlElementSyntax WithContent(SyntaxList content) => Update(this.StartTag, content, this.EndTag); + public XmlElementSyntax WithEndTag(XmlElementEndTagSyntax endTag) => Update(this.StartTag, this.Content, endTag); - internal XmlElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public XmlElementSyntax AddStartTagAttributes(params XmlAttributeSyntax[] items) => WithStartTag(this.StartTag.WithAttributes(this.StartTag.Attributes.AddRange(items))); + public XmlElementSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); +} - public XmlElementStartTagSyntax StartTag => GetRedAtZero(ref this.startTag)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode +{ + private XmlNameSyntax? name; + private SyntaxNode? attributes; - public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 1)); + internal XmlElementStartTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public XmlElementEndTagSyntax EndTag => GetRed(ref this.endTag, 2)!; + public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementStartTagSyntax)this.Green).lessThanToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.startTag)!, - 1 => GetRed(ref this.content, 1)!, - 2 => GetRed(ref this.endTag, 2)!, - _ => null, - }; + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.startTag, - 1 => this.content, - 2 => this.endTag, - _ => null, - }; + public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElement(this); + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementStartTagSyntax)this.Green).greaterThanToken, GetChildPosition(3), GetChildIndex(3)); - public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, SyntaxList content, XmlElementEndTagSyntax endTag) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) - { - var newNode = SyntaxFactory.XmlElement(startTag, content, endTag); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 1 => GetRed(ref this.name, 1)!, + 2 => GetRed(ref this.attributes, 2)!, + _ => null, + }; - public XmlElementSyntax WithStartTag(XmlElementStartTagSyntax startTag) => Update(startTag, this.Content, this.EndTag); - public XmlElementSyntax WithContent(SyntaxList content) => Update(this.StartTag, content, this.EndTag); - public XmlElementSyntax WithEndTag(XmlElementEndTagSyntax endTag) => Update(this.StartTag, this.Content, endTag); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.name, + 2 => this.attributes, + _ => null, + }; - public XmlElementSyntax AddStartTagAttributes(params XmlAttributeSyntax[] items) => WithStartTag(this.StartTag.WithAttributes(this.StartTag.Attributes.AddRange(items))); - public XmlElementSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementStartTag(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode + public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken greaterThanToken) { - private XmlNameSyntax? name; - private SyntaxNode? attributes; - - internal XmlElementStartTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) { + var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementStartTagSyntax)this.Green).lessThanToken, Position, 0); + return this; + } - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + public XmlElementStartTagSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.GreaterThanToken); + public XmlElementStartTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.GreaterThanToken); + public XmlElementStartTagSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.GreaterThanToken); + public XmlElementStartTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, greaterThanToken); - public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); + public XmlElementStartTagSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); +} - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementStartTagSyntax)this.Green).greaterThanToken, GetChildPosition(3), GetChildIndex(3)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode +{ + private XmlNameSyntax? name; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.name, 1)!, - 2 => GetRed(ref this.attributes, 2)!, - _ => null, - }; + internal XmlElementEndTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.name, - 2 => this.attributes, - _ => null, - }; + public SyntaxToken LessThanSlashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementEndTagSyntax)this.Green).lessThanSlashToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementStartTag(this); + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken greaterThanToken) - { - if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementEndTagSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; - public XmlElementStartTagSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.GreaterThanToken); - public XmlElementStartTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.GreaterThanToken); - public XmlElementStartTagSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.GreaterThanToken); - public XmlElementStartTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, greaterThanToken); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; - public XmlElementStartTagSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementEndTag(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode + public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) { - private XmlNameSyntax? name; - - internal XmlElementEndTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken) { + var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken LessThanSlashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementEndTagSyntax)this.Green).lessThanSlashToken, Position, 0); + return this; + } + + public XmlElementEndTagSyntax WithLessThanSlashToken(SyntaxToken lessThanSlashToken) => Update(lessThanSlashToken, this.Name, this.GreaterThanToken); + public XmlElementEndTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanSlashToken, name, this.GreaterThanToken); + public XmlElementEndTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanSlashToken, this.Name, greaterThanToken); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax +{ + private XmlNameSyntax? name; + private SyntaxNode? attributes; - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + internal XmlEmptyElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementEndTagSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlEmptyElementSyntax)this.Green).lessThanToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementEndTag(this); + public SyntaxToken SlashGreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlEmptyElementSyntax)this.Green).slashGreaterThanToken, GetChildPosition(3), GetChildIndex(3)); - public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 1 => GetRed(ref this.name, 1)!, + 2 => GetRed(ref this.attributes, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.name, + 2 => this.attributes, + _ => null, + }; - public XmlElementEndTagSyntax WithLessThanSlashToken(SyntaxToken lessThanSlashToken) => Update(lessThanSlashToken, this.Name, this.GreaterThanToken); - public XmlElementEndTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanSlashToken, name, this.GreaterThanToken); - public XmlElementEndTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanSlashToken, this.Name, greaterThanToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlEmptyElement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax + public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken slashGreaterThanToken) { - private XmlNameSyntax? name; - private SyntaxNode? attributes; - - internal XmlEmptyElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) { + var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlEmptyElementSyntax)this.Green).lessThanToken, Position, 0); - - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + return this; + } - public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); + public XmlEmptyElementSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.SlashGreaterThanToken); + public XmlEmptyElementSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.SlashGreaterThanToken); + public XmlEmptyElementSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.SlashGreaterThanToken); + public XmlEmptyElementSyntax WithSlashGreaterThanToken(SyntaxToken slashGreaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, slashGreaterThanToken); - public SyntaxToken SlashGreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlEmptyElementSyntax)this.Green).slashGreaterThanToken, GetChildPosition(3), GetChildIndex(3)); + public XmlEmptyElementSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.name, 1)!, - 2 => GetRed(ref this.attributes, 2)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlNameSyntax : CSharpSyntaxNode +{ + private XmlPrefixSyntax? prefix; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.name, - 2 => this.attributes, - _ => null, - }; + internal XmlNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlEmptyElement(this); + public XmlPrefixSyntax? Prefix => GetRedAtZero(ref this.prefix); - public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken slashGreaterThanToken) - { - if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) - { - var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken LocalName => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameSyntax)this.Green).localName, GetChildPosition(1), GetChildIndex(1)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.prefix) : null; - public XmlEmptyElementSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.SlashGreaterThanToken); - public XmlEmptyElementSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.SlashGreaterThanToken); - public XmlEmptyElementSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.SlashGreaterThanToken); - public XmlEmptyElementSyntax WithSlashGreaterThanToken(SyntaxToken slashGreaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, slashGreaterThanToken); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.prefix : null; - public XmlEmptyElementSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlName(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlNameSyntax : CSharpSyntaxNode + public XmlNameSyntax Update(XmlPrefixSyntax? prefix, SyntaxToken localName) { - private XmlPrefixSyntax? prefix; - - internal XmlNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (prefix != this.Prefix || localName != this.LocalName) { + var newNode = SyntaxFactory.XmlName(prefix, localName); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public XmlPrefixSyntax? Prefix => GetRedAtZero(ref this.prefix); - - public SyntaxToken LocalName => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameSyntax)this.Green).localName, GetChildPosition(1), GetChildIndex(1)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.prefix) : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.prefix : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlName(this); - - public XmlNameSyntax Update(XmlPrefixSyntax? prefix, SyntaxToken localName) - { - if (prefix != this.Prefix || localName != this.LocalName) - { - var newNode = SyntaxFactory.XmlName(prefix, localName); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + return this; + } - return this; - } + public XmlNameSyntax WithPrefix(XmlPrefixSyntax? prefix) => Update(prefix, this.LocalName); + public XmlNameSyntax WithLocalName(SyntaxToken localName) => Update(this.Prefix, localName); +} - public XmlNameSyntax WithPrefix(XmlPrefixSyntax? prefix) => Update(prefix, this.LocalName); - public XmlNameSyntax WithLocalName(SyntaxToken localName) => Update(this.Prefix, localName); - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlPrefixSyntax : CSharpSyntaxNode +{ - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlPrefixSyntax : CSharpSyntaxNode + internal XmlPrefixSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { + } - internal XmlPrefixSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public SyntaxToken Prefix => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlPrefixSyntax)this.Green).prefix, Position, 0); + public SyntaxToken Prefix => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlPrefixSyntax)this.Green).prefix, Position, 0); - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlPrefixSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlPrefixSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlPrefix(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlPrefix(this); - public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken) + public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken) + { + if (prefix != this.Prefix || colonToken != this.ColonToken) { - if (prefix != this.Prefix || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public XmlPrefixSyntax WithPrefix(SyntaxToken prefix) => Update(prefix, this.ColonToken); - public XmlPrefixSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Prefix, colonToken); + return this; } - public abstract partial class XmlAttributeSyntax : CSharpSyntaxNode + public XmlPrefixSyntax WithPrefix(SyntaxToken prefix) => Update(prefix, this.ColonToken); + public XmlPrefixSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Prefix, colonToken); +} + +public abstract partial class XmlAttributeSyntax : CSharpSyntaxNode +{ + internal XmlAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal XmlAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - public abstract XmlNameSyntax Name { get; } - public XmlAttributeSyntax WithName(XmlNameSyntax name) => WithNameCore(name); - internal abstract XmlAttributeSyntax WithNameCore(XmlNameSyntax name); + public abstract XmlNameSyntax Name { get; } + public XmlAttributeSyntax WithName(XmlNameSyntax name) => WithNameCore(name); + internal abstract XmlAttributeSyntax WithNameCore(XmlNameSyntax name); - public abstract SyntaxToken EqualsToken { get; } - public XmlAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => WithEqualsTokenCore(equalsToken); - internal abstract XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken); + public abstract SyntaxToken EqualsToken { get; } + public XmlAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => WithEqualsTokenCore(equalsToken); + internal abstract XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken); - public abstract SyntaxToken StartQuoteToken { get; } - public XmlAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => WithStartQuoteTokenCore(startQuoteToken); - internal abstract XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken); + public abstract SyntaxToken StartQuoteToken { get; } + public XmlAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => WithStartQuoteTokenCore(startQuoteToken); + internal abstract XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken); - public abstract SyntaxToken EndQuoteToken { get; } - public XmlAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => WithEndQuoteTokenCore(endQuoteToken); - internal abstract XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken); - } + public abstract SyntaxToken EndQuoteToken { get; } + public XmlAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => WithEndQuoteTokenCore(endQuoteToken); + internal abstract XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken); +} - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax - { - private XmlNameSyntax? name; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax +{ + private XmlNameSyntax? name; - internal XmlTextAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal XmlTextAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; + public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxTokenList TextTokens + public SyntaxTokenList TextTokens + { + get { - get - { - var slot = this.Green.GetSlot(3); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } + var slot = this.Green.GetSlot(3); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } + } - public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlTextAttribute(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlTextAttribute(this); - public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, SyntaxTokenList textTokens, SyntaxToken endQuoteToken) + public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, SyntaxTokenList textTokens, SyntaxToken endQuoteToken) + { + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); - public new XmlTextAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); - public new XmlTextAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); - internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); - public new XmlTextAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.TextTokens, this.EndQuoteToken); - public XmlTextAttributeSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, textTokens, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); - public new XmlTextAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, endQuoteToken); - - public XmlTextAttributeSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax - { - private XmlNameSyntax? name; - private CrefSyntax? cref; - - internal XmlCrefAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); + public new XmlTextAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); + public new XmlTextAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); + internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); + public new XmlTextAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.TextTokens, this.EndQuoteToken); + public XmlTextAttributeSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, textTokens, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); + public new XmlTextAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, endQuoteToken); - public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; + public XmlTextAttributeSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); +} - public override SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax +{ + private XmlNameSyntax? name; + private CrefSyntax? cref; - public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + internal XmlCrefAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public CrefSyntax Cref => GetRed(ref this.cref, 3)!; + public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 3 => GetRed(ref this.cref, 3)!, - _ => null, - }; + public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 3 => this.cref, - _ => null, - }; + public CrefSyntax Cref => GetRed(ref this.cref, 3)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCrefAttribute(this); + public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); - public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.name)!, + 3 => GetRed(ref this.cref, 3)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 3 => this.cref, + _ => null, + }; - internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); - public new XmlCrefAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); - public new XmlCrefAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); - internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); - public new XmlCrefAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Cref, this.EndQuoteToken); - public XmlCrefAttributeSyntax WithCref(CrefSyntax cref) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, cref, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); - public new XmlCrefAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Cref, endQuoteToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCrefAttribute(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax + public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) { - private XmlNameSyntax? name; - private IdentifierNameSyntax? identifier; - - internal XmlNameAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken) { + var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; + return this; + } + + internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); + public new XmlCrefAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); + public new XmlCrefAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); + internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); + public new XmlCrefAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Cref, this.EndQuoteToken); + public XmlCrefAttributeSyntax WithCref(CrefSyntax cref) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, cref, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); + public new XmlCrefAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Cref, endQuoteToken); +} - public override SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax +{ + private XmlNameSyntax? name; + private IdentifierNameSyntax? identifier; - public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + internal XmlNameAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public IdentifierNameSyntax Identifier => GetRed(ref this.identifier, 3)!; + public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 3 => GetRed(ref this.identifier, 3)!, - _ => null, - }; + public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 3 => this.identifier, - _ => null, - }; + public IdentifierNameSyntax Identifier => GetRed(ref this.identifier, 3)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlNameAttribute(this); + public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); - public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.name)!, + 3 => GetRed(ref this.identifier, 3)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 3 => this.identifier, + _ => null, + }; - internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); - public new XmlNameAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); - public new XmlNameAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); - internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); - public new XmlNameAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Identifier, this.EndQuoteToken); - public XmlNameAttributeSyntax WithIdentifier(IdentifierNameSyntax identifier) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, identifier, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); - public new XmlNameAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Identifier, endQuoteToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlNameAttribute(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlTextSyntax : XmlNodeSyntax + public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) { - - internal XmlTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken) { + var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(0); - return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; - } - } + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); + public new XmlNameAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); + public new XmlNameAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); + internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); + public new XmlNameAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Identifier, this.EndQuoteToken); + public XmlNameAttributeSyntax WithIdentifier(IdentifierNameSyntax identifier) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, identifier, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); + public new XmlNameAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Identifier, endQuoteToken); +} - internal override SyntaxNode? GetCachedSlot(int index) => null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlTextSyntax : XmlNodeSyntax +{ - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlText(this); + internal XmlTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public XmlTextSyntax Update(SyntaxTokenList textTokens) + public SyntaxTokenList TextTokens + { + get { - if (textTokens != this.TextTokens) - { - var newNode = SyntaxFactory.XmlText(textTokens); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(0); + return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; } + } - public XmlTextSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(textTokens); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public XmlTextSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlText(this); - internal XmlCDataSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public XmlTextSyntax Update(SyntaxTokenList textTokens) + { + if (textTokens != this.TextTokens) { + var newNode = SyntaxFactory.XmlText(textTokens); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken StartCDataToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); + return this; + } - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public XmlTextSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(textTokens); - public SyntaxToken EndCDataToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); + public XmlTextSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal XmlCDataSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCDataSection(this); + public SyntaxToken StartCDataToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); - public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, SyntaxTokenList textTokens, SyntaxToken endCDataToken) + public SyntaxTokenList TextTokens + { + get { - if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) - { - var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public XmlCDataSectionSyntax WithStartCDataToken(SyntaxToken startCDataToken) => Update(startCDataToken, this.TextTokens, this.EndCDataToken); - public XmlCDataSectionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartCDataToken, textTokens, this.EndCDataToken); - public XmlCDataSectionSyntax WithEndCDataToken(SyntaxToken endCDataToken) => Update(this.StartCDataToken, this.TextTokens, endCDataToken); + public SyntaxToken EndCDataToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); - public XmlCDataSectionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax - { - private XmlNameSyntax? name; + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCDataSection(this); - internal XmlProcessingInstructionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, SyntaxTokenList textTokens, SyntaxToken endCDataToken) + { + if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) { + var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken StartProcessingInstructionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlProcessingInstructionSyntax)this.Green).startProcessingInstructionToken, Position, 0); + return this; + } - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + public XmlCDataSectionSyntax WithStartCDataToken(SyntaxToken startCDataToken) => Update(startCDataToken, this.TextTokens, this.EndCDataToken); + public XmlCDataSectionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartCDataToken, textTokens, this.EndCDataToken); + public XmlCDataSectionSyntax WithEndCDataToken(SyntaxToken endCDataToken) => Update(this.StartCDataToken, this.TextTokens, endCDataToken); - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(2); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public XmlCDataSectionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); +} - public SyntaxToken EndProcessingInstructionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax +{ + private XmlNameSyntax? name; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; + internal XmlProcessingInstructionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + public SyntaxToken StartProcessingInstructionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlProcessingInstructionSyntax)this.Green).startProcessingInstructionToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlProcessingInstruction(this); + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, SyntaxTokenList textTokens, SyntaxToken endProcessingInstructionToken) + public SyntaxTokenList TextTokens + { + get { - if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) - { - var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(2); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } + } - public XmlProcessingInstructionSyntax WithStartProcessingInstructionToken(SyntaxToken startProcessingInstructionToken) => Update(startProcessingInstructionToken, this.Name, this.TextTokens, this.EndProcessingInstructionToken); - public XmlProcessingInstructionSyntax WithName(XmlNameSyntax name) => Update(this.StartProcessingInstructionToken, name, this.TextTokens, this.EndProcessingInstructionToken); - public XmlProcessingInstructionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartProcessingInstructionToken, this.Name, textTokens, this.EndProcessingInstructionToken); - public XmlProcessingInstructionSyntax WithEndProcessingInstructionToken(SyntaxToken endProcessingInstructionToken) => Update(this.StartProcessingInstructionToken, this.Name, this.TextTokens, endProcessingInstructionToken); + public SyntaxToken EndProcessingInstructionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); - public XmlProcessingInstructionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlCommentSyntax : XmlNodeSyntax - { + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlProcessingInstruction(this); - internal XmlCommentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, SyntaxTokenList textTokens, SyntaxToken endProcessingInstructionToken) + { + if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) { + var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken LessThanExclamationMinusMinusToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); + return this; + } - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public XmlProcessingInstructionSyntax WithStartProcessingInstructionToken(SyntaxToken startProcessingInstructionToken) => Update(startProcessingInstructionToken, this.Name, this.TextTokens, this.EndProcessingInstructionToken); + public XmlProcessingInstructionSyntax WithName(XmlNameSyntax name) => Update(this.StartProcessingInstructionToken, name, this.TextTokens, this.EndProcessingInstructionToken); + public XmlProcessingInstructionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartProcessingInstructionToken, this.Name, textTokens, this.EndProcessingInstructionToken); + public XmlProcessingInstructionSyntax WithEndProcessingInstructionToken(SyntaxToken endProcessingInstructionToken) => Update(this.StartProcessingInstructionToken, this.Name, this.TextTokens, endProcessingInstructionToken); - public SyntaxToken MinusMinusGreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public XmlProcessingInstructionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlCommentSyntax : XmlNodeSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal XmlCommentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlComment(this); + public SyntaxToken LessThanExclamationMinusMinusToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); - public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, SyntaxTokenList textTokens, SyntaxToken minusMinusGreaterThanToken) + public SyntaxTokenList TextTokens + { + get { - if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) - { - var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public XmlCommentSyntax WithLessThanExclamationMinusMinusToken(SyntaxToken lessThanExclamationMinusMinusToken) => Update(lessThanExclamationMinusMinusToken, this.TextTokens, this.MinusMinusGreaterThanToken); - public XmlCommentSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.LessThanExclamationMinusMinusToken, textTokens, this.MinusMinusGreaterThanToken); - public XmlCommentSyntax WithMinusMinusGreaterThanToken(SyntaxToken minusMinusGreaterThanToken) => Update(this.LessThanExclamationMinusMinusToken, this.TextTokens, minusMinusGreaterThanToken); + public SyntaxToken MinusMinusGreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); - public XmlCommentSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => null; + + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlComment(this); - public abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax + public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, SyntaxTokenList textTokens, SyntaxToken minusMinusGreaterThanToken) { - internal DirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) { + var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxToken HashToken { get; } - public DirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => WithHashTokenCore(hashToken); - internal abstract DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken); + return this; + } - public abstract SyntaxToken EndOfDirectiveToken { get; } - public DirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveTokenCore(endOfDirectiveToken); - internal abstract DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken); + public XmlCommentSyntax WithLessThanExclamationMinusMinusToken(SyntaxToken lessThanExclamationMinusMinusToken) => Update(lessThanExclamationMinusMinusToken, this.TextTokens, this.MinusMinusGreaterThanToken); + public XmlCommentSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.LessThanExclamationMinusMinusToken, textTokens, this.MinusMinusGreaterThanToken); + public XmlCommentSyntax WithMinusMinusGreaterThanToken(SyntaxToken minusMinusGreaterThanToken) => Update(this.LessThanExclamationMinusMinusToken, this.TextTokens, minusMinusGreaterThanToken); - public abstract bool IsActive { get; } - } + public XmlCommentSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); +} - public abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax +public abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax +{ + internal DirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal BranchingDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - public abstract bool BranchTaken { get; } + public abstract SyntaxToken HashToken { get; } + public DirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => WithHashTokenCore(hashToken); + internal abstract DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken); - public new BranchingDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (BranchingDirectiveTriviaSyntax)WithHashTokenCore(hashToken); - public new BranchingDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (BranchingDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); - } + public abstract SyntaxToken EndOfDirectiveToken { get; } + public DirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveTokenCore(endOfDirectiveToken); + internal abstract DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken); - public abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax + public abstract bool IsActive { get; } +} + +public abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal BranchingDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal ConditionalDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - public abstract ExpressionSyntax Condition { get; } - public ConditionalDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => WithConditionCore(condition); - internal abstract ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition); + public abstract bool BranchTaken { get; } - public abstract bool ConditionValue { get; } - } + public new BranchingDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (BranchingDirectiveTriviaSyntax)WithHashTokenCore(hashToken); + public new BranchingDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (BranchingDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); +} - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax +public abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax +{ + internal ConditionalDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? condition; + } - internal IfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public abstract ExpressionSyntax Condition { get; } + public ConditionalDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => WithConditionCore(condition); + internal abstract ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition); - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public abstract bool ConditionValue { get; } +} - public SyntaxToken IfKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax +{ + private ExpressionSyntax? condition; - public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; + internal IfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override bool IsActive => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).IsActive; + public SyntaxToken IfKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); - public override bool BranchTaken => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).BranchTaken; + public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; - public override bool ConditionValue => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ConditionValue; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; + public override bool IsActive => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; + public override bool BranchTaken => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).BranchTaken; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfDirectiveTrivia(this); + public override bool ConditionValue => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ConditionValue; - public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { - if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new IfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.HashToken, ifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); - public new IfDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.IfKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new IfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.IfKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfDirectiveTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax + public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) { - private ExpressionSyntax? condition; - - internal ElifDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken ElifKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).elifKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new IfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.HashToken, ifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); + public new IfDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.IfKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new IfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.IfKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); +} - public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax +{ + private ExpressionSyntax? condition; - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + internal ElifDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override bool BranchTaken => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).BranchTaken; + public SyntaxToken ElifKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).elifKeyword, GetChildPosition(1), GetChildIndex(1)); - public override bool ConditionValue => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).ConditionValue; + public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; + public override bool IsActive => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).IsActive; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElifDirectiveTrivia(this); + public override bool BranchTaken => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).BranchTaken; - public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { - if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool ConditionValue => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).ConditionValue; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ElifDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithElifKeyword(SyntaxToken elifKeyword) => Update(this.HashToken, elifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); - public new ElifDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.ElifKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ElifDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElifKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElifDirectiveTrivia(this); - internal ElseDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { + if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken ElseKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).elseKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ElifDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithElifKeyword(SyntaxToken elifKeyword) => Update(this.HashToken, elifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); + public new ElifDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.ElifKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ElifDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElifKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); +} - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax +{ - public override bool IsActive => ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).IsActive; + internal ElseDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool BranchTaken => ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).BranchTaken; + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken ElseKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).elseKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseDirectiveTrivia(this); + public override bool IsActive => ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).IsActive; - public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) - { - if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool BranchTaken => ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).BranchTaken; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ElseDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); - public ElseDirectiveTriviaSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(this.HashToken, elseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ElseDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElseKeyword, endOfDirectiveToken, this.IsActive, this.BranchTaken); - public ElseDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, isActive, this.BranchTaken); - public ElseDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, branchTaken); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseDirectiveTrivia(this); - internal EndIfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + { + if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } + + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ElseDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); + public ElseDirectiveTriviaSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(this.HashToken, elseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ElseDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElseKeyword, endOfDirectiveToken, this.IsActive, this.BranchTaken); + public ElseDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, isActive, this.BranchTaken); + public ElseDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, branchTaken); +} - public SyntaxToken EndIfKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endIfKeyword, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal EndIfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken EndIfKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endIfKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndIfDirectiveTrivia(this); + public override bool IsActive => ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).IsActive; - public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new EndIfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndIfKeyword, this.EndOfDirectiveToken, this.IsActive); - public EndIfDirectiveTriviaSyntax WithEndIfKeyword(SyntaxToken endIfKeyword) => Update(this.HashToken, endIfKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new EndIfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndIfKeyword, endOfDirectiveToken, this.IsActive); - public EndIfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndIfKeyword, this.EndOfDirectiveToken, isActive); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndIfDirectiveTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax + public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) { - - internal RegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } + + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new EndIfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndIfKeyword, this.EndOfDirectiveToken, this.IsActive); + public EndIfDirectiveTriviaSyntax WithEndIfKeyword(SyntaxToken endIfKeyword) => Update(this.HashToken, endIfKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new EndIfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndIfKeyword, endOfDirectiveToken, this.IsActive); + public EndIfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndIfKeyword, this.EndOfDirectiveToken, isActive); +} - public SyntaxToken RegionKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).regionKeyword, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal RegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken RegionKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).regionKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRegionDirectiveTrivia(this); + public override bool IsActive => ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).IsActive; - public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new RegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.RegionKeyword, this.EndOfDirectiveToken, this.IsActive); - public RegionDirectiveTriviaSyntax WithRegionKeyword(SyntaxToken regionKeyword) => Update(this.HashToken, regionKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new RegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.RegionKeyword, endOfDirectiveToken, this.IsActive); - public RegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.RegionKeyword, this.EndOfDirectiveToken, isActive); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRegionDirectiveTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax + public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) { - - internal EndRegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken EndRegionKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endRegionKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new RegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.RegionKeyword, this.EndOfDirectiveToken, this.IsActive); + public RegionDirectiveTriviaSyntax WithRegionKeyword(SyntaxToken regionKeyword) => Update(this.HashToken, regionKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new RegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.RegionKeyword, endOfDirectiveToken, this.IsActive); + public RegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.RegionKeyword, this.EndOfDirectiveToken, isActive); +} - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override bool IsActive => ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).IsActive; + internal EndRegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken EndRegionKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endRegionKeyword, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndRegionDirectiveTrivia(this); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool IsActive => ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).IsActive; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new EndRegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, this.IsActive); - public EndRegionDirectiveTriviaSyntax WithEndRegionKeyword(SyntaxToken endRegionKeyword) => Update(this.HashToken, endRegionKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new EndRegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndRegionKeyword, endOfDirectiveToken, this.IsActive); - public EndRegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, isActive); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndRegionDirectiveTrivia(this); - internal ErrorDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken ErrorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).errorKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new EndRegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, this.IsActive); + public EndRegionDirectiveTriviaSyntax WithEndRegionKeyword(SyntaxToken endRegionKeyword) => Update(this.HashToken, endRegionKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new EndRegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndRegionKeyword, endOfDirectiveToken, this.IsActive); + public EndRegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, isActive); +} - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override bool IsActive => ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).IsActive; + internal ErrorDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken ErrorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).errorKeyword, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitErrorDirectiveTrivia(this); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool IsActive => ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).IsActive; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ErrorDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ErrorKeyword, this.EndOfDirectiveToken, this.IsActive); - public ErrorDirectiveTriviaSyntax WithErrorKeyword(SyntaxToken errorKeyword) => Update(this.HashToken, errorKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ErrorDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ErrorKeyword, endOfDirectiveToken, this.IsActive); - public ErrorDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ErrorKeyword, this.EndOfDirectiveToken, isActive); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitErrorDirectiveTrivia(this); - internal WarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } + + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ErrorDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ErrorKeyword, this.EndOfDirectiveToken, this.IsActive); + public ErrorDirectiveTriviaSyntax WithErrorKeyword(SyntaxToken errorKeyword) => Update(this.HashToken, errorKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ErrorDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ErrorKeyword, endOfDirectiveToken, this.IsActive); + public ErrorDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ErrorKeyword, this.EndOfDirectiveToken, isActive); +} - public SyntaxToken WarningKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal WarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken WarningKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWarningDirectiveTrivia(this); + public override bool IsActive => ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).IsActive; - public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new WarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.WarningKeyword, this.EndOfDirectiveToken, this.IsActive); - public WarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, warningKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new WarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.WarningKeyword, endOfDirectiveToken, this.IsActive); - public WarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.WarningKeyword, this.EndOfDirectiveToken, isActive); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWarningDirectiveTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax + public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) { - - internal BadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } + + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new WarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.WarningKeyword, this.EndOfDirectiveToken, this.IsActive); + public WarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, warningKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new WarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.WarningKeyword, endOfDirectiveToken, this.IsActive); + public WarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.WarningKeyword, this.EndOfDirectiveToken, isActive); +} - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal BadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBadDirectiveTrivia(this); + public override bool IsActive => ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).IsActive; - public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new BadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.Identifier, this.EndOfDirectiveToken, this.IsActive); - public BadDirectiveTriviaSyntax WithIdentifier(SyntaxToken identifier) => Update(this.HashToken, identifier, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new BadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.Identifier, endOfDirectiveToken, this.IsActive); - public BadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.Identifier, this.EndOfDirectiveToken, isActive); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBadDirectiveTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax + public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) { - - internal DefineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken DefineKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).defineKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new BadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.Identifier, this.EndOfDirectiveToken, this.IsActive); + public BadDirectiveTriviaSyntax WithIdentifier(SyntaxToken identifier) => Update(this.HashToken, identifier, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new BadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.Identifier, endOfDirectiveToken, this.IsActive); + public BadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.Identifier, this.EndOfDirectiveToken, isActive); +} - public SyntaxToken Name => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + internal DefineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken DefineKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).defineKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken Name => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefineDirectiveTrivia(this); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool IsActive => ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).IsActive; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new DefineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public DefineDirectiveTriviaSyntax WithDefineKeyword(SyntaxToken defineKeyword) => Update(this.HashToken, defineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public DefineDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.DefineKeyword, name, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new DefineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.DefineKeyword, this.Name, endOfDirectiveToken, this.IsActive); - public DefineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, isActive); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefineDirectiveTrivia(this); - internal UndefDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken UndefKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).undefKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new DefineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public DefineDirectiveTriviaSyntax WithDefineKeyword(SyntaxToken defineKeyword) => Update(this.HashToken, defineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public DefineDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.DefineKeyword, name, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new DefineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.DefineKeyword, this.Name, endOfDirectiveToken, this.IsActive); + public DefineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, isActive); +} - public SyntaxToken Name => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + internal UndefDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken UndefKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).undefKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken Name => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUndefDirectiveTrivia(this); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool IsActive => ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).IsActive; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new UndefDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public UndefDirectiveTriviaSyntax WithUndefKeyword(SyntaxToken undefKeyword) => Update(this.HashToken, undefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public UndefDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.UndefKeyword, name, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new UndefDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.UndefKeyword, this.Name, endOfDirectiveToken, this.IsActive); - public UndefDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, isActive); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUndefDirectiveTrivia(this); + + public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) { - internal LineOrSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxToken LineKeyword { get; } - public LineOrSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => WithLineKeywordCore(lineKeyword); - internal abstract LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword); + return this; + } - public abstract SyntaxToken File { get; } - public LineOrSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => WithFileCore(file); - internal abstract LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new UndefDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public UndefDirectiveTriviaSyntax WithUndefKeyword(SyntaxToken undefKeyword) => Update(this.HashToken, undefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public UndefDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.UndefKeyword, name, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new UndefDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.UndefKeyword, this.Name, endOfDirectiveToken, this.IsActive); + public UndefDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, isActive); +} - public new LineOrSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (LineOrSpanDirectiveTriviaSyntax)WithHashTokenCore(hashToken); - public new LineOrSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (LineOrSpanDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); +public abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal LineOrSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax - { + public abstract SyntaxToken LineKeyword { get; } + public LineOrSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => WithLineKeywordCore(lineKeyword); + internal abstract LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword); - internal LineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public abstract SyntaxToken File { get; } + public LineOrSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => WithFileCore(file); + internal abstract LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file); + + public new LineOrSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (LineOrSpanDirectiveTriviaSyntax)WithHashTokenCore(hashToken); + public new LineOrSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (LineOrSpanDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax +{ + + internal LineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override SyntaxToken LineKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken LineKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken Line => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Line => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken File + public override SyntaxToken File + { + get { - get - { - var slot = ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } + var slot = ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } + } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); - public override bool IsActive => ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectiveTrivia(this); - public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new LineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); - public new LineDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineDirectiveTriviaSyntax WithLine(SyntaxToken line) => Update(this.HashToken, this.LineKeyword, line, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); - public new LineDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Line, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new LineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, endOfDirectiveToken, this.IsActive); - public LineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new LineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); + public new LineDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineDirectiveTriviaSyntax WithLine(SyntaxToken line) => Update(this.HashToken, this.LineKeyword, line, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); + public new LineDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Line, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new LineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, endOfDirectiveToken, this.IsActive); + public LineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, isActive); +} - internal LineDirectivePositionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode +{ + + internal LineDirectivePositionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).openParenToken, Position, 0); - public SyntaxToken Line => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).line, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Line => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).line, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken CommaToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).commaToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CommaToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).commaToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken Character => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).character, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Character => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).character, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectivePosition(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectivePosition(this); - public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken) { - if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public LineDirectivePositionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Line, this.CommaToken, this.Character, this.CloseParenToken); - public LineDirectivePositionSyntax WithLine(SyntaxToken line) => Update(this.OpenParenToken, line, this.CommaToken, this.Character, this.CloseParenToken); - public LineDirectivePositionSyntax WithCommaToken(SyntaxToken commaToken) => Update(this.OpenParenToken, this.Line, commaToken, this.Character, this.CloseParenToken); - public LineDirectivePositionSyntax WithCharacter(SyntaxToken character) => Update(this.OpenParenToken, this.Line, this.CommaToken, character, this.CloseParenToken); - public LineDirectivePositionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Line, this.CommaToken, this.Character, closeParenToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax - { - private LineDirectivePositionSyntax? start; - private LineDirectivePositionSyntax? end; + public LineDirectivePositionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Line, this.CommaToken, this.Character, this.CloseParenToken); + public LineDirectivePositionSyntax WithLine(SyntaxToken line) => Update(this.OpenParenToken, line, this.CommaToken, this.Character, this.CloseParenToken); + public LineDirectivePositionSyntax WithCommaToken(SyntaxToken commaToken) => Update(this.OpenParenToken, this.Line, commaToken, this.Character, this.CloseParenToken); + public LineDirectivePositionSyntax WithCharacter(SyntaxToken character) => Update(this.OpenParenToken, this.Line, this.CommaToken, character, this.CloseParenToken); + public LineDirectivePositionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Line, this.CommaToken, this.Character, closeParenToken); +} - internal LineSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax +{ + private LineDirectivePositionSyntax? start; + private LineDirectivePositionSyntax? end; - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal LineSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken LineKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public LineDirectivePositionSyntax Start => GetRed(ref this.start, 2)!; + public override SyntaxToken LineKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken MinusToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).minusToken, GetChildPosition(3), GetChildIndex(3)); + public LineDirectivePositionSyntax Start => GetRed(ref this.start, 2)!; - public LineDirectivePositionSyntax End => GetRed(ref this.end, 4)!; + public SyntaxToken MinusToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).minusToken, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken CharacterOffset + public LineDirectivePositionSyntax End => GetRed(ref this.end, 4)!; + + public SyntaxToken CharacterOffset + { + get { - get - { - var slot = ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } + var slot = ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } + } - public override SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); + public override SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); - public override bool IsActive => ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 2 => GetRed(ref this.start, 2)!, - 4 => GetRed(ref this.end, 4)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 2 => GetRed(ref this.start, 2)!, + 4 => GetRed(ref this.end, 4)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.start, - 4 => this.end, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 2 => this.start, + 4 => this.end, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineSpanDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineSpanDirectiveTrivia(this); - public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new LineSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); - public new LineSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithStart(LineDirectivePositionSyntax start) => Update(this.HashToken, this.LineKeyword, start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithMinusToken(SyntaxToken minusToken) => Update(this.HashToken, this.LineKeyword, this.Start, minusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithEnd(LineDirectivePositionSyntax end) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, end, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithCharacterOffset(SyntaxToken characterOffset) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, characterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); - public new LineSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new LineSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, endOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - private SyntaxNode? errorCodes; + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new LineSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); + public new LineSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithStart(LineDirectivePositionSyntax start) => Update(this.HashToken, this.LineKeyword, start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithMinusToken(SyntaxToken minusToken) => Update(this.HashToken, this.LineKeyword, this.Start, minusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithEnd(LineDirectivePositionSyntax end) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, end, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithCharacterOffset(SyntaxToken characterOffset) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, characterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); + public new LineSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new LineSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, endOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, isActive); +} - internal PragmaWarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + private SyntaxNode? errorCodes; + + internal PragmaWarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken WarningKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken WarningKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken DisableOrRestoreKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken DisableOrRestoreKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); - public SeparatedSyntaxList ErrorCodes + public SeparatedSyntaxList ErrorCodes + { + get { - get - { - var red = GetRed(ref this.errorCodes, 4); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; - } + var red = GetRed(ref this.errorCodes, 4); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; } + } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); - public override bool IsActive => ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.errorCodes, 4)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.errorCodes, 4)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.errorCodes : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.errorCodes : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaWarningDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaWarningDirectiveTrivia(this); - public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new PragmaWarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, this.PragmaKeyword, warningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithDisableOrRestoreKeyword(SyntaxToken disableOrRestoreKeyword) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, disableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithErrorCodes(SeparatedSyntaxList errorCodes) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, errorCodes, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new PragmaWarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, endOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, isActive); - - public PragmaWarningDirectiveTriviaSyntax AddErrorCodes(params ExpressionSyntax[] items) => WithErrorCodes(this.ErrorCodes.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new PragmaWarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, this.PragmaKeyword, warningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithDisableOrRestoreKeyword(SyntaxToken disableOrRestoreKeyword) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, disableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithErrorCodes(SeparatedSyntaxList errorCodes) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, errorCodes, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new PragmaWarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, endOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, isActive); - internal PragmaChecksumDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public PragmaWarningDirectiveTriviaSyntax AddErrorCodes(params ExpressionSyntax[] items) => WithErrorCodes(this.ErrorCodes.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal PragmaChecksumDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ChecksumKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).checksumKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).file, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken ChecksumKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).checksumKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken Guid => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).guid, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).file, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken Bytes => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).bytes, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken Guid => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).guid, GetChildPosition(4), GetChildIndex(4)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken Bytes => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).bytes, GetChildPosition(5), GetChildIndex(5)); - public override bool IsActive => ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override bool IsActive => ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaChecksumDirectiveTrivia(this); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaChecksumDirectiveTrivia(this); - return this; + public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new PragmaChecksumDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithChecksumKeyword(SyntaxToken checksumKeyword) => Update(this.HashToken, this.PragmaKeyword, checksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, file, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithGuid(SyntaxToken guid) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithBytes(SyntaxToken bytes) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, bytes, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new PragmaChecksumDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, endOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new PragmaChecksumDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithChecksumKeyword(SyntaxToken checksumKeyword) => Update(this.HashToken, this.PragmaKeyword, checksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, file, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithGuid(SyntaxToken guid) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithBytes(SyntaxToken bytes) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, bytes, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new PragmaChecksumDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, endOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, isActive); +} - internal ReferenceDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + + internal ReferenceDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ReferenceKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).referenceKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ReferenceKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).referenceKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public override bool IsActive => ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReferenceDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReferenceDirectiveTrivia(this); - public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ReferenceDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public ReferenceDirectiveTriviaSyntax WithReferenceKeyword(SyntaxToken referenceKeyword) => Update(this.HashToken, referenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public ReferenceDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.ReferenceKeyword, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ReferenceDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ReferenceKeyword, this.File, endOfDirectiveToken, this.IsActive); - public ReferenceDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ReferenceDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public ReferenceDirectiveTriviaSyntax WithReferenceKeyword(SyntaxToken referenceKeyword) => Update(this.HashToken, referenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public ReferenceDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.ReferenceKeyword, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ReferenceDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ReferenceKeyword, this.File, endOfDirectiveToken, this.IsActive); + public ReferenceDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, isActive); +} - internal LoadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal LoadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken LoadKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).loadKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken LoadKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).loadKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override bool IsActive => ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLoadDirectiveTrivia(this); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLoadDirectiveTrivia(this); - return this; + public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new LoadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public LoadDirectiveTriviaSyntax WithLoadKeyword(SyntaxToken loadKeyword) => Update(this.HashToken, loadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public LoadDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LoadKeyword, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new LoadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LoadKeyword, this.File, endOfDirectiveToken, this.IsActive); - public LoadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new LoadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public LoadDirectiveTriviaSyntax WithLoadKeyword(SyntaxToken loadKeyword) => Update(this.HashToken, loadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public LoadDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LoadKeyword, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new LoadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LoadKeyword, this.File, endOfDirectiveToken, this.IsActive); + public LoadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, isActive); +} - internal ShebangDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + + internal ShebangDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ExclamationToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).exclamationToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ExclamationToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).exclamationToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitShebangDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitShebangDirectiveTrivia(this); - public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ShebangDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ExclamationToken, this.EndOfDirectiveToken, this.IsActive); - public ShebangDirectiveTriviaSyntax WithExclamationToken(SyntaxToken exclamationToken) => Update(this.HashToken, exclamationToken, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ShebangDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ExclamationToken, endOfDirectiveToken, this.IsActive); - public ShebangDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ExclamationToken, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ShebangDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ExclamationToken, this.EndOfDirectiveToken, this.IsActive); + public ShebangDirectiveTriviaSyntax WithExclamationToken(SyntaxToken exclamationToken) => Update(this.HashToken, exclamationToken, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ShebangDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ExclamationToken, endOfDirectiveToken, this.IsActive); + public ShebangDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ExclamationToken, this.EndOfDirectiveToken, isActive); +} - internal NullableDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal NullableDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken NullableKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).nullableKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken SettingToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken NullableKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).nullableKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken TargetToken + public SyntaxToken SettingToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); + + public SyntaxToken TargetToken + { + get { - get - { - var slot = ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } + var slot = ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } + } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); - public override bool IsActive => ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableDirectiveTrivia(this); - public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new NullableDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithNullableKeyword(SyntaxToken nullableKeyword) => Update(this.HashToken, nullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithSettingToken(SyntaxToken settingToken) => Update(this.HashToken, this.NullableKeyword, settingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithTargetToken(SyntaxToken targetToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, targetToken, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new NullableDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, endOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, isActive); + return this; } + + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new NullableDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithNullableKeyword(SyntaxToken nullableKeyword) => Update(this.HashToken, nullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithSettingToken(SyntaxToken settingToken) => Update(this.HashToken, this.NullableKeyword, settingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithTargetToken(SyntaxToken targetToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, targetToken, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new NullableDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, endOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, isActive); } diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index fe3c2d21bcbb9..f88653ce27221 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -37,6 +37,7 @@ private void WriteFileHeader() WriteLine("using System.Diagnostics.CodeAnalysis;"); WriteLine("using Microsoft.CodeAnalysis.Syntax.InternalSyntax;"); WriteLine("using Roslyn.Utilities;"); + WriteLine("using CoreSyntax = Microsoft.CodeAnalysis.Syntax.InternalSyntax;"); WriteLine(); } @@ -139,7 +140,7 @@ private void WriteGreenType(TreeType node) if (IsSeparatedNodeList(field.Type) || IsNodeList(field.Type)) { - WriteLine($"public abstract {(IsNew(field) ? "new " : "")}{field.Type} {field.Name} {{ get; }}"); + WriteLine($"public abstract {(IsNew(field) ? "new " : "")}CoreSyntax.{field.Type} {field.Name} {{ get; }}"); } else { @@ -223,15 +224,15 @@ private void WriteGreenType(TreeType node) WriteComment(field.PropertyComment, ""); if (IsNodeList(field.Type)) { - WriteLine($"public {OverrideOrNewModifier(field)}Microsoft.CodeAnalysis.Syntax.InternalSyntax.{field.Type} {field.Name} => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.{field.Type}(this.{CamelCase(field.Name)});"); + WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.{field.Type} {field.Name} => new CoreSyntax.{field.Type}(this.{CamelCase(field.Name)});"); } else if (IsSeparatedNodeList(field.Type)) { - WriteLine($"public {OverrideOrNewModifier(field)}Microsoft.CodeAnalysis.Syntax.InternalSyntax.{field.Type} {field.Name} => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.{field.Type}(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.{CamelCase(field.Name)}));"); + WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.{field.Type} {field.Name} => new CoreSyntax.{field.Type}(new CoreSyntax.SyntaxList(this.{CamelCase(field.Name)}));"); } else if (field.Type == "SyntaxNodeOrTokenList") { - WriteLine($"public {OverrideOrNewModifier(field)}Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList {field.Name} => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.{CamelCase(field.Name)});"); + WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.SyntaxList {field.Name} => new CoreSyntax.SyntaxList(this.{CamelCase(field.Name)});"); } else { @@ -470,10 +471,10 @@ private void WriteGreenUpdateMethod(Node node) Write(CommaJoin(node.Fields.Select(f => { var type = - f.Type == "SyntaxNodeOrTokenList" ? "Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList" : - f.Type == "SyntaxTokenList" ? "Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList" : - IsNodeList(f.Type) ? "Microsoft.CodeAnalysis.Syntax.InternalSyntax." + f.Type : - IsSeparatedNodeList(f.Type) ? "Microsoft.CodeAnalysis.Syntax.InternalSyntax." + f.Type : + f.Type == "SyntaxNodeOrTokenList" ? "CoreSyntax.SyntaxList" : + f.Type == "SyntaxTokenList" ? "CoreSyntax.SyntaxList" : + IsNodeList(f.Type) ? "CoreSyntax." + f.Type : + IsSeparatedNodeList(f.Type) ? "CoreSyntax." + f.Type : f.Type; return $"{type} {CamelCase(f.Name)}"; @@ -743,8 +744,8 @@ private void WriteGreenFactoryParameters(Node nd) { var type = f.Type switch { - "SyntaxNodeOrTokenList" => "Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList", - _ when IsSeparatedNodeList(f.Type) || IsNodeList(f.Type) => $"Microsoft.CodeAnalysis.Syntax.InternalSyntax.{f.Type}", + "SyntaxNodeOrTokenList" => "CoreSyntax.SyntaxList", + _ when IsSeparatedNodeList(f.Type) || IsNodeList(f.Type) => $"CoreSyntax.{f.Type}", _ => GetFieldType(f, green: true), }; From 7a10bb47a53cceb7da140749178a09e8614bd5e7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 24 Aug 2023 12:37:53 -0700 Subject: [PATCH 013/141] Reduce more --- .../Syntax.xml.Internal.Generated.cs | 306 ++-- .../Syntax.xml.Syntax.Generated.cs | 1230 ++++++++--------- .../CSharpSyntaxGenerator/SourceWriter.cs | 16 +- 3 files changed, 776 insertions(+), 776 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs index d2e09bc2543f1..820c5c10487af 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs @@ -414,7 +414,7 @@ internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Gree /// SyntaxToken representing less than. public SyntaxToken LessThanToken => this.lessThanToken; /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. - public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + public CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); /// SyntaxToken representing greater than. public SyntaxToken GreaterThanToken => this.greaterThanToken; @@ -757,7 +757,7 @@ internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? ran /// TypeSyntax node representing the type of the element of the array. public TypeSyntax ElementType => this.elementType; /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. - public CoreSyntax.SyntaxList RankSpecifiers => new CoreSyntax.SyntaxList(this.rankSpecifiers); + public CoreSyntax.SyntaxList RankSpecifiers => new(this.rankSpecifiers); internal override GreenNode? GetSlot(int index) => index switch @@ -876,7 +876,7 @@ internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, } public SyntaxToken OpenBracketToken => this.openBracketToken; - public CoreSyntax.SeparatedSyntaxList Sizes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.sizes)); + public CoreSyntax.SeparatedSyntaxList Sizes => new(new(this.sizes)); public SyntaxToken CloseBracketToken => this.closeBracketToken; internal override GreenNode? GetSlot(int index) @@ -1249,7 +1249,7 @@ internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessTha /// SyntaxToken representing the less than token. public SyntaxToken LessThanToken => this.lessThanToken; /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. - public CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + public CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// SyntaxToken representing the greater than token. public SyntaxToken GreaterThanToken => this.greaterThanToken; @@ -1493,7 +1493,7 @@ internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, Sy /// SyntaxToken representing open bracket. public SyntaxToken OpenBracketToken => this.openBracketToken; /// SeparatedSyntaxList of calling convention identifiers. - public CoreSyntax.SeparatedSyntaxList CallingConventions => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.callingConventions)); + public CoreSyntax.SeparatedSyntaxList CallingConventions => new(new(this.callingConventions)); /// SyntaxToken representing close bracket. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -1809,7 +1809,7 @@ internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? /// SyntaxToken representing the open parenthesis. public SyntaxToken OpenParenToken => this.openParenToken; - public CoreSyntax.SeparatedSyntaxList Elements => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.elements)); + public CoreSyntax.SeparatedSyntaxList Elements => new(new(this.elements)); /// SyntaxToken representing the close parenthesis. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -2520,7 +2520,7 @@ internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, Gree /// SyntaxToken representing the open parenthesis. public SyntaxToken OpenParenToken => this.openParenToken; /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + public CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); /// SyntaxToken representing the close parenthesis. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -5432,7 +5432,7 @@ internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNo /// SyntaxToken representing open parenthesis. public SyntaxToken OpenParenToken => this.openParenToken; /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + public override CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); /// SyntaxToken representing close parenthesis. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -5561,7 +5561,7 @@ internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketTok /// SyntaxToken representing open bracket. public SyntaxToken OpenBracketToken => this.openBracketToken; /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + public override CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); /// SyntaxToken representing close bracket. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -6351,7 +6351,7 @@ internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, } } - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// SyntaxToken representing the delegate keyword. public SyntaxToken DelegateKeyword => this.delegateKeyword; /// List of parameters of the anonymous method expression, or null if there no parameters are specified. @@ -6577,8 +6577,8 @@ internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// ParameterSyntax node representing the parameter of the lambda expression. public ParameterSyntax Parameter => this.parameter; /// SyntaxToken representing equals greater than. @@ -6904,8 +6904,8 @@ internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attribu } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public TypeSyntax? ReturnType => this.returnType; /// ParameterListSyntax node representing the list of parameters for the lambda expression. public ParameterListSyntax ParameterList => this.parameterList; @@ -7079,7 +7079,7 @@ internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken /// SyntaxToken representing the open brace. public SyntaxToken OpenBraceToken => this.openBraceToken; /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. - public CoreSyntax.SeparatedSyntaxList Expressions => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.expressions)); + public CoreSyntax.SeparatedSyntaxList Expressions => new(new(this.expressions)); /// SyntaxToken representing the close brace. public SyntaxToken CloseBraceToken => this.closeBraceToken; @@ -7756,7 +7756,7 @@ internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken ne /// SyntaxToken representing the open brace. public SyntaxToken OpenBraceToken => this.openBraceToken; /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. - public CoreSyntax.SeparatedSyntaxList Initializers => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.initializers)); + public CoreSyntax.SeparatedSyntaxList Initializers => new(new(this.initializers)); /// SyntaxToken representing the close brace. public SyntaxToken CloseBraceToken => this.closeBraceToken; @@ -8035,7 +8035,7 @@ internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newK /// SyntaxToken representing the open bracket. public SyntaxToken OpenBracketToken => this.openBracketToken; /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. - public CoreSyntax.SyntaxList Commas => new CoreSyntax.SyntaxList(this.commas); + public CoreSyntax.SyntaxList Commas => new(this.commas); /// SyntaxToken representing the close bracket. public SyntaxToken CloseBracketToken => this.closeBracketToken; /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. @@ -8434,7 +8434,7 @@ internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToke public SyntaxToken OpenBracketToken => this.openBracketToken; /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. - public CoreSyntax.SeparatedSyntaxList Elements => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.elements)); + public CoreSyntax.SeparatedSyntaxList Elements => new(new(this.elements)); public SyntaxToken CloseBracketToken => this.closeBracketToken; internal override GreenNode? GetSlot(int index) @@ -8904,7 +8904,7 @@ internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClaus } } - public CoreSyntax.SyntaxList Clauses => new CoreSyntax.SyntaxList(this.clauses); + public CoreSyntax.SyntaxList Clauses => new(this.clauses); public SelectOrGroupClauseSyntax SelectOrGroup => this.selectOrGroup; public QueryContinuationSyntax? Continuation => this.continuation; @@ -9735,7 +9735,7 @@ internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenN } public SyntaxToken OrderByKeyword => this.orderByKeyword; - public CoreSyntax.SeparatedSyntaxList Orderings => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.orderings)); + public CoreSyntax.SeparatedSyntaxList Orderings => new(new(this.orderings)); internal override GreenNode? GetSlot(int index) => index switch @@ -10393,7 +10393,7 @@ internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringS /// The first part of an interpolated string, $" or $@" or $""" public SyntaxToken StringStartToken => this.stringStartToken; /// List of parts of the interpolated string, each one is either a literal part or an interpolation. - public CoreSyntax.SyntaxList Contents => new CoreSyntax.SyntaxList(this.contents); + public CoreSyntax.SyntaxList Contents => new(this.contents); /// The closing quote of the interpolated string. public SyntaxToken StringEndToken => this.stringEndToken; @@ -11310,7 +11310,7 @@ internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenTok } public SyntaxToken OpenParenToken => this.openParenToken; - public CoreSyntax.SeparatedSyntaxList Subpatterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.subpatterns)); + public CoreSyntax.SeparatedSyntaxList Subpatterns => new(new(this.subpatterns)); public SyntaxToken CloseParenToken => this.closeParenToken; internal override GreenNode? GetSlot(int index) @@ -11435,7 +11435,7 @@ internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken } public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SeparatedSyntaxList Subpatterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.subpatterns)); + public CoreSyntax.SeparatedSyntaxList Subpatterns => new(new(this.subpatterns)); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -12283,7 +12283,7 @@ internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenN } public SyntaxToken OpenBracketToken => this.openBracketToken; - public CoreSyntax.SeparatedSyntaxList Patterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.patterns)); + public CoreSyntax.SeparatedSyntaxList Patterns => new(new(this.patterns)); public SyntaxToken CloseBracketToken => this.closeBracketToken; public VariableDesignationSyntax? Designation => this.designation; @@ -13007,8 +13007,8 @@ internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Green this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public StatementSyntax Statement => this.statement; internal override GreenNode? GetSlot(int index) @@ -13172,9 +13172,9 @@ internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ope this.closeBraceToken = closeBraceToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SyntaxList Statements => new CoreSyntax.SyntaxList(this.statements); + public CoreSyntax.SyntaxList Statements => new(this.statements); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -13409,14 +13409,14 @@ internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public TypeSyntax ReturnType => this.returnType; /// Gets the identifier. public SyntaxToken Identifier => this.identifier; public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public ParameterListSyntax ParameterList => this.parameterList; - public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public BlockSyntax? Body => this.body; public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; /// Gets the optional semicolon token. @@ -13644,11 +13644,11 @@ internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLi this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken? AwaitKeyword => this.awaitKeyword; public SyntaxToken? UsingKeyword => this.usingKeyword; /// Gets the modifier list. - public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public VariableDeclarationSyntax Declaration => this.declaration; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -13791,7 +13791,7 @@ internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? } public TypeSyntax Type => this.type; - public CoreSyntax.SeparatedSyntaxList Variables => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.variables)); + public CoreSyntax.SeparatedSyntaxList Variables => new(new(this.variables)); internal override GreenNode? GetSlot(int index) => index switch @@ -14332,7 +14332,7 @@ internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken ope } public SyntaxToken OpenParenToken => this.openParenToken; - public CoreSyntax.SeparatedSyntaxList Variables => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.variables)); + public CoreSyntax.SeparatedSyntaxList Variables => new(new(this.variables)); public SyntaxToken CloseParenToken => this.closeParenToken; internal override GreenNode? GetSlot(int index) @@ -14456,7 +14456,7 @@ internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, E this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public ExpressionSyntax Expression => this.expression; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -14574,7 +14574,7 @@ internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken SemicolonToken => this.semicolonToken; internal override GreenNode? GetSlot(int index) @@ -14701,7 +14701,7 @@ internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// Gets the identifier. public SyntaxToken Identifier => this.identifier; /// Gets a SyntaxToken that represents the colon following the statement's label. @@ -14869,7 +14869,7 @@ internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// /// Gets a SyntaxToken that represents the goto keyword. /// @@ -15024,7 +15024,7 @@ internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken BreakKeyword => this.breakKeyword; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -15149,7 +15149,7 @@ internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syn this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken ContinueKeyword => this.continueKeyword; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -15290,7 +15290,7 @@ internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken ReturnKeyword => this.returnKeyword; public ExpressionSyntax? Expression => this.expression; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -15440,7 +15440,7 @@ internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken ThrowKeyword => this.throwKeyword; public ExpressionSyntax? Expression => this.expression; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -15597,7 +15597,7 @@ internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken YieldKeyword => this.yieldKeyword; public SyntaxToken ReturnOrBreakKeyword => this.returnOrBreakKeyword; public ExpressionSyntax? Expression => this.expression; @@ -15758,7 +15758,7 @@ internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken WhileKeyword => this.whileKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public ExpressionSyntax Condition => this.condition; @@ -15936,7 +15936,7 @@ internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTok this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken DoKeyword => this.doKeyword; public StatementSyntax Statement => this.statement; public SyntaxToken WhileKeyword => this.whileKeyword; @@ -16183,15 +16183,15 @@ internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTo this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken ForKeyword => this.forKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public VariableDeclarationSyntax? Declaration => this.declaration; - public CoreSyntax.SeparatedSyntaxList Initializers => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.initializers)); + public CoreSyntax.SeparatedSyntaxList Initializers => new(new(this.initializers)); public SyntaxToken FirstSemicolonToken => this.firstSemicolonToken; public ExpressionSyntax? Condition => this.condition; public SyntaxToken SecondSemicolonToken => this.secondSemicolonToken; - public CoreSyntax.SeparatedSyntaxList Incrementors => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.incrementors)); + public CoreSyntax.SeparatedSyntaxList Incrementors => new(new(this.incrementors)); public SyntaxToken CloseParenToken => this.closeParenToken; public StatementSyntax Statement => this.statement; @@ -16458,7 +16458,7 @@ internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public override SyntaxToken? AwaitKeyword => this.awaitKeyword; public override SyntaxToken ForEachKeyword => this.forEachKeyword; public override SyntaxToken OpenParenToken => this.openParenToken; @@ -16680,7 +16680,7 @@ internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLis this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public override SyntaxToken? AwaitKeyword => this.awaitKeyword; public override SyntaxToken ForEachKeyword => this.forEachKeyword; public override SyntaxToken OpenParenToken => this.openParenToken; @@ -16912,7 +16912,7 @@ internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken? AwaitKeyword => this.awaitKeyword; public SyntaxToken UsingKeyword => this.usingKeyword; public SyntaxToken OpenParenToken => this.openParenToken; @@ -17097,7 +17097,7 @@ internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken FixedKeyword => this.fixedKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public VariableDeclarationSyntax Declaration => this.declaration; @@ -17240,7 +17240,7 @@ internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt this.block = block; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken Keyword => this.keyword; public BlockSyntax Block => this.block; @@ -17365,7 +17365,7 @@ internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta this.block = block; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken UnsafeKeyword => this.unsafeKeyword; public BlockSyntax Block => this.block; @@ -17511,7 +17511,7 @@ internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken LockKeyword => this.lockKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public ExpressionSyntax Expression => this.expression; @@ -17694,7 +17694,7 @@ internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTok } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// /// Gets a SyntaxToken that represents the if keyword. /// @@ -18031,7 +18031,7 @@ internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta this.closeBraceToken = closeBraceToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// /// Gets a SyntaxToken that represents the switch keyword. /// @@ -18055,7 +18055,7 @@ internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta /// /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. /// - public CoreSyntax.SyntaxList Sections => new CoreSyntax.SyntaxList(this.sections); + public CoreSyntax.SyntaxList Sections => new(this.sections); /// /// Gets a SyntaxToken that represents the open braces following the switch sections. /// @@ -18222,11 +18222,11 @@ internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? stat /// /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. /// - public CoreSyntax.SyntaxList Labels => new CoreSyntax.SyntaxList(this.labels); + public CoreSyntax.SyntaxList Labels => new(this.labels); /// /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. /// - public CoreSyntax.SyntaxList Statements => new CoreSyntax.SyntaxList(this.statements); + public CoreSyntax.SyntaxList Statements => new(this.statements); internal override GreenNode? GetSlot(int index) => index switch @@ -18756,7 +18756,7 @@ internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpre public ExpressionSyntax GoverningExpression => this.governingExpression; public SyntaxToken SwitchKeyword => this.switchKeyword; public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SeparatedSyntaxList Arms => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arms)); + public CoreSyntax.SeparatedSyntaxList Arms => new(new(this.arms)); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -19060,10 +19060,10 @@ internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTo } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken TryKeyword => this.tryKeyword; public BlockSyntax Block => this.block; - public CoreSyntax.SyntaxList Catches => new CoreSyntax.SyntaxList(this.catches); + public CoreSyntax.SyntaxList Catches => new(this.catches); public FinallyClauseSyntax? Finally => this.@finally; internal override GreenNode? GetSlot(int index) @@ -19758,11 +19758,11 @@ internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? u this.endOfFileToken = endOfFileToken; } - public CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); - public CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); + public CoreSyntax.SyntaxList Externs => new(this.externs); + public CoreSyntax.SyntaxList Usings => new(this.usings); /// Gets the attribute declaration list. - public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public CoreSyntax.SyntaxList Members => new(this.members); public SyntaxToken EndOfFileToken => this.endOfFileToken; internal override GreenNode? GetSlot(int index) @@ -20398,14 +20398,14 @@ internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; public override NameSyntax Name => this.name; public SyntaxToken OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); - public override CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Externs => new(this.externs); + public override CoreSyntax.SyntaxList Usings => new(this.usings); + public override CoreSyntax.SyntaxList Members => new(this.members); public SyntaxToken CloseBraceToken => this.closeBraceToken; /// Gets the optional semicolon token. public SyntaxToken? SemicolonToken => this.semicolonToken; @@ -20652,14 +20652,14 @@ internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attrib } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; public override NameSyntax Name => this.name; public SyntaxToken SemicolonToken => this.semicolonToken; - public override CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); - public override CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Externs => new(this.externs); + public override CoreSyntax.SyntaxList Usings => new(this.usings); + public override CoreSyntax.SyntaxList Members => new(this.members); internal override GreenNode? GetSlot(int index) => index switch @@ -20841,7 +20841,7 @@ internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, Attr /// Gets the optional construct targeted by the attribute. public AttributeTargetSpecifierSyntax? Target => this.target; /// Gets the attribute declaration list. - public CoreSyntax.SeparatedSyntaxList Attributes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.attributes)); + public CoreSyntax.SeparatedSyntaxList Attributes => new(new(this.attributes)); /// Gets the close bracket token. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -21195,7 +21195,7 @@ internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken /// Gets the open paren token. public SyntaxToken OpenParenToken => this.openParenToken; /// Gets the arguments syntax list. - public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + public CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); /// Gets the close paren token. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -21565,7 +21565,7 @@ internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Gre /// Gets the < token. public SyntaxToken LessThanToken => this.lessThanToken; /// Gets the parameter list. - public CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + public CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// Gets the > token. public SyntaxToken GreaterThanToken => this.greaterThanToken; @@ -21701,7 +21701,7 @@ internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT } /// Gets the attribute declaration list. - public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken? VarianceKeyword => this.varianceKeyword; /// Gets the identifier. public SyntaxToken Identifier => this.identifier; @@ -22041,17 +22041,17 @@ internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the class keyword token. public override SyntaxToken Keyword => this.keyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Members => new(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -22393,17 +22393,17 @@ internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the struct keyword token. public override SyntaxToken Keyword => this.keyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Members => new(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -22745,17 +22745,17 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the interface keyword token. public override SyntaxToken Keyword => this.keyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Members => new(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -23112,17 +23112,17 @@ internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override SyntaxToken Keyword => this.keyword; public SyntaxToken? ClassOrStructKeyword => this.classOrStructKeyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Members => new(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -23424,15 +23424,15 @@ internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Green } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the enum keyword token. public SyntaxToken EnumKeyword => this.enumKeyword; public override SyntaxToken Identifier => this.identifier; public override BaseListSyntax? BaseList => this.baseList; public override SyntaxToken? OpenBraceToken => this.openBraceToken; /// Gets the members declaration list. - public CoreSyntax.SeparatedSyntaxList Members => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.members)); + public CoreSyntax.SeparatedSyntaxList Members => new(new(this.members)); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; /// Gets the optional semicolon token. public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -23676,8 +23676,8 @@ internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the "delegate" keyword. public SyntaxToken DelegateKeyword => this.delegateKeyword; /// Gets the return type. @@ -23688,7 +23688,7 @@ internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G /// Gets the parameter list. public ParameterListSyntax ParameterList => this.parameterList; /// Gets the constraint clause list. - public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); /// Gets the semicolon token. public SyntaxToken SemicolonToken => this.semicolonToken; @@ -23877,8 +23877,8 @@ internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the identifier. public SyntaxToken Identifier => this.identifier; public EqualsValueClauseSyntax? EqualsValue => this.equalsValue; @@ -24012,7 +24012,7 @@ internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? type /// Gets the colon token. public SyntaxToken ColonToken => this.colonToken; /// Gets the base type references. - public CoreSyntax.SeparatedSyntaxList Types => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.types)); + public CoreSyntax.SeparatedSyntaxList Types => new(new(this.types)); internal override GreenNode? GetSlot(int index) => index switch @@ -24348,7 +24348,7 @@ internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereK /// Gets the colon token. public SyntaxToken ColonToken => this.colonToken; /// Gets the constraints list. - public CoreSyntax.SeparatedSyntaxList Constraints => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.constraints)); + public CoreSyntax.SeparatedSyntaxList Constraints => new(new(this.constraints)); internal override GreenNode? GetSlot(int index) => index switch @@ -24935,8 +24935,8 @@ internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override VariableDeclarationSyntax Declaration => this.declaration; public override SyntaxToken SemicolonToken => this.semicolonToken; @@ -25092,8 +25092,8 @@ internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public SyntaxToken EventKeyword => this.eventKeyword; public override VariableDeclarationSyntax Declaration => this.declaration; public override SyntaxToken SemicolonToken => this.semicolonToken; @@ -25481,8 +25481,8 @@ internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the return type syntax. public TypeSyntax ReturnType => this.returnType; public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -25491,7 +25491,7 @@ internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax ParameterList => this.parameterList; /// Gets the constraint clause list. - public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public override BlockSyntax? Body => this.body; public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; /// Gets the optional semicolon token. @@ -25790,8 +25790,8 @@ internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the return type. public TypeSyntax ReturnType => this.returnType; public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -26097,8 +26097,8 @@ internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attribu } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the "implicit" or "explicit" token. public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -26374,8 +26374,8 @@ internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the identifier. public SyntaxToken Identifier => this.identifier; public override ParameterListSyntax ParameterList => this.parameterList; @@ -26734,8 +26734,8 @@ internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the tilde token. public SyntaxToken TildeToken => this.tildeToken; /// Gets the identifier. @@ -27027,8 +27027,8 @@ internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override TypeSyntax Type => this.type; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; /// Gets the identifier. @@ -27379,8 +27379,8 @@ internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public SyntaxToken EventKeyword => this.eventKeyword; public override TypeSyntax Type => this.type; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -27634,8 +27634,8 @@ internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gr } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override TypeSyntax Type => this.type; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; public SyntaxToken ThisKeyword => this.thisKeyword; @@ -27812,7 +27812,7 @@ internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNo } public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SyntaxList Accessors => new CoreSyntax.SyntaxList(this.accessors); + public CoreSyntax.SyntaxList Accessors => new(this.accessors); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -27994,9 +27994,9 @@ internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G } /// Gets the attribute declaration list. - public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// Gets the modifier list. - public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the keyword token, or identifier if an erroneous accessor declaration. public SyntaxToken Keyword => this.keyword; /// Gets the optional body block which may be empty, but it is null if there are no braces. @@ -28179,7 +28179,7 @@ internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenN /// Gets the open paren token. public SyntaxToken OpenParenToken => this.openParenToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// Gets the close paren token. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -28307,7 +28307,7 @@ internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketTo /// Gets the open bracket token. public SyntaxToken OpenBracketToken => this.openBracketToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// Gets the close bracket token. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -28502,9 +28502,9 @@ internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? } /// Gets the attribute declaration list. - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// Gets the modifier list. - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override TypeSyntax? Type => this.type; /// Gets the identifier. public SyntaxToken Identifier => this.identifier; @@ -28661,9 +28661,9 @@ internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLis } /// Gets the attribute declaration list. - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// Gets the modifier list. - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override TypeSyntax Type => this.type; internal override GreenNode? GetSlot(int index) @@ -28808,8 +28808,8 @@ internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree } } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public TypeSyntax? Type => this.type; internal override GreenNode? GetSlot(int index) @@ -28925,7 +28925,7 @@ internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) } } - public CoreSyntax.SyntaxList Tokens => new CoreSyntax.SyntaxList(this.tokens); + public CoreSyntax.SyntaxList Tokens => new(this.tokens); internal override GreenNode? GetSlot(int index) => index == 0 ? this.tokens : null; @@ -29027,7 +29027,7 @@ internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, S this.endOfComment = endOfComment; } - public CoreSyntax.SyntaxList Content => new CoreSyntax.SyntaxList(this.content); + public CoreSyntax.SyntaxList Content => new(this.content); public SyntaxToken EndOfComment => this.endOfComment; internal override GreenNode? GetSlot(int index) @@ -29990,7 +29990,7 @@ internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, Gr /// Gets the open paren token. public SyntaxToken OpenParenToken => this.openParenToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// Gets the close paren token. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -30120,7 +30120,7 @@ internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBrack /// Gets the open bracket token. public SyntaxToken OpenBracketToken => this.openBracketToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// Gets the close bracket token. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -30407,7 +30407,7 @@ internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, Gr } public XmlElementStartTagSyntax StartTag => this.startTag; - public CoreSyntax.SyntaxList Content => new CoreSyntax.SyntaxList(this.content); + public CoreSyntax.SyntaxList Content => new(this.content); public XmlElementEndTagSyntax EndTag => this.endTag; internal override GreenNode? GetSlot(int index) @@ -30540,7 +30540,7 @@ internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Xm public SyntaxToken LessThanToken => this.lessThanToken; public XmlNameSyntax Name => this.name; - public CoreSyntax.SyntaxList Attributes => new CoreSyntax.SyntaxList(this.attributes); + public CoreSyntax.SyntaxList Attributes => new(this.attributes); public SyntaxToken GreaterThanToken => this.greaterThanToken; internal override GreenNode? GetSlot(int index) @@ -30791,7 +30791,7 @@ internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNa public SyntaxToken LessThanToken => this.lessThanToken; public XmlNameSyntax Name => this.name; - public CoreSyntax.SyntaxList Attributes => new CoreSyntax.SyntaxList(this.attributes); + public CoreSyntax.SyntaxList Attributes => new(this.attributes); public SyntaxToken SlashGreaterThanToken => this.slashGreaterThanToken; internal override GreenNode? GetSlot(int index) @@ -31175,7 +31175,7 @@ internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken public override XmlNameSyntax Name => this.name; public override SyntaxToken EqualsToken => this.equalsToken; public override SyntaxToken StartQuoteToken => this.startQuoteToken; - public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); public override SyntaxToken EndQuoteToken => this.endQuoteToken; internal override GreenNode? GetSlot(int index) @@ -31573,7 +31573,7 @@ internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) } } - public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); internal override GreenNode? GetSlot(int index) => index == 0 ? this.textTokens : null; @@ -31683,7 +31683,7 @@ internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, Gre } public SyntaxToken StartCDataToken => this.startCDataToken; - public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); public SyntaxToken EndCDataToken => this.endCDataToken; internal override GreenNode? GetSlot(int index) @@ -31816,7 +31816,7 @@ internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProces public SyntaxToken StartProcessingInstructionToken => this.startProcessingInstructionToken; public XmlNameSyntax Name => this.name; - public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); public SyntaxToken EndProcessingInstructionToken => this.endProcessingInstructionToken; internal override GreenNode? GetSlot(int index) @@ -31946,7 +31946,7 @@ internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusM } public SyntaxToken LessThanExclamationMinusMinusToken => this.lessThanExclamationMinusMinusToken; - public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); public SyntaxToken MinusMinusGreaterThanToken => this.minusMinusGreaterThanToken; internal override GreenNode? GetSlot(int index) @@ -34091,7 +34091,7 @@ internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashTok public SyntaxToken PragmaKeyword => this.pragmaKeyword; public SyntaxToken WarningKeyword => this.warningKeyword; public SyntaxToken DisableOrRestoreKeyword => this.disableOrRestoreKeyword; - public CoreSyntax.SeparatedSyntaxList ErrorCodes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.errorCodes)); + public CoreSyntax.SeparatedSyntaxList ErrorCodes => new(new(this.errorCodes)); public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; public override bool IsActive => this.isActive; diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs index 17651292e6e41..6da11cf8eb869 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs @@ -51,7 +51,7 @@ internal IdentifierNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// SyntaxToken representing the keyword for the kind of the identifier name. - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.IdentifierNameSyntax)this.Green).identifier, Position, 0); + public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.IdentifierNameSyntax)this.Green).identifier, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -97,7 +97,7 @@ internal QualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public NameSyntax Left => GetRedAtZero(ref this.left)!; /// SyntaxToken representing the dot. - public SyntaxToken DotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.QualifiedNameSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DotToken => new(this, ((Syntax.InternalSyntax.QualifiedNameSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. public SimpleNameSyntax Right => GetRed(ref this.right, 2)!; @@ -155,7 +155,7 @@ internal GenericNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa } /// SyntaxToken representing the name of the identifier of the generic name. - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.GenericNameSyntax)this.Green).identifier, Position, 0); + public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.GenericNameSyntax)this.Green).identifier, Position, 0); /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. public TypeArgumentListSyntax TypeArgumentList => GetRed(ref this.typeArgumentList, 1)!; @@ -203,7 +203,7 @@ internal TypeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod } /// SyntaxToken representing less than. - public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken LessThanToken => new(this, ((Syntax.InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. public SeparatedSyntaxList Arguments @@ -211,12 +211,12 @@ public SeparatedSyntaxList Arguments get { var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// SyntaxToken representing greater than. - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken GreaterThanToken => new(this, ((Syntax.InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; @@ -265,7 +265,7 @@ internal AliasQualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN public IdentifierNameSyntax Alias => GetRedAtZero(ref this.alias)!; /// SyntaxToken representing colon colon. - public SyntaxToken ColonColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AliasQualifiedNameSyntax)this.Green).colonColonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ColonColonToken => new(this, ((Syntax.InternalSyntax.AliasQualifiedNameSyntax)this.Green).colonColonToken, GetChildPosition(1), GetChildIndex(1)); /// SimpleNameSyntax node representing the name that is being alias qualified. public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; @@ -331,7 +331,7 @@ internal PredefinedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// SyntaxToken which represents the keyword corresponding to the predefined type. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PredefinedTypeSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.PredefinedTypeSyntax)this.Green).keyword, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -376,7 +376,7 @@ internal ArrayTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. - public SyntaxList RankSpecifiers => new SyntaxList(GetRed(ref this.rankSpecifiers, 1)); + public SyntaxList RankSpecifiers => new(GetRed(ref this.rankSpecifiers, 1)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -430,18 +430,18 @@ internal ArrayRankSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); public SeparatedSyntaxList Sizes { get { var red = GetRed(ref this.sizes, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.sizes, 1)! : null; @@ -489,7 +489,7 @@ internal PointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken AsteriskToken => new(this, ((Syntax.InternalSyntax.PointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; @@ -531,10 +531,10 @@ internal FunctionPointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax } /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerTypeSyntax)this.Green).delegateKeyword, Position, 0); + public SyntaxToken DelegateKeyword => new(this, ((Syntax.InternalSyntax.FunctionPointerTypeSyntax)this.Green).delegateKeyword, Position, 0); /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken AsteriskToken => new(this, ((Syntax.InternalSyntax.FunctionPointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); /// Node representing the optional calling convention. public FunctionPointerCallingConventionSyntax? CallingConvention => GetRed(ref this.callingConvention, 2); @@ -598,7 +598,7 @@ internal FunctionPointerParameterListSyntax(InternalSyntax.CSharpSyntaxNode gree } /// SyntaxToken representing the less than token. - public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken LessThanToken => new(this, ((Syntax.InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. public SeparatedSyntaxList Parameters @@ -606,12 +606,12 @@ public SeparatedSyntaxList Parameters get { var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// SyntaxToken representing the greater than token. - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken GreaterThanToken => new(this, ((Syntax.InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -656,7 +656,7 @@ internal FunctionPointerCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode } /// SyntaxToken representing whether the calling convention is managed or unmanaged. - public SyntaxToken ManagedOrUnmanagedKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerCallingConventionSyntax)this.Green).managedOrUnmanagedKeyword, Position, 0); + public SyntaxToken ManagedOrUnmanagedKeyword => new(this, ((Syntax.InternalSyntax.FunctionPointerCallingConventionSyntax)this.Green).managedOrUnmanagedKeyword, Position, 0); /// Optional list of identifiers that will contribute to an unmanaged calling convention. public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => GetRed(ref this.unmanagedCallingConventionList, 1); @@ -707,7 +707,7 @@ internal FunctionPointerUnmanagedCallingConventionListSyntax(InternalSyntax.CSha } /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); /// SeparatedSyntaxList of calling convention identifiers. public SeparatedSyntaxList CallingConventions @@ -715,12 +715,12 @@ public SeparatedSyntaxList Call get { var red = GetRed(ref this.callingConventions, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.callingConventions, 1)! : null; @@ -764,7 +764,7 @@ internal FunctionPointerUnmanagedCallingConventionSyntax(InternalSyntax.CSharpSy } /// SyntaxToken representing the calling convention identifier. - public SyntaxToken Name => new SyntaxToken(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionSyntax)this.Green).name, Position, 0); + public SyntaxToken Name => new(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionSyntax)this.Green).name, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -808,7 +808,7 @@ internal NullableTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableTypeSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken QuestionToken => new(this, ((Syntax.InternalSyntax.NullableTypeSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; @@ -850,19 +850,19 @@ internal TupleTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare } /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); public SeparatedSyntaxList Elements { get { var red = GetRed(ref this.elements, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; @@ -915,7 +915,7 @@ public SyntaxToken Identifier get { var slot = ((Syntax.InternalSyntax.TupleElementSyntax)this.Green).identifier; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -958,7 +958,7 @@ internal OmittedTypeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax } /// SyntaxToken representing the omitted type argument. - public SyntaxToken OmittedTypeArgumentToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OmittedTypeArgumentSyntax)this.Green).omittedTypeArgumentToken, Position, 0); + public SyntaxToken OmittedTypeArgumentToken => new(this, ((Syntax.InternalSyntax.OmittedTypeArgumentSyntax)this.Green).omittedTypeArgumentToken, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -998,7 +998,7 @@ internal RefTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent { } - public SyntaxToken RefKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); + public SyntaxToken RefKeyword => new(this, ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); /// Gets the optional "readonly" keyword. public SyntaxToken ReadOnlyKeyword @@ -1006,7 +1006,7 @@ public SyntaxToken ReadOnlyKeyword get { var slot = ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -1052,7 +1052,7 @@ internal ScopedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken ScopedKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ScopedTypeSyntax)this.Green).scopedKeyword, Position, 0); + public SyntaxToken ScopedKeyword => new(this, ((Syntax.InternalSyntax.ScopedTypeSyntax)this.Green).scopedKeyword, Position, 0); public TypeSyntax Type => GetRed(ref this.type, 1)!; @@ -1113,13 +1113,13 @@ internal ParenthesizedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Sy } /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedExpressionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedExpressionSyntax)this.Green).openParenToken, Position, 0); /// ExpressionSyntax node representing the expression enclosed within the parenthesis. public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; @@ -1162,7 +1162,7 @@ internal TupleExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode } /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. public SeparatedSyntaxList Arguments @@ -1170,12 +1170,12 @@ public SeparatedSyntaxList Arguments get { var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; @@ -1228,7 +1228,7 @@ internal PrefixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synt } /// SyntaxToken representing the kind of the operator of the prefix unary expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PrefixUnaryExpressionSyntax)this.Green).operatorToken, Position, 0); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.PrefixUnaryExpressionSyntax)this.Green).operatorToken, Position, 0); /// ExpressionSyntax representing the operand of the prefix unary expression. public ExpressionSyntax Operand => GetRed(ref this.operand, 1)!; @@ -1273,7 +1273,7 @@ internal AwaitExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode } /// SyntaxToken representing the kind "await" keyword. - public SyntaxToken AwaitKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AwaitExpressionSyntax)this.Green).awaitKeyword, Position, 0); + public SyntaxToken AwaitKeyword => new(this, ((Syntax.InternalSyntax.AwaitExpressionSyntax)this.Green).awaitKeyword, Position, 0); /// ExpressionSyntax representing the operand of the "await" operator. public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -1323,7 +1323,7 @@ internal PostfixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public ExpressionSyntax Operand => GetRedAtZero(ref this.operand)!; /// SyntaxToken representing the kind of the operator of the postfix unary expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PostfixUnaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.PostfixUnaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.operand)! : null; @@ -1370,7 +1370,7 @@ internal MemberAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; /// SyntaxToken representing the kind of the operator in the member access expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MemberAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.MemberAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); /// SimpleNameSyntax node representing the member being accessed. public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; @@ -1432,7 +1432,7 @@ internal ConditionalAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; /// SyntaxToken representing the question mark. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConditionalAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.ConditionalAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); /// ExpressionSyntax node representing the access expression to be executed when the object is not null. public ExpressionSyntax WhenNotNull => GetRed(ref this.whenNotNull, 2)!; @@ -1490,7 +1490,7 @@ internal MemberBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Sy } /// SyntaxToken representing dot. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MemberBindingExpressionSyntax)this.Green).operatorToken, Position, 0); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.MemberBindingExpressionSyntax)this.Green).operatorToken, Position, 0); /// SimpleNameSyntax node representing the member being bound to. public SimpleNameSyntax Name => GetRed(ref this.name, 1)!; @@ -1582,7 +1582,7 @@ internal RangeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public ExpressionSyntax? LeftOperand => GetRedAtZero(ref this.leftOperand); /// SyntaxToken representing the operator of the range expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RangeExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.RangeExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); /// ExpressionSyntax node representing the expression on the right of the range operator. public ExpressionSyntax? RightOperand => GetRed(ref this.rightOperand, 2); @@ -1708,7 +1708,7 @@ internal BinaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; /// SyntaxToken representing the operator of the binary expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BinaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.BinaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); /// ExpressionSyntax node representing the expression on the right of the binary operator. public ExpressionSyntax Right => GetRed(ref this.right, 2)!; @@ -1782,7 +1782,7 @@ internal AssignmentExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synta public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; /// SyntaxToken representing the operator of the assignment expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AssignmentExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.AssignmentExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); /// ExpressionSyntax node representing the expression on the right of the assignment operator. public ExpressionSyntax Right => GetRed(ref this.right, 2)!; @@ -1845,13 +1845,13 @@ internal ConditionalExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public ExpressionSyntax Condition => GetRedAtZero(ref this.condition)!; /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConditionalExpressionSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken QuestionToken => new(this, ((Syntax.InternalSyntax.ConditionalExpressionSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); /// ExpressionSyntax node representing the expression to be executed when the condition is true. public ExpressionSyntax WhenTrue => GetRed(ref this.whenTrue, 2)!; /// SyntaxToken representing the colon. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConditionalExpressionSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.ConditionalExpressionSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); /// ExpressionSyntax node representing the expression to be executed when the condition is false. public ExpressionSyntax WhenFalse => GetRed(ref this.whenFalse, 4)!; @@ -1921,7 +1921,7 @@ internal ThisExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// SyntaxToken representing the this keyword. - public SyntaxToken Token => new SyntaxToken(this, ((Syntax.InternalSyntax.ThisExpressionSyntax)this.Green).token, Position, 0); + public SyntaxToken Token => new(this, ((Syntax.InternalSyntax.ThisExpressionSyntax)this.Green).token, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -1961,7 +1961,7 @@ internal BaseExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// SyntaxToken representing the base keyword. - public SyntaxToken Token => new SyntaxToken(this, ((Syntax.InternalSyntax.BaseExpressionSyntax)this.Green).token, Position, 0); + public SyntaxToken Token => new(this, ((Syntax.InternalSyntax.BaseExpressionSyntax)this.Green).token, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -2009,7 +2009,7 @@ internal LiteralExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. - public SyntaxToken Token => new SyntaxToken(this, ((Syntax.InternalSyntax.LiteralExpressionSyntax)this.Green).token, Position, 0); + public SyntaxToken Token => new(this, ((Syntax.InternalSyntax.LiteralExpressionSyntax)this.Green).token, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -2050,16 +2050,16 @@ internal MakeRefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the MakeRefKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Argument of the primary function. public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; @@ -2103,16 +2103,16 @@ internal RefTypeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the RefTypeKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Argument of the primary function. public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; @@ -2157,22 +2157,22 @@ internal RefValueExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN } /// SyntaxToken representing the RefValueKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Typed reference expression. public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; /// Comma separating the arguments. - public SyntaxToken Comma => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).comma, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Comma => new(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).comma, GetChildPosition(3), GetChildIndex(3)); /// The type of the value. public TypeSyntax Type => GetRed(ref this.type, 4)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).closeParenToken, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).closeParenToken, GetChildPosition(5), GetChildIndex(5)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -2231,16 +2231,16 @@ internal CheckedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the checked or unchecked keyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Argument of the primary function. public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; @@ -2284,16 +2284,16 @@ internal DefaultExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the DefaultKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Argument of the primary function. public TypeSyntax Type => GetRed(ref this.type, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; @@ -2337,16 +2337,16 @@ internal TypeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod } /// SyntaxToken representing the TypeOfKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// The expression to return type of. public TypeSyntax Type => GetRed(ref this.type, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; @@ -2390,16 +2390,16 @@ internal SizeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod } /// SyntaxToken representing the SizeOfKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Argument of the primary function. public TypeSyntax Type => GetRed(ref this.type, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; @@ -2580,7 +2580,7 @@ internal ArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p } /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. public override SeparatedSyntaxList Arguments @@ -2588,12 +2588,12 @@ public override SeparatedSyntaxList Arguments get { var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; @@ -2640,7 +2640,7 @@ internal BracketedArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, Synt } /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. public override SeparatedSyntaxList Arguments @@ -2648,12 +2648,12 @@ public override SeparatedSyntaxList Arguments get { var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; @@ -2709,7 +2709,7 @@ public SyntaxToken RefKindKeyword get { var slot = ((Syntax.InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -2785,7 +2785,7 @@ internal ExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public override ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExpressionColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.ExpressionColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; @@ -2832,7 +2832,7 @@ internal NameColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; /// SyntaxToken representing colon. - public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NameColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.NameColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; @@ -2933,13 +2933,13 @@ internal CastExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CastExpressionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.CastExpressionSyntax)this.Green).openParenToken, Position, 0); /// TypeSyntax node representing the type to which the expression is being cast. public TypeSyntax Type => GetRed(ref this.type, 1)!; /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CastExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.CastExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); /// ExpressionSyntax node representing the expression that is being casted. public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; @@ -3042,12 +3042,12 @@ public override SyntaxTokenList Modifiers get { var slot = this.Green.GetSlot(0); - return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; + return slot != null ? new(this, slot, Position, 0) : default; } } /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DelegateKeyword => new(this, ((Syntax.InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); /// List of parameters of the anonymous method expression, or null if there no parameters are specified. public ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 2); @@ -3169,14 +3169,14 @@ internal SimpleLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Syn { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -3184,7 +3184,7 @@ public override SyntaxTokenList Modifiers public ParameterSyntax Parameter => GetRed(ref this.parameter, 2)!; /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SimpleLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken ArrowToken => new(this, ((Syntax.InternalSyntax.SimpleLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(3), GetChildIndex(3)); /// /// BlockSyntax node representing the body of the lambda. @@ -3280,7 +3280,7 @@ internal RefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken RefKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RefExpressionSyntax)this.Green).refKeyword, Position, 0); + public SyntaxToken RefKeyword => new(this, ((Syntax.InternalSyntax.RefExpressionSyntax)this.Green).refKeyword, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -3327,14 +3327,14 @@ internal ParenthesizedLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode gre { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -3344,7 +3344,7 @@ public override SyntaxTokenList Modifiers public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken ArrowToken => new(this, ((Syntax.InternalSyntax.ParenthesizedLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(4), GetChildIndex(4)); /// /// BlockSyntax node representing the body of the lambda. @@ -3448,7 +3448,7 @@ internal InitializerExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synt } /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); + public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. public SeparatedSyntaxList Expressions @@ -3456,12 +3456,12 @@ public SeparatedSyntaxList Expressions get { var red = GetRed(ref this.expressions, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expressions, 1)! : null; @@ -3533,7 +3533,7 @@ internal ImplicitObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode } /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + public override SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.ImplicitObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. public override ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; @@ -3602,7 +3602,7 @@ internal ObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, S } /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + public override SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.ObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); /// TypeSyntax representing the type of the object being created. public TypeSyntax Type => GetRed(ref this.type, 1)!; @@ -3680,7 +3680,7 @@ internal WithExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public SyntaxToken WithKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WithExpressionSyntax)this.Green).withKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken WithKeyword => new(this, ((Syntax.InternalSyntax.WithExpressionSyntax)this.Green).withKeyword, GetChildPosition(1), GetChildIndex(1)); /// InitializerExpressionSyntax representing the initializer expression for the with expression. public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 2)!; @@ -3797,10 +3797,10 @@ internal AnonymousObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode } /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + public SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. public SeparatedSyntaxList Initializers @@ -3808,12 +3808,12 @@ public SeparatedSyntaxList Initializers get { var red = GetRed(ref this.initializers, 2); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; + return red != null ? new(red, GetChildIndex(2)) : default; } } /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.initializers, 2)! : null; @@ -3860,7 +3860,7 @@ internal ArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Sy } /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + public SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.ArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); /// ArrayTypeSyntax node representing the type of the array. public ArrayTypeSyntax Type => GetRed(ref this.type, 1)!; @@ -3923,10 +3923,10 @@ internal ImplicitArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode g } /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + public SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. public SyntaxTokenList Commas @@ -3934,12 +3934,12 @@ public SyntaxTokenList Commas get { var slot = this.Green.GetSlot(2); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 4)!; @@ -3991,7 +3991,7 @@ internal StackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode } /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.StackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); + public SyntaxToken StackAllocKeyword => new(this, ((Syntax.InternalSyntax.StackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); /// TypeSyntax node representing the type of the stackalloc array. public TypeSyntax Type => GetRed(ref this.type, 1)!; @@ -4052,13 +4052,13 @@ internal ImplicitStackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSy } /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); + public SyntaxToken StackAllocKeyword => new(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 3)!; @@ -4105,7 +4105,7 @@ internal CollectionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. public SeparatedSyntaxList Elements @@ -4113,11 +4113,11 @@ public SeparatedSyntaxList Elements get { var red = GetRed(ref this.elements, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; @@ -4207,7 +4207,7 @@ internal SpreadElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SpreadElementSyntax)this.Green).operatorToken, Position, 0); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.SpreadElementSyntax)this.Green).operatorToken, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -4324,7 +4324,7 @@ internal QueryBodySyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare { } - public SyntaxList Clauses => new SyntaxList(GetRed(ref this.clauses, 0)); + public SyntaxList Clauses => new(GetRed(ref this.clauses, 0)); public SelectOrGroupClauseSyntax SelectOrGroup => GetRed(ref this.selectOrGroup, 1)!; @@ -4386,14 +4386,14 @@ internal FromClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken FromKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).fromKeyword, Position, 0); + public SyntaxToken FromKeyword => new(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).fromKeyword, Position, 0); public TypeSyntax? Type => GetRed(ref this.type, 1); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken InKeyword => new(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); public ExpressionSyntax Expression => GetRed(ref this.expression, 4)!; @@ -4450,12 +4450,12 @@ internal LetClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare { } - public SyntaxToken LetKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).letKeyword, Position, 0); + public SyntaxToken LetKeyword => new(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).letKeyword, Position, 0); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).equalsToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).equalsToken, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; @@ -4503,22 +4503,22 @@ internal JoinClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken JoinKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).joinKeyword, Position, 0); + public SyntaxToken JoinKeyword => new(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).joinKeyword, Position, 0); public TypeSyntax? Type => GetRed(ref this.type, 1); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken InKeyword => new(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); public ExpressionSyntax InExpression => GetRed(ref this.inExpression, 4)!; - public SyntaxToken OnKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).onKeyword, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken OnKeyword => new(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).onKeyword, GetChildPosition(5), GetChildIndex(5)); public ExpressionSyntax LeftExpression => GetRed(ref this.leftExpression, 6)!; - public SyntaxToken EqualsKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).equalsKeyword, GetChildPosition(7), GetChildIndex(7)); + public SyntaxToken EqualsKeyword => new(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).equalsKeyword, GetChildPosition(7), GetChildIndex(7)); public ExpressionSyntax RightExpression => GetRed(ref this.rightExpression, 8)!; @@ -4587,10 +4587,10 @@ internal JoinIntoClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken IntoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinIntoClauseSyntax)this.Green).intoKeyword, Position, 0); + public SyntaxToken IntoKeyword => new(this, ((Syntax.InternalSyntax.JoinIntoClauseSyntax)this.Green).intoKeyword, Position, 0); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.JoinIntoClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.JoinIntoClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -4630,7 +4630,7 @@ internal WhereClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa { } - public SyntaxToken WhereKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WhereClauseSyntax)this.Green).whereKeyword, Position, 0); + public SyntaxToken WhereKeyword => new(this, ((Syntax.InternalSyntax.WhereClauseSyntax)this.Green).whereKeyword, Position, 0); public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; @@ -4672,14 +4672,14 @@ internal OrderByClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken OrderByKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); + public SyntaxToken OrderByKeyword => new(this, ((Syntax.InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); public SeparatedSyntaxList Orderings { get { var red = GetRed(ref this.orderings, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } @@ -4731,7 +4731,7 @@ public SyntaxToken AscendingOrDescendingKeyword get { var slot = ((Syntax.InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -4773,7 +4773,7 @@ internal SelectClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p { } - public SyntaxToken SelectKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SelectClauseSyntax)this.Green).selectKeyword, Position, 0); + public SyntaxToken SelectKeyword => new(this, ((Syntax.InternalSyntax.SelectClauseSyntax)this.Green).selectKeyword, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -4816,11 +4816,11 @@ internal GroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa { } - public SyntaxToken GroupKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.GroupClauseSyntax)this.Green).groupKeyword, Position, 0); + public SyntaxToken GroupKeyword => new(this, ((Syntax.InternalSyntax.GroupClauseSyntax)this.Green).groupKeyword, Position, 0); public ExpressionSyntax GroupExpression => GetRed(ref this.groupExpression, 1)!; - public SyntaxToken ByKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.GroupClauseSyntax)this.Green).byKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ByKeyword => new(this, ((Syntax.InternalSyntax.GroupClauseSyntax)this.Green).byKeyword, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax ByExpression => GetRed(ref this.byExpression, 3)!; @@ -4876,10 +4876,10 @@ internal QueryContinuationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public SyntaxToken IntoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.QueryContinuationSyntax)this.Green).intoKeyword, Position, 0); + public SyntaxToken IntoKeyword => new(this, ((Syntax.InternalSyntax.QueryContinuationSyntax)this.Green).intoKeyword, Position, 0); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.QueryContinuationSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.QueryContinuationSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); public QueryBodySyntax Body => GetRed(ref this.body, 2)!; @@ -4925,7 +4925,7 @@ internal OmittedArraySizeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, } /// SyntaxToken representing the omitted array size expression. - public SyntaxToken OmittedArraySizeExpressionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OmittedArraySizeExpressionSyntax)this.Green).omittedArraySizeExpressionToken, Position, 0); + public SyntaxToken OmittedArraySizeExpressionToken => new(this, ((Syntax.InternalSyntax.OmittedArraySizeExpressionSyntax)this.Green).omittedArraySizeExpressionToken, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -4965,13 +4965,13 @@ internal InterpolatedStringExpressionSyntax(InternalSyntax.CSharpSyntaxNode gree } /// The first part of an interpolated string, $" or $@" or $""" - public SyntaxToken StringStartToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringStartToken, Position, 0); + public SyntaxToken StringStartToken => new(this, ((Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringStartToken, Position, 0); /// List of parts of the interpolated string, each one is either a literal part or an interpolation. - public SyntaxList Contents => new SyntaxList(GetRed(ref this.contents, 1)); + public SyntaxList Contents => new(GetRed(ref this.contents, 1)); /// The closing quote of the interpolated string. - public SyntaxToken StringEndToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringEndToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken StringEndToken => new(this, ((Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringEndToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.contents, 1)! : null; @@ -5019,7 +5019,7 @@ internal IsPatternExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax /// ExpressionSyntax node representing the expression on the left of the "is" operator. public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public SyntaxToken IsKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IsPatternExpressionSyntax)this.Green).isKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken IsKeyword => new(this, ((Syntax.InternalSyntax.IsPatternExpressionSyntax)this.Green).isKeyword, GetChildPosition(1), GetChildIndex(1)); /// PatternSyntax node representing the pattern on the right of the "is" operator. public PatternSyntax Pattern => GetRed(ref this.pattern, 2)!; @@ -5075,7 +5075,7 @@ internal ThrowExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ThrowExpressionSyntax)this.Green).throwKeyword, Position, 0); + public SyntaxToken ThrowKeyword => new(this, ((Syntax.InternalSyntax.ThrowExpressionSyntax)this.Green).throwKeyword, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -5117,7 +5117,7 @@ internal WhenClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken WhenKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WhenClauseSyntax)this.Green).whenKeyword, Position, 0); + public SyntaxToken WhenKeyword => new(this, ((Syntax.InternalSyntax.WhenClauseSyntax)this.Green).whenKeyword, Position, 0); public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; @@ -5166,7 +5166,7 @@ internal DiscardPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DiscardPatternSyntax)this.Green).underscoreToken, Position, 0); + public SyntaxToken UnderscoreToken => new(this, ((Syntax.InternalSyntax.DiscardPatternSyntax)this.Green).underscoreToken, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -5260,7 +5260,7 @@ internal VarPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken VarKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.VarPatternSyntax)this.Green).varKeyword, Position, 0); + public SyntaxToken VarKeyword => new(this, ((Syntax.InternalSyntax.VarPatternSyntax)this.Green).varKeyword, Position, 0); public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; @@ -5380,18 +5380,18 @@ internal PositionalPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, Sy { } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); public SeparatedSyntaxList Subpatterns { get { var red = GetRed(ref this.subpatterns, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; @@ -5434,18 +5434,18 @@ internal PropertyPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); + public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); public SeparatedSyntaxList Subpatterns { get { var red = GetRed(ref this.subpatterns, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; @@ -5583,11 +5583,11 @@ internal ParenthesizedPatternSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedPatternSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedPatternSyntax)this.Green).openParenToken, Position, 0); public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedPatternSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedPatternSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; @@ -5629,7 +5629,7 @@ internal RelationalPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the operator of the relational pattern. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RelationalPatternSyntax)this.Green).operatorToken, Position, 0); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.RelationalPatternSyntax)this.Green).operatorToken, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -5715,7 +5715,7 @@ internal BinaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public PatternSyntax Left => GetRedAtZero(ref this.left)!; - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BinaryPatternSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.BinaryPatternSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); public PatternSyntax Right => GetRed(ref this.right, 2)!; @@ -5770,7 +5770,7 @@ internal UnaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p { } - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UnaryPatternSyntax)this.Green).operatorToken, Position, 0); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.UnaryPatternSyntax)this.Green).operatorToken, Position, 0); public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; @@ -5813,18 +5813,18 @@ internal ListPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa { } - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); public SeparatedSyntaxList Patterns { get { var red = GetRed(ref this.patterns, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); @@ -5882,7 +5882,7 @@ internal SlicePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p { } - public SyntaxToken DotDotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SlicePatternSyntax)this.Green).dotDotToken, Position, 0); + public SyntaxToken DotDotToken => new(this, ((Syntax.InternalSyntax.SlicePatternSyntax)this.Green).dotDotToken, Position, 0); public PatternSyntax? Pattern => GetRed(ref this.pattern, 1); @@ -5932,7 +5932,7 @@ internal InterpolatedStringTextSyntax(InternalSyntax.CSharpSyntaxNode green, Syn } /// The text contents of a part of the interpolated string. - public SyntaxToken TextToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolatedStringTextSyntax)this.Green).textToken, Position, 0); + public SyntaxToken TextToken => new(this, ((Syntax.InternalSyntax.InterpolatedStringTextSyntax)this.Green).textToken, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -5974,7 +5974,7 @@ internal InterpolationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationSyntax)this.Green).openBraceToken, Position, 0); + public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.InterpolationSyntax)this.Green).openBraceToken, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -5985,7 +5985,7 @@ internal InterpolationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? /// /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). /// - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.InterpolationSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -6042,7 +6042,7 @@ internal InterpolationAlignmentClauseSyntax(InternalSyntax.CSharpSyntaxNode gree { } - public SyntaxToken CommaToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationAlignmentClauseSyntax)this.Green).commaToken, Position, 0); + public SyntaxToken CommaToken => new(this, ((Syntax.InternalSyntax.InterpolationAlignmentClauseSyntax)this.Green).commaToken, Position, 0); public ExpressionSyntax Value => GetRed(ref this.value, 1)!; @@ -6083,10 +6083,10 @@ internal InterpolationFormatClauseSyntax(InternalSyntax.CSharpSyntaxNode green, { } - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationFormatClauseSyntax)this.Green).colonToken, Position, 0); + public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.InterpolationFormatClauseSyntax)this.Green).colonToken, Position, 0); /// The text contents of the format specifier for an interpolation. - public SyntaxToken FormatStringToken => new SyntaxToken(this, ((Syntax.InternalSyntax.InterpolationFormatClauseSyntax)this.Green).formatStringToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken FormatStringToken => new(this, ((Syntax.InternalSyntax.InterpolationFormatClauseSyntax)this.Green).formatStringToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -6127,14 +6127,14 @@ internal GlobalStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -6215,13 +6215,13 @@ internal BlockSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BlockSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.BlockSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); - public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 2)); + public SyntaxList Statements => new(GetRed(ref this.statements, 2)); - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BlockSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.BlockSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -6286,27 +6286,27 @@ internal LocalFunctionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, Syn { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; - public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 6)); + public SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 6)); public BlockSyntax? Body => GetRed(ref this.body, 7); @@ -6318,7 +6318,7 @@ public SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + return slot != null ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; } } @@ -6413,14 +6413,14 @@ internal LocalDeclarationStatementSyntax(InternalSyntax.CSharpSyntaxNode green, { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public SyntaxToken AwaitKeyword { get { var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -6429,7 +6429,7 @@ public SyntaxToken UsingKeyword get { var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -6439,13 +6439,13 @@ public SyntaxTokenList Modifiers get { var slot = this.Green.GetSlot(3); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } } public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 4)!; - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).semicolonToken, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).semicolonToken, GetChildPosition(5), GetChildIndex(5)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -6515,7 +6515,7 @@ public SeparatedSyntaxList Variables get { var red = GetRed(ref this.variables, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } @@ -6573,7 +6573,7 @@ internal VariableDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN } /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.VariableDeclaratorSyntax)this.Green).identifier, Position, 0); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.VariableDeclaratorSyntax)this.Green).identifier, Position, 0); public BracketedArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); @@ -6636,7 +6636,7 @@ internal EqualsValueClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EqualsValueClauseSyntax)this.Green).equalsToken, Position, 0); + public SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.EqualsValueClauseSyntax)this.Green).equalsToken, Position, 0); public ExpressionSyntax Value => GetRed(ref this.value, 1)!; @@ -6685,7 +6685,7 @@ internal SingleVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, { } - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.SingleVariableDesignationSyntax)this.Green).identifier, Position, 0); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.SingleVariableDesignationSyntax)this.Green).identifier, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -6723,7 +6723,7 @@ internal DiscardDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DiscardDesignationSyntax)this.Green).underscoreToken, Position, 0); + public SyntaxToken UnderscoreToken => new(this, ((Syntax.InternalSyntax.DiscardDesignationSyntax)this.Green).underscoreToken, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -6762,18 +6762,18 @@ internal ParenthesizedVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode { } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); public SeparatedSyntaxList Variables { get { var red = GetRed(ref this.variables, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.variables, 1)! : null; @@ -6817,11 +6817,11 @@ internal ExpressionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExpressionStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.ExpressionStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -6878,9 +6878,9 @@ internal EmptyStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EmptyStatementSyntax)this.Green).semicolonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.EmptyStatementSyntax)this.Green).semicolonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; @@ -6926,13 +6926,13 @@ internal LabeledStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.LabeledStatementSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.LabeledStatementSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); /// Gets a SyntaxToken that represents the colon following the statement's label. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LabeledStatementSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.LabeledStatementSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); public StatementSyntax Statement => GetRed(ref this.statement, 3)!; @@ -6998,12 +6998,12 @@ internal GotoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// /// Gets a SyntaxToken that represents the goto keyword. /// - public SyntaxToken GotoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).gotoKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken GotoKeyword => new(this, ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).gotoKeyword, GetChildPosition(1), GetChildIndex(1)); /// /// Gets a SyntaxToken that represents the case or default keywords if any exists. @@ -7013,7 +7013,7 @@ public SyntaxToken CaseOrDefaultKeyword get { var slot = ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -7025,7 +7025,7 @@ public SyntaxToken CaseOrDefaultKeyword /// /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. /// - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -7084,11 +7084,11 @@ internal BreakStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken BreakKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.BreakStatementSyntax)this.Green).breakKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken BreakKeyword => new(this, ((Syntax.InternalSyntax.BreakStatementSyntax)this.Green).breakKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BreakStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.BreakStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; @@ -7133,11 +7133,11 @@ internal ContinueStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken ContinueKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ContinueStatementSyntax)this.Green).continueKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ContinueKeyword => new(this, ((Syntax.InternalSyntax.ContinueStatementSyntax)this.Green).continueKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ContinueStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.ContinueStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; @@ -7183,13 +7183,13 @@ internal ReturnStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken ReturnKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ReturnStatementSyntax)this.Green).returnKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ReturnKeyword => new(this, ((Syntax.InternalSyntax.ReturnStatementSyntax)this.Green).returnKeyword, GetChildPosition(1), GetChildIndex(1)); public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ReturnStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.ReturnStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -7248,13 +7248,13 @@ internal ThrowStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ThrowStatementSyntax)this.Green).throwKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ThrowKeyword => new(this, ((Syntax.InternalSyntax.ThrowStatementSyntax)this.Green).throwKeyword, GetChildPosition(1), GetChildIndex(1)); public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ThrowStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.ThrowStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -7314,15 +7314,15 @@ internal YieldStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken YieldKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).yieldKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken YieldKeyword => new(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).yieldKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken ReturnOrBreakKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).returnOrBreakKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ReturnOrBreakKeyword => new(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).returnOrBreakKeyword, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -7383,15 +7383,15 @@ internal WhileStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken WhileKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).whileKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken WhileKeyword => new(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).whileKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); public StatementSyntax Statement => GetRed(ref this.statement, 5)!; @@ -7457,21 +7457,21 @@ internal DoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken DoKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).doKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DoKeyword => new(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).doKeyword, GetChildPosition(1), GetChildIndex(1)); public StatementSyntax Statement => GetRed(ref this.statement, 2)!; - public SyntaxToken WhileKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).whileKeyword, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken WhileKeyword => new(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).whileKeyword, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).openParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).openParenToken, GetChildPosition(4), GetChildIndex(4)); public ExpressionSyntax Condition => GetRed(ref this.condition, 5)!; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).semicolonToken, GetChildPosition(7), GetChildIndex(7)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).semicolonToken, GetChildPosition(7), GetChildIndex(7)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -7540,11 +7540,11 @@ internal ForStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken ForKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).forKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ForKeyword => new(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).forKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 3); @@ -7553,26 +7553,26 @@ public SeparatedSyntaxList Initializers get { var red = GetRed(ref this.initializers, 4); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; + return red != null ? new(red, GetChildIndex(4)) : default; } } - public SyntaxToken FirstSemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken FirstSemicolonToken => new(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); public ExpressionSyntax? Condition => GetRed(ref this.condition, 6); - public SyntaxToken SecondSemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); + public SyntaxToken SecondSemicolonToken => new(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); public SeparatedSyntaxList Incrementors { get { var red = GetRed(ref this.incrementors, 8); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(8)) : default; + return red != null ? new(red, GetChildIndex(8)) : default; } } - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); public StatementSyntax Statement => GetRed(ref this.statement, 10)!; @@ -7692,31 +7692,31 @@ internal ForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxToken AwaitKeyword { get { var slot = ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken ForEachKeyword => new(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); public TypeSyntax Type => GetRed(ref this.type, 4)!; /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); - public override SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).inKeyword, GetChildPosition(6), GetChildIndex(6)); + public override SyntaxToken InKeyword => new(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).inKeyword, GetChildPosition(6), GetChildIndex(6)); public override ExpressionSyntax Expression => GetRed(ref this.expression, 7)!; - public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).closeParenToken, GetChildPosition(8), GetChildIndex(8)); + public override SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).closeParenToken, GetChildPosition(8), GetChildIndex(8)); public override StatementSyntax Statement => GetRed(ref this.statement, 9)!; @@ -7796,20 +7796,20 @@ internal ForEachVariableStatementSyntax(InternalSyntax.CSharpSyntaxNode green, S { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxToken AwaitKeyword { get { var slot = ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken ForEachKeyword => new(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); /// /// The variable(s) of the loop. In correct code this is a tuple @@ -7819,11 +7819,11 @@ public override SyntaxToken AwaitKeyword /// public ExpressionSyntax Variable => GetRed(ref this.variable, 4)!; - public override SyntaxToken InKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).inKeyword, GetChildPosition(5), GetChildIndex(5)); + public override SyntaxToken InKeyword => new(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).inKeyword, GetChildPosition(5), GetChildIndex(5)); public override ExpressionSyntax Expression => GetRed(ref this.expression, 6)!; - public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).closeParenToken, GetChildPosition(7), GetChildIndex(7)); + public override SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).closeParenToken, GetChildPosition(7), GetChildIndex(7)); public override StatementSyntax Statement => GetRed(ref this.statement, 8)!; @@ -7902,26 +7902,26 @@ internal UsingStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public SyntaxToken AwaitKeyword { get { var slot = ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - public SyntaxToken UsingKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken UsingKeyword => new(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 4); public ExpressionSyntax? Expression => GetRed(ref this.expression, 5); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); public StatementSyntax Statement => GetRed(ref this.statement, 7)!; @@ -7991,15 +7991,15 @@ internal FixedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken FixedKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).fixedKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken FixedKeyword => new(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).fixedKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); public StatementSyntax Statement => GetRed(ref this.statement, 5)!; @@ -8066,9 +8066,9 @@ internal CheckedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CheckedStatementSyntax)this.Green).keyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.CheckedStatementSyntax)this.Green).keyword, GetChildPosition(1), GetChildIndex(1)); public BlockSyntax Block => GetRed(ref this.block, 2)!; @@ -8130,9 +8130,9 @@ internal UnsafeStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken UnsafeKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UnsafeStatementSyntax)this.Green).unsafeKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken UnsafeKeyword => new(this, ((Syntax.InternalSyntax.UnsafeStatementSyntax)this.Green).unsafeKeyword, GetChildPosition(1), GetChildIndex(1)); public BlockSyntax Block => GetRed(ref this.block, 2)!; @@ -8195,15 +8195,15 @@ internal LockStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken LockKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).lockKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken LockKeyword => new(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).lockKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); public StatementSyntax Statement => GetRed(ref this.statement, 5)!; @@ -8273,17 +8273,17 @@ internal IfStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// /// Gets a SyntaxToken that represents the if keyword. /// - public SyntaxToken IfKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken IfKeyword => new(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); /// /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. /// - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); /// /// Gets an ExpressionSyntax that represents the condition of the if statement. @@ -8293,7 +8293,7 @@ internal IfStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa /// /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. /// - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); /// /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. @@ -8372,7 +8372,7 @@ internal ElseClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par /// /// Gets a syntax token /// - public SyntaxToken ElseKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseClauseSyntax)this.Green).elseKeyword, Position, 0); + public SyntaxToken ElseKeyword => new(this, ((Syntax.InternalSyntax.ElseClauseSyntax)this.Green).elseKeyword, Position, 0); public StatementSyntax Statement => GetRed(ref this.statement, 1)!; @@ -8417,12 +8417,12 @@ internal SwitchStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// /// Gets a SyntaxToken that represents the switch keyword. /// - public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken SwitchKeyword => new(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); /// /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. @@ -8432,7 +8432,7 @@ public SyntaxToken OpenParenToken get { var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -8449,24 +8449,24 @@ public SyntaxToken CloseParenToken get { var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; + return slot != null ? new(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; } } /// /// Gets a SyntaxToken that represents the open braces preceding the switch sections. /// - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openBraceToken, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openBraceToken, GetChildPosition(5), GetChildIndex(5)); /// /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. /// - public SyntaxList Sections => new SyntaxList(GetRed(ref this.sections, 6)); + public SyntaxList Sections => new(GetRed(ref this.sections, 6)); /// /// Gets a SyntaxToken that represents the open braces following the switch sections. /// - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeBraceToken, GetChildPosition(7), GetChildIndex(7)); + public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeBraceToken, GetChildPosition(7), GetChildIndex(7)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -8536,12 +8536,12 @@ internal SwitchSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? /// /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. /// - public SyntaxList Labels => new SyntaxList(GetRed(ref this.labels, 0)); + public SyntaxList Labels => new(GetRed(ref this.labels, 0)); /// /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. /// - public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 1)); + public SyntaxList Statements => new(GetRed(ref this.statements, 1)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -8622,7 +8622,7 @@ internal CasePatternSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, Syn } /// Gets the case keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).keyword, Position, 0); + public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).keyword, Position, 0); /// /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. @@ -8631,7 +8631,7 @@ internal CasePatternSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 2); - public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -8689,14 +8689,14 @@ internal CaseSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode } /// Gets the case keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CaseSwitchLabelSyntax)this.Green).keyword, Position, 0); + public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.CaseSwitchLabelSyntax)this.Green).keyword, Position, 0); /// /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. /// public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CaseSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.CaseSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; @@ -8740,9 +8740,9 @@ internal DefaultSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN } /// Gets the default keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultSwitchLabelSyntax)this.Green).keyword, Position, 0); + public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.DefaultSwitchLabelSyntax)this.Green).keyword, Position, 0); - public override SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.DefaultSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -8787,20 +8787,20 @@ internal SwitchExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public ExpressionSyntax GoverningExpression => GetRedAtZero(ref this.governingExpression)!; - public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken SwitchKeyword => new(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); public SeparatedSyntaxList Arms { get { var red = GetRed(ref this.arms, 3); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; + return red != null ? new(red, GetChildIndex(3)) : default; } } - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -8863,7 +8863,7 @@ internal SwitchExpressionArmSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 1); - public SyntaxToken EqualsGreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.SwitchExpressionArmSyntax)this.Green).equalsGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EqualsGreaterThanToken => new(this, ((Syntax.InternalSyntax.SwitchExpressionArmSyntax)this.Green).equalsGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; @@ -8924,13 +8924,13 @@ internal TryStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken TryKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.TryStatementSyntax)this.Green).tryKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken TryKeyword => new(this, ((Syntax.InternalSyntax.TryStatementSyntax)this.Green).tryKeyword, GetChildPosition(1), GetChildIndex(1)); public BlockSyntax Block => GetRed(ref this.block, 2)!; - public SyntaxList Catches => new SyntaxList(GetRed(ref this.catches, 3)); + public SyntaxList Catches => new(GetRed(ref this.catches, 3)); public FinallyClauseSyntax? Finally => GetRed(ref this.@finally, 4); @@ -9000,7 +9000,7 @@ internal CatchClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa { } - public SyntaxToken CatchKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchClauseSyntax)this.Green).catchKeyword, Position, 0); + public SyntaxToken CatchKeyword => new(this, ((Syntax.InternalSyntax.CatchClauseSyntax)this.Green).catchKeyword, Position, 0); public CatchDeclarationSyntax? Declaration => GetRed(ref this.declaration, 1); @@ -9065,7 +9065,7 @@ internal CatchDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).openParenToken, Position, 0); public TypeSyntax Type => GetRed(ref this.type, 1)!; @@ -9074,11 +9074,11 @@ public SyntaxToken Identifier get { var slot = ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).identifier; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; @@ -9120,13 +9120,13 @@ internal CatchFilterClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public SyntaxToken WhenKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).whenKeyword, Position, 0); + public SyntaxToken WhenKeyword => new(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).whenKeyword, Position, 0); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); public ExpressionSyntax FilterExpression => GetRed(ref this.filterExpression, 2)!; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.filterExpression, 2)! : null; @@ -9168,7 +9168,7 @@ internal FinallyClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken FinallyKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FinallyClauseSyntax)this.Green).finallyKeyword, Position, 0); + public SyntaxToken FinallyKeyword => new(this, ((Syntax.InternalSyntax.FinallyClauseSyntax)this.Green).finallyKeyword, Position, 0); public BlockSyntax Block => GetRed(ref this.block, 1)!; @@ -9216,16 +9216,16 @@ internal CompilationUnitSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 0)); + public SyntaxList Externs => new(GetRed(ref this.externs, 0)); - public SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 1)); + public SyntaxList Usings => new(GetRed(ref this.usings, 1)); /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 2)); + public SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 2)); - public SyntaxList Members => new SyntaxList(GetRed(ref this.members, 3)); + public SyntaxList Members => new(GetRed(ref this.members, 3)); - public SyntaxToken EndOfFileToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CompilationUnitSyntax)this.Green).endOfFileToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken EndOfFileToken => new(this, ((Syntax.InternalSyntax.CompilationUnitSyntax)this.Green).endOfFileToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -9292,16 +9292,16 @@ internal ExternAliasDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, Synta } /// SyntaxToken representing the extern keyword. - public SyntaxToken ExternKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).externKeyword, Position, 0); + public SyntaxToken ExternKeyword => new(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).externKeyword, Position, 0); /// SyntaxToken representing the alias keyword. - public SyntaxToken AliasKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).aliasKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken AliasKeyword => new(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).aliasKeyword, GetChildPosition(1), GetChildIndex(1)); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); /// SyntaxToken representing the semicolon token. - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -9349,18 +9349,18 @@ public SyntaxToken GlobalKeyword get { var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword; - return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; + return slot != null ? new(this, slot, Position, 0) : default; } } - public SyntaxToken UsingKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken UsingKeyword => new(this, ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); public SyntaxToken StaticKeyword { get { var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -9369,7 +9369,7 @@ public SyntaxToken UnsafeKeyword get { var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } } @@ -9377,7 +9377,7 @@ public SyntaxToken UnsafeKeyword public TypeSyntax NamespaceOrType => GetRed(ref this.namespaceOrType, 5)!; - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(6), GetChildIndex(6)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -9507,30 +9507,30 @@ internal NamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken NamespaceKeyword => new(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); public override NameSyntax Name => GetRed(ref this.name, 3)!; - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).openBraceToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).openBraceToken, GetChildPosition(4), GetChildIndex(4)); - public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); + public override SyntaxList Externs => new(GetRed(ref this.externs, 5)); - public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); + public override SyntaxList Usings => new(GetRed(ref this.usings, 6)); - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); + public override SyntaxList Members => new(GetRed(ref this.members, 7)); - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); + public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); /// Gets the optional semicolon token. public SyntaxToken SemicolonToken @@ -9538,7 +9538,7 @@ public SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + return slot != null ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; } } @@ -9628,28 +9628,28 @@ internal FileScopedNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode gr { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken NamespaceKeyword => new(this, ((Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); public override NameSyntax Name => GetRed(ref this.name, 3)!; - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); + public override SyntaxList Externs => new(GetRed(ref this.externs, 5)); - public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); + public override SyntaxList Usings => new(GetRed(ref this.usings, 6)); - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); + public override SyntaxList Members => new(GetRed(ref this.members, 7)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -9734,7 +9734,7 @@ internal AttributeListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeListSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.AttributeListSyntax)this.Green).openBracketToken, Position, 0); /// Gets the optional construct targeted by the attribute. public AttributeTargetSpecifierSyntax? Target => GetRed(ref this.target, 1); @@ -9745,12 +9745,12 @@ public SeparatedSyntaxList Attributes get { var red = GetRed(ref this.attributes, 2); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; + return red != null ? new(red, GetChildIndex(2)) : default; } } /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -9807,10 +9807,10 @@ internal AttributeTargetSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, S } /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).identifier, Position, 0); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).identifier, Position, 0); /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -9915,7 +9915,7 @@ internal AttributeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, Synt } /// Gets the open paren token. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); /// Gets the arguments syntax list. public SeparatedSyntaxList Arguments @@ -9923,12 +9923,12 @@ public SeparatedSyntaxList Arguments get { var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// Gets the close paren token. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; @@ -10038,7 +10038,7 @@ internal NameEqualsSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par /// Gets the identifier name. public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; - public SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NameEqualsSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.NameEqualsSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; @@ -10080,7 +10080,7 @@ internal TypeParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// Gets the < token. - public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken LessThanToken => new(this, ((Syntax.InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); /// Gets the parameter list. public SeparatedSyntaxList Parameters @@ -10088,12 +10088,12 @@ public SeparatedSyntaxList Parameters get { var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// Gets the > token. - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken GreaterThanToken => new(this, ((Syntax.InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -10138,19 +10138,19 @@ internal TypeParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public SyntaxToken VarianceKeyword { get { var slot = ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; @@ -10295,21 +10295,21 @@ internal ClassDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the class keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); @@ -10317,25 +10317,25 @@ public override SyntaxTokenList Modifiers public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); public override SyntaxToken OpenBraceToken { get { var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + public override SyntaxList Members => new(GetRed(ref this.members, 9)); public override SyntaxToken CloseBraceToken { get { var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -10344,7 +10344,7 @@ public override SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; } } @@ -10461,21 +10461,21 @@ internal StructDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the struct keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); @@ -10483,25 +10483,25 @@ public override SyntaxTokenList Modifiers public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); public override SyntaxToken OpenBraceToken { get { var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + public override SyntaxList Members => new(GetRed(ref this.members, 9)); public override SyntaxToken CloseBraceToken { get { var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -10510,7 +10510,7 @@ public override SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; } } @@ -10627,21 +10627,21 @@ internal InterfaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the interface keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); @@ -10649,25 +10649,25 @@ public override SyntaxTokenList Modifiers public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); public override SyntaxToken OpenBraceToken { get { var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + public override SyntaxList Members => new(GetRed(ref this.members, 9)); public override SyntaxToken CloseBraceToken { get { var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -10676,7 +10676,7 @@ public override SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; } } @@ -10793,29 +10793,29 @@ internal RecordDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - public override SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); public SyntaxToken ClassOrStructKeyword { get { var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } } - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); @@ -10823,25 +10823,25 @@ public SyntaxToken ClassOrStructKeyword public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 7); - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 8)); + public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 8)); public override SyntaxToken OpenBraceToken { get { var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + return slot != null ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; } } - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 10)); + public override SyntaxList Members => new(GetRed(ref this.members, 10)); public override SyntaxToken CloseBraceToken { get { var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; } } @@ -10850,7 +10850,7 @@ public override SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; + return slot != null ? new(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; } } @@ -10965,21 +10965,21 @@ internal EnumDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the enum keyword token. - public SyntaxToken EnumKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EnumKeyword => new(this, ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 4); @@ -10988,7 +10988,7 @@ public override SyntaxToken OpenBraceToken get { var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } } @@ -10998,7 +10998,7 @@ public SeparatedSyntaxList Members get { var red = GetRed(ref this.members, 6); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(6)) : default; + return red != null ? new(red, GetChildIndex(6)) : default; } } @@ -11007,7 +11007,7 @@ public override SyntaxToken CloseBraceToken get { var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; } } @@ -11017,7 +11017,7 @@ public override SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } @@ -11104,25 +11104,25 @@ internal DelegateDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the "delegate" keyword. - public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken DelegateKeyword => new(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); /// Gets the return type. public TypeSyntax ReturnType => GetRed(ref this.returnType, 3)!; /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); @@ -11130,10 +11130,10 @@ public override SyntaxTokenList Modifiers public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; /// Gets the constraint clause list. - public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + public SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); /// Gets the semicolon token. - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(8), GetChildIndex(8)); + public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(8), GetChildIndex(8)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -11213,19 +11213,19 @@ internal EnumMemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); public EqualsValueClauseSyntax? EqualsValue => GetRed(ref this.equalsValue, 3); @@ -11290,7 +11290,7 @@ internal BaseListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? paren } /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); + public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); /// Gets the base type references. public SeparatedSyntaxList Types @@ -11298,7 +11298,7 @@ public SeparatedSyntaxList Types get { var red = GetRed(ref this.types, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } @@ -11455,13 +11455,13 @@ internal TypeParameterConstraintClauseSyntax(InternalSyntax.CSharpSyntaxNode gre { } - public SyntaxToken WhereKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).whereKeyword, Position, 0); + public SyntaxToken WhereKeyword => new(this, ((Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).whereKeyword, Position, 0); /// Gets the identifier. public IdentifierNameSyntax Name => GetRed(ref this.name, 1)!; /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); /// Gets the constraints list. public SeparatedSyntaxList Constraints @@ -11469,7 +11469,7 @@ public SeparatedSyntaxList Constraints get { var red = GetRed(ref this.constraints, 3); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; + return red != null ? new(red, GetChildIndex(3)) : default; } } @@ -11537,13 +11537,13 @@ internal ConstructorConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, Synt } /// Gets the "new" keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).newKeyword, Position, 0); + public SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).newKeyword, Position, 0); /// Gets the open paren keyword. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Gets the close paren keyword. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -11586,7 +11586,7 @@ internal ClassOrStructConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, Sy } /// Gets the constraint keyword ("class" or "struct"). - public SyntaxToken ClassOrStructKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); + public SyntaxToken ClassOrStructKeyword => new(this, ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); /// SyntaxToken representing the question mark. public SyntaxToken QuestionToken @@ -11594,7 +11594,7 @@ public SyntaxToken QuestionToken get { var slot = ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -11678,7 +11678,7 @@ internal DefaultConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// Gets the "default" keyword. - public SyntaxToken DefaultKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefaultConstraintSyntax)this.Green).defaultKeyword, Position, 0); + public SyntaxToken DefaultKeyword => new(this, ((Syntax.InternalSyntax.DefaultConstraintSyntax)this.Green).defaultKeyword, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -11744,20 +11744,20 @@ internal FieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 2)!; - public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.FieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.FieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -11823,22 +11823,22 @@ internal EventFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - public SyntaxToken EventKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EventKeyword => new(this, ((Syntax.InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; - public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EventFieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.EventFieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -11906,7 +11906,7 @@ internal ExplicitInterfaceSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, public NameSyntax Name => GetRedAtZero(ref this.name)!; - public SyntaxToken DotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DotToken => new(this, ((Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; @@ -11997,14 +11997,14 @@ internal MethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -12014,14 +12014,14 @@ public override SyntaxTokenList Modifiers public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; /// Gets the constraint clause list. - public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + public SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); public override BlockSyntax? Body => GetRed(ref this.body, 8); @@ -12033,7 +12033,7 @@ public override SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -12145,14 +12145,14 @@ internal OperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -12162,7 +12162,7 @@ public override SyntaxTokenList Modifiers public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); /// Gets the "operator" keyword. - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken OperatorKeyword => new(this, ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); /// Gets the "checked" keyword. public SyntaxToken CheckedKeyword @@ -12170,12 +12170,12 @@ public SyntaxToken CheckedKeyword get { var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } } /// Gets the operator token. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; @@ -12189,7 +12189,7 @@ public override SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -12291,24 +12291,24 @@ internal ConversionOperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode gre { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the "implicit" or "explicit" token. - public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ImplicitOrExplicitKeyword => new(this, ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); /// Gets the "operator" token. - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken OperatorKeyword => new(this, ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); /// Gets the "checked" keyword. public SyntaxToken CheckedKeyword @@ -12316,7 +12316,7 @@ public SyntaxToken CheckedKeyword get { var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } } @@ -12335,7 +12335,7 @@ public override SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -12436,19 +12436,19 @@ internal ConstructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syn { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; @@ -12464,7 +12464,7 @@ public override SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; } } @@ -12558,10 +12558,10 @@ internal ConstructorInitializerSyntax(InternalSyntax.CSharpSyntaxNode green, Syn } /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorInitializerSyntax)this.Green).colonToken, Position, 0); + public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.ConstructorInitializerSyntax)this.Green).colonToken, Position, 0); /// Gets the "this" or "base" keyword. - public SyntaxToken ThisOrBaseKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConstructorInitializerSyntax)this.Green).thisOrBaseKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ThisOrBaseKeyword => new(this, ((Syntax.InternalSyntax.ConstructorInitializerSyntax)this.Green).thisOrBaseKeyword, GetChildPosition(1), GetChildIndex(1)); public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 2)!; @@ -12610,22 +12610,22 @@ internal DestructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the tilde token. - public SyntaxToken TildeToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken TildeToken => new(this, ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 4)!; @@ -12639,7 +12639,7 @@ public override SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; } } @@ -12766,14 +12766,14 @@ internal PropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -12782,7 +12782,7 @@ public override SyntaxTokenList Modifiers public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 5); @@ -12795,7 +12795,7 @@ public SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } @@ -12881,7 +12881,7 @@ internal ArrowExpressionClauseSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public SyntaxToken ArrowToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ArrowExpressionClauseSyntax)this.Green).arrowToken, Position, 0); + public SyntaxToken ArrowToken => new(this, ((Syntax.InternalSyntax.ArrowExpressionClauseSyntax)this.Green).arrowToken, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -12926,25 +12926,25 @@ internal EventDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - public SyntaxToken EventKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EventKeyword => new(this, ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); public override TypeSyntax Type => GetRed(ref this.type, 3)!; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 4); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); @@ -12953,7 +12953,7 @@ public SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; } } @@ -13038,14 +13038,14 @@ internal IndexerDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -13053,7 +13053,7 @@ public override SyntaxTokenList Modifiers public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - public SyntaxToken ThisKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).thisKeyword, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken ThisKeyword => new(this, ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).thisKeyword, GetChildPosition(4), GetChildIndex(4)); /// Gets the parameter list. public BracketedParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; @@ -13067,7 +13067,7 @@ public SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } @@ -13153,11 +13153,11 @@ internal AccessorListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p { } - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AccessorListSyntax)this.Green).openBraceToken, Position, 0); + public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.AccessorListSyntax)this.Green).openBraceToken, Position, 0); - public SyntaxList Accessors => new SyntaxList(GetRed(ref this.accessors, 1)); + public SyntaxList Accessors => new(GetRed(ref this.accessors, 1)); - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((Syntax.InternalSyntax.AccessorListSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.AccessorListSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.accessors, 1)! : null; @@ -13208,7 +13208,7 @@ internal AccessorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax } /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// Gets the modifier list. public SyntaxTokenList Modifiers @@ -13216,12 +13216,12 @@ public SyntaxTokenList Modifiers get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the keyword token, or identifier if an erroneous accessor declaration. - public SyntaxToken Keyword => new SyntaxToken(this, ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); /// Gets the optional body block which may be empty, but it is null if there are no braces. public BlockSyntax? Body => GetRed(ref this.body, 3); @@ -13235,7 +13235,7 @@ public SyntaxToken SemicolonToken get { var slot = ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } } @@ -13327,19 +13327,19 @@ internal ParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// Gets the open paren token. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); public override SeparatedSyntaxList Parameters { get { var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// Gets the close paren token. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -13386,19 +13386,19 @@ internal BracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, Syn } /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); public override SeparatedSyntaxList Parameters { get { var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -13476,7 +13476,7 @@ internal ParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare } /// Gets the attribute declaration list. - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// Gets the modifier list. public override SyntaxTokenList Modifiers @@ -13484,14 +13484,14 @@ public override SyntaxTokenList Modifiers get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } public override TypeSyntax? Type => GetRed(ref this.type, 2); /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.ParameterSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.ParameterSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public EqualsValueClauseSyntax? Default => GetRed(ref this.@default, 4); @@ -13561,7 +13561,7 @@ internal FunctionPointerParameterSyntax(InternalSyntax.CSharpSyntaxNode green, S } /// Gets the attribute declaration list. - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// Gets the modifier list. public override SyntaxTokenList Modifiers @@ -13569,7 +13569,7 @@ public override SyntaxTokenList Modifiers get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -13635,14 +13635,14 @@ internal IncompleteMemberSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); public override SyntaxTokenList Modifiers { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -13710,7 +13710,7 @@ public SyntaxTokenList Tokens get { var slot = this.Green.GetSlot(0); - return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; + return slot != null ? new(this, slot, Position, 0) : default; } } @@ -13754,9 +13754,9 @@ internal DocumentationCommentTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, { } - public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 0)); + public SyntaxList Content => new(GetRed(ref this.content, 0)); - public SyntaxToken EndOfComment => new SyntaxToken(this, ((Syntax.InternalSyntax.DocumentationCommentTriviaSyntax)this.Green).endOfComment, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken EndOfComment => new(this, ((Syntax.InternalSyntax.DocumentationCommentTriviaSyntax)this.Green).endOfComment, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.content)! : null; @@ -13866,7 +13866,7 @@ internal QualifiedCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public TypeSyntax Container => GetRedAtZero(ref this.container)!; - public SyntaxToken DotToken => new SyntaxToken(this, ((Syntax.InternalSyntax.QualifiedCrefSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DotToken => new(this, ((Syntax.InternalSyntax.QualifiedCrefSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); public MemberCrefSyntax Member => GetRed(ref this.member, 2)!; @@ -14007,7 +14007,7 @@ internal IndexerMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public SyntaxToken ThisKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IndexerMemberCrefSyntax)this.Green).thisKeyword, Position, 0); + public SyntaxToken ThisKeyword => new(this, ((Syntax.InternalSyntax.IndexerMemberCrefSyntax)this.Green).thisKeyword, Position, 0); public CrefBracketedParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); @@ -14060,19 +14060,19 @@ internal OperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); + public SyntaxToken OperatorKeyword => new(this, ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); public SyntaxToken CheckedKeyword { get { var slot = ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } /// Gets the operator token. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 3); @@ -14127,16 +14127,16 @@ internal ConversionOperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode gree { } - public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).implicitOrExplicitKeyword, Position, 0); + public SyntaxToken ImplicitOrExplicitKeyword => new(this, ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).implicitOrExplicitKeyword, Position, 0); - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorKeyword => new(this, ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); public SyntaxToken CheckedKeyword { get { var slot = ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -14227,19 +14227,19 @@ internal CrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// Gets the open paren token. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); public override SeparatedSyntaxList Parameters { get { var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// Gets the close paren token. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -14288,19 +14288,19 @@ internal CrefBracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, } /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); public override SeparatedSyntaxList Parameters { get { var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + return red != null ? new(red, GetChildIndex(1)) : default; } } /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((Syntax.InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -14356,7 +14356,7 @@ public SyntaxToken RefKindKeyword get { var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword; - return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; + return slot != null ? new(this, slot, Position, 0) : default; } } @@ -14365,7 +14365,7 @@ public SyntaxToken ReadOnlyKeyword get { var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -14422,7 +14422,7 @@ internal XmlElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par public XmlElementStartTagSyntax StartTag => GetRedAtZero(ref this.startTag)!; - public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 1)); + public SyntaxList Content => new(GetRed(ref this.content, 1)); public XmlElementEndTagSyntax EndTag => GetRed(ref this.endTag, 2)!; @@ -14483,13 +14483,13 @@ internal XmlElementStartTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementStartTagSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken LessThanToken => new(this, ((Syntax.InternalSyntax.XmlElementStartTagSyntax)this.Green).lessThanToken, Position, 0); public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); + public SyntaxList Attributes => new(GetRed(ref this.attributes, 2)); - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementStartTagSyntax)this.Green).greaterThanToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken GreaterThanToken => new(this, ((Syntax.InternalSyntax.XmlElementStartTagSyntax)this.Green).greaterThanToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -14545,11 +14545,11 @@ internal XmlElementEndTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public SyntaxToken LessThanSlashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementEndTagSyntax)this.Green).lessThanSlashToken, Position, 0); + public SyntaxToken LessThanSlashToken => new(this, ((Syntax.InternalSyntax.XmlElementEndTagSyntax)this.Green).lessThanSlashToken, Position, 0); public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlElementEndTagSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken GreaterThanToken => new(this, ((Syntax.InternalSyntax.XmlElementEndTagSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; @@ -14591,13 +14591,13 @@ internal XmlEmptyElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public SyntaxToken LessThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlEmptyElementSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken LessThanToken => new(this, ((Syntax.InternalSyntax.XmlEmptyElementSyntax)this.Green).lessThanToken, Position, 0); public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); + public SyntaxList Attributes => new(GetRed(ref this.attributes, 2)); - public SyntaxToken SlashGreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlEmptyElementSyntax)this.Green).slashGreaterThanToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken SlashGreaterThanToken => new(this, ((Syntax.InternalSyntax.XmlEmptyElementSyntax)this.Green).slashGreaterThanToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -14655,7 +14655,7 @@ internal XmlNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent public XmlPrefixSyntax? Prefix => GetRedAtZero(ref this.prefix); - public SyntaxToken LocalName => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameSyntax)this.Green).localName, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken LocalName => new(this, ((Syntax.InternalSyntax.XmlNameSyntax)this.Green).localName, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.prefix) : null; @@ -14694,9 +14694,9 @@ internal XmlPrefixSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare { } - public SyntaxToken Prefix => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlPrefixSyntax)this.Green).prefix, Position, 0); + public SyntaxToken Prefix => new(this, ((Syntax.InternalSyntax.XmlPrefixSyntax)this.Green).prefix, Position, 0); - public SyntaxToken ColonToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlPrefixSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.XmlPrefixSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -14762,20 +14762,20 @@ internal XmlTextAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken StartQuoteToken => new(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); public SyntaxTokenList TextTokens { get { var slot = this.Green.GetSlot(3); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } } - public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndQuoteToken => new(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; @@ -14827,13 +14827,13 @@ internal XmlCrefAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken StartQuoteToken => new(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); public CrefSyntax Cref => GetRed(ref this.cref, 3)!; - public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndQuoteToken => new(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -14895,13 +14895,13 @@ internal XmlNameAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EqualsToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken StartQuoteToken => new(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); public IdentifierNameSyntax Identifier => GetRed(ref this.identifier, 3)!; - public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndQuoteToken => new(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -14964,7 +14964,7 @@ public SyntaxTokenList TextTokens get { var slot = this.Green.GetSlot(0); - return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; + return slot != null ? new(this, slot, Position, 0) : default; } } @@ -15006,18 +15006,18 @@ internal XmlCDataSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public SyntaxToken StartCDataToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); + public SyntaxToken StartCDataToken => new(this, ((Syntax.InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); public SyntaxTokenList TextTokens { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - public SyntaxToken EndCDataToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EndCDataToken => new(this, ((Syntax.InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15060,7 +15060,7 @@ internal XmlProcessingInstructionSyntax(InternalSyntax.CSharpSyntaxNode green, S { } - public SyntaxToken StartProcessingInstructionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlProcessingInstructionSyntax)this.Green).startProcessingInstructionToken, Position, 0); + public SyntaxToken StartProcessingInstructionToken => new(this, ((Syntax.InternalSyntax.XmlProcessingInstructionSyntax)this.Green).startProcessingInstructionToken, Position, 0); public XmlNameSyntax Name => GetRed(ref this.name, 1)!; @@ -15069,11 +15069,11 @@ public SyntaxTokenList TextTokens get { var slot = this.Green.GetSlot(2); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } - public SyntaxToken EndProcessingInstructionToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken EndProcessingInstructionToken => new(this, ((Syntax.InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; @@ -15116,18 +15116,18 @@ internal XmlCommentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken LessThanExclamationMinusMinusToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); + public SyntaxToken LessThanExclamationMinusMinusToken => new(this, ((Syntax.InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); public SyntaxTokenList TextTokens { get { var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - public SyntaxToken MinusMinusGreaterThanToken => new SyntaxToken(this, ((Syntax.InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken MinusMinusGreaterThanToken => new(this, ((Syntax.InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15215,13 +15215,13 @@ internal IfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken IfKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken IfKeyword => new(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).IsActive; @@ -15275,13 +15275,13 @@ internal ElifDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ElifKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).elifKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ElifKeyword => new(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).elifKeyword, GetChildPosition(1), GetChildIndex(1)); public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).IsActive; @@ -15334,11 +15334,11 @@ internal ElseDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ElseKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).elseKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ElseKeyword => new(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).elseKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).IsActive; @@ -15386,11 +15386,11 @@ internal EndIfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken EndIfKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endIfKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken EndIfKeyword => new(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endIfKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).IsActive; @@ -15435,11 +15435,11 @@ internal RegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken RegionKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).regionKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken RegionKeyword => new(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).regionKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).IsActive; @@ -15484,11 +15484,11 @@ internal EndRegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, S { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken EndRegionKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endRegionKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken EndRegionKeyword => new(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endRegionKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).IsActive; @@ -15533,11 +15533,11 @@ internal ErrorDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ErrorKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).errorKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ErrorKeyword => new(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).errorKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).IsActive; @@ -15582,11 +15582,11 @@ internal WarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syn { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken WarningKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken WarningKeyword => new(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).IsActive; @@ -15631,11 +15631,11 @@ internal BadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken Identifier => new SyntaxToken(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).IsActive; @@ -15680,13 +15680,13 @@ internal DefineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken DefineKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).defineKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DefineKeyword => new(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).defineKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken Name => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Name => new(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).IsActive; @@ -15732,13 +15732,13 @@ internal UndefDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken UndefKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).undefKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken UndefKeyword => new(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).undefKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken Name => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Name => new(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).IsActive; @@ -15803,22 +15803,22 @@ internal LineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override SyntaxToken LineKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken LineKeyword => new(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken Line => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Line => new(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); public override SyntaxToken File { get { var slot = ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); public override bool IsActive => ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).IsActive; @@ -15867,15 +15867,15 @@ internal LineDirectivePositionSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).openParenToken, Position, 0); - public SyntaxToken Line => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).line, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Line => new(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).line, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken CommaToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).commaToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CommaToken => new(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).commaToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken Character => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).character, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Character => new(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).character, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15919,13 +15919,13 @@ internal LineSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Sy { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override SyntaxToken LineKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken LineKeyword => new(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); public LineDirectivePositionSyntax Start => GetRed(ref this.start, 2)!; - public SyntaxToken MinusToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).minusToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken MinusToken => new(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).minusToken, GetChildPosition(3), GetChildIndex(3)); public LineDirectivePositionSyntax End => GetRed(ref this.end, 4)!; @@ -15934,13 +15934,13 @@ public SyntaxToken CharacterOffset get { var slot = ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } } - public override SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); + public override SyntaxToken File => new(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); public override bool IsActive => ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).IsActive; @@ -16005,24 +16005,24 @@ internal PragmaWarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode gree { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken PragmaKeyword => new(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken WarningKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken WarningKeyword => new(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken DisableOrRestoreKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken DisableOrRestoreKeyword => new(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); public SeparatedSyntaxList ErrorCodes { get { var red = GetRed(ref this.errorCodes, 4); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; + return red != null ? new(red, GetChildIndex(4)) : default; } } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); public override bool IsActive => ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).IsActive; @@ -16072,19 +16072,19 @@ internal PragmaChecksumDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode gre { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken PragmaKeyword => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken ChecksumKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).checksumKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ChecksumKeyword => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).checksumKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).file, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken File => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).file, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken Guid => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).guid, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken Guid => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).guid, GetChildPosition(4), GetChildIndex(4)); - public SyntaxToken Bytes => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).bytes, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken Bytes => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).bytes, GetChildPosition(5), GetChildIndex(5)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); public override bool IsActive => ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).IsActive; @@ -16133,13 +16133,13 @@ internal ReferenceDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, S { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ReferenceKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).referenceKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ReferenceKeyword => new(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).referenceKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken File => new(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).IsActive; @@ -16185,13 +16185,13 @@ internal LoadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken LoadKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).loadKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken LoadKeyword => new(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).loadKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken File => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken File => new(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).IsActive; @@ -16237,11 +16237,11 @@ internal ShebangDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syn { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ExclamationToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).exclamationToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ExclamationToken => new(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).exclamationToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).IsActive; @@ -16286,22 +16286,22 @@ internal NullableDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Sy { } - public override SyntaxToken HashToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken NullableKeyword => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).nullableKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken NullableKeyword => new(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).nullableKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken SettingToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken SettingToken => new(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); public SyntaxToken TargetToken { get { var slot = ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); public override bool IsActive => ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).IsActive; diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index f88653ce27221..d648f3cd8aad0 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -224,15 +224,15 @@ private void WriteGreenType(TreeType node) WriteComment(field.PropertyComment, ""); if (IsNodeList(field.Type)) { - WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.{field.Type} {field.Name} => new CoreSyntax.{field.Type}(this.{CamelCase(field.Name)});"); + WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.{field.Type} {field.Name} => new(this.{CamelCase(field.Name)});"); } else if (IsSeparatedNodeList(field.Type)) { - WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.{field.Type} {field.Name} => new CoreSyntax.{field.Type}(new CoreSyntax.SyntaxList(this.{CamelCase(field.Name)}));"); + WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.{field.Type} {field.Name} => new(new(this.{CamelCase(field.Name)}));"); } else if (field.Type == "SyntaxNodeOrTokenList") { - WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.SyntaxList {field.Name} => new CoreSyntax.SyntaxList(this.{CamelCase(field.Name)});"); + WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.SyntaxList {field.Name} => new(this.{CamelCase(field.Name)});"); } else { @@ -952,13 +952,13 @@ private void WriteRedType(TreeType node) WriteLine("get"); OpenBlock(); WriteLine($"var slot = ((Syntax.InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)};"); - WriteLine($"return slot != null ? new SyntaxToken(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); + WriteLine($"return slot != null ? new(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); CloseBlock(); CloseBlock(); } else { - WriteLine($" => new SyntaxToken(this, ((Syntax.InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)}, {GetChildPosition(i)}, {GetChildIndex(i)});"); + WriteLine($" => new(this, ((Syntax.InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)}, {GetChildPosition(i)}, {GetChildIndex(i)});"); } } else if (field.Type == "SyntaxList") @@ -969,7 +969,7 @@ private void WriteRedType(TreeType node) WriteLine("get"); OpenBlock(); WriteLine($"var slot = this.Green.GetSlot({i});"); - WriteLine($"return slot != null ? new SyntaxTokenList(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); + WriteLine($"return slot != null ? new(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); CloseBlock(); CloseBlock(); } @@ -980,7 +980,7 @@ private void WriteRedType(TreeType node) if (IsNodeList(field.Type)) { - WriteLine($" => new {field.Type}(GetRed(ref this.{CamelCase(field.Name)}, {i}));"); + WriteLine($" => new(GetRed(ref this.{CamelCase(field.Name)}, {i}));"); } else if (IsSeparatedNodeList(field.Type)) { @@ -990,7 +990,7 @@ private void WriteRedType(TreeType node) OpenBlock(); WriteLine($"var red = GetRed(ref this.{CamelCase(field.Name)}, {i});"); - WriteLine($"return red != null ? new {field.Type}(red, {GetChildIndex(i)}) : default;"); + WriteLine($"return red != null ? new(red, {GetChildIndex(i)}) : default;"); CloseBlock(); CloseBlock(); } From 6d0440f41693b23e793a924150ba4a010476e40b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 24 Aug 2023 12:42:09 -0700 Subject: [PATCH 014/141] Simplify --- .../Syntax.xml.Syntax.Generated.cs | 108 +++++++++--------- .../CSharpSyntaxGenerator/SourceWriter.cs | 2 +- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs index 6da11cf8eb869..0cbf5b1252812 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs @@ -914,7 +914,7 @@ public SyntaxToken Identifier { get { - var slot = ((Syntax.InternalSyntax.TupleElementSyntax)this.Green).identifier; + var slot = ((InternalSyntax.TupleElementSyntax)this.Green).identifier; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -1005,7 +1005,7 @@ public SyntaxToken ReadOnlyKeyword { get { - var slot = ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword; + var slot = ((InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -2708,7 +2708,7 @@ public SyntaxToken RefKindKeyword { get { - var slot = ((Syntax.InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword; + var slot = ((InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -4730,7 +4730,7 @@ public SyntaxToken AscendingOrDescendingKeyword { get { - var slot = ((Syntax.InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword; + var slot = ((InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -6317,7 +6317,7 @@ public SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; } } @@ -6419,7 +6419,7 @@ public SyntaxToken AwaitKeyword { get { - var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword; + var slot = ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -6428,7 +6428,7 @@ public SyntaxToken UsingKeyword { get { - var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword; + var slot = ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword; return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -7012,7 +7012,7 @@ public SyntaxToken CaseOrDefaultKeyword { get { - var slot = ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword; + var slot = ((InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword; return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -7698,7 +7698,7 @@ public override SyntaxToken AwaitKeyword { get { - var slot = ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword; + var slot = ((InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -7802,7 +7802,7 @@ public override SyntaxToken AwaitKeyword { get { - var slot = ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword; + var slot = ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -7908,7 +7908,7 @@ public SyntaxToken AwaitKeyword { get { - var slot = ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword; + var slot = ((InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -8431,7 +8431,7 @@ public SyntaxToken OpenParenToken { get { - var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken; + var slot = ((InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken; return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -8448,7 +8448,7 @@ public SyntaxToken CloseParenToken { get { - var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken; + var slot = ((InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken; return slot != null ? new(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; } } @@ -9073,7 +9073,7 @@ public SyntaxToken Identifier { get { - var slot = ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).identifier; + var slot = ((InternalSyntax.CatchDeclarationSyntax)this.Green).identifier; return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -9348,7 +9348,7 @@ public SyntaxToken GlobalKeyword { get { - var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword; + var slot = ((InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword; return slot != null ? new(this, slot, Position, 0) : default; } } @@ -9359,7 +9359,7 @@ public SyntaxToken StaticKeyword { get { - var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword; + var slot = ((InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword; return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -9368,7 +9368,7 @@ public SyntaxToken UnsafeKeyword { get { - var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword; + var slot = ((InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword; return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } } @@ -9537,7 +9537,7 @@ public SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; } } @@ -10144,7 +10144,7 @@ public SyntaxToken VarianceKeyword { get { - var slot = ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword; + var slot = ((InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -10323,7 +10323,7 @@ public override SyntaxToken OpenBraceToken { get { - var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken; + var slot = ((InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken; return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } @@ -10334,7 +10334,7 @@ public override SyntaxToken CloseBraceToken { get { - var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken; + var slot = ((InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken; return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -10343,7 +10343,7 @@ public override SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; } } @@ -10489,7 +10489,7 @@ public override SyntaxToken OpenBraceToken { get { - var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken; + var slot = ((InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken; return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } @@ -10500,7 +10500,7 @@ public override SyntaxToken CloseBraceToken { get { - var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken; + var slot = ((InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken; return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -10509,7 +10509,7 @@ public override SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; } } @@ -10655,7 +10655,7 @@ public override SyntaxToken OpenBraceToken { get { - var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken; + var slot = ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken; return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } @@ -10666,7 +10666,7 @@ public override SyntaxToken CloseBraceToken { get { - var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken; + var slot = ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken; return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -10675,7 +10675,7 @@ public override SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; } } @@ -10810,7 +10810,7 @@ public SyntaxToken ClassOrStructKeyword { get { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword; + var slot = ((InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword; return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } } @@ -10829,7 +10829,7 @@ public override SyntaxToken OpenBraceToken { get { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken; + var slot = ((InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken; return slot != null ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; } } @@ -10840,7 +10840,7 @@ public override SyntaxToken CloseBraceToken { get { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken; + var slot = ((InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken; return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; } } @@ -10849,7 +10849,7 @@ public override SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; } } @@ -10987,7 +10987,7 @@ public override SyntaxToken OpenBraceToken { get { - var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken; + var slot = ((InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken; return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } } @@ -11006,7 +11006,7 @@ public override SyntaxToken CloseBraceToken { get { - var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken; + var slot = ((InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken; return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; } } @@ -11016,7 +11016,7 @@ public override SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } @@ -11593,7 +11593,7 @@ public SyntaxToken QuestionToken { get { - var slot = ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken; + var slot = ((InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -12032,7 +12032,7 @@ public override SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -12169,7 +12169,7 @@ public SyntaxToken CheckedKeyword { get { - var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword; + var slot = ((InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword; return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } } @@ -12188,7 +12188,7 @@ public override SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -12315,7 +12315,7 @@ public SyntaxToken CheckedKeyword { get { - var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword; + var slot = ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword; return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } } @@ -12334,7 +12334,7 @@ public override SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } } @@ -12463,7 +12463,7 @@ public override SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; } } @@ -12638,7 +12638,7 @@ public override SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; } } @@ -12794,7 +12794,7 @@ public SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } @@ -12952,7 +12952,7 @@ public SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; } } @@ -13066,7 +13066,7 @@ public SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } @@ -13234,7 +13234,7 @@ public SyntaxToken SemicolonToken { get { - var slot = ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken; + var slot = ((InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken; return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } } @@ -14066,7 +14066,7 @@ public SyntaxToken CheckedKeyword { get { - var slot = ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword; + var slot = ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -14135,7 +14135,7 @@ public SyntaxToken CheckedKeyword { get { - var slot = ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword; + var slot = ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword; return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } @@ -14355,7 +14355,7 @@ public SyntaxToken RefKindKeyword { get { - var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword; + var slot = ((InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword; return slot != null ? new(this, slot, Position, 0) : default; } } @@ -14364,7 +14364,7 @@ public SyntaxToken ReadOnlyKeyword { get { - var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword; + var slot = ((InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword; return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } @@ -15813,7 +15813,7 @@ public override SyntaxToken File { get { - var slot = ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file; + var slot = ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file; return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } } @@ -15933,7 +15933,7 @@ public SyntaxToken CharacterOffset { get { - var slot = ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset; + var slot = ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset; return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } } @@ -16296,7 +16296,7 @@ public SyntaxToken TargetToken { get { - var slot = ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken; + var slot = ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken; return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } } diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index d648f3cd8aad0..f27637bf4d94d 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -951,7 +951,7 @@ private void WriteRedType(TreeType node) OpenBlock(); WriteLine("get"); OpenBlock(); - WriteLine($"var slot = ((Syntax.InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)};"); + WriteLine($"var slot = ((InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)};"); WriteLine($"return slot != null ? new(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); CloseBlock(); CloseBlock(); From aeb26b5397454f7459c7a112caf8a9988fe832a5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 24 Aug 2023 12:43:30 -0700 Subject: [PATCH 015/141] Simplify --- .../Syntax.xml.Syntax.Generated.cs | 816 +++++++++--------- .../CSharpSyntaxGenerator/SourceWriter.cs | 2 +- 2 files changed, 409 insertions(+), 409 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs index 0cbf5b1252812..2407a0ec7113b 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs @@ -51,7 +51,7 @@ internal IdentifierNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// SyntaxToken representing the keyword for the kind of the identifier name. - public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.IdentifierNameSyntax)this.Green).identifier, Position, 0); + public override SyntaxToken Identifier => new(this, ((InternalSyntax.IdentifierNameSyntax)this.Green).identifier, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -97,7 +97,7 @@ internal QualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public NameSyntax Left => GetRedAtZero(ref this.left)!; /// SyntaxToken representing the dot. - public SyntaxToken DotToken => new(this, ((Syntax.InternalSyntax.QualifiedNameSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DotToken => new(this, ((InternalSyntax.QualifiedNameSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. public SimpleNameSyntax Right => GetRed(ref this.right, 2)!; @@ -155,7 +155,7 @@ internal GenericNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa } /// SyntaxToken representing the name of the identifier of the generic name. - public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.GenericNameSyntax)this.Green).identifier, Position, 0); + public override SyntaxToken Identifier => new(this, ((InternalSyntax.GenericNameSyntax)this.Green).identifier, Position, 0); /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. public TypeArgumentListSyntax TypeArgumentList => GetRed(ref this.typeArgumentList, 1)!; @@ -203,7 +203,7 @@ internal TypeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod } /// SyntaxToken representing less than. - public SyntaxToken LessThanToken => new(this, ((Syntax.InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken LessThanToken => new(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. public SeparatedSyntaxList Arguments @@ -216,7 +216,7 @@ public SeparatedSyntaxList Arguments } /// SyntaxToken representing greater than. - public SyntaxToken GreaterThanToken => new(this, ((Syntax.InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; @@ -265,7 +265,7 @@ internal AliasQualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN public IdentifierNameSyntax Alias => GetRedAtZero(ref this.alias)!; /// SyntaxToken representing colon colon. - public SyntaxToken ColonColonToken => new(this, ((Syntax.InternalSyntax.AliasQualifiedNameSyntax)this.Green).colonColonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ColonColonToken => new(this, ((InternalSyntax.AliasQualifiedNameSyntax)this.Green).colonColonToken, GetChildPosition(1), GetChildIndex(1)); /// SimpleNameSyntax node representing the name that is being alias qualified. public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; @@ -331,7 +331,7 @@ internal PredefinedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// SyntaxToken which represents the keyword corresponding to the predefined type. - public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.PredefinedTypeSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((InternalSyntax.PredefinedTypeSyntax)this.Green).keyword, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -430,7 +430,7 @@ internal ArrayRankSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); public SeparatedSyntaxList Sizes { @@ -441,7 +441,7 @@ public SeparatedSyntaxList Sizes } } - public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.sizes, 1)! : null; @@ -489,7 +489,7 @@ internal PointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => new(this, ((Syntax.InternalSyntax.PointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken AsteriskToken => new(this, ((InternalSyntax.PointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; @@ -531,10 +531,10 @@ internal FunctionPointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax } /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => new(this, ((Syntax.InternalSyntax.FunctionPointerTypeSyntax)this.Green).delegateKeyword, Position, 0); + public SyntaxToken DelegateKeyword => new(this, ((InternalSyntax.FunctionPointerTypeSyntax)this.Green).delegateKeyword, Position, 0); /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => new(this, ((Syntax.InternalSyntax.FunctionPointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken AsteriskToken => new(this, ((InternalSyntax.FunctionPointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); /// Node representing the optional calling convention. public FunctionPointerCallingConventionSyntax? CallingConvention => GetRed(ref this.callingConvention, 2); @@ -598,7 +598,7 @@ internal FunctionPointerParameterListSyntax(InternalSyntax.CSharpSyntaxNode gree } /// SyntaxToken representing the less than token. - public SyntaxToken LessThanToken => new(this, ((Syntax.InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken LessThanToken => new(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. public SeparatedSyntaxList Parameters @@ -611,7 +611,7 @@ public SeparatedSyntaxList Parameters } /// SyntaxToken representing the greater than token. - public SyntaxToken GreaterThanToken => new(this, ((Syntax.InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -656,7 +656,7 @@ internal FunctionPointerCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode } /// SyntaxToken representing whether the calling convention is managed or unmanaged. - public SyntaxToken ManagedOrUnmanagedKeyword => new(this, ((Syntax.InternalSyntax.FunctionPointerCallingConventionSyntax)this.Green).managedOrUnmanagedKeyword, Position, 0); + public SyntaxToken ManagedOrUnmanagedKeyword => new(this, ((InternalSyntax.FunctionPointerCallingConventionSyntax)this.Green).managedOrUnmanagedKeyword, Position, 0); /// Optional list of identifiers that will contribute to an unmanaged calling convention. public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => GetRed(ref this.unmanagedCallingConventionList, 1); @@ -707,7 +707,7 @@ internal FunctionPointerUnmanagedCallingConventionListSyntax(InternalSyntax.CSha } /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); /// SeparatedSyntaxList of calling convention identifiers. public SeparatedSyntaxList CallingConventions @@ -720,7 +720,7 @@ public SeparatedSyntaxList Call } /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.callingConventions, 1)! : null; @@ -764,7 +764,7 @@ internal FunctionPointerUnmanagedCallingConventionSyntax(InternalSyntax.CSharpSy } /// SyntaxToken representing the calling convention identifier. - public SyntaxToken Name => new(this, ((Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionSyntax)this.Green).name, Position, 0); + public SyntaxToken Name => new(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionSyntax)this.Green).name, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -808,7 +808,7 @@ internal NullableTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => new(this, ((Syntax.InternalSyntax.NullableTypeSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken QuestionToken => new(this, ((InternalSyntax.NullableTypeSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; @@ -850,7 +850,7 @@ internal TupleTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare } /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); public SeparatedSyntaxList Elements { @@ -862,7 +862,7 @@ public SeparatedSyntaxList Elements } /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; @@ -958,7 +958,7 @@ internal OmittedTypeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax } /// SyntaxToken representing the omitted type argument. - public SyntaxToken OmittedTypeArgumentToken => new(this, ((Syntax.InternalSyntax.OmittedTypeArgumentSyntax)this.Green).omittedTypeArgumentToken, Position, 0); + public SyntaxToken OmittedTypeArgumentToken => new(this, ((InternalSyntax.OmittedTypeArgumentSyntax)this.Green).omittedTypeArgumentToken, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -998,7 +998,7 @@ internal RefTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent { } - public SyntaxToken RefKeyword => new(this, ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); + public SyntaxToken RefKeyword => new(this, ((InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); /// Gets the optional "readonly" keyword. public SyntaxToken ReadOnlyKeyword @@ -1052,7 +1052,7 @@ internal ScopedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken ScopedKeyword => new(this, ((Syntax.InternalSyntax.ScopedTypeSyntax)this.Green).scopedKeyword, Position, 0); + public SyntaxToken ScopedKeyword => new(this, ((InternalSyntax.ScopedTypeSyntax)this.Green).scopedKeyword, Position, 0); public TypeSyntax Type => GetRed(ref this.type, 1)!; @@ -1113,13 +1113,13 @@ internal ParenthesizedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Sy } /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedExpressionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ParenthesizedExpressionSyntax)this.Green).openParenToken, Position, 0); /// ExpressionSyntax node representing the expression enclosed within the parenthesis. public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ParenthesizedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; @@ -1162,7 +1162,7 @@ internal TupleExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode } /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. public SeparatedSyntaxList Arguments @@ -1175,7 +1175,7 @@ public SeparatedSyntaxList Arguments } /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; @@ -1228,7 +1228,7 @@ internal PrefixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synt } /// SyntaxToken representing the kind of the operator of the prefix unary expression. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.PrefixUnaryExpressionSyntax)this.Green).operatorToken, Position, 0); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.PrefixUnaryExpressionSyntax)this.Green).operatorToken, Position, 0); /// ExpressionSyntax representing the operand of the prefix unary expression. public ExpressionSyntax Operand => GetRed(ref this.operand, 1)!; @@ -1273,7 +1273,7 @@ internal AwaitExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode } /// SyntaxToken representing the kind "await" keyword. - public SyntaxToken AwaitKeyword => new(this, ((Syntax.InternalSyntax.AwaitExpressionSyntax)this.Green).awaitKeyword, Position, 0); + public SyntaxToken AwaitKeyword => new(this, ((InternalSyntax.AwaitExpressionSyntax)this.Green).awaitKeyword, Position, 0); /// ExpressionSyntax representing the operand of the "await" operator. public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -1323,7 +1323,7 @@ internal PostfixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public ExpressionSyntax Operand => GetRedAtZero(ref this.operand)!; /// SyntaxToken representing the kind of the operator of the postfix unary expression. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.PostfixUnaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.PostfixUnaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.operand)! : null; @@ -1370,7 +1370,7 @@ internal MemberAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; /// SyntaxToken representing the kind of the operator in the member access expression. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.MemberAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.MemberAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); /// SimpleNameSyntax node representing the member being accessed. public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; @@ -1432,7 +1432,7 @@ internal ConditionalAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; /// SyntaxToken representing the question mark. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.ConditionalAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.ConditionalAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); /// ExpressionSyntax node representing the access expression to be executed when the object is not null. public ExpressionSyntax WhenNotNull => GetRed(ref this.whenNotNull, 2)!; @@ -1490,7 +1490,7 @@ internal MemberBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Sy } /// SyntaxToken representing dot. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.MemberBindingExpressionSyntax)this.Green).operatorToken, Position, 0); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.MemberBindingExpressionSyntax)this.Green).operatorToken, Position, 0); /// SimpleNameSyntax node representing the member being bound to. public SimpleNameSyntax Name => GetRed(ref this.name, 1)!; @@ -1582,7 +1582,7 @@ internal RangeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public ExpressionSyntax? LeftOperand => GetRedAtZero(ref this.leftOperand); /// SyntaxToken representing the operator of the range expression. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.RangeExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.RangeExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); /// ExpressionSyntax node representing the expression on the right of the range operator. public ExpressionSyntax? RightOperand => GetRed(ref this.rightOperand, 2); @@ -1708,7 +1708,7 @@ internal BinaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; /// SyntaxToken representing the operator of the binary expression. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.BinaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.BinaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); /// ExpressionSyntax node representing the expression on the right of the binary operator. public ExpressionSyntax Right => GetRed(ref this.right, 2)!; @@ -1782,7 +1782,7 @@ internal AssignmentExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synta public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; /// SyntaxToken representing the operator of the assignment expression. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.AssignmentExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.AssignmentExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); /// ExpressionSyntax node representing the expression on the right of the assignment operator. public ExpressionSyntax Right => GetRed(ref this.right, 2)!; @@ -1845,13 +1845,13 @@ internal ConditionalExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public ExpressionSyntax Condition => GetRedAtZero(ref this.condition)!; /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => new(this, ((Syntax.InternalSyntax.ConditionalExpressionSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken QuestionToken => new(this, ((InternalSyntax.ConditionalExpressionSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); /// ExpressionSyntax node representing the expression to be executed when the condition is true. public ExpressionSyntax WhenTrue => GetRed(ref this.whenTrue, 2)!; /// SyntaxToken representing the colon. - public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.ConditionalExpressionSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken ColonToken => new(this, ((InternalSyntax.ConditionalExpressionSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); /// ExpressionSyntax node representing the expression to be executed when the condition is false. public ExpressionSyntax WhenFalse => GetRed(ref this.whenFalse, 4)!; @@ -1921,7 +1921,7 @@ internal ThisExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// SyntaxToken representing the this keyword. - public SyntaxToken Token => new(this, ((Syntax.InternalSyntax.ThisExpressionSyntax)this.Green).token, Position, 0); + public SyntaxToken Token => new(this, ((InternalSyntax.ThisExpressionSyntax)this.Green).token, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -1961,7 +1961,7 @@ internal BaseExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// SyntaxToken representing the base keyword. - public SyntaxToken Token => new(this, ((Syntax.InternalSyntax.BaseExpressionSyntax)this.Green).token, Position, 0); + public SyntaxToken Token => new(this, ((InternalSyntax.BaseExpressionSyntax)this.Green).token, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -2009,7 +2009,7 @@ internal LiteralExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. - public SyntaxToken Token => new(this, ((Syntax.InternalSyntax.LiteralExpressionSyntax)this.Green).token, Position, 0); + public SyntaxToken Token => new(this, ((InternalSyntax.LiteralExpressionSyntax)this.Green).token, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -2050,16 +2050,16 @@ internal MakeRefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the MakeRefKeyword. - public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Argument of the primary function. public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.MakeRefExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; @@ -2103,16 +2103,16 @@ internal RefTypeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the RefTypeKeyword. - public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Argument of the primary function. public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.RefTypeExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; @@ -2157,22 +2157,22 @@ internal RefValueExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN } /// SyntaxToken representing the RefValueKeyword. - public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Typed reference expression. public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; /// Comma separating the arguments. - public SyntaxToken Comma => new(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).comma, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Comma => new(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).comma, GetChildPosition(3), GetChildIndex(3)); /// The type of the value. public TypeSyntax Type => GetRed(ref this.type, 4)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.RefValueExpressionSyntax)this.Green).closeParenToken, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).closeParenToken, GetChildPosition(5), GetChildIndex(5)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -2231,16 +2231,16 @@ internal CheckedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the checked or unchecked keyword. - public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Argument of the primary function. public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.CheckedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; @@ -2284,16 +2284,16 @@ internal DefaultExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the DefaultKeyword. - public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Argument of the primary function. public TypeSyntax Type => GetRed(ref this.type, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.DefaultExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; @@ -2337,16 +2337,16 @@ internal TypeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod } /// SyntaxToken representing the TypeOfKeyword. - public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// The expression to return type of. public TypeSyntax Type => GetRed(ref this.type, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.TypeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; @@ -2390,16 +2390,16 @@ internal SizeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod } /// SyntaxToken representing the SizeOfKeyword. - public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).keyword, Position, 0); + public SyntaxToken Keyword => new(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).keyword, Position, 0); /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Argument of the primary function. public TypeSyntax Type => GetRed(ref this.type, 2)!; /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.SizeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; @@ -2580,7 +2580,7 @@ internal ArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p } /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. public override SeparatedSyntaxList Arguments @@ -2593,7 +2593,7 @@ public override SeparatedSyntaxList Arguments } /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; @@ -2640,7 +2640,7 @@ internal BracketedArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, Synt } /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. public override SeparatedSyntaxList Arguments @@ -2653,7 +2653,7 @@ public override SeparatedSyntaxList Arguments } /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; @@ -2785,7 +2785,7 @@ internal ExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public override ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public override SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.ExpressionColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken ColonToken => new(this, ((InternalSyntax.ExpressionColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; @@ -2832,7 +2832,7 @@ internal NameColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; /// SyntaxToken representing colon. - public override SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.NameColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken ColonToken => new(this, ((InternalSyntax.NameColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; @@ -2933,13 +2933,13 @@ internal CastExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.CastExpressionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CastExpressionSyntax)this.Green).openParenToken, Position, 0); /// TypeSyntax node representing the type to which the expression is being cast. public TypeSyntax Type => GetRed(ref this.type, 1)!; /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.CastExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CastExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); /// ExpressionSyntax node representing the expression that is being casted. public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; @@ -3047,7 +3047,7 @@ public override SyntaxTokenList Modifiers } /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => new(this, ((Syntax.InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DelegateKeyword => new(this, ((InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); /// List of parameters of the anonymous method expression, or null if there no parameters are specified. public ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 2); @@ -3184,7 +3184,7 @@ public override SyntaxTokenList Modifiers public ParameterSyntax Parameter => GetRed(ref this.parameter, 2)!; /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => new(this, ((Syntax.InternalSyntax.SimpleLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken ArrowToken => new(this, ((InternalSyntax.SimpleLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(3), GetChildIndex(3)); /// /// BlockSyntax node representing the body of the lambda. @@ -3280,7 +3280,7 @@ internal RefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken RefKeyword => new(this, ((Syntax.InternalSyntax.RefExpressionSyntax)this.Green).refKeyword, Position, 0); + public SyntaxToken RefKeyword => new(this, ((InternalSyntax.RefExpressionSyntax)this.Green).refKeyword, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -3344,7 +3344,7 @@ public override SyntaxTokenList Modifiers public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => new(this, ((Syntax.InternalSyntax.ParenthesizedLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken ArrowToken => new(this, ((InternalSyntax.ParenthesizedLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(4), GetChildIndex(4)); /// /// BlockSyntax node representing the body of the lambda. @@ -3448,7 +3448,7 @@ internal InitializerExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synt } /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); + public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. public SeparatedSyntaxList Expressions @@ -3461,7 +3461,7 @@ public SeparatedSyntaxList Expressions } /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expressions, 1)! : null; @@ -3533,7 +3533,7 @@ internal ImplicitObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode } /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.ImplicitObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + public override SyntaxToken NewKeyword => new(this, ((InternalSyntax.ImplicitObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. public override ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; @@ -3602,7 +3602,7 @@ internal ObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, S } /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.ObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + public override SyntaxToken NewKeyword => new(this, ((InternalSyntax.ObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); /// TypeSyntax representing the type of the object being created. public TypeSyntax Type => GetRed(ref this.type, 1)!; @@ -3680,7 +3680,7 @@ internal WithExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public SyntaxToken WithKeyword => new(this, ((Syntax.InternalSyntax.WithExpressionSyntax)this.Green).withKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken WithKeyword => new(this, ((InternalSyntax.WithExpressionSyntax)this.Green).withKeyword, GetChildPosition(1), GetChildIndex(1)); /// InitializerExpressionSyntax representing the initializer expression for the with expression. public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 2)!; @@ -3797,10 +3797,10 @@ internal AnonymousObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode } /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + public SyntaxToken NewKeyword => new(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. public SeparatedSyntaxList Initializers @@ -3813,7 +3813,7 @@ public SeparatedSyntaxList Initializers } /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.initializers, 2)! : null; @@ -3860,7 +3860,7 @@ internal ArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Sy } /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.ArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + public SyntaxToken NewKeyword => new(this, ((InternalSyntax.ArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); /// ArrayTypeSyntax node representing the type of the array. public ArrayTypeSyntax Type => GetRed(ref this.type, 1)!; @@ -3923,10 +3923,10 @@ internal ImplicitArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode g } /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + public SyntaxToken NewKeyword => new(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. public SyntaxTokenList Commas @@ -3939,7 +3939,7 @@ public SyntaxTokenList Commas } /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 4)!; @@ -3991,7 +3991,7 @@ internal StackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode } /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => new(this, ((Syntax.InternalSyntax.StackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); + public SyntaxToken StackAllocKeyword => new(this, ((InternalSyntax.StackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); /// TypeSyntax node representing the type of the stackalloc array. public TypeSyntax Type => GetRed(ref this.type, 1)!; @@ -4052,13 +4052,13 @@ internal ImplicitStackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSy } /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => new(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); + public SyntaxToken StackAllocKeyword => new(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 3)!; @@ -4105,7 +4105,7 @@ internal CollectionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. public SeparatedSyntaxList Elements @@ -4117,7 +4117,7 @@ public SeparatedSyntaxList Elements } } - public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; @@ -4207,7 +4207,7 @@ internal SpreadElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.SpreadElementSyntax)this.Green).operatorToken, Position, 0); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.SpreadElementSyntax)this.Green).operatorToken, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -4386,14 +4386,14 @@ internal FromClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken FromKeyword => new(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).fromKeyword, Position, 0); + public SyntaxToken FromKeyword => new(this, ((InternalSyntax.FromClauseSyntax)this.Green).fromKeyword, Position, 0); public TypeSyntax? Type => GetRed(ref this.type, 1); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.FromClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken InKeyword => new(this, ((Syntax.InternalSyntax.FromClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken InKeyword => new(this, ((InternalSyntax.FromClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); public ExpressionSyntax Expression => GetRed(ref this.expression, 4)!; @@ -4450,12 +4450,12 @@ internal LetClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare { } - public SyntaxToken LetKeyword => new(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).letKeyword, Position, 0); + public SyntaxToken LetKeyword => new(this, ((InternalSyntax.LetClauseSyntax)this.Green).letKeyword, Position, 0); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.LetClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.LetClauseSyntax)this.Green).equalsToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EqualsToken => new(this, ((InternalSyntax.LetClauseSyntax)this.Green).equalsToken, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; @@ -4503,22 +4503,22 @@ internal JoinClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken JoinKeyword => new(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).joinKeyword, Position, 0); + public SyntaxToken JoinKeyword => new(this, ((InternalSyntax.JoinClauseSyntax)this.Green).joinKeyword, Position, 0); public TypeSyntax? Type => GetRed(ref this.type, 1); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.JoinClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken InKeyword => new(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken InKeyword => new(this, ((InternalSyntax.JoinClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); public ExpressionSyntax InExpression => GetRed(ref this.inExpression, 4)!; - public SyntaxToken OnKeyword => new(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).onKeyword, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken OnKeyword => new(this, ((InternalSyntax.JoinClauseSyntax)this.Green).onKeyword, GetChildPosition(5), GetChildIndex(5)); public ExpressionSyntax LeftExpression => GetRed(ref this.leftExpression, 6)!; - public SyntaxToken EqualsKeyword => new(this, ((Syntax.InternalSyntax.JoinClauseSyntax)this.Green).equalsKeyword, GetChildPosition(7), GetChildIndex(7)); + public SyntaxToken EqualsKeyword => new(this, ((InternalSyntax.JoinClauseSyntax)this.Green).equalsKeyword, GetChildPosition(7), GetChildIndex(7)); public ExpressionSyntax RightExpression => GetRed(ref this.rightExpression, 8)!; @@ -4587,10 +4587,10 @@ internal JoinIntoClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken IntoKeyword => new(this, ((Syntax.InternalSyntax.JoinIntoClauseSyntax)this.Green).intoKeyword, Position, 0); + public SyntaxToken IntoKeyword => new(this, ((InternalSyntax.JoinIntoClauseSyntax)this.Green).intoKeyword, Position, 0); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.JoinIntoClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.JoinIntoClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -4630,7 +4630,7 @@ internal WhereClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa { } - public SyntaxToken WhereKeyword => new(this, ((Syntax.InternalSyntax.WhereClauseSyntax)this.Green).whereKeyword, Position, 0); + public SyntaxToken WhereKeyword => new(this, ((InternalSyntax.WhereClauseSyntax)this.Green).whereKeyword, Position, 0); public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; @@ -4672,7 +4672,7 @@ internal OrderByClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken OrderByKeyword => new(this, ((Syntax.InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); + public SyntaxToken OrderByKeyword => new(this, ((InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); public SeparatedSyntaxList Orderings { @@ -4773,7 +4773,7 @@ internal SelectClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p { } - public SyntaxToken SelectKeyword => new(this, ((Syntax.InternalSyntax.SelectClauseSyntax)this.Green).selectKeyword, Position, 0); + public SyntaxToken SelectKeyword => new(this, ((InternalSyntax.SelectClauseSyntax)this.Green).selectKeyword, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -4816,11 +4816,11 @@ internal GroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa { } - public SyntaxToken GroupKeyword => new(this, ((Syntax.InternalSyntax.GroupClauseSyntax)this.Green).groupKeyword, Position, 0); + public SyntaxToken GroupKeyword => new(this, ((InternalSyntax.GroupClauseSyntax)this.Green).groupKeyword, Position, 0); public ExpressionSyntax GroupExpression => GetRed(ref this.groupExpression, 1)!; - public SyntaxToken ByKeyword => new(this, ((Syntax.InternalSyntax.GroupClauseSyntax)this.Green).byKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ByKeyword => new(this, ((InternalSyntax.GroupClauseSyntax)this.Green).byKeyword, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax ByExpression => GetRed(ref this.byExpression, 3)!; @@ -4876,10 +4876,10 @@ internal QueryContinuationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public SyntaxToken IntoKeyword => new(this, ((Syntax.InternalSyntax.QueryContinuationSyntax)this.Green).intoKeyword, Position, 0); + public SyntaxToken IntoKeyword => new(this, ((InternalSyntax.QueryContinuationSyntax)this.Green).intoKeyword, Position, 0); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.QueryContinuationSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.QueryContinuationSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); public QueryBodySyntax Body => GetRed(ref this.body, 2)!; @@ -4925,7 +4925,7 @@ internal OmittedArraySizeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, } /// SyntaxToken representing the omitted array size expression. - public SyntaxToken OmittedArraySizeExpressionToken => new(this, ((Syntax.InternalSyntax.OmittedArraySizeExpressionSyntax)this.Green).omittedArraySizeExpressionToken, Position, 0); + public SyntaxToken OmittedArraySizeExpressionToken => new(this, ((InternalSyntax.OmittedArraySizeExpressionSyntax)this.Green).omittedArraySizeExpressionToken, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -4965,13 +4965,13 @@ internal InterpolatedStringExpressionSyntax(InternalSyntax.CSharpSyntaxNode gree } /// The first part of an interpolated string, $" or $@" or $""" - public SyntaxToken StringStartToken => new(this, ((Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringStartToken, Position, 0); + public SyntaxToken StringStartToken => new(this, ((InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringStartToken, Position, 0); /// List of parts of the interpolated string, each one is either a literal part or an interpolation. public SyntaxList Contents => new(GetRed(ref this.contents, 1)); /// The closing quote of the interpolated string. - public SyntaxToken StringEndToken => new(this, ((Syntax.InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringEndToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken StringEndToken => new(this, ((InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringEndToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.contents, 1)! : null; @@ -5019,7 +5019,7 @@ internal IsPatternExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax /// ExpressionSyntax node representing the expression on the left of the "is" operator. public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public SyntaxToken IsKeyword => new(this, ((Syntax.InternalSyntax.IsPatternExpressionSyntax)this.Green).isKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken IsKeyword => new(this, ((InternalSyntax.IsPatternExpressionSyntax)this.Green).isKeyword, GetChildPosition(1), GetChildIndex(1)); /// PatternSyntax node representing the pattern on the right of the "is" operator. public PatternSyntax Pattern => GetRed(ref this.pattern, 2)!; @@ -5075,7 +5075,7 @@ internal ThrowExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public SyntaxToken ThrowKeyword => new(this, ((Syntax.InternalSyntax.ThrowExpressionSyntax)this.Green).throwKeyword, Position, 0); + public SyntaxToken ThrowKeyword => new(this, ((InternalSyntax.ThrowExpressionSyntax)this.Green).throwKeyword, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -5117,7 +5117,7 @@ internal WhenClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken WhenKeyword => new(this, ((Syntax.InternalSyntax.WhenClauseSyntax)this.Green).whenKeyword, Position, 0); + public SyntaxToken WhenKeyword => new(this, ((InternalSyntax.WhenClauseSyntax)this.Green).whenKeyword, Position, 0); public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; @@ -5166,7 +5166,7 @@ internal DiscardPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken UnderscoreToken => new(this, ((Syntax.InternalSyntax.DiscardPatternSyntax)this.Green).underscoreToken, Position, 0); + public SyntaxToken UnderscoreToken => new(this, ((InternalSyntax.DiscardPatternSyntax)this.Green).underscoreToken, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -5260,7 +5260,7 @@ internal VarPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken VarKeyword => new(this, ((Syntax.InternalSyntax.VarPatternSyntax)this.Green).varKeyword, Position, 0); + public SyntaxToken VarKeyword => new(this, ((InternalSyntax.VarPatternSyntax)this.Green).varKeyword, Position, 0); public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; @@ -5380,7 +5380,7 @@ internal PositionalPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, Sy { } - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); public SeparatedSyntaxList Subpatterns { @@ -5391,7 +5391,7 @@ public SeparatedSyntaxList Subpatterns } } - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; @@ -5434,7 +5434,7 @@ internal PropertyPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); + public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); public SeparatedSyntaxList Subpatterns { @@ -5445,7 +5445,7 @@ public SeparatedSyntaxList Subpatterns } } - public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; @@ -5583,11 +5583,11 @@ internal ParenthesizedPatternSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedPatternSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ParenthesizedPatternSyntax)this.Green).openParenToken, Position, 0); public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedPatternSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ParenthesizedPatternSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; @@ -5629,7 +5629,7 @@ internal RelationalPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// SyntaxToken representing the operator of the relational pattern. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.RelationalPatternSyntax)this.Green).operatorToken, Position, 0); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.RelationalPatternSyntax)this.Green).operatorToken, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -5715,7 +5715,7 @@ internal BinaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public PatternSyntax Left => GetRedAtZero(ref this.left)!; - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.BinaryPatternSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.BinaryPatternSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); public PatternSyntax Right => GetRed(ref this.right, 2)!; @@ -5770,7 +5770,7 @@ internal UnaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p { } - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.UnaryPatternSyntax)this.Green).operatorToken, Position, 0); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.UnaryPatternSyntax)this.Green).operatorToken, Position, 0); public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; @@ -5813,7 +5813,7 @@ internal ListPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa { } - public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); public SeparatedSyntaxList Patterns { @@ -5824,7 +5824,7 @@ public SeparatedSyntaxList Patterns } } - public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); @@ -5882,7 +5882,7 @@ internal SlicePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p { } - public SyntaxToken DotDotToken => new(this, ((Syntax.InternalSyntax.SlicePatternSyntax)this.Green).dotDotToken, Position, 0); + public SyntaxToken DotDotToken => new(this, ((InternalSyntax.SlicePatternSyntax)this.Green).dotDotToken, Position, 0); public PatternSyntax? Pattern => GetRed(ref this.pattern, 1); @@ -5932,7 +5932,7 @@ internal InterpolatedStringTextSyntax(InternalSyntax.CSharpSyntaxNode green, Syn } /// The text contents of a part of the interpolated string. - public SyntaxToken TextToken => new(this, ((Syntax.InternalSyntax.InterpolatedStringTextSyntax)this.Green).textToken, Position, 0); + public SyntaxToken TextToken => new(this, ((InternalSyntax.InterpolatedStringTextSyntax)this.Green).textToken, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -5974,7 +5974,7 @@ internal InterpolationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). - public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.InterpolationSyntax)this.Green).openBraceToken, Position, 0); + public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.InterpolationSyntax)this.Green).openBraceToken, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -5985,7 +5985,7 @@ internal InterpolationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? /// /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). /// - public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.InterpolationSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.InterpolationSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -6042,7 +6042,7 @@ internal InterpolationAlignmentClauseSyntax(InternalSyntax.CSharpSyntaxNode gree { } - public SyntaxToken CommaToken => new(this, ((Syntax.InternalSyntax.InterpolationAlignmentClauseSyntax)this.Green).commaToken, Position, 0); + public SyntaxToken CommaToken => new(this, ((InternalSyntax.InterpolationAlignmentClauseSyntax)this.Green).commaToken, Position, 0); public ExpressionSyntax Value => GetRed(ref this.value, 1)!; @@ -6083,10 +6083,10 @@ internal InterpolationFormatClauseSyntax(InternalSyntax.CSharpSyntaxNode green, { } - public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.InterpolationFormatClauseSyntax)this.Green).colonToken, Position, 0); + public SyntaxToken ColonToken => new(this, ((InternalSyntax.InterpolationFormatClauseSyntax)this.Green).colonToken, Position, 0); /// The text contents of the format specifier for an interpolation. - public SyntaxToken FormatStringToken => new(this, ((Syntax.InternalSyntax.InterpolationFormatClauseSyntax)this.Green).formatStringToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken FormatStringToken => new(this, ((InternalSyntax.InterpolationFormatClauseSyntax)this.Green).formatStringToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -6217,11 +6217,11 @@ internal BlockSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.BlockSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.BlockSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); public SyntaxList Statements => new(GetRed(ref this.statements, 2)); - public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.BlockSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.BlockSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -6300,7 +6300,7 @@ public SyntaxTokenList Modifiers public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.LocalFunctionStatementSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); @@ -6445,7 +6445,7 @@ public SyntaxTokenList Modifiers public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 4)!; - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).semicolonToken, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).semicolonToken, GetChildPosition(5), GetChildIndex(5)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -6573,7 +6573,7 @@ internal VariableDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN } /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.VariableDeclaratorSyntax)this.Green).identifier, Position, 0); + public SyntaxToken Identifier => new(this, ((InternalSyntax.VariableDeclaratorSyntax)this.Green).identifier, Position, 0); public BracketedArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); @@ -6636,7 +6636,7 @@ internal EqualsValueClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.EqualsValueClauseSyntax)this.Green).equalsToken, Position, 0); + public SyntaxToken EqualsToken => new(this, ((InternalSyntax.EqualsValueClauseSyntax)this.Green).equalsToken, Position, 0); public ExpressionSyntax Value => GetRed(ref this.value, 1)!; @@ -6685,7 +6685,7 @@ internal SingleVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, { } - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.SingleVariableDesignationSyntax)this.Green).identifier, Position, 0); + public SyntaxToken Identifier => new(this, ((InternalSyntax.SingleVariableDesignationSyntax)this.Green).identifier, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -6723,7 +6723,7 @@ internal DiscardDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public SyntaxToken UnderscoreToken => new(this, ((Syntax.InternalSyntax.DiscardDesignationSyntax)this.Green).underscoreToken, Position, 0); + public SyntaxToken UnderscoreToken => new(this, ((InternalSyntax.DiscardDesignationSyntax)this.Green).underscoreToken, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -6762,7 +6762,7 @@ internal ParenthesizedVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode { } - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); public SeparatedSyntaxList Variables { @@ -6773,7 +6773,7 @@ public SeparatedSyntaxList Variables } } - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.variables, 1)! : null; @@ -6821,7 +6821,7 @@ internal ExpressionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.ExpressionStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.ExpressionStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -6880,7 +6880,7 @@ internal EmptyStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.EmptyStatementSyntax)this.Green).semicolonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.EmptyStatementSyntax)this.Green).semicolonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; @@ -6929,10 +6929,10 @@ internal LabeledStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.LabeledStatementSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.LabeledStatementSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); /// Gets a SyntaxToken that represents the colon following the statement's label. - public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.LabeledStatementSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ColonToken => new(this, ((InternalSyntax.LabeledStatementSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); public StatementSyntax Statement => GetRed(ref this.statement, 3)!; @@ -7003,7 +7003,7 @@ internal GotoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? /// /// Gets a SyntaxToken that represents the goto keyword. /// - public SyntaxToken GotoKeyword => new(this, ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).gotoKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken GotoKeyword => new(this, ((InternalSyntax.GotoStatementSyntax)this.Green).gotoKeyword, GetChildPosition(1), GetChildIndex(1)); /// /// Gets a SyntaxToken that represents the case or default keywords if any exists. @@ -7025,7 +7025,7 @@ public SyntaxToken CaseOrDefaultKeyword /// /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. /// - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.GotoStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -7086,9 +7086,9 @@ internal BreakStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken BreakKeyword => new(this, ((Syntax.InternalSyntax.BreakStatementSyntax)this.Green).breakKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken BreakKeyword => new(this, ((InternalSyntax.BreakStatementSyntax)this.Green).breakKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.BreakStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.BreakStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; @@ -7135,9 +7135,9 @@ internal ContinueStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken ContinueKeyword => new(this, ((Syntax.InternalSyntax.ContinueStatementSyntax)this.Green).continueKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ContinueKeyword => new(this, ((InternalSyntax.ContinueStatementSyntax)this.Green).continueKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.ContinueStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.ContinueStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; @@ -7185,11 +7185,11 @@ internal ReturnStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken ReturnKeyword => new(this, ((Syntax.InternalSyntax.ReturnStatementSyntax)this.Green).returnKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ReturnKeyword => new(this, ((InternalSyntax.ReturnStatementSyntax)this.Green).returnKeyword, GetChildPosition(1), GetChildIndex(1)); public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.ReturnStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.ReturnStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -7250,11 +7250,11 @@ internal ThrowStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken ThrowKeyword => new(this, ((Syntax.InternalSyntax.ThrowStatementSyntax)this.Green).throwKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ThrowKeyword => new(this, ((InternalSyntax.ThrowStatementSyntax)this.Green).throwKeyword, GetChildPosition(1), GetChildIndex(1)); public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.ThrowStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.ThrowStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -7316,13 +7316,13 @@ internal YieldStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken YieldKeyword => new(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).yieldKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken YieldKeyword => new(this, ((InternalSyntax.YieldStatementSyntax)this.Green).yieldKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken ReturnOrBreakKeyword => new(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).returnOrBreakKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ReturnOrBreakKeyword => new(this, ((InternalSyntax.YieldStatementSyntax)this.Green).returnOrBreakKeyword, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.YieldStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.YieldStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -7385,13 +7385,13 @@ internal WhileStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken WhileKeyword => new(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).whileKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken WhileKeyword => new(this, ((InternalSyntax.WhileStatementSyntax)this.Green).whileKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.WhileStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.WhileStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.WhileStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); public StatementSyntax Statement => GetRed(ref this.statement, 5)!; @@ -7459,19 +7459,19 @@ internal DoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken DoKeyword => new(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).doKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DoKeyword => new(this, ((InternalSyntax.DoStatementSyntax)this.Green).doKeyword, GetChildPosition(1), GetChildIndex(1)); public StatementSyntax Statement => GetRed(ref this.statement, 2)!; - public SyntaxToken WhileKeyword => new(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).whileKeyword, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken WhileKeyword => new(this, ((InternalSyntax.DoStatementSyntax)this.Green).whileKeyword, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).openParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.DoStatementSyntax)this.Green).openParenToken, GetChildPosition(4), GetChildIndex(4)); public ExpressionSyntax Condition => GetRed(ref this.condition, 5)!; - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.DoStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.DoStatementSyntax)this.Green).semicolonToken, GetChildPosition(7), GetChildIndex(7)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.DoStatementSyntax)this.Green).semicolonToken, GetChildPosition(7), GetChildIndex(7)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -7542,9 +7542,9 @@ internal ForStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken ForKeyword => new(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).forKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ForKeyword => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).forKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 3); @@ -7557,11 +7557,11 @@ public SeparatedSyntaxList Initializers } } - public SyntaxToken FirstSemicolonToken => new(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken FirstSemicolonToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); public ExpressionSyntax? Condition => GetRed(ref this.condition, 6); - public SyntaxToken SecondSemicolonToken => new(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); + public SyntaxToken SecondSemicolonToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); public SeparatedSyntaxList Incrementors { @@ -7572,7 +7572,7 @@ public SeparatedSyntaxList Incrementors } } - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); public StatementSyntax Statement => GetRed(ref this.statement, 10)!; @@ -7703,20 +7703,20 @@ public override SyntaxToken AwaitKeyword } } - public override SyntaxToken ForEachKeyword => new(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken ForEachKeyword => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); public TypeSyntax Type => GetRed(ref this.type, 4)!; /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); - public override SyntaxToken InKeyword => new(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).inKeyword, GetChildPosition(6), GetChildIndex(6)); + public override SyntaxToken InKeyword => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).inKeyword, GetChildPosition(6), GetChildIndex(6)); public override ExpressionSyntax Expression => GetRed(ref this.expression, 7)!; - public override SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).closeParenToken, GetChildPosition(8), GetChildIndex(8)); + public override SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).closeParenToken, GetChildPosition(8), GetChildIndex(8)); public override StatementSyntax Statement => GetRed(ref this.statement, 9)!; @@ -7807,9 +7807,9 @@ public override SyntaxToken AwaitKeyword } } - public override SyntaxToken ForEachKeyword => new(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken ForEachKeyword => new(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); /// /// The variable(s) of the loop. In correct code this is a tuple @@ -7819,11 +7819,11 @@ public override SyntaxToken AwaitKeyword /// public ExpressionSyntax Variable => GetRed(ref this.variable, 4)!; - public override SyntaxToken InKeyword => new(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).inKeyword, GetChildPosition(5), GetChildIndex(5)); + public override SyntaxToken InKeyword => new(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).inKeyword, GetChildPosition(5), GetChildIndex(5)); public override ExpressionSyntax Expression => GetRed(ref this.expression, 6)!; - public override SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).closeParenToken, GetChildPosition(7), GetChildIndex(7)); + public override SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).closeParenToken, GetChildPosition(7), GetChildIndex(7)); public override StatementSyntax Statement => GetRed(ref this.statement, 8)!; @@ -7913,15 +7913,15 @@ public SyntaxToken AwaitKeyword } } - public SyntaxToken UsingKeyword => new(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken UsingKeyword => new(this, ((InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.UsingStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 4); public ExpressionSyntax? Expression => GetRed(ref this.expression, 5); - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.UsingStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); public StatementSyntax Statement => GetRed(ref this.statement, 7)!; @@ -7993,13 +7993,13 @@ internal FixedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken FixedKeyword => new(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).fixedKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken FixedKeyword => new(this, ((InternalSyntax.FixedStatementSyntax)this.Green).fixedKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.FixedStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.FixedStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.FixedStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); public StatementSyntax Statement => GetRed(ref this.statement, 5)!; @@ -8068,7 +8068,7 @@ internal CheckedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.CheckedStatementSyntax)this.Green).keyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Keyword => new(this, ((InternalSyntax.CheckedStatementSyntax)this.Green).keyword, GetChildPosition(1), GetChildIndex(1)); public BlockSyntax Block => GetRed(ref this.block, 2)!; @@ -8132,7 +8132,7 @@ internal UnsafeStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken UnsafeKeyword => new(this, ((Syntax.InternalSyntax.UnsafeStatementSyntax)this.Green).unsafeKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken UnsafeKeyword => new(this, ((InternalSyntax.UnsafeStatementSyntax)this.Green).unsafeKeyword, GetChildPosition(1), GetChildIndex(1)); public BlockSyntax Block => GetRed(ref this.block, 2)!; @@ -8197,13 +8197,13 @@ internal LockStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken LockKeyword => new(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).lockKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken LockKeyword => new(this, ((InternalSyntax.LockStatementSyntax)this.Green).lockKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.LockStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.LockStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.LockStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); public StatementSyntax Statement => GetRed(ref this.statement, 5)!; @@ -8278,12 +8278,12 @@ internal IfStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa /// /// Gets a SyntaxToken that represents the if keyword. /// - public SyntaxToken IfKeyword => new(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken IfKeyword => new(this, ((InternalSyntax.IfStatementSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); /// /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. /// - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.IfStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); /// /// Gets an ExpressionSyntax that represents the condition of the if statement. @@ -8293,7 +8293,7 @@ internal IfStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa /// /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. /// - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.IfStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.IfStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); /// /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. @@ -8372,7 +8372,7 @@ internal ElseClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par /// /// Gets a syntax token /// - public SyntaxToken ElseKeyword => new(this, ((Syntax.InternalSyntax.ElseClauseSyntax)this.Green).elseKeyword, Position, 0); + public SyntaxToken ElseKeyword => new(this, ((InternalSyntax.ElseClauseSyntax)this.Green).elseKeyword, Position, 0); public StatementSyntax Statement => GetRed(ref this.statement, 1)!; @@ -8422,7 +8422,7 @@ internal SwitchStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode /// /// Gets a SyntaxToken that represents the switch keyword. /// - public SyntaxToken SwitchKeyword => new(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken SwitchKeyword => new(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); /// /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. @@ -8456,7 +8456,7 @@ public SyntaxToken CloseParenToken /// /// Gets a SyntaxToken that represents the open braces preceding the switch sections. /// - public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openBraceToken, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).openBraceToken, GetChildPosition(5), GetChildIndex(5)); /// /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. @@ -8466,7 +8466,7 @@ public SyntaxToken CloseParenToken /// /// Gets a SyntaxToken that represents the open braces following the switch sections. /// - public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeBraceToken, GetChildPosition(7), GetChildIndex(7)); + public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).closeBraceToken, GetChildPosition(7), GetChildIndex(7)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -8622,7 +8622,7 @@ internal CasePatternSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, Syn } /// Gets the case keyword token. - public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).keyword, Position, 0); + public override SyntaxToken Keyword => new(this, ((InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).keyword, Position, 0); /// /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. @@ -8631,7 +8631,7 @@ internal CasePatternSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 2); - public override SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken ColonToken => new(this, ((InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -8689,14 +8689,14 @@ internal CaseSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode } /// Gets the case keyword token. - public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.CaseSwitchLabelSyntax)this.Green).keyword, Position, 0); + public override SyntaxToken Keyword => new(this, ((InternalSyntax.CaseSwitchLabelSyntax)this.Green).keyword, Position, 0); /// /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. /// public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - public override SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.CaseSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken ColonToken => new(this, ((InternalSyntax.CaseSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; @@ -8740,9 +8740,9 @@ internal DefaultSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN } /// Gets the default keyword token. - public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.DefaultSwitchLabelSyntax)this.Green).keyword, Position, 0); + public override SyntaxToken Keyword => new(this, ((InternalSyntax.DefaultSwitchLabelSyntax)this.Green).keyword, Position, 0); - public override SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.DefaultSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken ColonToken => new(this, ((InternalSyntax.DefaultSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -8787,9 +8787,9 @@ internal SwitchExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public ExpressionSyntax GoverningExpression => GetRedAtZero(ref this.governingExpression)!; - public SyntaxToken SwitchKeyword => new(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken SwitchKeyword => new(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); public SeparatedSyntaxList Arms { @@ -8800,7 +8800,7 @@ public SeparatedSyntaxList Arms } } - public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -8863,7 +8863,7 @@ internal SwitchExpressionArmSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 1); - public SyntaxToken EqualsGreaterThanToken => new(this, ((Syntax.InternalSyntax.SwitchExpressionArmSyntax)this.Green).equalsGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EqualsGreaterThanToken => new(this, ((InternalSyntax.SwitchExpressionArmSyntax)this.Green).equalsGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; @@ -8926,7 +8926,7 @@ internal TryStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken TryKeyword => new(this, ((Syntax.InternalSyntax.TryStatementSyntax)this.Green).tryKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken TryKeyword => new(this, ((InternalSyntax.TryStatementSyntax)this.Green).tryKeyword, GetChildPosition(1), GetChildIndex(1)); public BlockSyntax Block => GetRed(ref this.block, 2)!; @@ -9000,7 +9000,7 @@ internal CatchClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa { } - public SyntaxToken CatchKeyword => new(this, ((Syntax.InternalSyntax.CatchClauseSyntax)this.Green).catchKeyword, Position, 0); + public SyntaxToken CatchKeyword => new(this, ((InternalSyntax.CatchClauseSyntax)this.Green).catchKeyword, Position, 0); public CatchDeclarationSyntax? Declaration => GetRed(ref this.declaration, 1); @@ -9065,7 +9065,7 @@ internal CatchDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).openParenToken, Position, 0); public TypeSyntax Type => GetRed(ref this.type, 1)!; @@ -9078,7 +9078,7 @@ public SyntaxToken Identifier } } - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; @@ -9120,13 +9120,13 @@ internal CatchFilterClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public SyntaxToken WhenKeyword => new(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).whenKeyword, Position, 0); + public SyntaxToken WhenKeyword => new(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).whenKeyword, Position, 0); - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); public ExpressionSyntax FilterExpression => GetRed(ref this.filterExpression, 2)!; - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.CatchFilterClauseSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.filterExpression, 2)! : null; @@ -9168,7 +9168,7 @@ internal FinallyClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken FinallyKeyword => new(this, ((Syntax.InternalSyntax.FinallyClauseSyntax)this.Green).finallyKeyword, Position, 0); + public SyntaxToken FinallyKeyword => new(this, ((InternalSyntax.FinallyClauseSyntax)this.Green).finallyKeyword, Position, 0); public BlockSyntax Block => GetRed(ref this.block, 1)!; @@ -9225,7 +9225,7 @@ internal CompilationUnitSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public SyntaxList Members => new(GetRed(ref this.members, 3)); - public SyntaxToken EndOfFileToken => new(this, ((Syntax.InternalSyntax.CompilationUnitSyntax)this.Green).endOfFileToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken EndOfFileToken => new(this, ((InternalSyntax.CompilationUnitSyntax)this.Green).endOfFileToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -9292,16 +9292,16 @@ internal ExternAliasDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, Synta } /// SyntaxToken representing the extern keyword. - public SyntaxToken ExternKeyword => new(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).externKeyword, Position, 0); + public SyntaxToken ExternKeyword => new(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).externKeyword, Position, 0); /// SyntaxToken representing the alias keyword. - public SyntaxToken AliasKeyword => new(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).aliasKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken AliasKeyword => new(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).aliasKeyword, GetChildPosition(1), GetChildIndex(1)); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); /// SyntaxToken representing the semicolon token. - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.ExternAliasDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -9353,7 +9353,7 @@ public SyntaxToken GlobalKeyword } } - public SyntaxToken UsingKeyword => new(this, ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken UsingKeyword => new(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); public SyntaxToken StaticKeyword { @@ -9377,7 +9377,7 @@ public SyntaxToken UnsafeKeyword public TypeSyntax NamespaceOrType => GetRed(ref this.namespaceOrType, 5)!; - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(6), GetChildIndex(6)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -9518,11 +9518,11 @@ public override SyntaxTokenList Modifiers } } - public override SyntaxToken NamespaceKeyword => new(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken NamespaceKeyword => new(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); public override NameSyntax Name => GetRed(ref this.name, 3)!; - public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).openBraceToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).openBraceToken, GetChildPosition(4), GetChildIndex(4)); public override SyntaxList Externs => new(GetRed(ref this.externs, 5)); @@ -9530,7 +9530,7 @@ public override SyntaxTokenList Modifiers public override SyntaxList Members => new(GetRed(ref this.members, 7)); - public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); + public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); /// Gets the optional semicolon token. public SyntaxToken SemicolonToken @@ -9639,11 +9639,11 @@ public override SyntaxTokenList Modifiers } } - public override SyntaxToken NamespaceKeyword => new(this, ((Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken NamespaceKeyword => new(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); public override NameSyntax Name => GetRed(ref this.name, 3)!; - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); public override SyntaxList Externs => new(GetRed(ref this.externs, 5)); @@ -9734,7 +9734,7 @@ internal AttributeListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.AttributeListSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.AttributeListSyntax)this.Green).openBracketToken, Position, 0); /// Gets the optional construct targeted by the attribute. public AttributeTargetSpecifierSyntax? Target => GetRed(ref this.target, 1); @@ -9750,7 +9750,7 @@ public SeparatedSyntaxList Attributes } /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -9807,10 +9807,10 @@ internal AttributeTargetSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, S } /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).identifier, Position, 0); + public SyntaxToken Identifier => new(this, ((InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).identifier, Position, 0); /// Gets the colon token. - public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ColonToken => new(this, ((InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -9915,7 +9915,7 @@ internal AttributeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, Synt } /// Gets the open paren token. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); /// Gets the arguments syntax list. public SeparatedSyntaxList Arguments @@ -9928,7 +9928,7 @@ public SeparatedSyntaxList Arguments } /// Gets the close paren token. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; @@ -10038,7 +10038,7 @@ internal NameEqualsSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par /// Gets the identifier name. public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; - public SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.NameEqualsSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken EqualsToken => new(this, ((InternalSyntax.NameEqualsSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; @@ -10080,7 +10080,7 @@ internal TypeParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// Gets the < token. - public SyntaxToken LessThanToken => new(this, ((Syntax.InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken LessThanToken => new(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); /// Gets the parameter list. public SeparatedSyntaxList Parameters @@ -10093,7 +10093,7 @@ public SeparatedSyntaxList Parameters } /// Gets the > token. - public SyntaxToken GreaterThanToken => new(this, ((Syntax.InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -10150,7 +10150,7 @@ public SyntaxToken VarianceKeyword } /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; @@ -10307,9 +10307,9 @@ public override SyntaxTokenList Modifiers } /// Gets the class keyword token. - public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken Keyword => new(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken Identifier => new(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); @@ -10473,9 +10473,9 @@ public override SyntaxTokenList Modifiers } /// Gets the struct keyword token. - public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken Keyword => new(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken Identifier => new(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); @@ -10639,9 +10639,9 @@ public override SyntaxTokenList Modifiers } /// Gets the interface keyword token. - public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken Keyword => new(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken Identifier => new(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); @@ -10804,7 +10804,7 @@ public override SyntaxTokenList Modifiers } } - public override SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken Keyword => new(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); public SyntaxToken ClassOrStructKeyword { @@ -10815,7 +10815,7 @@ public SyntaxToken ClassOrStructKeyword } } - public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken Identifier => new(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); @@ -10977,9 +10977,9 @@ public override SyntaxTokenList Modifiers } /// Gets the enum keyword token. - public SyntaxToken EnumKeyword => new(this, ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EnumKeyword => new(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken Identifier => new(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 4); @@ -11116,13 +11116,13 @@ public override SyntaxTokenList Modifiers } /// Gets the "delegate" keyword. - public SyntaxToken DelegateKeyword => new(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken DelegateKeyword => new(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); /// Gets the return type. public TypeSyntax ReturnType => GetRed(ref this.returnType, 3)!; /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); @@ -11133,7 +11133,7 @@ public override SyntaxTokenList Modifiers public SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); /// Gets the semicolon token. - public SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.DelegateDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(8), GetChildIndex(8)); + public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(8), GetChildIndex(8)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -11225,7 +11225,7 @@ public override SyntaxTokenList Modifiers } /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); public EqualsValueClauseSyntax? EqualsValue => GetRed(ref this.equalsValue, 3); @@ -11290,7 +11290,7 @@ internal BaseListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? paren } /// Gets the colon token. - public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); + public SyntaxToken ColonToken => new(this, ((InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); /// Gets the base type references. public SeparatedSyntaxList Types @@ -11455,13 +11455,13 @@ internal TypeParameterConstraintClauseSyntax(InternalSyntax.CSharpSyntaxNode gre { } - public SyntaxToken WhereKeyword => new(this, ((Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).whereKeyword, Position, 0); + public SyntaxToken WhereKeyword => new(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).whereKeyword, Position, 0); /// Gets the identifier. public IdentifierNameSyntax Name => GetRed(ref this.name, 1)!; /// Gets the colon token. - public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ColonToken => new(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); /// Gets the constraints list. public SeparatedSyntaxList Constraints @@ -11537,13 +11537,13 @@ internal ConstructorConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, Synt } /// Gets the "new" keyword. - public SyntaxToken NewKeyword => new(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).newKeyword, Position, 0); + public SyntaxToken NewKeyword => new(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).newKeyword, Position, 0); /// Gets the open paren keyword. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); /// Gets the close paren keyword. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ConstructorConstraintSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -11586,7 +11586,7 @@ internal ClassOrStructConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, Sy } /// Gets the constraint keyword ("class" or "struct"). - public SyntaxToken ClassOrStructKeyword => new(this, ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); + public SyntaxToken ClassOrStructKeyword => new(this, ((InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); /// SyntaxToken representing the question mark. public SyntaxToken QuestionToken @@ -11678,7 +11678,7 @@ internal DefaultConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// Gets the "default" keyword. - public SyntaxToken DefaultKeyword => new(this, ((Syntax.InternalSyntax.DefaultConstraintSyntax)this.Green).defaultKeyword, Position, 0); + public SyntaxToken DefaultKeyword => new(this, ((InternalSyntax.DefaultConstraintSyntax)this.Green).defaultKeyword, Position, 0); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -11757,7 +11757,7 @@ public override SyntaxTokenList Modifiers public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 2)!; - public override SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.FieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken SemicolonToken => new(this, ((InternalSyntax.FieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -11834,11 +11834,11 @@ public override SyntaxTokenList Modifiers } } - public SyntaxToken EventKeyword => new(this, ((Syntax.InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EventKeyword => new(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; - public override SyntaxToken SemicolonToken => new(this, ((Syntax.InternalSyntax.EventFieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken SemicolonToken => new(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -11906,7 +11906,7 @@ internal ExplicitInterfaceSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, public NameSyntax Name => GetRedAtZero(ref this.name)!; - public SyntaxToken DotToken => new(this, ((Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DotToken => new(this, ((InternalSyntax.ExplicitInterfaceSpecifierSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; @@ -12014,7 +12014,7 @@ public override SyntaxTokenList Modifiers public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.MethodDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); @@ -12162,7 +12162,7 @@ public override SyntaxTokenList Modifiers public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); /// Gets the "operator" keyword. - public SyntaxToken OperatorKeyword => new(this, ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); /// Gets the "checked" keyword. public SyntaxToken CheckedKeyword @@ -12175,7 +12175,7 @@ public SyntaxToken CheckedKeyword } /// Gets the operator token. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; @@ -12303,12 +12303,12 @@ public override SyntaxTokenList Modifiers } /// Gets the "implicit" or "explicit" token. - public SyntaxToken ImplicitOrExplicitKeyword => new(this, ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ImplicitOrExplicitKeyword => new(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); /// Gets the "operator" token. - public SyntaxToken OperatorKeyword => new(this, ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); /// Gets the "checked" keyword. public SyntaxToken CheckedKeyword @@ -12448,7 +12448,7 @@ public override SyntaxTokenList Modifiers } /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; @@ -12558,10 +12558,10 @@ internal ConstructorInitializerSyntax(InternalSyntax.CSharpSyntaxNode green, Syn } /// Gets the colon token. - public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.ConstructorInitializerSyntax)this.Green).colonToken, Position, 0); + public SyntaxToken ColonToken => new(this, ((InternalSyntax.ConstructorInitializerSyntax)this.Green).colonToken, Position, 0); /// Gets the "this" or "base" keyword. - public SyntaxToken ThisOrBaseKeyword => new(this, ((Syntax.InternalSyntax.ConstructorInitializerSyntax)this.Green).thisOrBaseKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ThisOrBaseKeyword => new(this, ((InternalSyntax.ConstructorInitializerSyntax)this.Green).thisOrBaseKeyword, GetChildPosition(1), GetChildIndex(1)); public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 2)!; @@ -12622,10 +12622,10 @@ public override SyntaxTokenList Modifiers } /// Gets the tilde token. - public SyntaxToken TildeToken => new(this, ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken TildeToken => new(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 4)!; @@ -12782,7 +12782,7 @@ public override SyntaxTokenList Modifiers public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.PropertyDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 5); @@ -12881,7 +12881,7 @@ internal ArrowExpressionClauseSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public SyntaxToken ArrowToken => new(this, ((Syntax.InternalSyntax.ArrowExpressionClauseSyntax)this.Green).arrowToken, Position, 0); + public SyntaxToken ArrowToken => new(this, ((InternalSyntax.ArrowExpressionClauseSyntax)this.Green).arrowToken, Position, 0); public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; @@ -12937,14 +12937,14 @@ public override SyntaxTokenList Modifiers } } - public SyntaxToken EventKeyword => new(this, ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EventKeyword => new(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); public override TypeSyntax Type => GetRed(ref this.type, 3)!; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 4); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); @@ -13053,7 +13053,7 @@ public override SyntaxTokenList Modifiers public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - public SyntaxToken ThisKeyword => new(this, ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).thisKeyword, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken ThisKeyword => new(this, ((InternalSyntax.IndexerDeclarationSyntax)this.Green).thisKeyword, GetChildPosition(4), GetChildIndex(4)); /// Gets the parameter list. public BracketedParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; @@ -13153,11 +13153,11 @@ internal AccessorListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p { } - public SyntaxToken OpenBraceToken => new(this, ((Syntax.InternalSyntax.AccessorListSyntax)this.Green).openBraceToken, Position, 0); + public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.AccessorListSyntax)this.Green).openBraceToken, Position, 0); public SyntaxList Accessors => new(GetRed(ref this.accessors, 1)); - public SyntaxToken CloseBraceToken => new(this, ((Syntax.InternalSyntax.AccessorListSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.AccessorListSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.accessors, 1)! : null; @@ -13221,7 +13221,7 @@ public SyntaxTokenList Modifiers } /// Gets the keyword token, or identifier if an erroneous accessor declaration. - public SyntaxToken Keyword => new(this, ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Keyword => new(this, ((InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); /// Gets the optional body block which may be empty, but it is null if there are no braces. public BlockSyntax? Body => GetRed(ref this.body, 3); @@ -13327,7 +13327,7 @@ internal ParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? } /// Gets the open paren token. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); public override SeparatedSyntaxList Parameters { @@ -13339,7 +13339,7 @@ public override SeparatedSyntaxList Parameters } /// Gets the close paren token. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -13386,7 +13386,7 @@ internal BracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, Syn } /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); public override SeparatedSyntaxList Parameters { @@ -13398,7 +13398,7 @@ public override SeparatedSyntaxList Parameters } /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -13491,7 +13491,7 @@ public override SyntaxTokenList Modifiers public override TypeSyntax? Type => GetRed(ref this.type, 2); /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.ParameterSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.ParameterSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); public EqualsValueClauseSyntax? Default => GetRed(ref this.@default, 4); @@ -13756,7 +13756,7 @@ internal DocumentationCommentTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, public SyntaxList Content => new(GetRed(ref this.content, 0)); - public SyntaxToken EndOfComment => new(this, ((Syntax.InternalSyntax.DocumentationCommentTriviaSyntax)this.Green).endOfComment, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken EndOfComment => new(this, ((InternalSyntax.DocumentationCommentTriviaSyntax)this.Green).endOfComment, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.content)! : null; @@ -13866,7 +13866,7 @@ internal QualifiedCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public TypeSyntax Container => GetRedAtZero(ref this.container)!; - public SyntaxToken DotToken => new(this, ((Syntax.InternalSyntax.QualifiedCrefSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DotToken => new(this, ((InternalSyntax.QualifiedCrefSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); public MemberCrefSyntax Member => GetRed(ref this.member, 2)!; @@ -14007,7 +14007,7 @@ internal IndexerMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public SyntaxToken ThisKeyword => new(this, ((Syntax.InternalSyntax.IndexerMemberCrefSyntax)this.Green).thisKeyword, Position, 0); + public SyntaxToken ThisKeyword => new(this, ((InternalSyntax.IndexerMemberCrefSyntax)this.Green).thisKeyword, Position, 0); public CrefBracketedParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); @@ -14060,7 +14060,7 @@ internal OperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public SyntaxToken OperatorKeyword => new(this, ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); + public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); public SyntaxToken CheckedKeyword { @@ -14072,7 +14072,7 @@ public SyntaxToken CheckedKeyword } /// Gets the operator token. - public SyntaxToken OperatorToken => new(this, ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OperatorToken => new(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 3); @@ -14127,9 +14127,9 @@ internal ConversionOperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode gree { } - public SyntaxToken ImplicitOrExplicitKeyword => new(this, ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).implicitOrExplicitKeyword, Position, 0); + public SyntaxToken ImplicitOrExplicitKeyword => new(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).implicitOrExplicitKeyword, Position, 0); - public SyntaxToken OperatorKeyword => new(this, ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); public SyntaxToken CheckedKeyword { @@ -14227,7 +14227,7 @@ internal CrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo } /// Gets the open paren token. - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); public override SeparatedSyntaxList Parameters { @@ -14239,7 +14239,7 @@ public override SeparatedSyntaxList Parameters } /// Gets the close paren token. - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -14288,7 +14288,7 @@ internal CrefBracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, } /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new(this, ((Syntax.InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); + public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); public override SeparatedSyntaxList Parameters { @@ -14300,7 +14300,7 @@ public override SeparatedSyntaxList Parameters } /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new(this, ((Syntax.InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; @@ -14483,13 +14483,13 @@ internal XmlElementStartTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public SyntaxToken LessThanToken => new(this, ((Syntax.InternalSyntax.XmlElementStartTagSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken LessThanToken => new(this, ((InternalSyntax.XmlElementStartTagSyntax)this.Green).lessThanToken, Position, 0); public XmlNameSyntax Name => GetRed(ref this.name, 1)!; public SyntaxList Attributes => new(GetRed(ref this.attributes, 2)); - public SyntaxToken GreaterThanToken => new(this, ((Syntax.InternalSyntax.XmlElementStartTagSyntax)this.Green).greaterThanToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.XmlElementStartTagSyntax)this.Green).greaterThanToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -14545,11 +14545,11 @@ internal XmlElementEndTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod { } - public SyntaxToken LessThanSlashToken => new(this, ((Syntax.InternalSyntax.XmlElementEndTagSyntax)this.Green).lessThanSlashToken, Position, 0); + public SyntaxToken LessThanSlashToken => new(this, ((InternalSyntax.XmlElementEndTagSyntax)this.Green).lessThanSlashToken, Position, 0); public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public SyntaxToken GreaterThanToken => new(this, ((Syntax.InternalSyntax.XmlElementEndTagSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.XmlElementEndTagSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; @@ -14591,13 +14591,13 @@ internal XmlEmptyElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public SyntaxToken LessThanToken => new(this, ((Syntax.InternalSyntax.XmlEmptyElementSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken LessThanToken => new(this, ((InternalSyntax.XmlEmptyElementSyntax)this.Green).lessThanToken, Position, 0); public XmlNameSyntax Name => GetRed(ref this.name, 1)!; public SyntaxList Attributes => new(GetRed(ref this.attributes, 2)); - public SyntaxToken SlashGreaterThanToken => new(this, ((Syntax.InternalSyntax.XmlEmptyElementSyntax)this.Green).slashGreaterThanToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken SlashGreaterThanToken => new(this, ((InternalSyntax.XmlEmptyElementSyntax)this.Green).slashGreaterThanToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -14655,7 +14655,7 @@ internal XmlNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent public XmlPrefixSyntax? Prefix => GetRedAtZero(ref this.prefix); - public SyntaxToken LocalName => new(this, ((Syntax.InternalSyntax.XmlNameSyntax)this.Green).localName, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken LocalName => new(this, ((InternalSyntax.XmlNameSyntax)this.Green).localName, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.prefix) : null; @@ -14694,9 +14694,9 @@ internal XmlPrefixSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare { } - public SyntaxToken Prefix => new(this, ((Syntax.InternalSyntax.XmlPrefixSyntax)this.Green).prefix, Position, 0); + public SyntaxToken Prefix => new(this, ((InternalSyntax.XmlPrefixSyntax)this.Green).prefix, Position, 0); - public SyntaxToken ColonToken => new(this, ((Syntax.InternalSyntax.XmlPrefixSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ColonToken => new(this, ((InternalSyntax.XmlPrefixSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -14762,9 +14762,9 @@ internal XmlTextAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EqualsToken => new(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken StartQuoteToken => new(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken StartQuoteToken => new(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); public SyntaxTokenList TextTokens { @@ -14775,7 +14775,7 @@ public SyntaxTokenList TextTokens } } - public override SyntaxToken EndQuoteToken => new(this, ((Syntax.InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndQuoteToken => new(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; @@ -14827,13 +14827,13 @@ internal XmlCrefAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EqualsToken => new(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken StartQuoteToken => new(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken StartQuoteToken => new(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); public CrefSyntax Cref => GetRed(ref this.cref, 3)!; - public override SyntaxToken EndQuoteToken => new(this, ((Syntax.InternalSyntax.XmlCrefAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndQuoteToken => new(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -14895,13 +14895,13 @@ internal XmlNameAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EqualsToken => new(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EqualsToken => new(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken StartQuoteToken => new(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken StartQuoteToken => new(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); public IdentifierNameSyntax Identifier => GetRed(ref this.identifier, 3)!; - public override SyntaxToken EndQuoteToken => new(this, ((Syntax.InternalSyntax.XmlNameAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndQuoteToken => new(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -15006,7 +15006,7 @@ internal XmlCDataSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode { } - public SyntaxToken StartCDataToken => new(this, ((Syntax.InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); + public SyntaxToken StartCDataToken => new(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); public SyntaxTokenList TextTokens { @@ -15017,7 +15017,7 @@ public SyntaxTokenList TextTokens } } - public SyntaxToken EndCDataToken => new(this, ((Syntax.InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken EndCDataToken => new(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15060,7 +15060,7 @@ internal XmlProcessingInstructionSyntax(InternalSyntax.CSharpSyntaxNode green, S { } - public SyntaxToken StartProcessingInstructionToken => new(this, ((Syntax.InternalSyntax.XmlProcessingInstructionSyntax)this.Green).startProcessingInstructionToken, Position, 0); + public SyntaxToken StartProcessingInstructionToken => new(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).startProcessingInstructionToken, Position, 0); public XmlNameSyntax Name => GetRed(ref this.name, 1)!; @@ -15073,7 +15073,7 @@ public SyntaxTokenList TextTokens } } - public SyntaxToken EndProcessingInstructionToken => new(this, ((Syntax.InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken EndProcessingInstructionToken => new(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; @@ -15116,7 +15116,7 @@ internal XmlCommentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par { } - public SyntaxToken LessThanExclamationMinusMinusToken => new(this, ((Syntax.InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); + public SyntaxToken LessThanExclamationMinusMinusToken => new(this, ((InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); public SyntaxTokenList TextTokens { @@ -15127,7 +15127,7 @@ public SyntaxTokenList TextTokens } } - public SyntaxToken MinusMinusGreaterThanToken => new(this, ((Syntax.InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken MinusMinusGreaterThanToken => new(this, ((InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15215,13 +15215,13 @@ internal IfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken IfKeyword => new(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken IfKeyword => new(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).IsActive; @@ -15275,13 +15275,13 @@ internal ElifDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ElifKeyword => new(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).elifKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ElifKeyword => new(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).elifKeyword, GetChildPosition(1), GetChildIndex(1)); public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).IsActive; @@ -15334,11 +15334,11 @@ internal ElseDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ElseKeyword => new(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).elseKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ElseKeyword => new(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).elseKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).IsActive; @@ -15386,11 +15386,11 @@ internal EndIfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken EndIfKeyword => new(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endIfKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken EndIfKeyword => new(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endIfKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).IsActive; @@ -15435,11 +15435,11 @@ internal RegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken RegionKeyword => new(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).regionKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken RegionKeyword => new(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).regionKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).IsActive; @@ -15484,11 +15484,11 @@ internal EndRegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, S { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken EndRegionKeyword => new(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endRegionKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken EndRegionKeyword => new(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endRegionKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).IsActive; @@ -15533,11 +15533,11 @@ internal ErrorDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ErrorKeyword => new(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).errorKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ErrorKeyword => new(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).errorKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).IsActive; @@ -15582,11 +15582,11 @@ internal WarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syn { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken WarningKeyword => new(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken WarningKeyword => new(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).IsActive; @@ -15631,11 +15631,11 @@ internal BadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken Identifier => new(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Identifier => new(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).IsActive; @@ -15680,13 +15680,13 @@ internal DefineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken DefineKeyword => new(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).defineKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken DefineKeyword => new(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).defineKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken Name => new(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Name => new(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).IsActive; @@ -15732,13 +15732,13 @@ internal UndefDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synta { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken UndefKeyword => new(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).undefKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken UndefKeyword => new(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).undefKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken Name => new(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Name => new(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).IsActive; @@ -15803,11 +15803,11 @@ internal LineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override SyntaxToken LineKeyword => new(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken LineKeyword => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken Line => new(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Line => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); public override SyntaxToken File { @@ -15818,7 +15818,7 @@ public override SyntaxToken File } } - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); public override bool IsActive => ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).IsActive; @@ -15867,15 +15867,15 @@ internal LineDirectivePositionSyntax(InternalSyntax.CSharpSyntaxNode green, Synt { } - public SyntaxToken OpenParenToken => new(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).openParenToken, Position, 0); - public SyntaxToken Line => new(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).line, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Line => new(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).line, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken CommaToken => new(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).commaToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CommaToken => new(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).commaToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken Character => new(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).character, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Character => new(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).character, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken CloseParenToken => new(this, ((Syntax.InternalSyntax.LineDirectivePositionSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15919,13 +15919,13 @@ internal LineSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Sy { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override SyntaxToken LineKeyword => new(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken LineKeyword => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); public LineDirectivePositionSyntax Start => GetRed(ref this.start, 2)!; - public SyntaxToken MinusToken => new(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).minusToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken MinusToken => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).minusToken, GetChildPosition(3), GetChildIndex(3)); public LineDirectivePositionSyntax End => GetRed(ref this.end, 4)!; @@ -15938,9 +15938,9 @@ public SyntaxToken CharacterOffset } } - public override SyntaxToken File => new(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); + public override SyntaxToken File => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); public override bool IsActive => ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).IsActive; @@ -16005,13 +16005,13 @@ internal PragmaWarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode gree { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken PragmaKeyword => new(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken PragmaKeyword => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken WarningKeyword => new(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken WarningKeyword => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken DisableOrRestoreKeyword => new(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken DisableOrRestoreKeyword => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); public SeparatedSyntaxList ErrorCodes { @@ -16022,7 +16022,7 @@ public SeparatedSyntaxList ErrorCodes } } - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); public override bool IsActive => ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).IsActive; @@ -16072,19 +16072,19 @@ internal PragmaChecksumDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode gre { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken PragmaKeyword => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken PragmaKeyword => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken ChecksumKeyword => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).checksumKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ChecksumKeyword => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).checksumKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken File => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).file, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken File => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).file, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken Guid => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).guid, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken Guid => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).guid, GetChildPosition(4), GetChildIndex(4)); - public SyntaxToken Bytes => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).bytes, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken Bytes => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).bytes, GetChildPosition(5), GetChildIndex(5)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); public override bool IsActive => ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).IsActive; @@ -16133,13 +16133,13 @@ internal ReferenceDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, S { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ReferenceKeyword => new(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).referenceKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ReferenceKeyword => new(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).referenceKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken File => new(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken File => new(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).IsActive; @@ -16185,13 +16185,13 @@ internal LoadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken LoadKeyword => new(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).loadKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken LoadKeyword => new(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).loadKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken File => new(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken File => new(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); public override bool IsActive => ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).IsActive; @@ -16237,11 +16237,11 @@ internal ShebangDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syn { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ExclamationToken => new(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).exclamationToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ExclamationToken => new(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).exclamationToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); public override bool IsActive => ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).IsActive; @@ -16286,11 +16286,11 @@ internal NullableDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Sy { } - public override SyntaxToken HashToken => new(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken NullableKeyword => new(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).nullableKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken NullableKeyword => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).nullableKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken SettingToken => new(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken SettingToken => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); public SyntaxToken TargetToken { @@ -16301,7 +16301,7 @@ public SyntaxToken TargetToken } } - public override SyntaxToken EndOfDirectiveToken => new(this, ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); public override bool IsActive => ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).IsActive; diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index f27637bf4d94d..aa20290ac7329 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -958,7 +958,7 @@ private void WriteRedType(TreeType node) } else { - WriteLine($" => new(this, ((Syntax.InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)}, {GetChildPosition(i)}, {GetChildIndex(i)});"); + WriteLine($" => new(this, ((InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)}, {GetChildPosition(i)}, {GetChildIndex(i)});"); } } else if (field.Type == "SyntaxList") From bd1189e8e4f462656aad75b9dffd719c72a55cf6 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 24 Aug 2023 12:45:08 -0700 Subject: [PATCH 016/141] Simplify --- .../Syntax.xml.Syntax.Generated.cs | 48 +++++++++---------- .../CSharpSyntaxGenerator/SourceWriter.cs | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs index 2407a0ec7113b..bec4bc8582157 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs @@ -15223,11 +15223,11 @@ internal IfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public override bool IsActive => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).IsActive; - public override bool BranchTaken => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).BranchTaken; + public override bool BranchTaken => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).BranchTaken; - public override bool ConditionValue => ((Syntax.InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ConditionValue; + public override bool ConditionValue => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ConditionValue; internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; @@ -15283,11 +15283,11 @@ internal ElifDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public override bool IsActive => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).IsActive; - public override bool BranchTaken => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).BranchTaken; + public override bool BranchTaken => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).BranchTaken; - public override bool ConditionValue => ((Syntax.InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).ConditionValue; + public override bool ConditionValue => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).ConditionValue; internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; @@ -15340,9 +15340,9 @@ internal ElseDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).IsActive; - public override bool BranchTaken => ((Syntax.InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).BranchTaken; + public override bool BranchTaken => ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).BranchTaken; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15392,7 +15392,7 @@ internal EndIfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synta public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((Syntax.InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15441,7 +15441,7 @@ internal RegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((Syntax.InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15490,7 +15490,7 @@ internal EndRegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, S public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((Syntax.InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15539,7 +15539,7 @@ internal ErrorDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synta public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((Syntax.InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15588,7 +15588,7 @@ internal WarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((Syntax.InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15637,7 +15637,7 @@ internal BadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((Syntax.InternalSyntax.BadDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15688,7 +15688,7 @@ internal DefineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public override bool IsActive => ((Syntax.InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15740,7 +15740,7 @@ internal UndefDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Synta public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public override bool IsActive => ((Syntax.InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15820,7 +15820,7 @@ public override SyntaxToken File public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); - public override bool IsActive => ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15942,7 +15942,7 @@ public SyntaxToken CharacterOffset public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); - public override bool IsActive => ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -16024,7 +16024,7 @@ public SeparatedSyntaxList ErrorCodes public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); - public override bool IsActive => ((Syntax.InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.errorCodes, 4)! : null; @@ -16086,7 +16086,7 @@ internal PragmaChecksumDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode gre public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); - public override bool IsActive => ((Syntax.InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -16141,7 +16141,7 @@ internal ReferenceDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, S public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public override bool IsActive => ((Syntax.InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -16193,7 +16193,7 @@ internal LoadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public override bool IsActive => ((Syntax.InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -16243,7 +16243,7 @@ internal ShebangDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((Syntax.InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -16303,7 +16303,7 @@ public SyntaxToken TargetToken public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); - public override bool IsActive => ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).IsActive; internal override SyntaxNode? GetNodeSlot(int index) => null; diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index aa20290ac7329..f4923519516da 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -1017,7 +1017,7 @@ private void WriteRedType(TreeType node) foreach (var field in valueFields) { WriteComment(field.PropertyComment, ""); - WriteLine($"{"public"} {OverrideOrNewModifier(field)}{field.Type} {field.Name} => ((Syntax.InternalSyntax.{node.Name})this.Green).{field.Name};"); + WriteLine($"{"public"} {OverrideOrNewModifier(field)}{field.Type} {field.Name} => ((InternalSyntax.{node.Name})this.Green).{field.Name};"); WriteLine(); } From 15402cb31919a5518cfea7f036024e2c5fc0feb4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 24 Aug 2023 12:58:01 -0700 Subject: [PATCH 017/141] Simplify more --- .../Syntax.xml.Syntax.Generated.cs | 1089 ++--------------- .../CSharpSyntaxGenerator/SourceWriter.cs | 29 +- 2 files changed, 125 insertions(+), 993 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs index bec4bc8582157..89bb63e7e5015 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs @@ -206,14 +206,7 @@ internal TypeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public SyntaxToken LessThanToken => new(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. - public SeparatedSyntaxList Arguments - { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Arguments => GetRed(ref this.arguments, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// SyntaxToken representing greater than. public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); @@ -432,14 +425,7 @@ internal ArrayRankSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); - public SeparatedSyntaxList Sizes - { - get - { - var red = GetRed(ref this.sizes, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Sizes => GetRed(ref this.sizes, 1) is { } red ? new(red, GetChildIndex(1)) : default; public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); @@ -601,14 +587,7 @@ internal FunctionPointerParameterListSyntax(InternalSyntax.CSharpSyntaxNode gree public SyntaxToken LessThanToken => new(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. - public SeparatedSyntaxList Parameters - { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// SyntaxToken representing the greater than token. public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); @@ -710,14 +689,7 @@ internal FunctionPointerUnmanagedCallingConventionListSyntax(InternalSyntax.CSha public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); /// SeparatedSyntaxList of calling convention identifiers. - public SeparatedSyntaxList CallingConventions - { - get - { - var red = GetRed(ref this.callingConventions, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList CallingConventions => GetRed(ref this.callingConventions, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// SyntaxToken representing close bracket. public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); @@ -852,14 +824,7 @@ internal TupleTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare /// SyntaxToken representing the open parenthesis. public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); - public SeparatedSyntaxList Elements - { - get - { - var red = GetRed(ref this.elements, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Elements => GetRed(ref this.elements, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// SyntaxToken representing the close parenthesis. public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); @@ -910,14 +875,7 @@ internal TupleElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p public TypeSyntax Type => GetRedAtZero(ref this.type)!; /// Gets the name of the tuple element. - public SyntaxToken Identifier - { - get - { - var slot = ((InternalSyntax.TupleElementSyntax)this.Green).identifier; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken Identifier => ((InternalSyntax.TupleElementSyntax)this.Green).identifier is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; @@ -1001,14 +959,7 @@ internal RefTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent public SyntaxToken RefKeyword => new(this, ((InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); /// Gets the optional "readonly" keyword. - public SyntaxToken ReadOnlyKeyword - { - get - { - var slot = ((InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken ReadOnlyKeyword => ((InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public TypeSyntax Type => GetRed(ref this.type, 2)!; @@ -1165,14 +1116,7 @@ internal TupleExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public SeparatedSyntaxList Arguments - { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Arguments => GetRed(ref this.arguments, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// SyntaxToken representing the close parenthesis. public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); @@ -2583,14 +2527,7 @@ internal ArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override SeparatedSyntaxList Arguments - { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public override SeparatedSyntaxList Arguments => GetRed(ref this.arguments, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// SyntaxToken representing close parenthesis. public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); @@ -2643,14 +2580,7 @@ internal BracketedArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override SeparatedSyntaxList Arguments - { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public override SeparatedSyntaxList Arguments => GetRed(ref this.arguments, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// SyntaxToken representing close bracket. public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); @@ -2704,14 +2634,7 @@ internal ArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? paren public NameColonSyntax? NameColon => GetRedAtZero(ref this.nameColon); /// SyntaxToken representing the optional ref or out keyword. - public SyntaxToken RefKindKeyword - { - get - { - var slot = ((InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken RefKindKeyword => ((InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// ExpressionSyntax node representing the argument. public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; @@ -3037,14 +2960,7 @@ internal AnonymousMethodExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, { } - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(0); - return slot != null ? new(this, slot, Position, 0) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(0) is { } slot ? new(this, slot, Position, 0) : default; /// SyntaxToken representing the delegate keyword. public SyntaxToken DelegateKeyword => new(this, ((InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); @@ -3171,14 +3087,7 @@ internal SimpleLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// ParameterSyntax node representing the parameter of the lambda expression. public ParameterSyntax Parameter => GetRed(ref this.parameter, 2)!; @@ -3329,14 +3238,7 @@ internal ParenthesizedLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode gre public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public TypeSyntax? ReturnType => GetRed(ref this.returnType, 2); @@ -3451,14 +3353,7 @@ internal InitializerExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. - public SeparatedSyntaxList Expressions - { - get - { - var red = GetRed(ref this.expressions, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Expressions => GetRed(ref this.expressions, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// SyntaxToken representing the close brace. public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); @@ -3803,14 +3698,7 @@ internal AnonymousObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. - public SeparatedSyntaxList Initializers - { - get - { - var red = GetRed(ref this.initializers, 2); - return red != null ? new(red, GetChildIndex(2)) : default; - } - } + public SeparatedSyntaxList Initializers => GetRed(ref this.initializers, 2) is { } red ? new(red, GetChildIndex(2)) : default; /// SyntaxToken representing the close brace. public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); @@ -3929,14 +3817,7 @@ internal ImplicitArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode g public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. - public SyntaxTokenList Commas - { - get - { - var slot = this.Green.GetSlot(2); - return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public SyntaxTokenList Commas => this.Green.GetSlot(2) is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; /// SyntaxToken representing the close bracket. public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); @@ -4108,14 +3989,7 @@ internal CollectionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, Synta public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. - public SeparatedSyntaxList Elements - { - get - { - var red = GetRed(ref this.elements, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Elements => GetRed(ref this.elements, 1) is { } red ? new(red, GetChildIndex(1)) : default; public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); @@ -4674,14 +4548,7 @@ internal OrderByClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public SyntaxToken OrderByKeyword => new(this, ((InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); - public SeparatedSyntaxList Orderings - { - get - { - var red = GetRed(ref this.orderings, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Orderings => GetRed(ref this.orderings, 1) is { } red ? new(red, GetChildIndex(1)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.orderings, 1)! : null; @@ -4726,14 +4593,7 @@ internal OrderingSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? paren public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public SyntaxToken AscendingOrDescendingKeyword - { - get - { - var slot = ((InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken AscendingOrDescendingKeyword => ((InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; @@ -5382,14 +5242,7 @@ internal PositionalPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, Sy public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); - public SeparatedSyntaxList Subpatterns - { - get - { - var red = GetRed(ref this.subpatterns, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Subpatterns => GetRed(ref this.subpatterns, 1) is { } red ? new(red, GetChildIndex(1)) : default; public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); @@ -5436,14 +5289,7 @@ internal PropertyPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); - public SeparatedSyntaxList Subpatterns - { - get - { - var red = GetRed(ref this.subpatterns, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Subpatterns => GetRed(ref this.subpatterns, 1) is { } red ? new(red, GetChildIndex(1)) : default; public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); @@ -5815,14 +5661,7 @@ internal ListPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pa public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); - public SeparatedSyntaxList Patterns - { - get - { - var red = GetRed(ref this.patterns, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Patterns => GetRed(ref this.patterns, 1) is { } red ? new(red, GetChildIndex(1)) : default; public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); @@ -6129,14 +5968,7 @@ internal GlobalStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public StatementSyntax Statement => GetRed(ref this.statement, 2)!; @@ -6288,14 +6120,7 @@ internal LocalFunctionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; @@ -6313,14 +6138,7 @@ public SyntaxTokenList Modifiers public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 8); /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; - } - } + public SyntaxToken SemicolonToken => ((InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -6415,33 +6233,12 @@ internal LocalDeclarationStatementSyntax(InternalSyntax.CSharpSyntaxNode green, public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken AwaitKeyword - { - get - { - var slot = ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken AwaitKeyword => ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - public SyntaxToken UsingKeyword - { - get - { - var slot = ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword; - return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public SyntaxToken UsingKeyword => ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; /// Gets the modifier list. - public SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(3); - return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } - } + public SyntaxTokenList Modifiers => this.Green.GetSlot(3) is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 4)!; @@ -6510,14 +6307,7 @@ internal VariableDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public SeparatedSyntaxList Variables - { - get - { - var red = GetRed(ref this.variables, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Variables => GetRed(ref this.variables, 1) is { } red ? new(red, GetChildIndex(1)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -6764,14 +6554,7 @@ internal ParenthesizedVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); - public SeparatedSyntaxList Variables - { - get - { - var red = GetRed(ref this.variables, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Variables => GetRed(ref this.variables, 1) is { } red ? new(red, GetChildIndex(1)) : default; public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); @@ -7008,14 +6791,7 @@ internal GotoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? /// /// Gets a SyntaxToken that represents the case or default keywords if any exists. /// - public SyntaxToken CaseOrDefaultKeyword - { - get - { - var slot = ((InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword; - return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public SyntaxToken CaseOrDefaultKeyword => ((InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; /// /// Gets a constant expression for a goto case statement. @@ -7548,14 +7324,7 @@ internal ForStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? p public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 3); - public SeparatedSyntaxList Initializers - { - get - { - var red = GetRed(ref this.initializers, 4); - return red != null ? new(red, GetChildIndex(4)) : default; - } - } + public SeparatedSyntaxList Initializers => GetRed(ref this.initializers, 4) is { } red ? new(red, GetChildIndex(4)) : default; public SyntaxToken FirstSemicolonToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); @@ -7563,14 +7332,7 @@ public SeparatedSyntaxList Initializers public SyntaxToken SecondSemicolonToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); - public SeparatedSyntaxList Incrementors - { - get - { - var red = GetRed(ref this.incrementors, 8); - return red != null ? new(red, GetChildIndex(8)) : default; - } - } + public SeparatedSyntaxList Incrementors => GetRed(ref this.incrementors, 8) is { } red ? new(red, GetChildIndex(8)) : default; public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); @@ -7694,14 +7456,7 @@ internal ForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxToken AwaitKeyword - { - get - { - var slot = ((InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxToken AwaitKeyword => ((InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public override SyntaxToken ForEachKeyword => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); @@ -7798,14 +7553,7 @@ internal ForEachVariableStatementSyntax(InternalSyntax.CSharpSyntaxNode green, S public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxToken AwaitKeyword - { - get - { - var slot = ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxToken AwaitKeyword => ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public override SyntaxToken ForEachKeyword => new(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); @@ -7904,14 +7652,7 @@ internal UsingStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken AwaitKeyword - { - get - { - var slot = ((InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken AwaitKeyword => ((InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public SyntaxToken UsingKeyword => new(this, ((InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); @@ -8427,14 +8168,7 @@ internal SwitchStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode /// /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. /// - public SyntaxToken OpenParenToken - { - get - { - var slot = ((InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken; - return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public SyntaxToken OpenParenToken => ((InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; /// /// Gets an ExpressionSyntax representing the expression of the switch statement. @@ -8444,14 +8178,7 @@ public SyntaxToken OpenParenToken /// /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. /// - public SyntaxToken CloseParenToken - { - get - { - var slot = ((InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken; - return slot != null ? new(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; - } - } + public SyntaxToken CloseParenToken => ((InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken is { } slot ? new(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; /// /// Gets a SyntaxToken that represents the open braces preceding the switch sections. @@ -8791,14 +8518,7 @@ internal SwitchExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); - public SeparatedSyntaxList Arms - { - get - { - var red = GetRed(ref this.arms, 3); - return red != null ? new(red, GetChildIndex(3)) : default; - } - } + public SeparatedSyntaxList Arms => GetRed(ref this.arms, 3) is { } red ? new(red, GetChildIndex(3)) : default; public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); @@ -9069,14 +8789,7 @@ internal CatchDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public TypeSyntax Type => GetRed(ref this.type, 1)!; - public SyntaxToken Identifier - { - get - { - var slot = ((InternalSyntax.CatchDeclarationSyntax)this.Green).identifier; - return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public SyntaxToken Identifier => ((InternalSyntax.CatchDeclarationSyntax)this.Green).identifier is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); @@ -9344,34 +9057,13 @@ internal UsingDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken GlobalKeyword - { - get - { - var slot = ((InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword; - return slot != null ? new(this, slot, Position, 0) : default; - } - } + public SyntaxToken GlobalKeyword => ((InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword is { } slot ? new(this, slot, Position, 0) : default; public SyntaxToken UsingKeyword => new(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken StaticKeyword - { - get - { - var slot = ((InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword; - return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public SyntaxToken StaticKeyword => ((InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - public SyntaxToken UnsafeKeyword - { - get - { - var slot = ((InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword; - return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } - } + public SyntaxToken UnsafeKeyword => ((InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; public NameEqualsSyntax? Alias => GetRed(ref this.alias, 4); @@ -9509,14 +9201,7 @@ internal NamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Synta public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public override SyntaxToken NamespaceKeyword => new(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); @@ -9533,14 +9218,7 @@ public override SyntaxTokenList Modifiers public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; - } - } + public SyntaxToken SemicolonToken => ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -9630,14 +9308,7 @@ internal FileScopedNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode gr public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public override SyntaxToken NamespaceKeyword => new(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); @@ -9740,14 +9411,7 @@ internal AttributeListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? public AttributeTargetSpecifierSyntax? Target => GetRed(ref this.target, 1); /// Gets the attribute declaration list. - public SeparatedSyntaxList Attributes - { - get - { - var red = GetRed(ref this.attributes, 2); - return red != null ? new(red, GetChildIndex(2)) : default; - } - } + public SeparatedSyntaxList Attributes => GetRed(ref this.attributes, 2) is { } red ? new(red, GetChildIndex(2)) : default; /// Gets the close bracket token. public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); @@ -9918,14 +9582,7 @@ internal AttributeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); /// Gets the arguments syntax list. - public SeparatedSyntaxList Arguments - { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Arguments => GetRed(ref this.arguments, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// Gets the close paren token. public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); @@ -10083,14 +9740,7 @@ internal TypeParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo public SyntaxToken LessThanToken => new(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); /// Gets the parameter list. - public SeparatedSyntaxList Parameters - { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// Gets the > token. public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); @@ -10140,14 +9790,7 @@ internal TypeParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? /// Gets the attribute declaration list. public SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public SyntaxToken VarianceKeyword - { - get - { - var slot = ((InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken VarianceKeyword => ((InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the identifier. public SyntaxToken Identifier => new(this, ((InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); @@ -10297,14 +9940,7 @@ internal ClassDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the class keyword token. public override SyntaxToken Keyword => new(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); @@ -10319,34 +9955,13 @@ public override SyntaxTokenList Modifiers public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } + public override SyntaxToken OpenBraceToken => ((InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; public override SyntaxList Members => new(GetRed(ref this.members, 9)); - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } + public override SyntaxToken CloseBraceToken => ((InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } - } + public override SyntaxToken SemicolonToken => ((InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -10463,14 +10078,7 @@ internal StructDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the struct keyword token. public override SyntaxToken Keyword => new(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); @@ -10485,34 +10093,13 @@ public override SyntaxTokenList Modifiers public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } + public override SyntaxToken OpenBraceToken => ((InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; public override SyntaxList Members => new(GetRed(ref this.members, 9)); - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } + public override SyntaxToken CloseBraceToken => ((InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } - } + public override SyntaxToken SemicolonToken => ((InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -10629,14 +10216,7 @@ internal InterfaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Synta public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the interface keyword token. public override SyntaxToken Keyword => new(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); @@ -10651,34 +10231,13 @@ public override SyntaxTokenList Modifiers public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } + public override SyntaxToken OpenBraceToken => ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; public override SyntaxList Members => new(GetRed(ref this.members, 9)); - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } + public override SyntaxToken CloseBraceToken => ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } - } + public override SyntaxToken SemicolonToken => ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -10795,25 +10354,11 @@ internal RecordDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public override SyntaxToken Keyword => new(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken ClassOrStructKeyword - { - get - { - var slot = ((InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword; - return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } - } + public SyntaxToken ClassOrStructKeyword => ((InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; public override SyntaxToken Identifier => new(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); @@ -10825,34 +10370,13 @@ public SyntaxToken ClassOrStructKeyword public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 8)); - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; - } - } + public override SyntaxToken OpenBraceToken => ((InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken is { } slot ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; public override SyntaxList Members => new(GetRed(ref this.members, 10)); - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } - } + public override SyntaxToken CloseBraceToken => ((InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken is { } slot ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; - } - } + public override SyntaxToken SemicolonToken => ((InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -10967,14 +10491,7 @@ internal EnumDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the enum keyword token. public SyntaxToken EnumKeyword => new(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); @@ -10983,43 +10500,15 @@ public override SyntaxTokenList Modifiers public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 4); - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } + public override SyntaxToken OpenBraceToken => ((InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken is { } slot ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; /// Gets the members declaration list. - public SeparatedSyntaxList Members - { - get - { - var red = GetRed(ref this.members, 6); - return red != null ? new(red, GetChildIndex(6)) : default; - } - } + public SeparatedSyntaxList Members => GetRed(ref this.members, 6) is { } red ? new(red, GetChildIndex(6)) : default; - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } - } + public override SyntaxToken CloseBraceToken => ((InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken is { } slot ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } + public override SyntaxToken SemicolonToken => ((InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -11106,14 +10595,7 @@ internal DelegateDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the "delegate" keyword. public SyntaxToken DelegateKeyword => new(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); @@ -11215,14 +10697,7 @@ internal EnumMemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the identifier. public SyntaxToken Identifier => new(this, ((InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); @@ -11293,14 +10768,7 @@ internal BaseListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? paren public SyntaxToken ColonToken => new(this, ((InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); /// Gets the base type references. - public SeparatedSyntaxList Types - { - get - { - var red = GetRed(ref this.types, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public SeparatedSyntaxList Types => GetRed(ref this.types, 1) is { } red ? new(red, GetChildIndex(1)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.types, 1)! : null; @@ -11464,14 +10932,7 @@ internal TypeParameterConstraintClauseSyntax(InternalSyntax.CSharpSyntaxNode gre public SyntaxToken ColonToken => new(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); /// Gets the constraints list. - public SeparatedSyntaxList Constraints - { - get - { - var red = GetRed(ref this.constraints, 3); - return red != null ? new(red, GetChildIndex(3)) : default; - } - } + public SeparatedSyntaxList Constraints => GetRed(ref this.constraints, 3) is { } red ? new(red, GetChildIndex(3)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -11589,14 +11050,7 @@ internal ClassOrStructConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, Sy public SyntaxToken ClassOrStructKeyword => new(this, ((InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken - { - get - { - var slot = ((InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken QuestionToken => ((InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -11746,14 +11200,7 @@ internal FieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 2)!; @@ -11825,14 +11272,7 @@ internal EventFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public SyntaxToken EventKeyword => new(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); @@ -11999,14 +11439,7 @@ internal MethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the return type syntax. public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; @@ -12028,14 +11461,7 @@ public override SyntaxTokenList Modifiers public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } + public override SyntaxToken SemicolonToken => ((InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -12147,14 +11573,7 @@ internal OperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the return type. public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; @@ -12165,14 +11584,7 @@ public override SyntaxTokenList Modifiers public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); /// Gets the "checked" keyword. - public SyntaxToken CheckedKeyword - { - get - { - var slot = ((InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword; - return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } + public SyntaxToken CheckedKeyword => ((InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword is { } slot ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; /// Gets the operator token. public SyntaxToken OperatorToken => new(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); @@ -12184,14 +11596,7 @@ public SyntaxToken CheckedKeyword public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } + public override SyntaxToken SemicolonToken => ((InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -12293,14 +11698,7 @@ internal ConversionOperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode gre public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the "implicit" or "explicit" token. public SyntaxToken ImplicitOrExplicitKeyword => new(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); @@ -12311,14 +11709,7 @@ public override SyntaxTokenList Modifiers public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); /// Gets the "checked" keyword. - public SyntaxToken CheckedKeyword - { - get - { - var slot = ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword; - return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } + public SyntaxToken CheckedKeyword => ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword is { } slot ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; /// Gets the type. public TypeSyntax Type => GetRed(ref this.type, 6)!; @@ -12330,14 +11721,7 @@ public SyntaxToken CheckedKeyword public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } + public override SyntaxToken SemicolonToken => ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -12438,14 +11822,7 @@ internal ConstructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syn public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the identifier. public SyntaxToken Identifier => new(this, ((InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); @@ -12459,14 +11836,7 @@ public override SyntaxTokenList Modifiers public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } - } + public override SyntaxToken SemicolonToken => ((InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -12612,14 +11982,7 @@ internal DestructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Synt public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the tilde token. public SyntaxToken TildeToken => new(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); @@ -12634,14 +11997,7 @@ public override SyntaxTokenList Modifiers public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } - } + public override SyntaxToken SemicolonToken => ((InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -12768,14 +12124,7 @@ internal PropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public override TypeSyntax Type => GetRed(ref this.type, 2)!; @@ -12790,14 +12139,7 @@ public override SyntaxTokenList Modifiers public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 7); - public SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } + public SyntaxToken SemicolonToken => ((InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -12928,14 +12270,7 @@ internal EventDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public SyntaxToken EventKeyword => new(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); @@ -12948,14 +12283,7 @@ public override SyntaxTokenList Modifiers public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); - public SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } - } + public SyntaxToken SemicolonToken => ((InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -13040,14 +12368,7 @@ internal IndexerDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public override TypeSyntax Type => GetRed(ref this.type, 2)!; @@ -13062,14 +12383,7 @@ public override SyntaxTokenList Modifiers public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 7); - public SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } + public SyntaxToken SemicolonToken => ((InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -13211,14 +12525,7 @@ internal AccessorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// Gets the modifier list. - public SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the keyword token, or identifier if an erroneous accessor declaration. public SyntaxToken Keyword => new(this, ((InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); @@ -13230,14 +12537,7 @@ public SyntaxTokenList Modifiers public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken - { - get - { - var slot = ((InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } + public SyntaxToken SemicolonToken => ((InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; internal override SyntaxNode? GetNodeSlot(int index) => index switch @@ -13329,14 +12629,7 @@ internal ParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? /// Gets the open paren token. public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); - public override SeparatedSyntaxList Parameters - { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public override SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// Gets the close paren token. public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); @@ -13388,14 +12681,7 @@ internal BracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, Syn /// Gets the open bracket token. public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); - public override SeparatedSyntaxList Parameters - { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public override SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// Gets the close bracket token. public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); @@ -13479,14 +12765,7 @@ internal ParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? pare public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// Gets the modifier list. - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public override TypeSyntax? Type => GetRed(ref this.type, 2); @@ -13564,14 +12843,7 @@ internal FunctionPointerParameterSyntax(InternalSyntax.CSharpSyntaxNode green, S public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); /// Gets the modifier list. - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public override TypeSyntax Type => GetRed(ref this.type, 2)!; @@ -13637,14 +12909,7 @@ internal IncompleteMemberSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public TypeSyntax? Type => GetRed(ref this.type, 2); @@ -13705,14 +12970,7 @@ internal SkippedTokensTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax { } - public SyntaxTokenList Tokens - { - get - { - var slot = this.Green.GetSlot(0); - return slot != null ? new(this, slot, Position, 0) : default; - } - } + public SyntaxTokenList Tokens => this.Green.GetSlot(0) is { } slot ? new(this, slot, Position, 0) : default; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -14062,14 +13320,7 @@ internal OperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxN public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); - public SyntaxToken CheckedKeyword - { - get - { - var slot = ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken CheckedKeyword => ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; /// Gets the operator token. public SyntaxToken OperatorToken => new(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); @@ -14131,14 +13382,7 @@ internal ConversionOperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode gree public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken CheckedKeyword - { - get - { - var slot = ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword; - return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public SyntaxToken CheckedKeyword => ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; public TypeSyntax Type => GetRed(ref this.type, 3)!; @@ -14229,14 +13473,7 @@ internal CrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNo /// Gets the open paren token. public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); - public override SeparatedSyntaxList Parameters - { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public override SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// Gets the close paren token. public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); @@ -14290,14 +13527,7 @@ internal CrefBracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, /// Gets the open bracket token. public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); - public override SeparatedSyntaxList Parameters - { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new(red, GetChildIndex(1)) : default; - } - } + public override SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; /// Gets the close bracket token. public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); @@ -14351,23 +13581,9 @@ internal CrefParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? { } - public SyntaxToken RefKindKeyword - { - get - { - var slot = ((InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword; - return slot != null ? new(this, slot, Position, 0) : default; - } - } + public SyntaxToken RefKindKeyword => ((InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword is { } slot ? new(this, slot, Position, 0) : default; - public SyntaxToken ReadOnlyKeyword - { - get - { - var slot = ((InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword; - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken ReadOnlyKeyword => ((InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public TypeSyntax Type => GetRed(ref this.type, 2)!; @@ -14766,14 +13982,7 @@ internal XmlTextAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNod public override SyntaxToken StartQuoteToken => new(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(3); - return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } - } + public SyntaxTokenList TextTokens => this.Green.GetSlot(3) is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; public override SyntaxToken EndQuoteToken => new(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); @@ -14959,14 +14168,7 @@ internal XmlTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent { } - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(0); - return slot != null ? new(this, slot, Position, 0) : default; - } - } + public SyntaxTokenList TextTokens => this.Green.GetSlot(0) is { } slot ? new(this, slot, Position, 0) : default; internal override SyntaxNode? GetNodeSlot(int index) => null; @@ -15008,14 +14210,7 @@ internal XmlCDataSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode public SyntaxToken StartCDataToken => new(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxTokenList TextTokens => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public SyntaxToken EndCDataToken => new(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); @@ -15064,14 +14259,7 @@ internal XmlProcessingInstructionSyntax(InternalSyntax.CSharpSyntaxNode green, S public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(2); - return slot != null ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public SyntaxTokenList TextTokens => this.Green.GetSlot(2) is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; public SyntaxToken EndProcessingInstructionToken => new(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); @@ -15118,14 +14306,7 @@ internal XmlCommentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? par public SyntaxToken LessThanExclamationMinusMinusToken => new(this, ((InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxTokenList TextTokens => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; public SyntaxToken MinusMinusGreaterThanToken => new(this, ((InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); @@ -15809,14 +14990,7 @@ internal LineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Syntax public SyntaxToken Line => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken File - { - get - { - var slot = ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file; - return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } - } + public override SyntaxToken File => ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); @@ -15929,14 +15103,7 @@ internal LineSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Sy public LineDirectivePositionSyntax End => GetRed(ref this.end, 4)!; - public SyntaxToken CharacterOffset - { - get - { - var slot = ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset; - return slot != null ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } + public SyntaxToken CharacterOffset => ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset is { } slot ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; public override SyntaxToken File => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); @@ -16013,14 +15180,7 @@ internal PragmaWarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode gree public SyntaxToken DisableOrRestoreKeyword => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); - public SeparatedSyntaxList ErrorCodes - { - get - { - var red = GetRed(ref this.errorCodes, 4); - return red != null ? new(red, GetChildIndex(4)) : default; - } - } + public SeparatedSyntaxList ErrorCodes => GetRed(ref this.errorCodes, 4) is { } red ? new(red, GetChildIndex(4)) : default; public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); @@ -16292,14 +15452,7 @@ internal NullableDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, Sy public SyntaxToken SettingToken => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken TargetToken - { - get - { - var slot = ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken; - return slot != null ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } - } + public SyntaxToken TargetToken => ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index f4923519516da..6ee45cd1695c4 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -947,14 +947,7 @@ private void WriteRedType(TreeType node) Write($"public {OverrideOrNewModifier(field)}{GetRedPropertyType(field)} {field.Name}"); if (IsOptional(field)) { - WriteLine(); - OpenBlock(); - WriteLine("get"); - OpenBlock(); - WriteLine($"var slot = ((InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)};"); - WriteLine($"return slot != null ? new(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); - CloseBlock(); - CloseBlock(); + WriteLine($" => ((InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)} is {{ }} slot ? new(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); } else { @@ -964,14 +957,8 @@ private void WriteRedType(TreeType node) else if (field.Type == "SyntaxList") { WriteComment(field.PropertyComment, ""); - WriteLine($"public {OverrideOrNewModifier(field)}SyntaxTokenList {field.Name}"); - OpenBlock(); - WriteLine("get"); - OpenBlock(); - WriteLine($"var slot = this.Green.GetSlot({i});"); - WriteLine($"return slot != null ? new(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); - CloseBlock(); - CloseBlock(); + Write($"public {OverrideOrNewModifier(field)}SyntaxTokenList {field.Name} => "); + WriteLine($"this.Green.GetSlot({i}) is {{ }} slot ? new(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); } else { @@ -984,15 +971,7 @@ private void WriteRedType(TreeType node) } else if (IsSeparatedNodeList(field.Type)) { - WriteLine(); - OpenBlock(); - WriteLine("get"); - OpenBlock(); - - WriteLine($"var red = GetRed(ref this.{CamelCase(field.Name)}, {i});"); - WriteLine($"return red != null ? new(red, {GetChildIndex(i)}) : default;"); - CloseBlock(); - CloseBlock(); + WriteLine($" => GetRed(ref this.{CamelCase(field.Name)}, {i}) is {{ }} red ? new(red, {GetChildIndex(i)}) : default;"); } else if (field.Type == "SyntaxNodeOrTokenList") { From f94fc84fac87deee9c8fd26ccc3a2ac7683c5568 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Tue, 29 Aug 2023 12:14:04 -0700 Subject: [PATCH 018/141] Bump Nuget version in response to SDK bump --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 4a6f2ffaba19b..33301ff0056ec 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -207,7 +207,7 @@ is expected by the NET SDK used in the Workspace.MSBuild UnitTests. In order to test against the same verion of NuGet as our configured SDK, we must set the version to be the same. --> - 6.4.0-preview.1.54 + 6.4.0-rc.123 $(NuGetCommonVersion) $(NuGetCommonVersion) $(NuGetCommonVersion) From e27aacdf53e3dac8e33368c502a1dc7971f6cc77 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Tue, 29 Aug 2023 15:29:17 -0700 Subject: [PATCH 019/141] Use new queue for osx --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2d4c29d45233a..0a5de5377fdf8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -173,7 +173,7 @@ jobs: buildJobName: Build_Unix_Debug testArtifactName: Transport_Artifacts_Unix_Debug configuration: Debug - testArguments: --testCoreClr --helixQueueName OSX.1015.Amd64.Open + testArguments: --testCoreClr --helixQueueName OSX.13.Amd64.Open - template: eng/common/templates/jobs/source-build.yml From 960c788656e15e7dc5d70cbe5f053f4467d65ba0 Mon Sep 17 00:00:00 2001 From: Gen Lu Date: Thu, 2 Nov 2023 12:51:05 -0700 Subject: [PATCH 020/141] Update NuGet-packages.md for 17.8 --- docs/wiki/NuGet-packages.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/wiki/NuGet-packages.md b/docs/wiki/NuGet-packages.md index 59047efc31c12..7d678b0a71f87 100644 --- a/docs/wiki/NuGet-packages.md +++ b/docs/wiki/NuGet-packages.md @@ -45,7 +45,8 @@ Below are the versions of the language available in the NuGet packages. Remember - Version `4.4` includes C# 11.0 (Visual Studio 2022 version 17.4, .NET 7) - Version `4.5` includes C# 11.0 (Visual Studio 2022 version 17.5, .NET 7) - Version `4.6` includes C# 11.0 (Visual Studio 2022 version 17.6, .NET 7) -- Version '4.7' includes C# 11.0 (Visual Studio 2022 version 17.7, .NET 7) +- Version `4.7` includes C# 11.0 (Visual Studio 2022 version 17.7, .NET 7) +- Version `4.8` includes C# 11.0 (Visual Studio 2022 version 17.8, .NET 7) See the [history of C# language features](https://github.com/dotnet/csharplang/blob/main/Language-Version-History.md) for more details. From 3259f05f9b4cbfa3d57daff705091258a8e3ce1c Mon Sep 17 00:00:00 2001 From: Gen Lu Date: Thu, 2 Nov 2023 12:54:43 -0700 Subject: [PATCH 021/141] Update NuGet-packages.md --- docs/wiki/NuGet-packages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/wiki/NuGet-packages.md b/docs/wiki/NuGet-packages.md index 7d678b0a71f87..44296c77aaa20 100644 --- a/docs/wiki/NuGet-packages.md +++ b/docs/wiki/NuGet-packages.md @@ -46,7 +46,7 @@ Below are the versions of the language available in the NuGet packages. Remember - Version `4.5` includes C# 11.0 (Visual Studio 2022 version 17.5, .NET 7) - Version `4.6` includes C# 11.0 (Visual Studio 2022 version 17.6, .NET 7) - Version `4.7` includes C# 11.0 (Visual Studio 2022 version 17.7, .NET 7) -- Version `4.8` includes C# 11.0 (Visual Studio 2022 version 17.8, .NET 7) +- Version `4.8` includes C# 12.0 (Visual Studio 2022 version 17.8, .NET 7) See the [history of C# language features](https://github.com/dotnet/csharplang/blob/main/Language-Version-History.md) for more details. From 821420b2e4e7338fab08683a4705d487c48464d1 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 9 Nov 2023 16:53:05 +1100 Subject: [PATCH 022/141] Create a Razor language server cohosted in Roslyn --- .../AbstractInProcLanguageClient.cs | 4 +- .../Protocol/WellKnownLspServerKinds.cs | 9 +++ .../Cohost/AbstractRazorRequestHandler.cs | 78 ++++++++++++++++++ .../ExternalAccess/Razor/Cohost/Constants.cs | 16 ++++ .../ExportRazorLspServiceFactoryAttribute.cs | 14 ++++ ...ExportRazorStatelessLspServiceAttribute.cs | 14 ++++ .../IRazorCohostCapabilitiesProvider.cs | 10 +++ ...orCohostLanguageClientActivationService.cs | 13 +++ .../Razor/Cohost/IRazorCustomMessageTarget.cs | 9 +++ .../Razor/Cohost/RazorCohostLanguageClient.cs | 80 +++++++++++++++++++ .../Razor/Cohost/RazorLspServiceProvider.cs | 21 +++++ .../Cohost/RazorLspWorkspaceManagerFactory.cs | 17 ++++ .../RazorRequestExecutionQueueProvider.cs | 25 ++++++ .../RazorRequestTelemetryLoggerFactory.cs | 17 ++++ .../Razor/InternalAPI.Unshipped.txt | 70 ++++++++++++++++ ...t.CodeAnalysis.ExternalAccess.Razor.csproj | 7 +- 16 files changed, 400 insertions(+), 4 deletions(-) create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/Constants.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/ExportRazorLspServiceFactoryAttribute.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/ExportRazorStatelessLspServiceAttribute.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostCapabilitiesProvider.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/IRazorCustomMessageTarget.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorLspServiceProvider.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorLspWorkspaceManagerFactory.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorRequestExecutionQueueProvider.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorRequestTelemetryLoggerFactory.cs diff --git a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs index db996d5b5f6df..7ec935749848d 100644 --- a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs @@ -64,7 +64,7 @@ internal abstract partial class AbstractInProcLanguageClient( /// Unused, implementing . /// Gets the optional target object for receiving custom messages not covered by the language server protocol. /// - public object? CustomMessageTarget => null; + public virtual object? CustomMessageTarget => null; /// /// An enum representing this server instance. @@ -107,7 +107,7 @@ internal abstract partial class AbstractInProcLanguageClient( /// public event AsyncEventHandler? StopAsync { add { } remove { } } - public async Task ActivateAsync(CancellationToken cancellationToken) + public virtual async Task ActivateAsync(CancellationToken cancellationToken) { // HACK HACK HACK: prevent potential crashes/state corruption during load. Fixes // https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1261421 diff --git a/src/Features/LanguageServer/Protocol/WellKnownLspServerKinds.cs b/src/Features/LanguageServer/Protocol/WellKnownLspServerKinds.cs index a99f84b743393..60a418301f69a 100644 --- a/src/Features/LanguageServer/Protocol/WellKnownLspServerKinds.cs +++ b/src/Features/LanguageServer/Protocol/WellKnownLspServerKinds.cs @@ -8,6 +8,11 @@ namespace Microsoft.CodeAnalysis.LanguageServer; internal enum WellKnownLspServerKinds { + /// + /// Razor LSP server for Razor document requests (.razor and .cshtml files) + /// + RazorCohostServer, + /// /// Roslyn LSP server for razor c# requests. /// @@ -52,6 +57,7 @@ public static string ToUserVisibleString(this WellKnownLspServerKinds server) { return server switch { + WellKnownLspServerKinds.RazorCohostServer => "Razor Cohost Language Server Client", WellKnownLspServerKinds.RazorLspServer => "Razor C# Language Server Client", WellKnownLspServerKinds.LiveShareLspServer => "Live Share C#/Visual Basic Language Server Client", WellKnownLspServerKinds.AlwaysActiveVSLspServer => "Roslyn Language Server Client", @@ -69,6 +75,8 @@ public static string ToTelemetryString(this WellKnownLspServerKinds server) { return server switch { + WellKnownLspServerKinds.RazorCohostServer => "RazorCohostLanguageClient", + // Telemetry was previously reported as RazorInProcLanguageClient.GetType().Name WellKnownLspServerKinds.RazorLspServer => "RazorInProcLanguageClient", @@ -96,6 +104,7 @@ public static string GetContractName(this WellKnownLspServerKinds server) { return server switch { + WellKnownLspServerKinds.RazorCohostServer => "RazorLanguageServer", WellKnownLspServerKinds.RazorLspServer => ProtocolConstants.RoslynLspLanguagesContract, WellKnownLspServerKinds.LiveShareLspServer => ProtocolConstants.RoslynLspLanguagesContract, WellKnownLspServerKinds.AlwaysActiveVSLspServer => ProtocolConstants.RoslynLspLanguagesContract, diff --git a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs new file mode 100644 index 0000000000000..acf63888fcaf0 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.LanguageServer.Handler; +using Microsoft.CommonLanguageServerProtocol.Framework; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +internal abstract class AbstractRazorCohostRequestHandler : ILspServiceRequestHandler +{ + bool IMethodHandler.MutatesSolutionState => MutatesSolutionState; + + bool ISolutionRequiredHandler.RequiresLSPSolution => RequiresLSPSolution; + + Task IRequestHandler.HandleRequestAsync(TRequestType request, RequestContext context, CancellationToken cancellationToken) + { + // We have to wrap the RequestContext in order to expose it to Roslyn. We could create our own (by exporting + // and IRequestContextFactory) but that would not be possible if/when we live in the same server as Roslyn + // so may as well deal with it now. + // This does mean we can't nicely pass through the original Uri, which would have ProjectContext info, but + // we get the Project so that will have to do. + + var razorRequestContext = new RazorCohostRequestContext( + context.Method, + context.TextDocument?.GetURI(), + context.Solution, + context.TextDocument); + return HandleRequestAsync(request, razorRequestContext, cancellationToken); + } + + protected abstract bool MutatesSolutionState { get; } + + protected abstract bool RequiresLSPSolution { get; } + + protected abstract Task HandleRequestAsync(TRequestType request, RazorCohostRequestContext context, CancellationToken cancellationToken); +} + +internal abstract class AbstractRazorCohostDocumentRequestHandler : AbstractRazorCohostRequestHandler, ITextDocumentIdentifierHandler +{ + TextDocumentIdentifier? ITextDocumentIdentifierHandler.GetTextDocumentIdentifier(TRequestType request) + { + var razorIdentifier = GetRazorTextDocumentIdentifier(request); + if (razorIdentifier == null) + { + return null; + } + + var textDocumentIdentifier = new VSTextDocumentIdentifier + { + Uri = razorIdentifier.Value.Uri, + }; + + if (razorIdentifier.Value.ProjectContextId != null) + { + textDocumentIdentifier.ProjectContext = new VSProjectContext + { + Id = razorIdentifier.Value.ProjectContextId + }; + } + + return textDocumentIdentifier; + } + + protected abstract RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(TRequestType request); +} + +internal record struct RazorCohostRequestContext(string Method, Uri? Uri, Solution? Solution, TextDocument? TextDocument); + +/// +/// Custom type containing information in a to avoid coupling LSP protocol versions. +/// +internal record struct RazorTextDocumentIdentifier(Uri Uri, string? ProjectContextId); diff --git a/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs b/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs new file mode 100644 index 0000000000000..bbcb0e23397f8 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +internal static class Constants +{ + public const string RazorLSPContentType = "Razor"; + + public const string RazorLanguageContract = "RazorLanguageServer"; + + public static readonly ImmutableArray RazorLanguage = ImmutableArray.Create("Razor"); +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorLspServiceFactoryAttribute.cs b/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorLspServiceFactoryAttribute.cs new file mode 100644 index 0000000000000..8c23bcce2509c --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorLspServiceFactoryAttribute.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.LanguageServer; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[AttributeUsage(AttributeTargets.Class), MetadataAttribute] +internal class ExportRazorLspServiceFactoryAttribute(Type handlerType) : ExportLspServiceFactoryAttribute(handlerType, Constants.RazorLanguageContract, WellKnownLspServerKinds.RazorCohostServer) +{ +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorStatelessLspServiceAttribute.cs b/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorStatelessLspServiceAttribute.cs new file mode 100644 index 0000000000000..3728932cce877 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/ExportRazorStatelessLspServiceAttribute.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.LanguageServer; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[AttributeUsage(AttributeTargets.Class), MetadataAttribute] +internal class ExportRazorStatelessLspServiceAttribute(Type handlerType) : ExportStatelessLspServiceAttribute(handlerType, Constants.RazorLanguageContract, WellKnownLspServerKinds.RazorCohostServer) +{ +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostCapabilitiesProvider.cs b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostCapabilitiesProvider.cs new file mode 100644 index 0000000000000..1679c16c61651 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostCapabilitiesProvider.cs @@ -0,0 +1,10 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +internal interface IRazorCohostCapabilitiesProvider +{ + string GetCapabilities(string clientCapabilities); +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs new file mode 100644 index 0000000000000..4b1a3fc34067e --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +internal interface IRazorCohostLanguageClientActivationService +{ + /// + /// Returns whether the Razor cohost server should activate + /// + bool ShouldActivateCohostServer(); +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCustomMessageTarget.cs b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCustomMessageTarget.cs new file mode 100644 index 0000000000000..28e11a4a5cad4 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCustomMessageTarget.cs @@ -0,0 +1,9 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +internal interface IRazorCustomMessageTarget +{ +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs new file mode 100644 index 0000000000000..695ea6a82b1a9 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs @@ -0,0 +1,80 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Immutable; +using System.ComponentModel.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.Options; +using Microsoft.VisualStudio.Composition; +using Microsoft.VisualStudio.LanguageServer.Client; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Utilities; +using Newtonsoft.Json; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +/// +/// A language server that handles requests .razor and .cshtml files. Endpoints and required services are supplied +/// by the Razor tooling team in the Razor tooling repo. +/// +[ContentType(Constants.RazorLSPContentType)] +[Export(typeof(ILanguageClient))] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class RazorCohostLanguageClient( + RazorLspServiceProvider lspServiceProvider, + IGlobalOptionService globalOptions, + IThreadingContext threadingContext, + ILspServiceLoggerFactory lspLoggerFactory, + ExportProvider exportProvider, + [Import(AllowDefault = true)] IRazorCohostCapabilitiesProvider? razorCapabilitiesProvider = null, + [Import(AllowDefault = true)] IRazorCustomMessageTarget? razorCustomMessageTarget = null, + [Import(AllowDefault = true)] IRazorCohostLanguageClientActivationService? razorCohostLanguageClientActivationService = null) + : AbstractInProcLanguageClient(lspServiceProvider, globalOptions, lspLoggerFactory, threadingContext, exportProvider, middleLayer: null) +{ + private readonly IRazorCohostLanguageClientActivationService? _razorCohostLanguageClientActivationService = razorCohostLanguageClientActivationService; + private readonly IRazorCohostCapabilitiesProvider? _razorCapabilitiesProvider = razorCapabilitiesProvider; + private readonly IRazorCustomMessageTarget? _razorCustomMessageTarget = razorCustomMessageTarget; + + protected override ImmutableArray SupportedLanguages => Constants.RazorLanguage; + + public override object? CustomMessageTarget => _razorCustomMessageTarget; + + public override Task ActivateAsync(CancellationToken cancellationToken) + { + if (_razorCohostLanguageClientActivationService?.ShouldActivateCohostServer() == true) + { + return base.ActivateAsync(cancellationToken); + } + + return Task.FromResult(null); + } + + public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapabilities) + { + Contract.ThrowIfNull(_razorCapabilitiesProvider); + + // We use a string to pass capabilities to/from Razor to avoid version issues with the Protocol DLL + var serializedClientCapabilities = JsonConvert.SerializeObject(clientCapabilities); + var serializedServerCapabilities = _razorCapabilitiesProvider.GetCapabilities(serializedClientCapabilities); + var razorCapabilities = JsonConvert.DeserializeObject(serializedServerCapabilities); + Contract.ThrowIfNull(razorCapabilities); + + return razorCapabilities; + } + + /// + /// If the cohost server is expected to activate then any failures are catastrophic as no razor features will work. + /// + public override bool ShowNotificationOnInitializeFailed => _razorCohostLanguageClientActivationService?.ShouldActivateCohostServer() == true; + + public override WellKnownLspServerKinds ServerKind => WellKnownLspServerKinds.RazorCohostServer; +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorLspServiceProvider.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorLspServiceProvider.cs new file mode 100644 index 0000000000000..dcf4b2487dab8 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorLspServiceProvider.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Composition; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[Export(typeof(RazorLspServiceProvider)), Shared] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class RazorLspServiceProvider( + [ImportMany(Constants.RazorLanguageContract)] IEnumerable> lspServices, + [ImportMany(Constants.RazorLanguageContract)] IEnumerable> lspServiceFactories) + : AbstractLspServiceProvider(lspServices, lspServiceFactories) +{ +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorLspWorkspaceManagerFactory.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorLspWorkspaceManagerFactory.cs new file mode 100644 index 0000000000000..2f74e31c45fca --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorLspWorkspaceManagerFactory.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[ExportRazorLspServiceFactory(typeof(LspWorkspaceManager)), Shared] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class RazorLspWorkspaceManagerFactory(LspWorkspaceRegistrationService lspWorkspaceRegistrationService) : LspWorkspaceManagerFactory(lspWorkspaceRegistrationService) +{ +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorRequestExecutionQueueProvider.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorRequestExecutionQueueProvider.cs new file mode 100644 index 0000000000000..5d3e8fb4bb23e --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorRequestExecutionQueueProvider.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.LanguageServer.Handler; +using Microsoft.CommonLanguageServerProtocol.Framework; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[ExportRazorStatelessLspService(typeof(IRequestExecutionQueueProvider)), Shared] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class RazorRequestExecutionQueueProvider() : IRequestExecutionQueueProvider +{ + public IRequestExecutionQueue CreateRequestExecutionQueue(AbstractLanguageServer languageServer, ILspLogger logger, IHandlerProvider handlerProvider) + { + var queue = new RoslynRequestExecutionQueue(languageServer, logger, handlerProvider); + queue.Start(); + return queue; + } +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorRequestTelemetryLoggerFactory.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorRequestTelemetryLoggerFactory.cs new file mode 100644 index 0000000000000..9c761d6da9ef6 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorRequestTelemetryLoggerFactory.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer.Handler; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[ExportRazorLspServiceFactory(typeof(RequestTelemetryLogger)), Shared] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal class RazorRequestTelemetryLoggerFactory() : RequestTelemetryLoggerFactory() +{ +} diff --git a/src/Tools/ExternalAccess/Razor/InternalAPI.Unshipped.txt b/src/Tools/ExternalAccess/Razor/InternalAPI.Unshipped.txt index 4bb4838af1d96..6abc8c4b57eeb 100644 --- a/src/Tools/ExternalAccess/Razor/InternalAPI.Unshipped.txt +++ b/src/Tools/ExternalAccess/Razor/InternalAPI.Unshipped.txt @@ -1,4 +1,58 @@ #nullable enable +abstract Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.AbstractRazorCohostDocumentRequestHandler.GetRazorTextDocumentIdentifier(TRequestType request) -> Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier? +abstract Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.AbstractRazorCohostDocumentRequestHandler.GetRazorTextDocumentIdentifier(TRequestType request) -> Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier? +abstract Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.AbstractCohostRazorRequestHandler.HandleRequestAsync(TRequestType request, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext context, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +abstract Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.AbstractCohostRazorRequestHandler.MutatesSolutionState.get -> bool +abstract Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.AbstractCohostRazorRequestHandler.RequiresLSPSolution.get -> bool +const Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.Constants.RazorLanguageContract = "RazorLanguageServer" -> string! +const Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.Constants.RazorLSPContentType = "Razor" -> string! +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.AbstractRazorCohostDocumentRequestHandler +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.AbstractRazorCohostDocumentRequestHandler.AbstractRazorCohostDocumentRequestHandler() -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.AbstractCohostRazorRequestHandler +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.AbstractCohostRazorRequestHandler.AbstractCohostRazorRequestHandler() -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.Constants +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.ExportRazorLspServiceFactoryAttribute +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.ExportRazorLspServiceFactoryAttribute.ExportRazorLspServiceFactoryAttribute(System.Type! handlerType) -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.ExportRazorStatelessLspServiceAttribute +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.ExportRazorStatelessLspServiceAttribute.ExportRazorStatelessLspServiceAttribute(System.Type! handlerType) -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostCapabilitiesProvider +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostCapabilitiesProvider.GetCapabilities(string! clientCapabilities) -> string! +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostLanguageClientActivationService +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostLanguageClientActivationService.ShouldActivateCohostServer() -> bool +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCustomMessageTarget +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostLanguageClient +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostLanguageClient.RazorCohostLanguageClient(Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorLspServiceProvider! lspServiceProvider, Microsoft.CodeAnalysis.Options.IGlobalOptionService! globalOptions, Microsoft.CodeAnalysis.Editor.Shared.Utilities.IThreadingContext! threadingContext, Microsoft.CodeAnalysis.LanguageServer.ILspServiceLoggerFactory! lspLoggerFactory, Microsoft.VisualStudio.Composition.ExportProvider! exportProvider, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostCapabilitiesProvider? razorCapabilitiesProvider = null, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCustomMessageTarget? razorCustomMessageTarget = null, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostLanguageClientActivationService? razorCohostLanguageClientActivationService = null) -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorLspServiceProvider +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorLspServiceProvider.RazorLspServiceProvider(System.Collections.Generic.IEnumerable!>! lspServices, System.Collections.Generic.IEnumerable!>! lspServiceFactories) -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorLspWorkspaceManagerFactory +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorLspWorkspaceManagerFactory.RazorLspWorkspaceManagerFactory(Microsoft.CodeAnalysis.LanguageServer.LspWorkspaceRegistrationService! lspWorkspaceRegistrationService) -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.Equals(Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext other) -> bool +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.Method.get -> string! +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.Method.set -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.RazorCohostRequestContext(string! Method, System.Uri? Uri, Microsoft.CodeAnalysis.Solution? Solution, Microsoft.CodeAnalysis.TextDocument? TextDocument) -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.Deconstruct(out string! Method, out System.Uri? Uri, out Microsoft.CodeAnalysis.Solution? Solution, out Microsoft.CodeAnalysis.TextDocument? TextDocument) -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.TextDocument.get -> Microsoft.CodeAnalysis.TextDocument? +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.TextDocument.set -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.RazorCohostRequestContext() -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.Solution.get -> Microsoft.CodeAnalysis.Solution? +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.Solution.set -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.Uri.get -> System.Uri? +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.Uri.set -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorRequestExecutionQueueProvider +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorRequestExecutionQueueProvider.CreateRequestExecutionQueue(Microsoft.CommonLanguageServerProtocol.Framework.AbstractLanguageServer! languageServer, Microsoft.CommonLanguageServerProtocol.Framework.ILspLogger! logger, Microsoft.CommonLanguageServerProtocol.Framework.IHandlerProvider! handlerProvider) -> Microsoft.CommonLanguageServerProtocol.Framework.IRequestExecutionQueue! +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorRequestExecutionQueueProvider.RazorRequestExecutionQueueProvider() -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorRequestTelemetryLoggerFactory +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorRequestTelemetryLoggerFactory.RazorRequestTelemetryLoggerFactory() -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.Equals(Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier other) -> bool +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.Deconstruct(out System.Uri! Uri, out string? ProjectContextId) -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.ProjectContextId.get -> string? +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.ProjectContextId.set -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.RazorTextDocumentIdentifier() -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.RazorTextDocumentIdentifier(System.Uri! Uri, string? ProjectContextId) -> void +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.Uri.get -> System.Uri! +Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.Uri.set -> void Microsoft.CodeAnalysis.ExternalAccess.Razor.IRazorAsynchronousOperationListenerProviderAccessor Microsoft.CodeAnalysis.ExternalAccess.Razor.IRazorAsynchronousOperationListenerProviderAccessor.GetListener(string! featureName) -> Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorAsynchronousOperationListenerWrapper Microsoft.CodeAnalysis.ExternalAccess.Razor.IRazorCapabilitiesProvider @@ -169,6 +223,13 @@ Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorTestWorkspaceRegistrationServic Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorTestWorkspaceRegistrationService.RazorTestWorkspaceRegistrationService() -> void Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorTestWorkspaceRegistrationService.Register(Microsoft.CodeAnalysis.Workspace! workspace) -> void Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorUri +override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostLanguageClient.ActivateAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostLanguageClient.CustomMessageTarget.get -> object? +override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostLanguageClient.GetCapabilities(Microsoft.VisualStudio.LanguageServer.Protocol.ClientCapabilities! clientCapabilities) -> Microsoft.VisualStudio.LanguageServer.Protocol.ServerCapabilities! +override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostLanguageClient.ServerKind.get -> Microsoft.CodeAnalysis.LanguageServer.WellKnownLspServerKinds +override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostLanguageClient.ShowNotificationOnInitializeFailed.get -> bool +override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.GetHashCode() -> int +override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.GetHashCode() -> int override Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorCSharpInterceptionMiddleLayerWrapper.CanHandle(string! methodName) -> bool override Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorCSharpInterceptionMiddleLayerWrapper.HandleNotificationAsync(string! methodName, Newtonsoft.Json.Linq.JToken! methodParam, System.Func! sendNotification) -> System.Threading.Tasks.Task! override Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorCSharpInterceptionMiddleLayerWrapper.HandleRequestAsync(string! methodName, Newtonsoft.Json.Linq.JToken! methodParam, System.Func!>! sendRequest) -> System.Threading.Tasks.Task! @@ -191,6 +252,10 @@ readonly Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorMappedSpanResult.Span readonly Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorPinnedSolutionInfoWrapper.UnderlyingObject -> Microsoft.CodeAnalysis.Checksum! readonly Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorRemoteCallbackWrapper.UnderlyingObject -> Microsoft.CodeAnalysis.Remote.RemoteCallback readonly Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorServiceDescriptorsWrapper.UnderlyingObject -> Microsoft.CodeAnalysis.Remote.ServiceDescriptors! +static Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.operator !=(Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext left, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext right) -> bool +static Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.operator ==(Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext left, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext right) -> bool +static Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.operator !=(Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier left, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier right) -> bool +static Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.operator ==(Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier left, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier right) -> bool static Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorBreakpointSpans.TryGetBreakpointSpan(Microsoft.CodeAnalysis.SyntaxTree! tree, int position, System.Threading.CancellationToken cancellationToken, out Microsoft.CodeAnalysis.Text.TextSpan breakpointSpan) -> bool static Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorClassificationOptionsWrapper.Default -> Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorClassificationOptionsWrapper static Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorClassifierAccessor.GetClassifiedSpansAsync(Microsoft.CodeAnalysis.Document! document, Microsoft.CodeAnalysis.Text.TextSpan textSpan, Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorClassificationOptionsWrapper options, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!>! @@ -414,6 +479,11 @@ static Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorSemanticTokensAccessor.R static Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorTestAnalyzerLoader.CreateAnalyzerAssemblyLoader() -> Microsoft.CodeAnalysis.IAnalyzerAssemblyLoader! static Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorUri.CreateAbsoluteUri(string! absolutePath) -> System.Uri! static Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorUri.CreateUri(this Microsoft.CodeAnalysis.TextDocument! document) -> System.Uri! +static readonly Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.Constants.RazorLanguage -> System.Collections.Immutable.ImmutableArray static readonly Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorRemoteServiceCallbackDispatcherRegistry.Empty -> Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorRemoteServiceCallbackDispatcherRegistry! +~override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.Equals(object obj) -> bool +~override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostRequestContext.ToString() -> string +~override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.Equals(object obj) -> bool +~override Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorTextDocumentIdentifier.ToString() -> string ~override Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorIndentationOptions.Equals(object obj) -> bool ~override Microsoft.CodeAnalysis.ExternalAccess.Razor.RazorIndentationOptions.ToString() -> string diff --git a/src/Tools/ExternalAccess/Razor/Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj b/src/Tools/ExternalAccess/Razor/Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj index d10ea5b694045..87ee2c23db03a 100644 --- a/src/Tools/ExternalAccess/Razor/Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj +++ b/src/Tools/ExternalAccess/Razor/Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj @@ -10,7 +10,7 @@ Microsoft.CodeAnalysis.ExternalAccess.Razor A supporting package for Razor: - https://github.com/aspnet/AspNetCore-Tooling + https://github.com/dotnet/razor @@ -31,7 +31,6 @@ - @@ -43,6 +42,10 @@ + + + + From 079c504956741344767a7796afbc0527bdd6a7e9 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 14 Nov 2023 16:12:16 +1100 Subject: [PATCH 023/141] Allow handlers to operate on TextDocuments --- .../Protocol/Extensions/Extensions.cs | 16 +++++++ .../Protocol/Handler/RequestContext.cs | 45 +++++++++++++++++-- .../Workspaces/LspWorkspaceManager.cs | 16 +++---- .../Workspaces/LspWorkspaceManagerTests.cs | 2 +- 4 files changed, 66 insertions(+), 13 deletions(-) diff --git a/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs b/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs index 130f3014c414e..28247e32e51ce 100644 --- a/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs +++ b/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs @@ -76,6 +76,22 @@ public static ImmutableArray GetDocuments(this Solution solution, stri return documents; } + /// + /// Get all regular and additional s for the given . + /// + public static ImmutableArray GetTextDocuments(this Solution solution, Uri documentUri) + { + var documentIds = GetDocumentIds(solution, documentUri); + + // We don't call GetRequiredDocument here as the id could be referring to an additional document. + var documents = documentIds + .Select(solution.GetDocument) + .Concat(documentIds.Select(solution.GetAdditionalDocument)) + .WhereNotNull() + .ToImmutableArray(); + return documents; + } + public static ImmutableArray GetDocumentIds(this Solution solution, Uri documentUri) => solution.GetDocumentIdsWithFilePath(ProtocolConversions.GetDocumentFilePathFromUri(documentUri)); diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs index e1a1678d30a49..62094a8362931 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs @@ -53,7 +53,7 @@ internal readonly struct RequestContext /// /// This field is only initialized for handlers that request solution context. /// - private readonly StrongBox<(Workspace Workspace, Solution Solution, Document? Document)>? _lspSolution; + private readonly StrongBox<(Workspace Workspace, Solution Solution, TextDocument? Document)>? _lspSolution; /// /// The workspace this request is for, if applicable. This will be present if is @@ -116,6 +116,43 @@ public Document? Document throw new InvalidOperationException(); } + if (_lspSolution.Value.Document is null) + { + return null; + } + + if (_lspSolution.Value.Document is Document document) + { + return document; + } + + // Explicitly throw for attempts to get a Document when only a TextDocument is available. + throw new InvalidOperationException(); + } + } + + /// + /// The text document that the request is for, if applicable. This comes from the returned from the handler itself via a call to + /// . + /// + public TextDocument? TextDocument + { + get + { + if (_lspSolution is null) + { + // This request context never had a solution instance + return null; + } + + // The solution is available unless it has been cleared by a call to ClearSolutionContext. Explicitly throw + // for attempts to access this property after it has been manually cleared. Note that we can't rely on + // Document being null for this check, because it is not always provided as part of the solution context. + if (_lspSolution.Value.Workspace is null) + { + throw new InvalidOperationException(); + } + return _lspSolution.Value.Document; } } @@ -149,7 +186,7 @@ public RequestContext( string method, ClientCapabilities? clientCapabilities, WellKnownLspServerKinds serverKind, - Document? document, + TextDocument? document, IDocumentChangeTracker documentChangeTracker, ImmutableDictionary trackedDocuments, ImmutableArray supportedLanguages, @@ -159,7 +196,7 @@ public RequestContext( if (workspace is not null) { RoslynDebug.Assert(solution is not null); - _lspSolution = new StrongBox<(Workspace Workspace, Solution Solution, Document? Document)>((workspace, solution, document)); + _lspSolution = new StrongBox<(Workspace Workspace, Solution Solution, TextDocument? Document)>((workspace, solution, document)); } else { @@ -228,7 +265,7 @@ public static async Task CreateAsync( { Workspace? workspace = null; Solution? solution = null; - Document? document = null; + TextDocument? document = null; if (textDocument is not null) { // we were given a request associated with a document. Find the corresponding roslyn document for this. diff --git a/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs b/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs index 0ee71de05d2fe..911d274626ff3 100644 --- a/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs +++ b/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs @@ -213,7 +213,7 @@ public void UpdateTrackedDocument(Uri uri, SourceText newSourceText) /// /// This is always called serially in the when creating the . /// - public async Task<(Workspace?, Solution?, Document?)> GetLspDocumentInfoAsync(TextDocumentIdentifier textDocumentIdentifier, CancellationToken cancellationToken) + public async Task<(Workspace?, Solution?, TextDocument?)> GetLspDocumentInfoAsync(TextDocumentIdentifier textDocumentIdentifier, CancellationToken cancellationToken) { // Get the LSP view of all the workspace solutions. var uri = textDocumentIdentifier.Uri; @@ -222,10 +222,10 @@ public void UpdateTrackedDocument(Uri uri, SourceText newSourceText) // Find the matching document from the LSP solutions. foreach (var (workspace, lspSolution, isForked) in lspSolutions) { - var documents = lspSolution.GetDocuments(textDocumentIdentifier.Uri); + var documents = lspSolution.GetTextDocuments(textDocumentIdentifier.Uri); if (documents.Any()) { - var document = documents.FindDocumentInProjectContext(textDocumentIdentifier, (sln, id) => sln.GetRequiredDocument(id)); + var document = documents.FindDocumentInProjectContext(textDocumentIdentifier, (sln, id) => sln.GetRequiredTextDocument(id)); // Record metadata on how we got this document. var workspaceKind = document.Project.Solution.WorkspaceKind; @@ -378,7 +378,7 @@ await workspace.TryOnDocumentOpenedAsync( /// /// Given a set of documents from the workspace current solution, verify that the LSP text is the same as the document contents. /// - private async Task DoesAllTextMatchWorkspaceSolutionAsync(ImmutableDictionary> documentsInWorkspace, CancellationToken cancellationToken) + private async Task DoesAllTextMatchWorkspaceSolutionAsync(ImmutableDictionary> documentsInWorkspace, CancellationToken cancellationToken) { foreach (var (uriInWorkspace, documentsForUri) in documentsInWorkspace) { @@ -396,7 +396,7 @@ private async Task DoesAllTextMatchWorkspaceSolutionAsync(ImmutableDiction return true; } - private static async ValueTask AreChecksumsEqualAsync(Document document, SourceText lspText, CancellationToken cancellationToken) + private static async ValueTask AreChecksumsEqualAsync(TextDocument document, SourceText lspText, CancellationToken cancellationToken) { var documentText = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); if (documentText == lspText) @@ -410,12 +410,12 @@ private static async ValueTask AreChecksumsEqualAsync(Document document, S /// /// Using the workspace's current solutions, find the matching documents in for each URI. /// - private static ImmutableDictionary> GetDocumentsForUris(ImmutableArray trackedDocuments, Solution workspaceCurrentSolution) + private static ImmutableDictionary> GetDocumentsForUris(ImmutableArray trackedDocuments, Solution workspaceCurrentSolution) { - using var _ = PooledDictionary>.GetInstance(out var documentsInSolution); + using var _ = PooledDictionary>.GetInstance(out var documentsInSolution); foreach (var trackedDoc in trackedDocuments) { - var documents = workspaceCurrentSolution.GetDocuments(trackedDoc); + var documents = workspaceCurrentSolution.GetTextDocuments(trackedDoc); if (documents.Any()) { documentsInSolution[trackedDoc] = documents; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs index 4357dedb32d48..8ee5c538f8e53 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs @@ -710,7 +710,7 @@ private static bool IsWorkspaceRegistered(Workspace workspace, TestLspServer tes private static async Task<(Workspace? workspace, Document? document)> GetLspWorkspaceAndDocumentAsync(Uri uri, TestLspServer testLspServer) { var (workspace, _, document) = await testLspServer.GetManager().GetLspDocumentInfoAsync(CreateTextDocumentIdentifier(uri), CancellationToken.None).ConfigureAwait(false); - return (workspace, document); + return (workspace, document as Document); } private static Task<(Workspace?, Solution?)> GetLspHostWorkspaceAndSolutionAsync(TestLspServer testLspServer) From 223d01bac0218bd78a98181d98fabb1e5b52be39 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 15 Nov 2023 15:04:40 +1100 Subject: [PATCH 024/141] Add test to validate that the server has all required services and handles requests --- .../AbstractInProcLanguageClient.cs | 17 +++ ...crosoft.CodeAnalysis.EditorFeatures.csproj | 1 + ...lysis.EditorFeatures.Test.Utilities.csproj | 1 + .../AbstractLanguageServer.cs | 5 + ...monLanguageServerProtocol.Framework.csproj | 1 + ...odeAnalysis.LanguageServer.Protocol.csproj | 1 + .../RazorTest/Cohost/RazorCohostTests.cs | 122 ++++++++++++++++++ ...ysis.ExternalAccess.Razor.UnitTests.csproj | 5 + .../Microsoft.CodeAnalysis.Workspaces.csproj | 1 + 9 files changed, 154 insertions(+) create mode 100644 src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs diff --git a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs index 7ec935749848d..d576eb44d330c 100644 --- a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs @@ -257,5 +257,22 @@ public virtual AbstractLanguageServer Create( /// This method is called after the language server has been activated, but connection has not been established. /// public Task AttachForCustomMessageAsync(JsonRpc rpc) => Task.CompletedTask; + + internal TestAccessor GetTestAccessor() + { + return new TestAccessor(this); + } + + internal readonly struct TestAccessor + { + private readonly AbstractInProcLanguageClient _instance; + + internal TestAccessor(AbstractInProcLanguageClient instance) + { + _instance = instance; + } + + public AbstractLanguageServer? LanguageServer => _instance._languageServer; + } } } diff --git a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj index 8c7d44ae3356d..7924e0bd7f73d 100644 --- a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj +++ b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj @@ -79,6 +79,7 @@ + diff --git a/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj b/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj index dc006033f6ca1..478f9de53cc99 100644 --- a/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj +++ b/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj @@ -92,6 +92,7 @@ + diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/AbstractLanguageServer.cs b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/AbstractLanguageServer.cs index 7196583560a2c..d02fe812dc219 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/AbstractLanguageServer.cs +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/AbstractLanguageServer.cs @@ -353,6 +353,11 @@ internal TestAccessor(AbstractLanguageServer server) return null; } + internal Task ExecuteRequestAsync(string methodName, TRequest request) + { + return _server._queue.Value.ExecuteAsync(request, methodName, _server._lspServices.Value, CancellationToken.None); + } + internal JsonRpc GetServerRpc() => _server._jsonRpc; internal bool HasShutdownStarted() diff --git a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Microsoft.CommonLanguageServerProtocol.Framework.csproj b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Microsoft.CommonLanguageServerProtocol.Framework.csproj index 8c0513a6b0158..3c304c0719c78 100644 --- a/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Microsoft.CommonLanguageServerProtocol.Framework.csproj +++ b/src/Features/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/Microsoft.CommonLanguageServerProtocol.Framework.csproj @@ -19,5 +19,6 @@ + diff --git a/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj b/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj index c01c28c61523f..6bfd8f20ad908 100644 --- a/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj +++ b/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj @@ -74,6 +74,7 @@ + diff --git a/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs b/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs new file mode 100644 index 0000000000000..19bde4de0f99b --- /dev/null +++ b/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs @@ -0,0 +1,122 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Xml.Linq; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; +using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.Test.Utilities; +using Microsoft.CommonLanguageServerProtocol.Framework; +using Microsoft.VisualStudio.LanguageServer.Client; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.Test.Utilities; +using StreamJsonRpc; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests; + +public class RazorCohostTests(ITestOutputHelper testOutputHelper) : AbstractLanguageServerProtocolTests(testOutputHelper) +{ + protected override TestComposition Composition => base.Composition + .AddAssemblies(typeof(RazorCohostLanguageClient).Assembly) + .AddParts( + typeof(RazorHandler), + typeof(RazorCohostCapabilitiesProvider), + typeof(RazorCohostLanguageClientActivationService), + typeof(NoOpLspLoggerFactory)); + + [WpfFact] + public async Task TestExternalAccessRazorHandlerInvoked() + { + var workspaceXml = +@$" + + + +"; + + var testWorkspace = CreateWorkspace(options: null, mutatingLspWorkspace: false, workspaceKind: null); + testWorkspace.InitializeDocuments(XElement.Parse(workspaceXml), openDocuments: false); + + var languageClient = testWorkspace.ExportProvider.GetExportedValues().OfType().Single(); + await languageClient.ActivateAsync(CancellationToken.None); + + var serverAccessor = languageClient.GetTestAccessor().LanguageServer!.GetTestAccessor(); + + await serverAccessor.ExecuteRequestAsync(Methods.InitializeName, new InitializeParams { Capabilities = new() }); + + var document = testWorkspace.CurrentSolution.Projects.Single().AdditionalDocuments.Single(); + var request = new TestRequest(document.GetURI(), document.Project.Id.Id); + + var response = await serverAccessor.ExecuteRequestAsync(RazorHandler.MethodName, request); + + Assert.NotNull(response); + Assert.Equal(request.DocumentUri, response.DocumentUri); + Assert.Equal(request.ProjectId, response.ProjectId); + } + + internal class TestRequest(Uri documentUri, Guid projectId) + { + public Uri DocumentUri => documentUri; + public Guid ProjectId => projectId; + } + + [LanguageServerEndpoint(MethodName)] + [ExportRazorStatelessLspService(typeof(RazorHandler)), Shared] + [method: ImportingConstructor] + [method: Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] + internal class RazorHandler() : AbstractRazorDocumentRequestHandler + { + internal const string MethodName = "testMethod"; + + protected override bool MutatesSolutionState => false; + + protected override bool RequiresLSPSolution => true; + + protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(TestRequest request) + { + return new RazorTextDocumentIdentifier(request.DocumentUri, request.ProjectId.ToString()); + } + + protected override Task HandleRequestAsync(TestRequest request, RazorRequestContext context, CancellationToken cancellationToken) + { + Assert.NotNull(context.Solution); + AssertEx.NotNull(context.TextDocument); + return Task.FromResult(new TestRequest(context.TextDocument.GetURI(), context.TextDocument.Project.Id.Id)); + } + } + + [Export(typeof(ILspServiceLoggerFactory)), Shared] + [method: ImportingConstructor] + [method: Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] + private class NoOpLspLoggerFactory() : ILspServiceLoggerFactory + { + public Task CreateLoggerAsync(string serverTypeName, JsonRpc jsonRpc, CancellationToken cancellationToken) + => Task.FromResult(NoOpLspLogger.Instance); + } + + [Export(typeof(IRazorCohostCapabilitiesProvider)), Shared] + [method: ImportingConstructor] + [method: Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] + private class RazorCohostCapabilitiesProvider() : IRazorCohostCapabilitiesProvider + { + public string GetCapabilities(string clientCapabilities) + { + return "{ }"; + } + } + + [Export(typeof(IRazorCohostLanguageClientActivationService)), Shared] + [method: ImportingConstructor] + [method: Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] + private class RazorCohostLanguageClientActivationService() : IRazorCohostLanguageClientActivationService + { + public bool ShouldActivateCohostServer() => true; + } +} diff --git a/src/Tools/ExternalAccess/RazorTest/Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests.csproj b/src/Tools/ExternalAccess/RazorTest/Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests.csproj index 4f3f41e9705c6..9b95cd9e85d37 100644 --- a/src/Tools/ExternalAccess/RazorTest/Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests.csproj +++ b/src/Tools/ExternalAccess/RazorTest/Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests.csproj @@ -7,7 +7,12 @@ net472 + + + + + \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj b/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj index f246af2aa5f88..31f7ed8f9aedb 100644 --- a/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj +++ b/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj @@ -125,6 +125,7 @@ + From 342d5dedf0c96fc4d1d00d0828bcdd38fedf0c86 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 15 Nov 2023 15:17:41 +1100 Subject: [PATCH 025/141] More realistic test --- .../RazorTest/Cohost/RazorCohostTests.cs | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs b/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs index 19bde4de0f99b..766fc09692e97 100644 --- a/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs +++ b/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs @@ -52,13 +52,23 @@ public async Task TestExternalAccessRazorHandlerInvoked() await serverAccessor.ExecuteRequestAsync(Methods.InitializeName, new InitializeParams { Capabilities = new() }); var document = testWorkspace.CurrentSolution.Projects.Single().AdditionalDocuments.Single(); - var request = new TestRequest(document.GetURI(), document.Project.Id.Id); - - var response = await serverAccessor.ExecuteRequestAsync(RazorHandler.MethodName, request); + var request = new TextDocumentPositionParams + { + TextDocument = new VSTextDocumentIdentifier + { + Uri = document.GetURI(), + ProjectContext = new VSProjectContext + { + Id = document.Project.Id.Id.ToString() + } + } + }; + + var response = await serverAccessor.ExecuteRequestAsync(RazorHandler.MethodName, request); Assert.NotNull(response); - Assert.Equal(request.DocumentUri, response.DocumentUri); - Assert.Equal(request.ProjectId, response.ProjectId); + Assert.Equal(document.GetURI(), response.DocumentUri); + Assert.Equal(document.Project.Id.Id, response.ProjectId); } internal class TestRequest(Uri documentUri, Guid projectId) @@ -71,7 +81,7 @@ internal class TestRequest(Uri documentUri, Guid projectId) [ExportRazorStatelessLspService(typeof(RazorHandler)), Shared] [method: ImportingConstructor] [method: Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] - internal class RazorHandler() : AbstractRazorDocumentRequestHandler + internal class RazorHandler() : AbstractRazorCohostDocumentRequestHandler { internal const string MethodName = "testMethod"; @@ -79,12 +89,12 @@ internal class RazorHandler() : AbstractRazorDocumentRequestHandler true; - protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(TestRequest request) + protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(TextDocumentPositionParams request) { - return new RazorTextDocumentIdentifier(request.DocumentUri, request.ProjectId.ToString()); + return new RazorTextDocumentIdentifier(request.TextDocument.Uri, (request.TextDocument as VSTextDocumentIdentifier)?.ProjectContext?.Id); } - protected override Task HandleRequestAsync(TestRequest request, RazorRequestContext context, CancellationToken cancellationToken) + protected override Task HandleRequestAsync(TextDocumentPositionParams request, RazorCohostRequestContext context, CancellationToken cancellationToken) { Assert.NotNull(context.Solution); AssertEx.NotNull(context.TextDocument); From f1ed068a24ffbb03464432d7b7e2f837dce01bc7 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 15 Nov 2023 16:55:29 +1100 Subject: [PATCH 026/141] Add endpoints that need to access Roslyn internals --- .../Cohost/RazorCohostDidChangeEndpoint.cs | 54 +++++++ .../Cohost/RazorCohostDidCloseEndpoint.cs | 42 ++++++ .../Cohost/RazorCohostDidOpenEndpoint.cs | 45 ++++++ .../Razor/Cohost/RazorCohostLanguageClient.cs | 8 ++ .../RazorCohostProjectContextEndpoint.cs | 17 +++ .../RazorTest/Cohost/RazorCohostTests.cs | 135 +++++++++++++++--- 6 files changed, 284 insertions(+), 17 deletions(-) create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidCloseEndpoint.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorCohostProjectContextEndpoint.cs diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs new file mode 100644 index 0000000000000..556d32db3d90f --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs @@ -0,0 +1,54 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.LanguageServer.Handler; +using Microsoft.CodeAnalysis.Text; +using Microsoft.CommonLanguageServerProtocol.Framework; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[LanguageServerEndpoint(Methods.TextDocumentDidChangeName)] +[ExportRazorStatelessLspService(typeof(RazorCohostDidChangeEndpoint)), Shared] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class RazorCohostDidChangeEndpoint([Import(AllowDefault = true)] IRazorCohostDidChangeHandler? didChangeHandler) : ILspServiceDocumentRequestHandler +{ + public bool MutatesSolutionState => true; + public bool RequiresLSPSolution => false; + + public TextDocumentIdentifier GetTextDocumentIdentifier(DidChangeTextDocumentParams request) + => request.TextDocument; + + public Task HandleRequestAsync(DidChangeTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) + { + var text = context.GetTrackedDocumentSourceText(request.TextDocument.Uri); + + // Per the LSP spec, each text change builds upon the previous, so we don't need to translate any text + // positions between changes, which makes this quite easy. See + // https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#didChangeTextDocumentParams + // for more details. + foreach (var change in request.ContentChanges) + text = text.WithChanges(ProtocolConversions.ContentChangeEventToTextChange(change, text)); + + context.UpdateTrackedDocument(request.TextDocument.Uri, text); + + // Razor can't handle this request because they don't have access to the RequestContext, but they might want to do something with it + didChangeHandler?.Handle(request.TextDocument.Uri, text); + + return SpecializedTasks.Default(); + } +} + +internal interface IRazorCohostDidChangeHandler +{ + void Handle(Uri uri, SourceText text); +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidCloseEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidCloseEndpoint.cs new file mode 100644 index 0000000000000..c7a827b2eb25d --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidCloseEndpoint.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer.Handler; +using Microsoft.CommonLanguageServerProtocol.Framework; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[LanguageServerEndpoint(Methods.TextDocumentDidCloseName)] +[ExportRazorStatelessLspService(typeof(RazorCohostDidCloseEndpoint)), Shared] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class RazorCohostDidCloseEndpoint([Import(AllowDefault = true)] IRazorCohostDidCloseHandler? didCloseHandler) : ILspServiceNotificationHandler, ITextDocumentIdentifierHandler +{ + public bool MutatesSolutionState => true; + public bool RequiresLSPSolution => false; + + public TextDocumentIdentifier GetTextDocumentIdentifier(DidCloseTextDocumentParams request) + => request.TextDocument; + + public async Task HandleNotificationAsync(DidCloseTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) + { + context.TraceInformation($"didClose for {request.TextDocument.Uri}"); + + await context.StopTrackingAsync(request.TextDocument.Uri, cancellationToken).ConfigureAwait(false); + + // Razor can't handle this request because they don't have access to the RequestContext, but they might want to do something with it + didCloseHandler?.Handle(request.TextDocument.Uri); + } +} + +internal interface IRazorCohostDidCloseHandler +{ + void Handle(Uri uri); +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs new file mode 100644 index 0000000000000..76f19336fb0ab --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer.Handler; +using Microsoft.CodeAnalysis.Text; +using Microsoft.CommonLanguageServerProtocol.Framework; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[LanguageServerEndpoint(Methods.TextDocumentDidOpenName)] +[ExportRazorStatelessLspService(typeof(RazorCohostDidOpenEndpoint)), Shared] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class RazorCohostDidOpenEndpoint([Import(AllowDefault = true)] IRazorCohostDidOpenHandler? didOpenHandler) : ILspServiceNotificationHandler, ITextDocumentIdentifierHandler +{ + public bool MutatesSolutionState => true; + public bool RequiresLSPSolution => false; + + public Uri GetTextDocumentIdentifier(DidOpenTextDocumentParams request) + => request.TextDocument.Uri; + + public async Task HandleNotificationAsync(DidOpenTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) + { + context.TraceInformation($"didOpen for {request.TextDocument.Uri}"); + + var sourceText = SourceText.From(request.TextDocument.Text, System.Text.Encoding.UTF8, SourceHashAlgorithms.OpenDocumentChecksumAlgorithm); + + await context.StartTrackingAsync(request.TextDocument.Uri, sourceText, request.TextDocument.LanguageId, cancellationToken).ConfigureAwait(false); + + // Razor can't handle this request because they don't have access to the RequestContext, but they might want to do something with it + didOpenHandler?.Handle(request.TextDocument.Uri, sourceText); + } +} + +internal interface IRazorCohostDidOpenHandler +{ + void Handle(Uri uri, SourceText text); +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs index 695ea6a82b1a9..f1770690ec30a 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs @@ -68,6 +68,14 @@ public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapa var razorCapabilities = JsonConvert.DeserializeObject(serializedServerCapabilities); Contract.ThrowIfNull(razorCapabilities); + // We support a few things on this side, so lets make sure they're set + razorCapabilities.ProjectContextProvider = true; + razorCapabilities.TextDocumentSync = new TextDocumentSyncOptions + { + OpenClose = true, + Change = TextDocumentSyncKind.Incremental + }; + return razorCapabilities; } diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostProjectContextEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostProjectContextEndpoint.cs new file mode 100644 index 0000000000000..8c2606a48cdf6 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostProjectContextEndpoint.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer.Handler; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[ExportRazorStatelessLspService(typeof(RazorCohostProjectContextEndpoint)), Shared] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class RazorCohostProjectContextEndpoint() : GetTextDocumentWithContextHandler +{ +} diff --git a/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs b/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs index 766fc09692e97..75136cb3b1193 100644 --- a/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs +++ b/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs @@ -8,8 +8,10 @@ using System.Threading; using System.Threading.Tasks; using System.Xml.Linq; +using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CommonLanguageServerProtocol.Framework; using Microsoft.VisualStudio.LanguageServer.Client; @@ -34,22 +36,15 @@ public class RazorCohostTests(ITestOutputHelper testOutputHelper) : AbstractLang [WpfFact] public async Task TestExternalAccessRazorHandlerInvoked() { - var workspaceXml = -@$" - - - -"; - - var testWorkspace = CreateWorkspace(options: null, mutatingLspWorkspace: false, workspaceKind: null); - testWorkspace.InitializeDocuments(XElement.Parse(workspaceXml), openDocuments: false); - - var languageClient = testWorkspace.ExportProvider.GetExportedValues().OfType().Single(); - await languageClient.ActivateAsync(CancellationToken.None); - - var serverAccessor = languageClient.GetTestAccessor().LanguageServer!.GetTestAccessor(); - - await serverAccessor.ExecuteRequestAsync(Methods.InitializeName, new InitializeParams { Capabilities = new() }); + var workspaceXml = """ + + + + + + """; + var testWorkspace = CreateWorkspace(workspaceXml); + var server = await InitializeLanguageServerAsync(testWorkspace); var document = testWorkspace.CurrentSolution.Projects.Single().AdditionalDocuments.Single(); var request = new TextDocumentPositionParams @@ -64,13 +59,119 @@ public async Task TestExternalAccessRazorHandlerInvoked() } }; - var response = await serverAccessor.ExecuteRequestAsync(RazorHandler.MethodName, request); + var response = await server.GetTestAccessor().ExecuteRequestAsync(RazorHandler.MethodName, request); Assert.NotNull(response); Assert.Equal(document.GetURI(), response.DocumentUri); Assert.Equal(document.Project.Id.Id, response.ProjectId); } + [WpfFact] + public async Task TestProjectContextHandler() + { + var workspaceXml = """ + + + + + + """; + var testWorkspace = CreateWorkspace(workspaceXml); + var server = await InitializeLanguageServerAsync(testWorkspace); + + var document = testWorkspace.CurrentSolution.Projects.Single().AdditionalDocuments.Single(); + var request = new VSGetProjectContextsParams + { + TextDocument = new TextDocumentItem + { + Uri = document.GetURI(), + } + }; + + var response = await server.GetTestAccessor().ExecuteRequestAsync(VSMethods.GetProjectContextsName, request); + + Assert.NotNull(response); + var projectContext = Assert.Single(response?.ProjectContexts); + Assert.Equal(ProtocolConversions.ProjectIdToProjectContextId(document.Project.Id), projectContext.Id); + } + + [WpfFact] + public async Task TestDocumentSync() + { + var workspaceXml = """ + + + + + + """; + var testWorkspace = CreateWorkspace(workspaceXml); + var server = await InitializeLanguageServerAsync(testWorkspace); + + var document = testWorkspace.CurrentSolution.Projects.Single().AdditionalDocuments.Single(); + var didOpenRequest = new DidOpenTextDocumentParams + { + TextDocument = new TextDocumentItem + { + Uri = document.GetURI(), + Text = "Original text" + } + }; + + await server.GetTestAccessor().ExecuteRequestAsync(Methods.TextDocumentDidOpenName, didOpenRequest); + + var workspaceManager = server.GetLspServices().GetRequiredService(); + Assert.True(workspaceManager.GetTrackedLspText().TryGetValue(document.GetURI(), out var trackedText)); + Assert.Equal("Original text", trackedText.Text.ToString()); + + var didChangeRequest = new DidChangeTextDocumentParams + { + TextDocument = new VersionedTextDocumentIdentifier + { + Uri = document.GetURI() + }, + ContentChanges = + [ + new TextDocumentContentChangeEvent + { + Range = new VisualStudio.LanguageServer.Protocol.Range + { + Start = new Position(0, 0), + End = new Position(0, 0) + }, + Text = "Not The " + } + ] + }; + + await server.GetTestAccessor().ExecuteRequestAsync(Methods.TextDocumentDidChangeName, didChangeRequest); + + Assert.True(workspaceManager.GetTrackedLspText().TryGetValue(document.GetURI(), out trackedText)); + Assert.Equal("Not The Original text", trackedText.Text.ToString()); + } + + private TestWorkspace CreateWorkspace(string workspaceXml) + { + var testWorkspace = CreateWorkspace(options: null, mutatingLspWorkspace: false, workspaceKind: null); + testWorkspace.InitializeDocuments(XElement.Parse(workspaceXml), openDocuments: false); + return testWorkspace; + } + + private static async Task> InitializeLanguageServerAsync(TestWorkspace testWorkspace) + { + var languageClient = testWorkspace.ExportProvider.GetExportedValues().OfType().Single(); + await languageClient.ActivateAsync(CancellationToken.None); + + var server = languageClient.GetTestAccessor().LanguageServer; + Assert.NotNull(server); + + var serverAccessor = server!.GetTestAccessor(); + + await serverAccessor.ExecuteRequestAsync(Methods.InitializeName, new InitializeParams { Capabilities = new() }); + + return server; + } + internal class TestRequest(Uri documentUri, Guid projectId) { public Uri DocumentUri => documentUri; From 3c3d2859215f09dd04df3746941715d92506bca9 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 15 Nov 2023 17:45:34 +1100 Subject: [PATCH 027/141] Allow project context handler to work with any document type --- .../GetTextDocumentWithContextHandler.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs b/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs index 3fb63ca69e04d..1c1e201e3698d 100644 --- a/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs @@ -35,19 +35,20 @@ public GetTextDocumentWithContextHandler() Contract.ThrowIfNull(context.Workspace); Contract.ThrowIfNull(context.Solution); - // We specifically don't use context.Document here because we want multiple - var documents = context.Solution.GetDocuments(request.TextDocument.Uri); + // We specifically don't use context.Document here because we want multiple. We also don't need + // all of the document info, just the Id is enough + var documentIds = context.Solution.GetDocumentIds(request.TextDocument.Uri); - if (!documents.Any()) + if (!documentIds.Any()) { return SpecializedTasks.Null(); } var contexts = new List(); - foreach (var document in documents) + foreach (var documentId in documentIds) { - var project = document.Project; + var project = context.Solution.GetRequiredProject(documentId.ProjectId); var projectContext = ProtocolConversions.ProjectToProjectContext(project); contexts.Add(projectContext); } @@ -57,13 +58,13 @@ public GetTextDocumentWithContextHandler() // GetDocumentIdInCurrentContext will just return the same ID back, which means we're going to pick the first // ID in GetDocumentIdsWithFilePath, but there's really nothing we can do since we don't have contexts for // close documents anyways. - var openDocument = documents.First(); - var currentContextDocumentId = context.Workspace.GetDocumentIdInCurrentContext(openDocument.Id); + var openDocumentId = documentIds.First(); + var currentContextDocumentId = context.Workspace.GetDocumentIdInCurrentContext(openDocumentId); return Task.FromResult(new VSProjectContextList { ProjectContexts = contexts.ToArray(), - DefaultIndex = documents.IndexOf(d => d.Id == currentContextDocumentId) + DefaultIndex = documentIds.IndexOf(d => d == currentContextDocumentId) }); } } From 38bffadff077d8860ae77dd4b9abcc5f7d678e3a Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 24 Nov 2023 12:10:22 +1100 Subject: [PATCH 028/141] Switch to ClientName to prevent activation, and avoid an immediate yellow bar --- .../AbstractInProcLanguageClient.cs | 2 +- ...orCohostLanguageClientActivationService.cs | 13 ------------- .../Razor/Cohost/RazorCohostLanguageClient.cs | 19 +++---------------- .../Razor/InternalAPI.Unshipped.txt | 2 -- .../RazorTest/Cohost/RazorCohostTests.cs | 12 +++--------- 5 files changed, 7 insertions(+), 41 deletions(-) delete mode 100644 src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs diff --git a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs index d576eb44d330c..18ce4fa5c13b5 100644 --- a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs @@ -107,7 +107,7 @@ internal abstract partial class AbstractInProcLanguageClient( /// public event AsyncEventHandler? StopAsync { add { } remove { } } - public virtual async Task ActivateAsync(CancellationToken cancellationToken) + public async Task ActivateAsync(CancellationToken cancellationToken) { // HACK HACK HACK: prevent potential crashes/state corruption during load. Fixes // https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1261421 diff --git a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs deleted file mode 100644 index 4b1a3fc34067e..0000000000000 --- a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostLanguageClientActivationService.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; - -internal interface IRazorCohostLanguageClientActivationService -{ - /// - /// Returns whether the Razor cohost server should activate - /// - bool ShouldActivateCohostServer(); -} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs index f1770690ec30a..dc7de7a803348 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs @@ -5,8 +5,6 @@ using System; using System.Collections.Immutable; using System.ComponentModel.Composition; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; @@ -26,6 +24,7 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; /// by the Razor tooling team in the Razor tooling repo. /// [ContentType(Constants.RazorLSPContentType)] +[ClientName("RazorCohost")] [Export(typeof(ILanguageClient))] [method: ImportingConstructor] [method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] @@ -36,11 +35,9 @@ internal sealed class RazorCohostLanguageClient( ILspServiceLoggerFactory lspLoggerFactory, ExportProvider exportProvider, [Import(AllowDefault = true)] IRazorCohostCapabilitiesProvider? razorCapabilitiesProvider = null, - [Import(AllowDefault = true)] IRazorCustomMessageTarget? razorCustomMessageTarget = null, - [Import(AllowDefault = true)] IRazorCohostLanguageClientActivationService? razorCohostLanguageClientActivationService = null) + [Import(AllowDefault = true)] IRazorCustomMessageTarget? razorCustomMessageTarget = null) : AbstractInProcLanguageClient(lspServiceProvider, globalOptions, lspLoggerFactory, threadingContext, exportProvider, middleLayer: null) { - private readonly IRazorCohostLanguageClientActivationService? _razorCohostLanguageClientActivationService = razorCohostLanguageClientActivationService; private readonly IRazorCohostCapabilitiesProvider? _razorCapabilitiesProvider = razorCapabilitiesProvider; private readonly IRazorCustomMessageTarget? _razorCustomMessageTarget = razorCustomMessageTarget; @@ -48,16 +45,6 @@ internal sealed class RazorCohostLanguageClient( public override object? CustomMessageTarget => _razorCustomMessageTarget; - public override Task ActivateAsync(CancellationToken cancellationToken) - { - if (_razorCohostLanguageClientActivationService?.ShouldActivateCohostServer() == true) - { - return base.ActivateAsync(cancellationToken); - } - - return Task.FromResult(null); - } - public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapabilities) { Contract.ThrowIfNull(_razorCapabilitiesProvider); @@ -82,7 +69,7 @@ public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapa /// /// If the cohost server is expected to activate then any failures are catastrophic as no razor features will work. /// - public override bool ShowNotificationOnInitializeFailed => _razorCohostLanguageClientActivationService?.ShouldActivateCohostServer() == true; + public override bool ShowNotificationOnInitializeFailed => true; public override WellKnownLspServerKinds ServerKind => WellKnownLspServerKinds.RazorCohostServer; } diff --git a/src/Tools/ExternalAccess/Razor/InternalAPI.Unshipped.txt b/src/Tools/ExternalAccess/Razor/InternalAPI.Unshipped.txt index 6abc8c4b57eeb..ef05e1f511437 100644 --- a/src/Tools/ExternalAccess/Razor/InternalAPI.Unshipped.txt +++ b/src/Tools/ExternalAccess/Razor/InternalAPI.Unshipped.txt @@ -17,8 +17,6 @@ Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.ExportRazorStatelessLspServic Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.ExportRazorStatelessLspServiceAttribute.ExportRazorStatelessLspServiceAttribute(System.Type! handlerType) -> void Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostCapabilitiesProvider Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostCapabilitiesProvider.GetCapabilities(string! clientCapabilities) -> string! -Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostLanguageClientActivationService -Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostLanguageClientActivationService.ShouldActivateCohostServer() -> bool Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCustomMessageTarget Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostLanguageClient Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorCohostLanguageClient.RazorCohostLanguageClient(Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.RazorLspServiceProvider! lspServiceProvider, Microsoft.CodeAnalysis.Options.IGlobalOptionService! globalOptions, Microsoft.CodeAnalysis.Editor.Shared.Utilities.IThreadingContext! threadingContext, Microsoft.CodeAnalysis.LanguageServer.ILspServiceLoggerFactory! lspLoggerFactory, Microsoft.VisualStudio.Composition.ExportProvider! exportProvider, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostCapabilitiesProvider? razorCapabilitiesProvider = null, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCustomMessageTarget? razorCustomMessageTarget = null, Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.IRazorCohostLanguageClientActivationService? razorCohostLanguageClientActivationService = null) -> void diff --git a/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs b/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs index 75136cb3b1193..c3c5a0ef99445 100644 --- a/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs +++ b/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs @@ -30,7 +30,6 @@ public class RazorCohostTests(ITestOutputHelper testOutputHelper) : AbstractLang .AddParts( typeof(RazorHandler), typeof(RazorCohostCapabilitiesProvider), - typeof(RazorCohostLanguageClientActivationService), typeof(NoOpLspLoggerFactory)); [WpfFact] @@ -178,6 +177,7 @@ internal class TestRequest(Uri documentUri, Guid projectId) public Guid ProjectId => projectId; } + [PartNotDiscoverable] [LanguageServerEndpoint(MethodName)] [ExportRazorStatelessLspService(typeof(RazorHandler)), Shared] [method: ImportingConstructor] @@ -203,6 +203,7 @@ protected override Task HandleRequestAsync(TextDocumentPositionPara } } + [PartNotDiscoverable] [Export(typeof(ILspServiceLoggerFactory)), Shared] [method: ImportingConstructor] [method: Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] @@ -212,6 +213,7 @@ public Task CreateLoggerAsync(string serverTypeName, JsonRpc => Task.FromResult(NoOpLspLogger.Instance); } + [PartNotDiscoverable] [Export(typeof(IRazorCohostCapabilitiesProvider)), Shared] [method: ImportingConstructor] [method: Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] @@ -222,12 +224,4 @@ public string GetCapabilities(string clientCapabilities) return "{ }"; } } - - [Export(typeof(IRazorCohostLanguageClientActivationService)), Shared] - [method: ImportingConstructor] - [method: Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] - private class RazorCohostLanguageClientActivationService() : IRazorCohostLanguageClientActivationService - { - public bool ShouldActivateCohostServer() => true; - } } From 2d59c8e40aea487e56b64f1aecbdf13599abb47d Mon Sep 17 00:00:00 2001 From: David Barbet Date: Tue, 28 Nov 2023 16:13:53 -0800 Subject: [PATCH 029/141] Fix building executables for language server --- .../Microsoft.CodeAnalysis.LanguageServer.csproj | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj index bdffa0d61f17a..31c76645cd23b 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj @@ -1,13 +1,6 @@  Exe - - false net7.0 enable enable @@ -21,6 +14,15 @@ true $(PackRuntimeIdentifier) + + + false + $(AssemblyName).$(PackRuntimeIdentifier) + + From b93538b86b0bb9d8b3c78402c6da10caebbfc78d Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 6 Dec 2023 16:47:37 +1100 Subject: [PATCH 036/141] Add IRazorLspService in case any lsp services need to be exported from the Razor repo --- .../Razor/Cohost/AbstractRazorRequestHandler.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs index acf63888fcaf0..e63cc1da5406e 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs @@ -70,6 +70,10 @@ internal abstract class AbstractRazorCohostDocumentRequestHandler From af6b3ab07afd2236783477cb9f2d45f569889607 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 6 Dec 2023 16:47:56 +1100 Subject: [PATCH 037/141] Add version number to didChange extension point --- .../Razor/Cohost/RazorCohostDidChangeEndpoint.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs index 556d32db3d90f..33a460c927e19 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs @@ -42,7 +42,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DidChangeTextDocumentPar context.UpdateTrackedDocument(request.TextDocument.Uri, text); // Razor can't handle this request because they don't have access to the RequestContext, but they might want to do something with it - didChangeHandler?.Handle(request.TextDocument.Uri, text); + didChangeHandler?.Handle(request.TextDocument.Uri, request.TextDocument.Version, text); return SpecializedTasks.Default(); } @@ -50,5 +50,5 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DidChangeTextDocumentPar internal interface IRazorCohostDidChangeHandler { - void Handle(Uri uri, SourceText text); + void Handle(Uri uri, int version, SourceText text); } From 54710e2ca283d18c147e1ae3a8c43c4b507dfbc5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 6 Dec 2023 09:29:07 -0800 Subject: [PATCH 038/141] Remove TS impl of goto-def. The are entirely on LSP now --- .../Api/IVSTypeScriptGoToDefinitionService.cs | 18 ------------------ ...ToDefinitionServiceFactoryImplementation.cs | 15 --------------- 2 files changed, 33 deletions(-) delete mode 100644 src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptGoToDefinitionService.cs delete mode 100644 src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptGoToDefinitionServiceFactoryImplementation.cs diff --git a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptGoToDefinitionService.cs b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptGoToDefinitionService.cs deleted file mode 100644 index 6d162ddd9394c..0000000000000 --- a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptGoToDefinitionService.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api -{ - [Obsolete("TS, remove your implementation of this type now that you're entirely on LSP for go-to-def. Then let us know.", error: false)] - internal interface IVSTypeScriptGoToDefinitionService - { - Task?> FindDefinitionsAsync(Document document, int position, CancellationToken cancellationToken); - bool TryGoToDefinition(Document document, int position, CancellationToken cancellationToken); - } -} diff --git a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptGoToDefinitionServiceFactoryImplementation.cs b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptGoToDefinitionServiceFactoryImplementation.cs deleted file mode 100644 index 6f87069485e38..0000000000000 --- a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/IVSTypeScriptGoToDefinitionServiceFactoryImplementation.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api -{ - [Obsolete("TS, remove your implementation of this type now that you're entirely on LSP for go-to-def. Then let us know.", error: false)] - internal interface IVSTypeScriptGoToDefinitionServiceFactoryImplementation - { - IVSTypeScriptGoToDefinitionService? CreateLanguageService(HostLanguageServices languageServices); - } -} From 5aaf1753b305aeb6dd17a4d0fda4bdeccb983c5f Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 5 Dec 2023 18:11:02 -0800 Subject: [PATCH 039/141] Ensure we also package the BuildHost folders in the generator Including the content output also brings along the .deps.json and .runtimeconfig.json so we have to update other things accordingly. --- ...nalysis.LanguageServerIndexFormat.Generator.csproj | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Features/Lsif/Generator/Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj b/src/Features/Lsif/Generator/Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj index 0c723f295eecd..a76aa82e0d649 100644 --- a/src/Features/Lsif/Generator/Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj +++ b/src/Features/Lsif/Generator/Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj @@ -33,7 +33,7 @@ en - + @@ -44,8 +44,13 @@ PackagePath="tools\$(TargetFramework)\any\%(ReferenceCopyLocalPaths.DestinationSubDirectory)" Condition="'%(ReferenceCopyLocalPaths.DestinationSubDirectory)' == '' and '%(Extension)' != '.pdb' and '%(Extension)' != '.xml'" /> - - + + + + From b13836cf57ff747b5b126dd6ee88a89b0b033189 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 6 Dec 2023 12:30:06 -0800 Subject: [PATCH 040/141] Fix issue with pragmas --- ...UsePrimaryConstructorDiagnosticAnalyzer.cs | 18 ++++- ...arpUsePrimaryConstructorCodeFixProvider.cs | 58 ++++++++++++--- ...yConstructorCodeFixProvider_DocComments.cs | 11 ++- .../UsePrimaryConstructorTests.cs | 73 +++++++++++++++++++ 4 files changed, 140 insertions(+), 20 deletions(-) diff --git a/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs index c9524f5a5694f..fac0d73aba468 100644 --- a/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs @@ -84,9 +84,11 @@ protected override void InitializeWorker(AnalysisContext context) public static bool IsViableMemberToAssignTo( INamedTypeSymbol namedType, [NotNullWhen(true)] ISymbol? member, + [NotNullWhen(true)] out MemberDeclarationSyntax? memberNode, [NotNullWhen(true)] out SyntaxNode? nodeToRemove, CancellationToken cancellationToken) { + memberNode = null; nodeToRemove = null; if (member is not IFieldSymbol and not IPropertySymbol) return false; @@ -116,9 +118,19 @@ public static bool IsViableMemberToAssignTo( { return false; } - } - return true; + memberNode = property; + return true; + } + else if (nodeToRemove is VariableDeclaratorSyntax { Parent: VariableDeclarationSyntax { Parent: FieldDeclarationSyntax field } }) + { + memberNode = field; + return true; + } + else + { + return false; + } } /// @@ -471,7 +483,7 @@ bool IsAssignmentToInstanceMember( // Has to bind to a field/prop on this type. member = semanticModel.GetSymbolInfo(leftIdentifier, cancellationToken).GetAnySymbol()?.OriginalDefinition; - if (!IsViableMemberToAssignTo(namedType, member, out var assignedMemberDeclaration, cancellationToken)) + if (!IsViableMemberToAssignTo(namedType, member, out _, out var assignedMemberDeclaration, cancellationToken)) return false; // Left side looks good. Now check the right side. It cannot reference 'this' (as that is not diff --git a/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs index e56b69184c0d0..77b2fb4068e46 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs @@ -129,7 +129,7 @@ private static async Task UsePrimaryConstructorAsync( // Then remove the constructor itself. var constructorDocumentEditor = await solutionEditor.GetDocumentEditorAsync(document.Id, cancellationToken).ConfigureAwait(false); - constructorDocumentEditor.RemoveNode(constructorDeclaration); + constructorDocumentEditor.RemoveNode(constructorDeclaration, GetConstructorRemovalOptions()); // When moving the parameter list from the constructor to the type, we will no longer have nested types or // member constants in scope. So rewrite references to them if that's the case. @@ -169,6 +169,33 @@ private static async Task UsePrimaryConstructorAsync( return; + SyntaxRemoveOptions GetConstructorRemovalOptions() + { + // if we're removing all the members prior to the constructor, and any of those member had pragmas we are + // keeping, then we need to keep it on the constructor as well. + + var constructorRemoveOptions = GetRemoveOptions(constructorDeclaration); + if (constructorRemoveOptions == SyntaxGenerator.DefaultRemoveOptions) + { + for (var currentIndex = typeDeclaration.Members.IndexOf(constructorDeclaration) - 1; currentIndex >= 0; currentIndex--) + { + var priorMember = typeDeclaration.Members[currentIndex]; + + // Hit a member we're not removing. Just use the default options for the constructor. + if (!removedMembers.Any(kvp => kvp.Value.memberNode == priorMember)) + break; + + // Check if we had special options when removing the field/prop. We want to apply that to the + // constructor as well. + var memberRemoveOptions = GetRemoveOptions(priorMember); + if (memberRemoveOptions != SyntaxGenerator.DefaultRemoveOptions) + return memberRemoveOptions; + } + } + + return constructorRemoveOptions; + } + ParameterListSyntax GenerateFinalParameterList() { // Note: we can use constructorDeclarationSemanticModel as we're only touching nodes within the constructor @@ -408,9 +435,9 @@ SyntaxNode UpdateDeclaration(SyntaxNode declaration, AssignmentExpressionSyntax } } - async ValueTask> RemoveMembersAsync() + async ValueTask> RemoveMembersAsync() { - var removedMembers = ImmutableDictionary.Empty; + var removedMembers = ImmutableDictionary.Empty; if (removeMembers) { // Go through each pair of member/parameterName. Update all references to member to now refer to @@ -420,35 +447,44 @@ async ValueTask> RemoveMembersAsync() { Contract.ThrowIfNull(parameterName); - var (member, nodeToRemove) = GetMemberToRemove(memberName); + var (member, memberNode, nodeToRemove) = GetMemberToRemove(memberName); if (member is null) continue; - removedMembers = removedMembers.Add(member, nodeToRemove); + removedMembers = removedMembers.Add(member, (memberNode, nodeToRemove)); await ReplaceReferencesToMemberWithParameterAsync( member, CSharpSyntaxFacts.Instance.EscapeIdentifier(parameterName)).ConfigureAwait(false); } - foreach (var group in removedMembers.Values.GroupBy(n => n.SyntaxTree)) + foreach (var group in removedMembers.Values.GroupBy(n => n.memberNode.SyntaxTree)) { var syntaxTree = group.Key; var memberDocument = solution.GetRequiredDocument(syntaxTree); var documentEditor = await solutionEditor.GetDocumentEditorAsync(memberDocument.Id, cancellationToken).ConfigureAwait(false); - foreach (var memberToRemove in group) - documentEditor.RemoveNode(memberToRemove); + foreach (var (memberNode, nodeToRemove) in group) + { + // Preserve pragmas around fields as they can affect more than just the field itself (they + // extend to the rest of the file). + documentEditor.RemoveNode(nodeToRemove, GetRemoveOptions(memberNode)); + } } } return removedMembers; } - (ISymbol? member, SyntaxNode nodeToRemove) GetMemberToRemove(string memberName) + static SyntaxRemoveOptions GetRemoveOptions(MemberDeclarationSyntax memberDeclaration) + => memberDeclaration.GetLeadingTrivia().Any(t => t.GetStructure()?.Kind() == SyntaxKind.PragmaWarningDirectiveTrivia) + ? SyntaxRemoveOptions.KeepDirectives + : SyntaxGenerator.DefaultRemoveOptions; + + (ISymbol? member, MemberDeclarationSyntax memberNode, SyntaxNode nodeToRemove) GetMemberToRemove(string memberName) { foreach (var member in namedType.GetMembers(memberName)) { - if (IsViableMemberToAssignTo(namedType, member, out var nodeToRemove, cancellationToken)) - return (member, nodeToRemove); + if (IsViableMemberToAssignTo(namedType, member, out var memberNode, out var nodeToRemove, cancellationToken)) + return (member, memberNode, nodeToRemove); } return default; diff --git a/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs b/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs index 95209b70f148d..f80728c00acd4 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs @@ -37,7 +37,7 @@ private static SyntaxTrivia GetDocComment(SyntaxNode node) private static SyntaxTrivia GetDocComment(SyntaxTriviaList trivia) => trivia.LastOrDefault(t => t.IsSingleLineDocComment()); - private static DocumentationCommentTriviaSyntax? GetDocCommentStructure(SyntaxNode node) + private static DocumentationCommentTriviaSyntax? GetDocCommentStructure(MemberDeclarationSyntax node) => GetDocCommentStructure(node.GetLeadingTrivia()); private static DocumentationCommentTriviaSyntax? GetDocCommentStructure(SyntaxTriviaList trivia) @@ -66,7 +66,7 @@ private static SyntaxTriviaList CreateFinalTypeDeclarationLeadingTrivia( ConstructorDeclarationSyntax constructorDeclaration, IMethodSymbol constructor, ImmutableDictionary properties, - ImmutableDictionary removedMembers) + ImmutableDictionary removedMembers) { // First, take the constructor doc comments and merge those into the type's doc comments. // Then, take any removed fields/properties and merge their comments into the type's doc comments. @@ -164,7 +164,7 @@ static SyntaxTrivia MergeDocComments(SyntaxTrivia typeDeclarationDocComment, Syn static SyntaxTriviaList MergeTypeDeclarationAndRemovedMembersDocComments( IMethodSymbol constructor, ImmutableDictionary properties, - ImmutableDictionary removedMembers, + ImmutableDictionary removedMembers, SyntaxTriviaList typeDeclarationLeadingTrivia) { // now, if we're removing any members, and they had doc comments, and we don't already have doc comments for @@ -176,12 +176,11 @@ static SyntaxTriviaList MergeTypeDeclarationAndRemovedMembersDocComments( using var _1 = ArrayBuilder<(string parameterName, DocumentationCommentTriviaSyntax docComment)>.GetInstance(out var docCommentsToMove); foreach (var (memberName, parameterName) in orderedKVPs) { - var (removedMember, memberDeclaration) = removedMembers.FirstOrDefault(kvp => kvp.Key.Name == memberName); + var (removedMember, (memberDeclaration, _)) = removedMembers.FirstOrDefault(kvp => kvp.Key.Name == memberName); if (removedMember is null) continue; - var removedMemberDocComment = GetDocCommentStructure( - memberDeclaration is VariableDeclaratorSyntax { Parent.Parent: FieldDeclarationSyntax field } ? field : memberDeclaration); + var removedMemberDocComment = GetDocCommentStructure(memberDeclaration); if (removedMemberDocComment != null) docCommentsToMove.Add((parameterName, removedMemberDocComment)!); } diff --git a/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs b/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs index f115bb5d3a1d1..5d91511f61f9d 100644 --- a/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs +++ b/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs @@ -3691,4 +3691,77 @@ public void Remove() LanguageVersion = LanguageVersion.CSharp12, }.RunAsync(); } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71119")] + public async Task TestPragma1() + { + await new VerifyCS.Test + { + TestCode = """ + public class Test + { + + #pragma warning disable IDE0044 // or any other suppression + private object _value; + #pragma warning restore IDE0044 + + private int? _other; + + public [|Test|](object value) + { + _value = value; + } + } + """, + FixedCode = """ + public class Test(object value) + { + + #pragma warning disable IDE0044 // or any other suppression + #pragma warning restore IDE0044 + + private int? _other; + } + """, + CodeActionIndex = 1, + LanguageVersion = LanguageVersion.CSharp12, + }.RunAsync(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71119")] + public async Task TestPragma2() + { + await new VerifyCS.Test + { + TestCode = """ + public class Test + { + + #pragma warning disable IDE0044 // or any other supporession + private object _value1; + + #pragma warning restore IDE0044 + private object _value2; + + public [|Test|](object value2) + { + _value1 = new(); + _value2 = value2; + } + } + """, + FixedCode = """ + public class Test(object value2) + { + + #pragma warning disable IDE0044 // or any other supporession + private object _value1 = new(); + + #pragma warning restore IDE0044 + } + """, + CodeActionIndex = 1, + LanguageVersion = LanguageVersion.CSharp12, + }.RunAsync(); + } } From 768a77f8b1bbb2e3e22e74c645625123ec7abf41 Mon Sep 17 00:00:00 2001 From: Shen Chen Date: Wed, 6 Dec 2023 13:08:24 -0800 Subject: [PATCH 041/141] Cherry-pick the linq expression fix --- .../UI/InlineRenameAdornmentProvider.cs | 2 +- .../ISmartRenameSessionFactoryWrapper.cs | 3 +-- .../Core.Wpf/Lightup/LightupHelpers.cs | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineRename/UI/InlineRenameAdornmentProvider.cs b/src/EditorFeatures/Core.Wpf/InlineRename/UI/InlineRenameAdornmentProvider.cs index cbbafb135644a..8bef24db2de17 100644 --- a/src/EditorFeatures/Core.Wpf/InlineRename/UI/InlineRenameAdornmentProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineRename/UI/InlineRenameAdornmentProvider.cs @@ -76,7 +76,7 @@ public InlineRenameAdornmentProvider( _listenerProvider = listenerProvider; if (smartRenameSessionFactory is not null) { - _smartRenameSessionFactory = new Lazy(() => ISmartRenameSessionFactoryWrapper.FromInstance(smartRenameSessionFactory)); + _smartRenameSessionFactory = new Lazy(() => ISmartRenameSessionFactoryWrapper.FromInstance(smartRenameSessionFactory.Value)); } _threadingContext = threadingContext; diff --git a/src/EditorFeatures/Core.Wpf/Lightup/ISmartRenameSessionFactoryWrapper.cs b/src/EditorFeatures/Core.Wpf/Lightup/ISmartRenameSessionFactoryWrapper.cs index 7285f63dca9fb..16288dc124c7e 100644 --- a/src/EditorFeatures/Core.Wpf/Lightup/ISmartRenameSessionFactoryWrapper.cs +++ b/src/EditorFeatures/Core.Wpf/Lightup/ISmartRenameSessionFactoryWrapper.cs @@ -23,7 +23,6 @@ internal readonly struct ISmartRenameSessionFactoryWrapper static ISmartRenameSessionFactoryWrapper() { s_wrappedType = typeof(AggregateFocusInterceptor).Assembly.GetType(WrappedTypeName, throwOnError: false, ignoreCase: false); - s_createSmartRenameSession = LightupHelpers.CreateFunctionAccessor(s_wrappedType, nameof(CreateSmartRenameSession), typeof(SnapshotSpan), SpecializedTasks.Null()); } @@ -58,6 +57,6 @@ public static bool IsInstance([NotNullWhen(true)] object? instance) if (!ISmartRenameSessionWrapper.IsInstance(session)) return null; - return (ISmartRenameSessionWrapper)session; + return ISmartRenameSessionWrapper.FromInstance(session); } } diff --git a/src/EditorFeatures/Core.Wpf/Lightup/LightupHelpers.cs b/src/EditorFeatures/Core.Wpf/Lightup/LightupHelpers.cs index 610a7ce0d0308..fbc7a560ca3a4 100644 --- a/src/EditorFeatures/Core.Wpf/Lightup/LightupHelpers.cs +++ b/src/EditorFeatures/Core.Wpf/Lightup/LightupHelpers.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Concurrent; +using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -311,11 +312,11 @@ public static Func CreateFunctionAccessor(Ty throw new InvalidOperationException($"Type '{type}' is not assignable to type '{typeof(T)}'"); } - var method = type.GetTypeInfo().GetDeclaredMethod(methodName); - if (method == null) + var method = type.GetTypeInfo().GetDeclaredMethods(methodName).Single(method => { - return CreateFallbackFunction(defaultValue); - } + var parameters = method.GetParameters(); + return parameters is [{ ParameterType: var parameterType }] && parameterType == argType; + }); var parameters = method.GetParameters(); if (argType != parameters[0].ParameterType) @@ -341,8 +342,13 @@ public static Func CreateFunctionAccessor(Ty var expression = Expression.Lambda>( - Expression.Convert(Expression.Call(instance, method, convertedArgument), typeof(TResult)), - parameter); + Expression.Convert( + Expression.Call( + instance, + method, + convertedArgument), typeof(TResult)), + parameter, + argument); return expression.Compile(); } From 06f72e9a0ebf33e9e4d001dc3ccbeeb47a13680f Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 7 Dec 2023 16:13:25 +1100 Subject: [PATCH 042/141] Add a way for Razor to make calls back to the client --- ...IRazorCohostClientLanguageServerManager.cs | 19 ++++++++ ...ohostClientLanguageServerManagerFactory.cs | 43 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostClientLanguageServerManager.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorCohostClientLanguageServerManagerFactory.cs diff --git a/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostClientLanguageServerManager.cs b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostClientLanguageServerManager.cs new file mode 100644 index 0000000000000..40f56f01e0c85 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/IRazorCohostClientLanguageServerManager.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.LanguageServer; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost +{ + internal interface IRazorCohostClientLanguageServerManager : ILspService + { + ValueTask SendNotificationAsync(string methodName, CancellationToken cancellationToken); + ValueTask SendNotificationAsync(string methodName, TParams @params, CancellationToken cancellationToken); + ValueTask SendRequestAsync(string methodName, CancellationToken cancellationToken); + Task SendRequestAsync(string methodName, TParams @params, CancellationToken cancellationToken); + ValueTask SendRequestAsync(string methodName, TParams @params, CancellationToken cancellationToken); + } +} diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostClientLanguageServerManagerFactory.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostClientLanguageServerManagerFactory.cs new file mode 100644 index 0000000000000..4f5b630e193c7 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostClientLanguageServerManagerFactory.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using System.Threading.Tasks; +using System.Threading; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +[ExportRazorLspServiceFactory(typeof(IRazorCohostClientLanguageServerManager)), Shared] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal class RazorCohostClientLanguageServerManagerFactory() : ILspServiceFactory +{ + public ILspService CreateILspService(LspServices lspServices, WellKnownLspServerKinds serverKind) + { + var notificationManager = lspServices.GetRequiredService(); + + return new RazorCohostClientLanguageServerManager(notificationManager); + } + + internal class RazorCohostClientLanguageServerManager(IClientLanguageServerManager clientLanguageServerManager) : IRazorCohostClientLanguageServerManager + { + public Task SendRequestAsync(string methodName, TParams @params, CancellationToken cancellationToken) + => clientLanguageServerManager.SendRequestAsync(methodName, @params, cancellationToken); + + public ValueTask SendRequestAsync(string methodName, CancellationToken cancellationToken) + => clientLanguageServerManager.SendRequestAsync(methodName, cancellationToken); + + public ValueTask SendRequestAsync(string methodName, TParams @params, CancellationToken cancellationToken) + => clientLanguageServerManager.SendRequestAsync(methodName, @params, cancellationToken); + + public ValueTask SendNotificationAsync(string methodName, CancellationToken cancellationToken) + => clientLanguageServerManager.SendNotificationAsync(methodName, cancellationToken); + + public ValueTask SendNotificationAsync(string methodName, TParams @params, CancellationToken cancellationToken) + => clientLanguageServerManager.SendNotificationAsync(methodName, @params, cancellationToken); + } +} From bc1768ff7653a37a53801327b770af6170578835 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 7 Dec 2023 16:13:38 +1100 Subject: [PATCH 043/141] Allow getting services from the RazorRequestContext --- .../Cohost/AbstractRazorRequestHandler.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs index e63cc1da5406e..89fcfe5f4fd4e 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs @@ -26,11 +26,7 @@ Task IRequestHandler // This does mean we can't nicely pass through the original Uri, which would have ProjectContext info, but // we get the Project so that will have to do. - var razorRequestContext = new RazorCohostRequestContext( - context.Method, - context.TextDocument?.GetURI(), - context.Solution, - context.TextDocument); + var razorRequestContext = new RazorCohostRequestContext(context); return HandleRequestAsync(request, razorRequestContext, cancellationToken); } @@ -70,12 +66,20 @@ internal abstract class AbstractRazorCohostDocumentRequestHandler context.Method; + internal Uri? Uri => context.TextDocument?.GetURI(); + /// + internal Workspace? Workspace => context.Workspace; + /// + internal Solution? Solution => context.Solution; + /// + internal TextDocument? TextDocument => context.TextDocument; + + internal T GetRequiredService() where T : class => context.GetRequiredService(); } -internal record struct RazorCohostRequestContext(string Method, Uri? Uri, Solution? Solution, TextDocument? TextDocument); - /// /// Custom type containing information in a to avoid coupling LSP protocol versions. /// From 359a6aa19df825ed9c040c0aa360033bccffaf3c Mon Sep 17 00:00:00 2001 From: Julien Couvreur Date: Thu, 7 Dec 2023 00:21:38 -0800 Subject: [PATCH 044/141] Support implicit indexer access in object initializers (#70649) --- docs/Language Feature Status.md | 1 + .../Portable/Binder/Binder_Expressions.cs | 11 + .../CSharp/Portable/CSharpResources.resx | 3 + .../CSharp/Portable/Errors/MessageID.cs | 3 + ...ocalRewriter_CompoundAssignmentOperator.cs | 1 + .../LocalRewriter_IndexerAccess.cs | 121 +- ...ObjectOrCollectionInitializerExpression.cs | 183 +- .../Portable/xlf/CSharpResources.cs.xlf | 5 + .../Portable/xlf/CSharpResources.de.xlf | 5 + .../Portable/xlf/CSharpResources.es.xlf | 5 + .../Portable/xlf/CSharpResources.fr.xlf | 5 + .../Portable/xlf/CSharpResources.it.xlf | 5 + .../Portable/xlf/CSharpResources.ja.xlf | 5 + .../Portable/xlf/CSharpResources.ko.xlf | 5 + .../Portable/xlf/CSharpResources.pl.xlf | 5 + .../Portable/xlf/CSharpResources.pt-BR.xlf | 5 + .../Portable/xlf/CSharpResources.ru.xlf | 5 + .../Portable/xlf/CSharpResources.tr.xlf | 5 + .../Portable/xlf/CSharpResources.zh-Hans.xlf | 5 + .../Portable/xlf/CSharpResources.zh-Hant.xlf | 5 + .../ObjectAndCollectionInitializerTests.cs | 297 +- .../Test/Emit2/CodeGen/IndexAndRangeTests.cs | 4517 +++++++++++++++++ .../Test/Emit2/Semantics/InlineArrayTests.cs | 8 +- ...perationTests_IObjectCreationExpression.cs | 52 +- .../Operations/ControlFlowGraphBuilder.cs | 101 + .../Compilation/ControlFlowGraphVerifier.cs | 38 - 26 files changed, 5222 insertions(+), 179 deletions(-) create mode 100644 src/Compilers/CSharp/Test/Emit2/CodeGen/IndexAndRangeTests.cs diff --git a/docs/Language Feature Status.md b/docs/Language Feature Status.md index fcdd02fc0b30d..671b4d72e066a 100644 --- a/docs/Language Feature Status.md +++ b/docs/Language Feature Status.md @@ -16,6 +16,7 @@ efforts behind them. | [Roles/Extensions](https://github.com/dotnet/csharplang/issues/5497) | [roles](https://github.com/dotnet/roslyn/tree/features/roles) | [In Progress](https://github.com/dotnet/roslyn/issues/66722) | [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs), [jjonescz](https://github.com/jjonescz) | | [MadsTorgersen](https://github.com/MadsTorgersen) | | [Escape character](https://github.com/dotnet/csharplang/issues/7400) | N/A | [In Progress](https://github.com/dotnet/roslyn/pull/70497) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [jcouv](https://github.com/jcouv), [RikkiGibson](https://github.com/RikkiGibson) | | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | | [Method group natural type improvements](https://github.com/dotnet/csharplang/blob/main/proposals/method-group-natural-type-improvements.md) | main | In Progress | [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs), [cston](https://github.com/cston) | | [jcouv](https://github.com/jcouv) | +| Implicit indexer access in object initializers | main | Merged into 17.9p3 | [jcouv](https://github.com/jcouv) | | | | # C# 12.0 diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs index f8edc0c743746..8c528711ab11d 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs @@ -5399,6 +5399,17 @@ private BoundExpression BindObjectInitializerMember( break; } + case BoundKind.ImplicitIndexerAccess: + var implicitIndexer = (BoundImplicitIndexerAccess)boundMember; + MessageID.IDS_ImplicitIndexerInitializer.CheckFeatureAvailability(diagnostics, implicitIndexer.Syntax); + + if (isRhsNestedInitializer && GetPropertySymbol(implicitIndexer, out _, out _) is { } property) + { + hasErrors |= !CheckNestedObjectInitializerPropertySymbol(property, leftSyntax, diagnostics, hasErrors, ref resultKind); + } + + return hasErrors ? boundMember : CheckValue(boundMember, valueKind, diagnostics); + case BoundKind.DynamicObjectInitializerMember: break; diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index 8ec6569cfc9cf..18e1aed8fc22c 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -7833,4 +7833,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ The diagnosticId argument to the 'Experimental' attribute must be a valid identifier + + implicit indexer initializer + \ No newline at end of file diff --git a/src/Compilers/CSharp/Portable/Errors/MessageID.cs b/src/Compilers/CSharp/Portable/Errors/MessageID.cs index 49c64d34ee213..0258897ff46e1 100644 --- a/src/Compilers/CSharp/Portable/Errors/MessageID.cs +++ b/src/Compilers/CSharp/Portable/Errors/MessageID.cs @@ -277,6 +277,8 @@ internal enum MessageID IDS_FeatureCollectionExpressions = MessageBase + 12837, IDS_FeatureRefReadonlyParameters = MessageBase + 12838, IDS_StringEscapeCharacter = MessageBase + 12839, + + IDS_ImplicitIndexerInitializer = MessageBase + 12840, } // Message IDs may refer to strings that need to be localized. @@ -458,6 +460,7 @@ internal static LanguageVersion RequiredVersion(this MessageID feature) // C# preview features. case MessageID.IDS_StringEscapeCharacter: + case MessageID.IDS_ImplicitIndexerInitializer: return LanguageVersion.Preview; // C# 12.0 features. diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CompoundAssignmentOperator.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CompoundAssignmentOperator.cs index 8e917ca957cdf..17d6c5396afa6 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CompoundAssignmentOperator.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CompoundAssignmentOperator.cs @@ -426,6 +426,7 @@ private BoundExpression TransformIndexPatternIndexerAccess(BoundImplicitIndexerA implicitIndexerAccess, isLeftOfAssignment: true, isRegularAssignmentOrRegularCompoundAssignment: isRegularCompoundAssignment, + cacheAllArgumentsOnly: false, stores, temps); if (access is BoundIndexerAccess indexerAccess) diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs index ee384b104c7a0..2009b7fb09125 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IndexerAccess.cs @@ -2,15 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Collections.Immutable; using System.Diagnostics; -using System.Linq; using Microsoft.CodeAnalysis.CSharp.CodeGen; using Microsoft.CodeAnalysis.CSharp.Symbols; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp @@ -429,6 +425,7 @@ private BoundExpression VisitIndexPatternIndexerAccess(BoundImplicitIndexerAcces BoundExpression rewrittenIndexerAccess = GetUnderlyingIndexerOrSliceAccess( node, isLeftOfAssignment, isRegularAssignmentOrRegularCompoundAssignment: isLeftOfAssignment, + cacheAllArgumentsOnly: false, sideeffects, locals); return _factory.Sequence( @@ -441,6 +438,7 @@ private BoundExpression GetUnderlyingIndexerOrSliceAccess( BoundImplicitIndexerAccess node, bool isLeftOfAssignment, bool isRegularAssignmentOrRegularCompoundAssignment, + bool cacheAllArgumentsOnly, ArrayBuilder sideeffects, ArrayBuilder locals) { @@ -457,37 +455,41 @@ private BoundExpression GetUnderlyingIndexerOrSliceAccess( var receiver = VisitExpression(node.Receiver); - // Do not capture receiver if it is a local or parameter and we are evaluating a pattern - // If length access is a local, then we are evaluating a pattern - if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) + // Do not capture receiver if we're in an initializer + if (!cacheAllArgumentsOnly) { - Debug.Assert(receiver.Type is { }); - - var receiverLocal = F.StoreToTemp( - receiver, - out var receiverStore, - // Store the receiver as a ref local if it's a value type to ensure side effects are propagated - receiver.Type.IsReferenceType ? RefKind.None : RefKind.Ref); - locals.Add(receiverLocal.LocalSymbol); - - if (receiverLocal.LocalSymbol.IsRef && - CodeGenerator.IsPossibleReferenceTypeReceiverOfConstrainedCall(receiverLocal) && - !CodeGenerator.ReceiverIsKnownToReferToTempIfReferenceType(receiverLocal) && - ((isLeftOfAssignment && !isRegularAssignmentOrRegularCompoundAssignment) || - !CodeGenerator.IsSafeToDereferenceReceiverRefAfterEvaluatingArguments(ImmutableArray.Create(makeOffsetInput)))) + // Do not capture receiver if it is a local or parameter and we are evaluating a pattern + // If length access is a local, then we are evaluating a pattern + if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) { - BoundAssignmentOperator? extraRefInitialization; - ReferToTempIfReferenceTypeReceiver(receiverLocal, ref receiverStore, out extraRefInitialization, locals); - - if (extraRefInitialization is object) + Debug.Assert(receiver.Type is { }); + + var receiverLocal = F.StoreToTemp( + receiver, + out var receiverStore, + // Store the receiver as a ref local if it's a value type to ensure side effects are propagated + receiver.Type.IsReferenceType ? RefKind.None : RefKind.Ref); + locals.Add(receiverLocal.LocalSymbol); + + if (receiverLocal.LocalSymbol.IsRef && + CodeGenerator.IsPossibleReferenceTypeReceiverOfConstrainedCall(receiverLocal) && + !CodeGenerator.ReceiverIsKnownToReferToTempIfReferenceType(receiverLocal) && + ((isLeftOfAssignment && !isRegularAssignmentOrRegularCompoundAssignment) || + !CodeGenerator.IsSafeToDereferenceReceiverRefAfterEvaluatingArguments(ImmutableArray.Create(makeOffsetInput)))) { - sideeffects.Add(extraRefInitialization); + BoundAssignmentOperator? extraRefInitialization; + ReferToTempIfReferenceTypeReceiver(receiverLocal, ref receiverStore, out extraRefInitialization, locals); + + if (extraRefInitialization is object) + { + sideeffects.Add(extraRefInitialization); + } } - } - sideeffects.Add(receiverStore); + sideeffects.Add(receiverStore); - receiver = receiverLocal; + receiver = receiverLocal; + } } AddPlaceholderReplacement(node.ReceiverPlaceholder, receiver); @@ -524,15 +526,19 @@ private BoundExpression GetUnderlyingIndexerOrSliceAccess( Debug.Assert(node.ArgumentPlaceholders.Length == 1); var argumentPlaceholder = node.ArgumentPlaceholders[0]; - AddPlaceholderReplacement(argumentPlaceholder, integerArgument); Debug.Assert(integerArgument.Type!.SpecialType == SpecialType.System_Int32); BoundExpression rewrittenIndexerAccess; if (node.IndexerOrSliceAccess is BoundIndexerAccess indexerAccess) { + Debug.Assert(indexerAccess.Arguments.Length == 1); if (isLeftOfAssignment && indexerAccess.GetRefKind() == RefKind.None) { + // Note: we currently don't honor cacheAllArgumentsOnly in this branch, and let + // callers do the caching instead + // Tracked by https://github.com/dotnet/roslyn/issues/71056 + AddPlaceholderReplacement(argumentPlaceholder, integerArgument); ImmutableArray rewrittenArguments = VisitArgumentsAndCaptureReceiverIfNeeded( ref receiver, captureReceiverMode: ReceiverCaptureMode.Default, @@ -555,12 +561,30 @@ private BoundExpression GetUnderlyingIndexerOrSliceAccess( } else { + if (cacheAllArgumentsOnly) + { + var integerTemp = F.StoreToTemp(integerArgument, out BoundAssignmentOperator integerStore); + locals.Add(integerTemp.LocalSymbol); + sideeffects.Add(integerStore); + integerArgument = integerTemp; + } + + AddPlaceholderReplacement(argumentPlaceholder, integerArgument); rewrittenIndexerAccess = VisitIndexerAccess(indexerAccess, isLeftOfAssignment); } } else { - rewrittenIndexerAccess = (BoundExpression)VisitArrayAccess(((BoundArrayAccess)node.IndexerOrSliceAccess)); + if (cacheAllArgumentsOnly) + { + var integerTemp = F.StoreToTemp(integerArgument, out BoundAssignmentOperator integerStore); + locals.Add(integerTemp.LocalSymbol); + sideeffects.Add(integerStore); + integerArgument = integerTemp; + } + + AddPlaceholderReplacement(argumentPlaceholder, integerArgument); + rewrittenIndexerAccess = (BoundExpression)VisitArrayAccess((BoundArrayAccess)node.IndexerOrSliceAccess); } RemovePlaceholderReplacement(argumentPlaceholder); @@ -694,6 +718,20 @@ private BoundExpression DetermineMakePatternIndexOffsetExpressionStrategy( } private BoundExpression VisitRangePatternIndexerAccess(BoundImplicitIndexerAccess node) + { + var F = _factory; + var localsBuilder = ArrayBuilder.GetInstance(); + var sideEffectsBuilder = ArrayBuilder.GetInstance(); + + var rewrittenIndexerAccess = VisitRangePatternIndexerAccess(node, localsBuilder, sideEffectsBuilder, cacheAllArgumentsOnly: false); + + return F.Sequence( + localsBuilder.ToImmutableAndFree(), + sideEffectsBuilder.ToImmutableAndFree(), + rewrittenIndexerAccess); + } + + private BoundExpression VisitRangePatternIndexerAccess(BoundImplicitIndexerAccess node, ArrayBuilder localsBuilder, ArrayBuilder sideEffectsBuilder, bool cacheAllArgumentsOnly) { Debug.Assert(node.ArgumentPlaceholders.Length == 2); Debug.Assert(node.IndexerOrSliceAccess is BoundCall); @@ -721,9 +759,6 @@ private BoundExpression VisitRangePatternIndexerAccess(BoundImplicitIndexerAcces PatternIndexOffsetLoweringStrategy startStrategy, endStrategy; RewriteRangeParts(rangeArg, out rangeExpr, out startMakeOffsetInput, out startStrategy, out endMakeOffsetInput, out endStrategy, out rewrittenRangeArg); - var localsBuilder = ArrayBuilder.GetInstance(); - var sideEffectsBuilder = ArrayBuilder.GetInstance(); - // Do not capture receiver if it is a local or parameter and we are evaluating a pattern // If length access is a local, then we are evaluating a pattern if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) @@ -889,6 +924,19 @@ private BoundExpression VisitRangePatternIndexerAccess(BoundImplicitIndexerAcces startExpr = MakePatternIndexOffsetExpression(startMakeOffsetInput, lengthAccess, startStrategy); BoundExpression endExpr = MakePatternIndexOffsetExpression(endMakeOffsetInput, lengthAccess, endStrategy); rangeSizeExpr = MakeRangeSize(ref startExpr, endExpr, localsBuilder, sideEffectsBuilder); + + if (cacheAllArgumentsOnly) + { + var startLocal = F.StoreToTemp(startExpr, out var startStore); + localsBuilder.Add(startLocal.LocalSymbol); + sideEffectsBuilder.Add(startStore); + startExpr = startLocal; + + var rangeSizeLocal = F.StoreToTemp(rangeSizeExpr, out var rangeSizeStore); + localsBuilder.Add(rangeSizeLocal.LocalSymbol); + sideEffectsBuilder.Add(rangeSizeStore); + rangeSizeExpr = startLocal; + } } else { @@ -907,10 +955,7 @@ private BoundExpression VisitRangePatternIndexerAccess(BoundImplicitIndexerAcces RemovePlaceholderReplacement(node.ArgumentPlaceholders[1]); RemovePlaceholderReplacement(node.ReceiverPlaceholder); - return F.Sequence( - localsBuilder.ToImmutableAndFree(), - sideEffectsBuilder.ToImmutableAndFree(), - rewrittenIndexerAccess); + return rewrittenIndexerAccess; } private BoundExpression MakeRangeSize(ref BoundExpression startExpr, BoundExpression endExpr, ArrayBuilder localsBuilder, ArrayBuilder sideEffectsBuilder) diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ObjectOrCollectionInitializerExpression.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ObjectOrCollectionInitializerExpression.cs index b84c348bf5d3c..1fe7f82f684bd 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ObjectOrCollectionInitializerExpression.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ObjectOrCollectionInitializerExpression.cs @@ -5,7 +5,6 @@ using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.PooledObjects; using Roslyn.Utilities; -using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Linq; @@ -272,25 +271,26 @@ private void AddObjectInitializer( Debug.Assert(rewrittenReceiver != null); Debug.Assert(!_inExpressionLambda); - // Update the receiver for the field/property access as we might have introduced a temp for the initializer rewrite. + BoundExpression left = assignment.Left; + BoundExpression right = assignment.Right; + bool isRhsNestedInitializer = right.Kind is BoundKind.ObjectInitializerExpression or BoundKind.CollectionInitializerExpression; - BoundExpression? rewrittenLeft = null; - - // Do not lower pointer access yet, we'll do it later. - if (assignment.Left.Kind != BoundKind.PointerElementAccess) + if (isRhsNestedInitializer && onlyContainsEmptyLeafNestedInitializers(assignment)) { - rewrittenLeft = assignment.Left is BoundObjectInitializerMember member ? VisitObjectInitializerMember(member, ref rewrittenReceiver, result, ref temps) : VisitExpression(assignment.Left); + // If we only have nested object initializers and the leaves are empty initializers, + // then we optimize, skip calling the indexers and properties in the chain, and only evaluate the indexes + addIndexes(result, assignment); + return; } - BoundKind rhsKind = assignment.Right.Kind; - bool isRhsNestedInitializer = rhsKind == BoundKind.ObjectInitializerExpression || rhsKind == BoundKind.CollectionInitializerExpression; - BoundExpression rewrittenAccess; - switch ((rewrittenLeft ?? assignment.Left).Kind) + switch (left.Kind) { case BoundKind.ObjectInitializerMember: { - var memberInit = (BoundObjectInitializerMember?)rewrittenLeft; + var memberInit = (BoundObjectInitializerMember)VisitObjectInitializerMember( + (BoundObjectInitializerMember)left, ref rewrittenReceiver, result, ref temps); + Debug.Assert(memberInit is { }); if (!memberInit.Arguments.IsDefaultOrEmpty) @@ -327,7 +327,7 @@ private void AddObjectInitializer( if (!isRhsNestedInitializer) { - var rewrittenRight = VisitExpression(assignment.Right); + var rewrittenRight = VisitExpression(right); var setMember = _dynamicFactory.MakeDynamicSetIndex( rewrittenReceiver, memberInit.Arguments, @@ -357,7 +357,7 @@ private void AddObjectInitializer( if (!isRhsNestedInitializer) { // Rewrite simple assignment to field/property. - var rewrittenRight = VisitExpression(assignment.Right); + var rewrittenRight = VisitExpression(right); result.Add(MakeStaticAssignmentOperator(assignment.Syntax, rewrittenAccess, rewrittenRight, isRef: assignment.IsRef, assignment.Type, used: false)); return; } @@ -367,17 +367,16 @@ private void AddObjectInitializer( case BoundKind.DynamicObjectInitializerMember: { + var initializerMember = (BoundDynamicObjectInitializerMember?)VisitDynamicObjectInitializerMember((BoundDynamicObjectInitializerMember)left); + Debug.Assert(initializerMember is { }); if (dynamicSiteInitializers == null) { dynamicSiteInitializers = ArrayBuilder.GetInstance(); } - Debug.Assert(rewrittenLeft is { }); - var initializerMember = (BoundDynamicObjectInitializerMember)rewrittenLeft; - if (!isRhsNestedInitializer) { - var rewrittenRight = VisitExpression(assignment.Right); + var rewrittenRight = VisitExpression(right); var setMember = _dynamicFactory.MakeDynamicSetMember(rewrittenReceiver, initializerMember.MemberName, rewrittenRight); Debug.Assert(setMember.SiteInitialization is { }); dynamicSiteInitializers.Add(setMember.SiteInitialization); @@ -394,22 +393,42 @@ private void AddObjectInitializer( case BoundKind.ArrayAccess: { - Debug.Assert(rewrittenLeft is { }); - var arrayAccess = (BoundArrayAccess)rewrittenLeft; + var rewrittenArrayAccess = VisitArrayAccess((BoundArrayAccess)left); + Debug.Assert(rewrittenArrayAccess is { }); + + if (rewrittenArrayAccess is BoundArrayAccess arrayAccess) + { + Debug.Assert(!arrayAccess.Indices.Any(a => a.IsParamsArray)); + + var indices = EvaluateSideEffectingArgumentsToTemps( + arrayAccess.Indices, + paramRefKindsOpt: default, + result, + ref temps); + rewrittenAccess = arrayAccess.Update(rewrittenReceiver, indices, arrayAccess.Type); + } + else if (rewrittenArrayAccess is BoundCall getSubArrayCall) + { + Debug.Assert(getSubArrayCall.Arguments.Length == 2); + var rangeArgument = getSubArrayCall.Arguments[1]; + Debug.Assert(TypeSymbol.Equals(rangeArgument.Type, _compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.ConsiderEverything)); - Debug.Assert(!arrayAccess.Indices.Any(a => a.IsParamsArray)); + var rangeTemp = _factory.StoreToTemp(rangeArgument, out BoundAssignmentOperator rangeStore); + temps ??= ArrayBuilder.GetInstance(); + temps.Add(rangeTemp.LocalSymbol); + result.Add(rangeStore); - var indices = EvaluateSideEffectingArgumentsToTemps( - arrayAccess.Indices, - paramRefKindsOpt: default, - result, - ref temps); - rewrittenAccess = arrayAccess.Update(rewrittenReceiver, indices, arrayAccess.Type); + rewrittenAccess = getSubArrayCall.Update(ImmutableArray.Create(getSubArrayCall.Arguments[0], rangeTemp)); + } + else + { + throw ExceptionUtilities.UnexpectedValue(rewrittenArrayAccess.Kind); + } if (!isRhsNestedInitializer) { // Rewrite simple assignment to field/property. - var rewrittenRight = VisitExpression(assignment.Right); + var rewrittenRight = VisitExpression(right); result.Add(MakeStaticAssignmentOperator(assignment.Syntax, rewrittenAccess, rewrittenRight, false, assignment.Type, used: false)); return; } @@ -419,8 +438,7 @@ private void AddObjectInitializer( case BoundKind.PointerElementAccess: { - // Remember we haven't lowered this node yet. - var pointerAccess = (BoundPointerElementAccess)assignment.Left; + var pointerAccess = (BoundPointerElementAccess)left; var rewrittenIndex = VisitExpression(pointerAccess.Index); if (CanChangeValueBetweenReads(rewrittenIndex)) @@ -442,7 +460,7 @@ private void AddObjectInitializer( if (!isRhsNestedInitializer) { // Rewrite as simple assignment. - var rewrittenRight = VisitExpression(assignment.Right); + var rewrittenRight = VisitExpression(right); result.Add(MakeStaticAssignmentOperator(assignment.Syntax, rewrittenAccess, rewrittenRight, false, assignment.Type, used: false)); return; } @@ -450,11 +468,110 @@ private void AddObjectInitializer( break; } + case BoundKind.ImplicitIndexerAccess: + var implicitIndexer = (BoundImplicitIndexerAccess)left; + temps ??= ArrayBuilder.GetInstance(); + + if (TypeSymbol.Equals(implicitIndexer.Argument.Type, _compilation.GetWellKnownType(WellKnownType.System_Index), TypeCompareKind.ConsiderEverything)) + { + rewrittenAccess = GetUnderlyingIndexerOrSliceAccess( + implicitIndexer, + isLeftOfAssignment: !isRhsNestedInitializer, + isRegularAssignmentOrRegularCompoundAssignment: true, + cacheAllArgumentsOnly: true, + result, temps); + + if (rewrittenAccess is BoundIndexerAccess indexerAccess) + { + rewrittenAccess = TransformIndexerAccessContinued(indexerAccess, indexerAccess.ReceiverOpt!, indexerAccess.Arguments, result, temps); + } + } + else + { + rewrittenAccess = VisitRangePatternIndexerAccess(implicitIndexer, temps, result, cacheAllArgumentsOnly: true); + } + + if (!isRhsNestedInitializer) + { + var rewrittenRight = VisitExpression(right); + result.Add(MakeStaticAssignmentOperator(assignment.Syntax, rewrittenAccess, rewrittenRight, isRef: false, assignment.Type, used: false)); + return; + } + + break; + default: - throw ExceptionUtilities.UnexpectedValue((rewrittenLeft ?? assignment.Left).Kind); + throw ExceptionUtilities.UnexpectedValue(left.Kind); + } + + AddObjectOrCollectionInitializers(ref dynamicSiteInitializers, ref temps, result, rewrittenAccess, right); + return; + + static bool onlyContainsEmptyLeafNestedInitializers(BoundAssignmentOperator assignment) + { + // Guard on the cases understood by addIndexes below + if (assignment.Left is BoundObjectInitializerMember + or BoundImplicitIndexerAccess + or BoundArrayAccess + or BoundPointerElementAccess) + { + return assignment.Right is BoundObjectInitializerExpression initializer + && initializer.Initializers.All(e => e is BoundAssignmentOperator nestedAssignment && onlyContainsEmptyLeafNestedInitializers(nestedAssignment)); + } + + return false; } - AddObjectOrCollectionInitializers(ref dynamicSiteInitializers, ref temps, result, rewrittenAccess, assignment.Right); + void addIndexes(ArrayBuilder result, BoundAssignmentOperator assignment) + { + // If we have an element access of the form `[arguments] = { ... }`, we'll evaluate `arguments` only + var lhs = assignment.Left; + if (lhs is BoundObjectInitializerMember initializerMember) + { + foreach (var argument in initializerMember.Arguments) + { + if (argument is BoundArrayCreation { IsParamsArray: true, InitializerOpt: var initializers }) + { + Debug.Assert(initializers is not null); + foreach (var element in initializers.Initializers) + { + result.Add(VisitExpression(element)); + } + } + else + { + result.Add(VisitExpression(argument)); + } + } + } + else if (lhs is BoundImplicitIndexerAccess implicitIndexerAccess) + { + result.Add(VisitExpression(implicitIndexerAccess.Argument)); + } + else if (lhs is BoundArrayAccess arrayAccess) + { + foreach (var index in arrayAccess.Indices) + { + result.Add(VisitExpression(index)); + } + } + else if (lhs is BoundPointerElementAccess pointerElementAccess) + { + result.Add(VisitExpression(pointerElementAccess.Index)); + } + else + { + // We only bind to a BoundDynamicCollectionElementInitializer in a situation like: + // D = { ..., = , ... }, where D : dynamic + throw ExceptionUtilities.UnexpectedValue(lhs.Kind); + } + + // And any nested indexes + foreach (var initializer in ((BoundObjectInitializerExpression)assignment.Right).Initializers) + { + addIndexes(result, (BoundAssignmentOperator)initializer); + } + } } private ImmutableArray EvaluateSideEffectingArgumentsToTemps( diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf index fcc08676e1174..475f07d243b38 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf @@ -2312,6 +2312,11 @@ vzor odpovídající ReadOnly/Span<char> na konstantním řetězci + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf index 101b025c47f13..bf769b42d8701 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf @@ -2312,6 +2312,11 @@ Musterabgleich ReadOnly/Span<char> bei konstanter Zeichenfolge + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf index 23278bf865d57..74c99e495128a 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf @@ -2312,6 +2312,11 @@ patrón que coincide con ReadOnly/Span<char> en una cadena constante + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf index 50ec1172f4cf1..8611bb679082a 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf @@ -2312,6 +2312,11 @@ modèle correspondant à ReadOnly/Span<char> sur une chaîne constante + + implicit indexer initializer + implicit indexer initializer + + <missing> <manquant> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf index 53be698d0b523..ddbc34d027b24 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf @@ -2312,6 +2312,11 @@ criterio corrispondente a ReadOnly/Span<char> su stringa costante + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf index c31075131d1ab..95f7ecbb255e2 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf @@ -2312,6 +2312,11 @@ 定数文字列の ReadOnly/Span<char> に一致するパターン + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf index b2e86f22daa5e..77a9fa34373fe 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf @@ -2312,6 +2312,11 @@ 상수 문자열에서 ReadOnly/Span<char>과 일치하는 패턴 + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf index 0b752a2c03bf9..236f999eb9965 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf @@ -2312,6 +2312,11 @@ dopasowanie wzorca ReadOnly/Span<char> w ciągu stałym + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf index 7f560a74015a2..a13a2b3cbe7fb 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf @@ -2312,6 +2312,11 @@ padrões correspondentes a ReadOnly/Span<char> na cadeia de caracteres constante + + implicit indexer initializer + implicit indexer initializer + + <missing> <ausente> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf index 35e9baf89531e..79e1b7602661b 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf @@ -2312,6 +2312,11 @@ сопоставление шаблонов ReadOnly/Span<char> в строке константы + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf index 98f452f5333a8..05deda7de2804 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf @@ -2312,6 +2312,11 @@ sabit dizede ReadOnly/Span<char> ile eşleşen desen + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf index bdba6990c87c5..f458782bd1e06 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf @@ -2312,6 +2312,11 @@ 与常量字符串上的 ReadOnly/Span<char> 匹配的模式 + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf index c9eee73147b2b..639f76b34a4d9 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf @@ -2312,6 +2312,11 @@ 常數字串上的模式比對 ReadOnly/Span<char> + + implicit indexer initializer + implicit indexer initializer + + <missing> <missing> diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/ObjectAndCollectionInitializerTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/ObjectAndCollectionInitializerTests.cs index 57348f5504c45..bc400616f839b 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/ObjectAndCollectionInitializerTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/ObjectAndCollectionInitializerTests.cs @@ -4,6 +4,7 @@ #nullable disable +using System.Linq; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; @@ -950,7 +951,7 @@ static void Main() var compVerifier = CompileAndVerify(source, expectedOutput: expectedOutput); compVerifier.VerifyIL("A.Main()", @" { - // Code size 86 (0x56) + // Code size 84 (0x54) .maxstack 3 .locals init (int V_0, //x A V_1, @@ -985,16 +986,14 @@ .locals init (int V_0, //x IL_003c: newobj ""A..ctor()"" IL_0041: pop IL_0042: ldloc.0 - IL_0043: dup - IL_0044: ldc.i4.1 - IL_0045: add - IL_0046: stloc.0 - IL_0047: pop - IL_0048: ldc.i4.s 45 - IL_004a: call ""void System.Console.WriteLine(char)"" - IL_004f: ldloc.0 - IL_0050: call ""void System.Console.WriteLine(int)"" - IL_0055: ret + IL_0043: ldc.i4.1 + IL_0044: add + IL_0045: stloc.0 + IL_0046: ldc.i4.s 45 + IL_0048: call ""void System.Console.WriteLine(char)"" + IL_004d: ldloc.0 + IL_004e: call ""void System.Console.WriteLine(int)"" + IL_0053: ret } "); } @@ -1042,7 +1041,7 @@ static void Main() var compVerifier = CompileAndVerify(source, expectedOutput: expectedOutput); compVerifier.VerifyIL("A.Main()", @" { - // Code size 113 (0x71) + // Code size 111 (0x6f) .maxstack 5 .locals init (int V_0, //x A V_1, @@ -1092,18 +1091,193 @@ .locals init (int V_0, //x IL_0057: newobj ""A..ctor()"" IL_005c: pop IL_005d: ldloc.0 - IL_005e: dup - IL_005f: ldc.i4.1 - IL_0060: add - IL_0061: stloc.0 - IL_0062: pop - IL_0063: ldc.i4.s 45 - IL_0065: call ""void System.Console.WriteLine(char)"" - IL_006a: ldloc.0 - IL_006b: call ""void System.Console.WriteLine(int)"" - IL_0070: ret + IL_005e: ldc.i4.1 + IL_005f: add + IL_0060: stloc.0 + IL_0061: ldc.i4.s 45 + IL_0063: call ""void System.Console.WriteLine(char)"" + IL_0068: ldloc.0 + IL_0069: call ""void System.Console.WriteLine(int)"" + IL_006e: ret } "); + var comp = compVerifier.Compilation; + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new A {[x++] = { } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + Locals: [System.Int32 x] + Block[B1] - Block + Predecessors: [B0] + Statements (1) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'x = 1') + Left: + ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: System.Int32, IsImplicit) (Syntax: 'x = 1') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + Next (Regular) Block[B2] + Entering: {R2} + .locals {R2} + { + CaptureIds: [0] + Block[B2] - Block + Predecessors: [B1] + Statements (1) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new A {[x++ ... , Z = 1 } }') + Value: + IObjectCreationOperation (Constructor: A..ctor()) (OperationKind.ObjectCreation, Type: A) (Syntax: 'new A {[x++ ... , Z = 1 } }') + Arguments(0) + Initializer: + null + Next (Regular) Block[B3] + Entering: {R3} + .locals {R3} + { + CaptureIds: [1] + Block[B3] - Block + Predecessors: [B2] + Statements (4) + IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: '[x++]') + Value: + IArrayCreationOperation (OperationKind.ArrayCreation, Type: System.Int32[], IsImplicit) (Syntax: '[x++]') + Dimension Sizes(1): + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1, IsImplicit) (Syntax: '[x++]') + Initializer: + IArrayInitializerOperation (1 elements) (OperationKind.ArrayInitializer, Type: null, IsImplicit) (Syntax: '[x++]') + Element Values(1): + IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'x++') + Target: + ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x') + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'X = 1') + Left: + IFieldReferenceOperation: System.Int32 A.X (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'X') + Instance Receiver: + IPropertyReferenceOperation: A A.this[params System.Int32[] x] { get; } (OperationKind.PropertyReference, Type: A) (Syntax: '[x++]') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: A, IsImplicit) (Syntax: 'new A {[x++ ... , Z = 1 } }') + Arguments(1): + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '[x++]') + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32[], IsImplicit) (Syntax: '[x++]') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'Y = 1') + Left: + IFieldReferenceOperation: System.Int32 A.Y (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'Y') + Instance Receiver: + IPropertyReferenceOperation: A A.this[params System.Int32[] x] { get; } (OperationKind.PropertyReference, Type: A) (Syntax: '[x++]') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: A, IsImplicit) (Syntax: 'new A {[x++ ... , Z = 1 } }') + Arguments(1): + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '[x++]') + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32[], IsImplicit) (Syntax: '[x++]') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'Z = 1') + Left: + IFieldReferenceOperation: System.Int32 A.Z (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'Z') + Instance Receiver: + IPropertyReferenceOperation: A A.this[params System.Int32[] x] { get; } (OperationKind.PropertyReference, Type: A) (Syntax: '[x++]') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: A, IsImplicit) (Syntax: 'new A {[x++ ... , Z = 1 } }') + Arguments(1): + IArgumentOperation (ArgumentKind.ParamArray, Matching Parameter: x) (OperationKind.Argument, Type: null, IsImplicit) (Syntax: '[x++]') + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32[], IsImplicit) (Syntax: '[x++]') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + Next (Regular) Block[B4] + Leaving: {R3} + } + Block[B4] - Block + Predecessors: [B3] + Statements (1) + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'new A {[x++ ... Z = 1 } };') + Expression: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: A, IsImplicit) (Syntax: 'new A {[x++ ... , Z = 1 } }') + Next (Regular) Block[B5] + Leaving: {R2} + } + Block[B5] - Block + Predecessors: [B4] + Statements (1) + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'Console.WriteLine('-');') + Expression: + IInvocationOperation (void System.Console.WriteLine(System.Char value)) (OperationKind.Invocation, Type: System.Void) (Syntax: 'Console.WriteLine('-')') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: ''-'') + ILiteralOperation (OperationKind.Literal, Type: System.Char, Constant: -) (Syntax: ''-'') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B6] + Entering: {R4} + .locals {R4} + { + CaptureIds: [2] + Block[B6] - Block + Predecessors: [B5] + Statements (3) + IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new A {[x++] = { } }') + Value: + IObjectCreationOperation (Constructor: A..ctor()) (OperationKind.ObjectCreation, Type: A) (Syntax: 'new A {[x++] = { } }') + Arguments(0) + Initializer: + null + IIncrementOrDecrementOperation (Postfix) (OperationKind.Increment, Type: System.Int32) (Syntax: 'x++') + Target: + ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x') + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'new A {[x++] = { } };') + Expression: + IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: A, IsImplicit) (Syntax: 'new A {[x++] = { } }') + Next (Regular) Block[B7] + Leaving: {R4} + } + Block[B7] - Block + Predecessors: [B6] + Statements (2) + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'Console.WriteLine('-');') + Expression: + IInvocationOperation (void System.Console.WriteLine(System.Char value)) (OperationKind.Invocation, Type: System.Void) (Syntax: 'Console.WriteLine('-')') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: ''-'') + ILiteralOperation (OperationKind.Literal, Type: System.Char, Constant: -) (Syntax: ''-'') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'Console.WriteLine(x);') + Expression: + IInvocationOperation (void System.Console.WriteLine(System.Int32 value)) (OperationKind.Invocation, Type: System.Void) (Syntax: 'Console.WriteLine(x)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: value) (OperationKind.Argument, Type: null) (Syntax: 'x') + ILocalReferenceOperation: x (OperationKind.LocalReference, Type: System.Int32) (Syntax: 'x') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B8] + Leaving: {R1} +} +Block[B8] - Exit + Predecessors: [B7] + Statements (0) +""", + graph, symbol); } [Fact] @@ -1252,7 +1426,7 @@ static void Main() - 3"; - var compVerifier = CompileAndVerify(source, targetFramework: TargetFramework.StandardAndCSharp, expectedOutput: expectedOutput); + CompileAndVerify(source, targetFramework: TargetFramework.StandardAndCSharp, expectedOutput: expectedOutput); } [Fact] @@ -3377,7 +3551,7 @@ static void Main() fixed (int** pp = array2 ) { - new C(pp) { X = {[Index] = {[0] = 2, [1] = 3} } }; + M(pp); } } @@ -3385,6 +3559,11 @@ static void Main() System.Console.WriteLine(array[1]); } + static C M(int** pp) + { + return new C(pp) { X = {[Index] = {[0] = 2, [1] = 3} } }; + } + static int Index { get @@ -3399,10 +3578,78 @@ static int Index X = x; } }"; - CompileAndVerify(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), verify: Verification.Fails, expectedOutput: + var verifier = CompileAndVerify(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), verify: Verification.Fails, expectedOutput: @"get_Index 2 3"); + + var comp = verifier.Compilation; + var tree = comp.SyntaxTrees.First(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Single(); + Assert.Equal("new C(pp) { X = {[Index] = {[0] = 2, [1] = 3} } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (3) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C(pp) { ... 1] = 3} } }') + Value: + IObjectCreationOperation (Constructor: C..ctor(System.Int32** x)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C(pp) { ... 1] = 3} } }') + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument, Type: null) (Syntax: 'pp') + IParameterReferenceOperation: pp (OperationKind.ParameterReference, Type: System.Int32**) (Syntax: 'pp') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Initializer: + null + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[0] = 2') + Left: + IOperation: (OperationKind.None, Type: System.Int32) (Syntax: '[0]') + Children(2): + IOperation: (OperationKind.None, Type: System.Int32*) (Syntax: '[Index]') + Children(2): + IFieldReferenceOperation: System.Int32** C.X (OperationKind.FieldReference, Type: System.Int32**) (Syntax: 'X') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C(pp) { ... 1] = 3} } }') + IPropertyReferenceOperation: System.Int32 C.Index { get; } (Static) (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'Index') + Instance Receiver: + null + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[1] = 3') + Left: + IOperation: (OperationKind.None, Type: System.Int32) (Syntax: '[1]') + Children(2): + IOperation: (OperationKind.None, Type: System.Int32*) (Syntax: '[Index]') + Children(2): + IFieldReferenceOperation: System.Int32** C.X (OperationKind.FieldReference, Type: System.Int32**) (Syntax: 'X') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C(pp) { ... 1] = 3} } }') + IPropertyReferenceOperation: System.Int32 C.Index { get; } (Static) (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'Index') + Instance Receiver: + null + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') + Next (Return) Block[B2] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C(pp) { ... 1] = 3} } }') + Leaving: {R1} +} +Block[B2] - Exit + Predecessors: [B1] + Statements (0) +""", + graph, symbol); } [Fact] diff --git a/src/Compilers/CSharp/Test/Emit2/CodeGen/IndexAndRangeTests.cs b/src/Compilers/CSharp/Test/Emit2/CodeGen/IndexAndRangeTests.cs new file mode 100644 index 0000000000000..9bab84daa2b20 --- /dev/null +++ b/src/Compilers/CSharp/Test/Emit2/CodeGen/IndexAndRangeTests.cs @@ -0,0 +1,4517 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#nullable disable + +using System.Linq; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.CSharp.Test.Utilities; +using Microsoft.CodeAnalysis.Test.Utilities; +using Roslyn.Test.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.CSharp.UnitTests.CodeGen +{ + public class IndexAndRangeTests : CSharpTestBase + { + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index(bool useCsharp13) + { + string source = """ +M(new Buffer10()); +M2(); +M3(); + +class C +{ + public Buffer10 F = new Buffer10(); +} + +partial class Program +{ + static void M(Buffer10 b) + { + b[Id(^1)] = 1; + } + + static Buffer10 M2() { return new Buffer10() { [Id(^1)] = Id(2) }; } + static C M3() => new C() { F = {[Id(^1)] = Id(3)} }; + + static int Id(int i) { System.Console.Write($"{i} "); return i; } + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length { get { System.Console.Write("Length "); return 10; } } + public int this[int x] + { + get => throw null; + set { System.Console.Write($"Index={x} Value={value}, "); } + } +} +"""; + var comp = CreateCompilationWithIndex(source, parseOptions: useCsharp13 ? TestOptions.RegularNext : TestOptions.RegularPreview); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1) Length Index=9 Value=1, Index(^1) Length 2 Index=9 Value=2, Index(^1) Length 3 Index=9 Value=3,"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("Program.M2", """ +{ + // Code size 51 (0x33) + .maxstack 3 + .locals init (Buffer10 V_0, + int V_1, + System.Index V_2) + IL_0000: ldloca.s V_0 + IL_0002: call "Buffer10..ctor()" + IL_0007: ldc.i4.1 + IL_0008: ldc.i4.1 + IL_0009: newobj "System.Index..ctor(int, bool)" + IL_000e: call "System.Index Program.Id(System.Index)" + IL_0013: stloc.2 + IL_0014: ldloca.s V_2 + IL_0016: ldloca.s V_0 + IL_0018: call "int Buffer10.Length.get" + IL_001d: call "int System.Index.GetOffset(int)" + IL_0022: stloc.1 + IL_0023: ldloca.s V_0 + IL_0025: ldloc.1 + IL_0026: ldc.i4.2 + IL_0027: call "int Program.Id(int)" + IL_002c: call "void Buffer10.this[int].set" + IL_0031: ldloc.0 + IL_0032: ret +} +"""); + + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Skip(2).First(); + Assert.Equal("new Buffer10() { [Id(^1)] = Id(2) }", node.ToString()); + + comp.VerifyOperationTree(node, expectedOperationTree: """ +IObjectCreationOperation (Constructor: Buffer10..ctor()) (OperationKind.ObjectCreation, Type: Buffer10) (Syntax: 'new Buffer1 ... ] = Id(2) }') +Arguments(0) +Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: Buffer10) (Syntax: '{ [Id(^1)] = Id(2) }') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(^1)] = Id(2)') + Left: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: System.Int32) (Syntax: '[Id(^1)]') + Instance: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: Buffer10, IsImplicit) (Syntax: 'Buffer10') + Argument: + IInvocationOperation (System.Index Program.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(^1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '^1') + IUnaryOperation (UnaryOperatorKind.Hat) (OperationKind.Unary, Type: System.Index) (Syntax: '^1') + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: System.Int32 Buffer10.this[System.Int32 x] { get; set; } + Right: + IInvocationOperation (System.Int32 Program.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '2') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +"""); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (1) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new Buffer1 ... ] = Id(2) }') + Value: + IObjectCreationOperation (Constructor: Buffer10..ctor()) (OperationKind.ObjectCreation, Type: Buffer10) (Syntax: 'new Buffer1 ... ] = Id(2) }') + Arguments(0) + Initializer: + null + Next (Regular) Block[B2] + Entering: {R2} + .locals {R2} + { + CaptureIds: [1] + Block[B2] - Block + Predecessors: [B1] + Statements (2) + IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(^1)') + Value: + IInvocationOperation (System.Index Program.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(^1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '^1') + IUnaryOperation (UnaryOperatorKind.Hat) (OperationKind.Unary, Type: System.Index) (Syntax: '^1') + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(^1)] = Id(2)') + Left: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: System.Int32) (Syntax: '[Id(^1)]') + Instance: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10, IsImplicit) (Syntax: 'new Buffer1 ... ] = Id(2) }') + Argument: + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Index, IsImplicit) (Syntax: 'Id(^1)') + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: System.Int32 Buffer10.this[System.Int32 x] { get; set; } + Right: + IInvocationOperation (System.Int32 Program.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '2') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B3] + Leaving: {R2} + } + Block[B3] - Block + Predecessors: [B2] + Statements (0) + Next (Return) Block[B4] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10, IsImplicit) (Syntax: 'new Buffer1 ... ] = Id(2) }') + Leaving: {R1} +} +Block[B4] - Exit + Predecessors: [B3] + Statements (0) +""", + graph, symbol); + + comp = CreateCompilationWithIndex(source, parseOptions: TestOptions.Regular12); + comp.VerifyDiagnostics( + // (17,52): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // static Buffer10 M2() { return new Buffer10() { [Id(^1)] = Id(2) }; } + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[Id(^1)]").WithArguments("implicit indexer initializer").WithLocation(17, 52), + // (18,37): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // static C M3() => new C() { F = {[Id(^1)] = Id(3)} }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[Id(^1)]").WithArguments("implicit indexer initializer").WithLocation(18, 37) + ); + } + + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_EmptyInitializer(bool useCsharp13) + { + string source = """ +M(); + +partial class Program +{ + static Buffer10 M() { return new Buffer10() { [Id(^1)] = { } }; } + + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length => throw null; + public object this[int x] => throw null; +} +"""; + var comp = CreateCompilationWithIndex(source, parseOptions: useCsharp13 ? TestOptions.RegularNext : TestOptions.RegularPreview); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1)"); + verifier.VerifyDiagnostics(); + + comp = CreateCompilationWithIndex(source, parseOptions: TestOptions.Regular12); + comp.VerifyDiagnostics( + // (5,51): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // static Buffer10 M() { return new Buffer10() { [Id(^1)] = { } }; } + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[Id(^1)]").WithArguments("implicit indexer initializer").WithLocation(5, 51) + ); + } + + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_NestedCollectionInitializer(bool useCsharp13) + { + string source = """ +using System.Collections; +using System.Collections.Generic; + +M(); + +partial class Program +{ + static Buffer10 M() { return new Buffer10() { [Id(^1)] = { Id(1), Id(2) } }; } + + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +class C : System.Collections.Generic.IEnumerable +{ + public void Add(int i) { } + IEnumerator IEnumerable.GetEnumerator() { yield return 0; } + IEnumerator IEnumerable.GetEnumerator() { yield return 0; } +} + +struct Buffer10 +{ + public int Length => 10; + public C this[int x] => new C(); +} +"""; + var comp = CreateCompilationWithIndex(source, parseOptions: useCsharp13 ? TestOptions.RegularNext : TestOptions.RegularPreview); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1) Id(1) Id(2)"); + verifier.VerifyDiagnostics(); + + comp = CreateCompilationWithIndex(source, parseOptions: TestOptions.Regular12); + comp.VerifyDiagnostics( + // (8,51): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // static Buffer10 M() { return new Buffer10() { [Id(^1)] = { Id(1), Id(2) } }; } + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[Id(^1)]").WithArguments("implicit indexer initializer").WithLocation(8, 51) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_FieldInitializerWithEmptyInitializer() + { + string source = """ +M(); + +partial class Program +{ + static Buffer10 M() { return new Buffer10() { [Id(^1)] = { F = { } } }; } + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length => throw null; + public C this[int x] => throw null; +} + +class C +{ + public object F = 0; +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1)"); + verifier.VerifyDiagnostics(); + + verifier.VerifyIL("Program.M", """ +{ + // Code size 19 (0x13) + .maxstack 3 + IL_0000: newobj "Buffer10..ctor()" + IL_0005: ldc.i4.1 + IL_0006: ldc.i4.1 + IL_0007: newobj "System.Index..ctor(int, bool)" + IL_000c: call "System.Index Program.Id(System.Index)" + IL_0011: pop + IL_0012: ret +} +"""); + + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + Assert.Equal("new Buffer10() { [Id(^1)] = { F = { } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (2) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new Buffer1 ... F = { } } }') + Value: + IObjectCreationOperation (Constructor: Buffer10..ctor()) (OperationKind.ObjectCreation, Type: Buffer10) (Syntax: 'new Buffer1 ... F = { } } }') + Arguments(0) + Initializer: + null + IInvocationOperation (System.Index Program.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(^1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '^1') + IUnaryOperation (UnaryOperatorKind.Hat) (OperationKind.Unary, Type: System.Index) (Syntax: '^1') + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Return) Block[B2] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10, IsImplicit) (Syntax: 'new Buffer1 ... F = { } } }') + Leaving: {R1} +} +Block[B2] - Exit + Predecessors: [B1] + Statements (0) +""", + graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_FieldLikeEventInitializerWithEmptyInitializer() + { + string source = """ +M(); + +partial class Program +{ + public event System.Action F; + static Buffer10 M() { return new Buffer10() { [Id(^1)] = { F = { } } }; } + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length => throw null; + public Program this[int x] => throw null; +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1)"); + verifier.VerifyDiagnostics( + // (5,32): warning CS0067: The event 'Program.F' is never used + // public event System.Action F; + Diagnostic(ErrorCode.WRN_UnreferencedEvent, "F").WithArguments("Program.F").WithLocation(5, 32) + ); + + verifier.VerifyIL("Program.M", """ +{ + // Code size 19 (0x13) + .maxstack 3 + IL_0000: newobj "Buffer10..ctor()" + IL_0005: ldc.i4.1 + IL_0006: ldc.i4.1 + IL_0007: newobj "System.Index..ctor(int, bool)" + IL_000c: call "System.Index Program.Id(System.Index)" + IL_0011: pop + IL_0012: ret +} +"""); + + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + Assert.Equal("new Buffer10() { [Id(^1)] = { F = { } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (2) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new Buffer1 ... F = { } } }') + Value: + IObjectCreationOperation (Constructor: Buffer10..ctor()) (OperationKind.ObjectCreation, Type: Buffer10) (Syntax: 'new Buffer1 ... F = { } } }') + Arguments(0) + Initializer: + null + IInvocationOperation (System.Index Program.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(^1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '^1') + IUnaryOperation (UnaryOperatorKind.Hat) (OperationKind.Unary, Type: System.Index) (Syntax: '^1') + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Return) Block[B2] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10, IsImplicit) (Syntax: 'new Buffer1 ... F = { } } }') + Leaving: {R1} +} +Block[B2] - Exit + Predecessors: [B1] + Statements (0) +""", + graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_PropertyInitializerWithEmptyInitializer() + { + string source = """ +M(); + +partial class Program +{ + static Buffer10 M() { return new Buffer10() { [Id(^1)] = { F = { } } }; } + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length => throw null; + public C this[int x] => throw null; +} + +class C +{ + public object F { get { throw null; } } +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1)"); + verifier.VerifyDiagnostics(); + + verifier.VerifyIL("Program.M", """ +{ + // Code size 19 (0x13) + .maxstack 3 + IL_0000: newobj "Buffer10..ctor()" + IL_0005: ldc.i4.1 + IL_0006: ldc.i4.1 + IL_0007: newobj "System.Index..ctor(int, bool)" + IL_000c: call "System.Index Program.Id(System.Index)" + IL_0011: pop + IL_0012: ret +} +"""); + + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + Assert.Equal("new Buffer10() { [Id(^1)] = { F = { } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (2) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new Buffer1 ... F = { } } }') + Value: + IObjectCreationOperation (Constructor: Buffer10..ctor()) (OperationKind.ObjectCreation, Type: Buffer10) (Syntax: 'new Buffer1 ... F = { } } }') + Arguments(0) + Initializer: + null + IInvocationOperation (System.Index Program.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(^1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '^1') + IUnaryOperation (UnaryOperatorKind.Hat) (OperationKind.Unary, Type: System.Index) (Syntax: '^1') + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Return) Block[B2] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10, IsImplicit) (Syntax: 'new Buffer1 ... F = { } } }') + Leaving: {R1} +} +Block[B2] - Exit + Predecessors: [B1] + Statements (0) +""", + graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_Array() + { + string source = """ +class C +{ + public static void Main() + { + var c = M(); + System.Console.Write($"Result={c.F[^1]},{c.F[^2]}"); + } + + public static C M() => new C() { F = {[Id(^1)] = Id(42), [Id(^2)] = Id(43)} }; + + public int[] F = new int[10]; + + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + public static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} +"""; + var comp = CreateCompilationWithIndex(source, options: TestOptions.ReleaseExe); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1) Id(42) Index(^2) Id(43) Result=42,43"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 96 (0x60) + .maxstack 3 + .locals init (C V_0, + int V_1, + int V_2, + System.Index V_3) + IL_0000: newobj "C..ctor()" + IL_0005: stloc.0 + IL_0006: ldc.i4.1 + IL_0007: ldc.i4.1 + IL_0008: newobj "System.Index..ctor(int, bool)" + IL_000d: call "System.Index C.Id(System.Index)" + IL_0012: stloc.3 + IL_0013: ldloca.s V_3 + IL_0015: ldloc.0 + IL_0016: ldfld "int[] C.F" + IL_001b: ldlen + IL_001c: conv.i4 + IL_001d: call "int System.Index.GetOffset(int)" + IL_0022: stloc.1 + IL_0023: ldloc.0 + IL_0024: ldfld "int[] C.F" + IL_0029: ldloc.1 + IL_002a: ldc.i4.s 42 + IL_002c: call "int C.Id(int)" + IL_0031: stelem.i4 + IL_0032: ldc.i4.2 + IL_0033: ldc.i4.1 + IL_0034: newobj "System.Index..ctor(int, bool)" + IL_0039: call "System.Index C.Id(System.Index)" + IL_003e: stloc.3 + IL_003f: ldloca.s V_3 + IL_0041: ldloc.0 + IL_0042: ldfld "int[] C.F" + IL_0047: ldlen + IL_0048: conv.i4 + IL_0049: call "int System.Index.GetOffset(int)" + IL_004e: stloc.2 + IL_004f: ldloc.0 + IL_0050: ldfld "int[] C.F" + IL_0055: ldloc.2 + IL_0056: ldc.i4.s 43 + IL_0058: call "int C.Id(int)" + IL_005d: stelem.i4 + IL_005e: ldloc.0 + IL_005f: ret +} +"""); + + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Single(); + Assert.Equal("new C() { F = {[Id(^1)] = Id(42), [Id(^2)] = Id(43)} }", node.ToString()); + + comp.VerifyOperationTree(node, expectedOperationTree: """ +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... = Id(43)} }') +Arguments(0) +Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C) (Syntax: '{ F = {[Id( ... = Id(43)} }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: System.Int32[]) (Syntax: 'F = {[Id(^1 ... ] = Id(43)}') + InitializedMember: + IFieldReferenceOperation: System.Int32[] C.F (OperationKind.FieldReference, Type: System.Int32[]) (Syntax: 'F') + Instance Receiver: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'F') + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: System.Int32[]) (Syntax: '{[Id(^1)] = ... ] = Id(43)}') + Initializers(2): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(^1)] = Id(42)') + Left: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32) (Syntax: '[Id(^1)]') + Array reference: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: System.Int32[], IsImplicit) (Syntax: 'F') + Indices(1): + IInvocationOperation (System.Index C.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(^1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '^1') + IUnaryOperation (UnaryOperatorKind.Hat) (OperationKind.Unary, Type: System.Index) (Syntax: '^1') + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(42)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '42') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 42) (Syntax: '42') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(^2)] = Id(43)') + Left: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32) (Syntax: '[Id(^2)]') + Array reference: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: System.Int32[], IsImplicit) (Syntax: 'F') + Indices(1): + IInvocationOperation (System.Index C.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(^2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '^2') + IUnaryOperation (UnaryOperatorKind.Hat) (OperationKind.Unary, Type: System.Index) (Syntax: '^2') + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(43)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '43') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 43) (Syntax: '43') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +"""); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (1) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C() { F ... = Id(43)} }') + Value: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... = Id(43)} }') + Arguments(0) + Initializer: + null + Next (Regular) Block[B2] + Entering: {R2} + .locals {R2} + { + CaptureIds: [1] + Block[B2] - Block + Predecessors: [B1] + Statements (2) + IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(^1)') + Value: + IInvocationOperation (System.Index C.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(^1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '^1') + IUnaryOperation (UnaryOperatorKind.Hat) (OperationKind.Unary, Type: System.Index) (Syntax: '^1') + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(^1)] = Id(42)') + Left: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32) (Syntax: '[Id(^1)]') + Array reference: + IFieldReferenceOperation: System.Int32[] C.F (OperationKind.FieldReference, Type: System.Int32[]) (Syntax: 'F') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... = Id(43)} }') + Indices(1): + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Index, IsImplicit) (Syntax: 'Id(^1)') + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(42)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '42') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 42) (Syntax: '42') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B3] + Leaving: {R2} + Entering: {R3} + } + .locals {R3} + { + CaptureIds: [2] + Block[B3] - Block + Predecessors: [B2] + Statements (2) + IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(^2)') + Value: + IInvocationOperation (System.Index C.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(^2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '^2') + IUnaryOperation (UnaryOperatorKind.Hat) (OperationKind.Unary, Type: System.Index) (Syntax: '^2') + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(^2)] = Id(43)') + Left: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32) (Syntax: '[Id(^2)]') + Array reference: + IFieldReferenceOperation: System.Int32[] C.F (OperationKind.FieldReference, Type: System.Int32[]) (Syntax: 'F') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... = Id(43)} }') + Indices(1): + IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Index, IsImplicit) (Syntax: 'Id(^2)') + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(43)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '43') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 43) (Syntax: '43') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B4] + Leaving: {R3} + } + Block[B4] - Block + Predecessors: [B3] + Statements (0) + Next (Return) Block[B5] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... = Id(43)} }') + Leaving: {R1} +} +Block[B5] - Exit + Predecessors: [B4] + Statements (0) +""", graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Integer_Array() + { + string source = """ +class C +{ + public static void Main() + { + var c = M(); + System.Console.Write($"Result={c.F[1]},{c.F[2]}"); + } + + public static C M() => new C() { F = {[Id(1)] = Id(42), [Id(2)] = Id(43)} }; + + public int[] F = new int[10]; + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } +} +"""; + var comp = CreateCompilationWithIndex(source, options: TestOptions.ReleaseExe); + var verifier = CompileAndVerify(comp, expectedOutput: "Id(1) Id(42) Id(2) Id(43) Result=42,43"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 50 (0x32) + .maxstack 4 + .locals init (int V_0, + int V_1) + IL_0000: newobj "C..ctor()" + IL_0005: ldc.i4.1 + IL_0006: call "int C.Id(int)" + IL_000b: stloc.0 + IL_000c: dup + IL_000d: ldfld "int[] C.F" + IL_0012: ldloc.0 + IL_0013: ldc.i4.s 42 + IL_0015: call "int C.Id(int)" + IL_001a: stelem.i4 + IL_001b: ldc.i4.2 + IL_001c: call "int C.Id(int)" + IL_0021: stloc.1 + IL_0022: dup + IL_0023: ldfld "int[] C.F" + IL_0028: ldloc.1 + IL_0029: ldc.i4.s 43 + IL_002b: call "int C.Id(int)" + IL_0030: stelem.i4 + IL_0031: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_Array_GetOffset() + { + string source = """ +class C +{ + public static void M(System.Index index) + { + _ = new C() { F = {[index] = 42} }; + } + + public int[] F = new int[10]; +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 33 (0x21) + .maxstack 3 + .locals init (C V_0, + int V_1) + IL_0000: newobj "C..ctor()" + IL_0005: stloc.0 + IL_0006: ldarga.s V_0 + IL_0008: ldloc.0 + IL_0009: ldfld "int[] C.F" + IL_000e: ldlen + IL_000f: conv.i4 + IL_0010: call "int System.Index.GetOffset(int)" + IL_0015: stloc.1 + IL_0016: ldloc.0 + IL_0017: ldfld "int[] C.F" + IL_001c: ldloc.1 + IL_001d: ldc.i4.s 42 + IL_001f: stelem.i4 + IL_0020: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_Array_GetOffset_WithNesting() + { + string source = """ +var x = C.M(^1, ^2, ^3); +System.Console.Write($"Result={x.F[^1][^2]},{x.F[^1][^3]}"); + +class C +{ + public static C M(System.Index index, System.Index index2, System.Index index3) + { + return new C() { F = {[Id(index)] = { [Id(index2)] = Id(42), [Id(index3)] = Id(43) } } }; + } + + public int[][] F = new int[2][] { new int[4], new int[4] }; + + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + public static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1) Index(^2) Id(42) Index(^3) Id(43) Result=42,43"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 118 (0x76) + .maxstack 3 + .locals init (C V_0, + int V_1, + int V_2, + int V_3, + System.Index V_4) + IL_0000: newobj "C..ctor()" + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: call "System.Index C.Id(System.Index)" + IL_000c: stloc.s V_4 + IL_000e: ldloca.s V_4 + IL_0010: ldloc.0 + IL_0011: ldfld "int[][] C.F" + IL_0016: ldlen + IL_0017: conv.i4 + IL_0018: call "int System.Index.GetOffset(int)" + IL_001d: stloc.1 + IL_001e: ldarg.1 + IL_001f: call "System.Index C.Id(System.Index)" + IL_0024: stloc.s V_4 + IL_0026: ldloca.s V_4 + IL_0028: ldloc.0 + IL_0029: ldfld "int[][] C.F" + IL_002e: ldloc.1 + IL_002f: ldelem.ref + IL_0030: ldlen + IL_0031: conv.i4 + IL_0032: call "int System.Index.GetOffset(int)" + IL_0037: stloc.2 + IL_0038: ldloc.0 + IL_0039: ldfld "int[][] C.F" + IL_003e: ldloc.1 + IL_003f: ldelem.ref + IL_0040: ldloc.2 + IL_0041: ldc.i4.s 42 + IL_0043: call "int C.Id(int)" + IL_0048: stelem.i4 + IL_0049: ldarg.2 + IL_004a: call "System.Index C.Id(System.Index)" + IL_004f: stloc.s V_4 + IL_0051: ldloca.s V_4 + IL_0053: ldloc.0 + IL_0054: ldfld "int[][] C.F" + IL_0059: ldloc.1 + IL_005a: ldelem.ref + IL_005b: ldlen + IL_005c: conv.i4 + IL_005d: call "int System.Index.GetOffset(int)" + IL_0062: stloc.3 + IL_0063: ldloc.0 + IL_0064: ldfld "int[][] C.F" + IL_0069: ldloc.1 + IL_006a: ldelem.ref + IL_006b: ldloc.3 + IL_006c: ldc.i4.s 43 + IL_006e: call "int C.Id(int)" + IL_0073: stelem.i4 + IL_0074: ldloc.0 + IL_0075: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_Twice() + { + string source = """ +M(^1, ^2); + +partial class Program +{ + static Buffer10 M(System.Index i1, System.Index i2) => new Buffer10() { [Id(i1)] = Id(1), [Id(i2)] = Id(2) }; + + static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length { get { System.Console.Write("Length "); return 10; } } + public int this[int x] + { + get => throw null; + set { System.Console.Write($"Index={x} Value={value} "); } + } +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1) Length Id(1) Index=9 Value=1 Index(^2) Length Id(2) Index=8 Value=2"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("Program.M", """ +{ + // Code size 81 (0x51) + .maxstack 3 + .locals init (Buffer10 V_0, + int V_1, + int V_2, + System.Index V_3) + IL_0000: ldloca.s V_0 + IL_0002: call "Buffer10..ctor()" + IL_0007: ldarg.0 + IL_0008: call "System.Index Program.Id(System.Index)" + IL_000d: stloc.3 + IL_000e: ldloca.s V_3 + IL_0010: ldloca.s V_0 + IL_0012: call "int Buffer10.Length.get" + IL_0017: call "int System.Index.GetOffset(int)" + IL_001c: stloc.1 + IL_001d: ldloca.s V_0 + IL_001f: ldloc.1 + IL_0020: ldc.i4.1 + IL_0021: call "int Program.Id(int)" + IL_0026: call "void Buffer10.this[int].set" + IL_002b: ldarg.1 + IL_002c: call "System.Index Program.Id(System.Index)" + IL_0031: stloc.3 + IL_0032: ldloca.s V_3 + IL_0034: ldloca.s V_0 + IL_0036: call "int Buffer10.Length.get" + IL_003b: call "int System.Index.GetOffset(int)" + IL_0040: stloc.2 + IL_0041: ldloca.s V_0 + IL_0043: ldloc.2 + IL_0044: ldc.i4.2 + IL_0045: call "int Program.Id(int)" + IL_004a: call "void Buffer10.this[int].set" + IL_004f: ldloc.0 + IL_0050: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_OptionalParameter() + { + string source = """ +Buffer10 b = default; +b[^1] = 42; // 1 + +_ = new Buffer10() { [^1] = 42 }; // 2 + +struct Buffer10 +{ + public Buffer10() { } + + public int Length => throw null; + public int this[int x, int y = 0] + { + get => throw null; + set => throw null; + } +} +"""; + var comp = CreateCompilation(source, targetFramework: TargetFramework.Net70); + comp.VerifyDiagnostics( + // (2,3): error CS1503: Argument 1: cannot convert from 'System.Index' to 'int' + // b[^1] = 42; // 1 + Diagnostic(ErrorCode.ERR_BadArgType, "^1").WithArguments("1", "System.Index", "int").WithLocation(2, 3), + // (4,23): error CS1503: Argument 1: cannot convert from 'System.Index' to 'int' + // _ = new Buffer10() { [^1] = 42 }; // 2 + Diagnostic(ErrorCode.ERR_BadArgType, "^1").WithArguments("1", "System.Index", "int").WithLocation(4, 23) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_Unassigned() + { + string source = """ +class Program +{ + static Buffer10 M() + { + int i; + return new Buffer10() { [^1] = i }; // 1 + } +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length => throw null; + public int this[int x] + { + get => throw null; + set => throw null; + } +} +"""; + var comp = CreateCompilation(source, targetFramework: TargetFramework.Net70); + comp.VerifyDiagnostics( + // (6,40): error CS0165: Use of unassigned local variable 'i' + // return new Buffer10() { [^1] = i }; // 1 + Diagnostic(ErrorCode.ERR_UseDefViolation, "i").WithArguments("i").WithLocation(6, 40) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_Nullability() + { + string source = """ +#nullable enable +string? s = null; +_ = new Buffer10() { [^1] = s }; // 1 + +struct Buffer10 +{ + public Buffer10() { } + + public int Length => throw null!; + public string this[int x] + { + get => throw null!; + set => throw null!; + } +} +"""; + var comp = CreateCompilation(source, targetFramework: TargetFramework.Net70); + comp.VerifyDiagnostics( + // (3,29): warning CS8601: Possible null reference assignment. + // _ = new Buffer10() { [^1] = s }; // 1 + Diagnostic(ErrorCode.WRN_NullReferenceAssignment, "s").WithLocation(3, 29) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_Readonly() + { + string source = """ +class C +{ + public Buffer10 F = new Buffer10(); +} + +class Program +{ + static void M(Buffer10 b) + { + b[^1] = 123; + } + + static Buffer10 M2() => new Buffer10() { [^1] = 111 }; + static C M3() => new C() { F = {[^1] = 111} }; +} + +struct Buffer10 +{ + public int[] _array = new int[10]; + public Buffer10() { } + + public int Length => 10; + public int this[int x] + { + get => _array[x]; + } +} +"""; + var comp = CreateCompilation(source, targetFramework: TargetFramework.Net70); + comp.VerifyDiagnostics( + // (10,9): error CS0200: Property or indexer 'Buffer10.this[int]' cannot be assigned to -- it is read only + // b[^1] = 123; + Diagnostic(ErrorCode.ERR_AssgReadonlyProp, "b[^1]").WithArguments("Buffer10.this[int]").WithLocation(10, 9), + // (13,46): error CS0200: Property or indexer 'Buffer10.this[int]' cannot be assigned to -- it is read only + // static Buffer10 M2() => new Buffer10() { [^1] = 111 }; + Diagnostic(ErrorCode.ERR_AssgReadonlyProp, "[^1]").WithArguments("Buffer10.this[int]").WithLocation(13, 46), + // (14,37): error CS0200: Property or indexer 'Buffer10.this[int]' cannot be assigned to -- it is read only + // static C M3() => new C() { F = {[^1] = 111} }; + Diagnostic(ErrorCode.ERR_AssgReadonlyProp, "[^1]").WithArguments("Buffer10.this[int]").WithLocation(14, 37) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_RefReturningIndexer() + { + string source = """ +var b = new Buffer10() { [^1] = 42 }; +System.Console.WriteLine($"Result={b[^1]}"); + +class Buffer10 +{ + public Buffer10() { } + + public int field = 0; + public int Length { get { System.Console.Write("Length "); return 10; } } + public ref int this[int x] + { + get { System.Console.Write($"Index={x} "); return ref field; } + } +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Length Index=9 Length Index=9 Result=42"); + verifier.VerifyDiagnostics(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_RefReturningIndexer_WithNesting() + { + string source = """ +var m = M(); +System.Console.Write("Result: "); +System.Console.Write(m[Id(^1)][Id(^2)]); + +partial class Program +{ + public static Container M() + { + return new Container() { [Id(^1)] = { [Id(^2)] = Id(42) } }; + } + + static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +class Container +{ + public Buffer10 field = new Buffer10(); + public int Length { get { System.Console.Write("ContainerLength "); return 10; } } + public ref Buffer10 this[int x] + { + get { System.Console.Write($"ContainerIndex={x} "); return ref field; } + } +} + +class Buffer10 +{ + public Buffer10() { } + + public int field = 0; + public int Length { get { System.Console.Write("Length "); return 10; } } + public ref int this[int x] + { + get { System.Console.Write($"Index={x} "); return ref field; } + } +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1) ContainerLength Index(^2) ContainerIndex=9 Length ContainerIndex=9 Index=8 Id(42)" + + " Result: Index(^1) ContainerLength ContainerIndex=9 Index(^2) Length Index=8 42"); + verifier.VerifyDiagnostics(); + + verifier.VerifyIL("Program.M", """ +{ + // Code size 91 (0x5b) + .maxstack 3 + .locals init (Container V_0, + int V_1, + int V_2, + System.Index V_3) + IL_0000: newobj "Container..ctor()" + IL_0005: stloc.0 + IL_0006: ldc.i4.1 + IL_0007: ldc.i4.1 + IL_0008: newobj "System.Index..ctor(int, bool)" + IL_000d: call "System.Index Program.Id(System.Index)" + IL_0012: stloc.3 + IL_0013: ldloca.s V_3 + IL_0015: ldloc.0 + IL_0016: callvirt "int Container.Length.get" + IL_001b: call "int System.Index.GetOffset(int)" + IL_0020: stloc.1 + IL_0021: ldc.i4.2 + IL_0022: ldc.i4.1 + IL_0023: newobj "System.Index..ctor(int, bool)" + IL_0028: call "System.Index Program.Id(System.Index)" + IL_002d: stloc.3 + IL_002e: ldloca.s V_3 + IL_0030: ldloc.0 + IL_0031: ldloc.1 + IL_0032: callvirt "ref Buffer10 Container.this[int].get" + IL_0037: ldind.ref + IL_0038: callvirt "int Buffer10.Length.get" + IL_003d: call "int System.Index.GetOffset(int)" + IL_0042: stloc.2 + IL_0043: ldloc.0 + IL_0044: ldloc.1 + IL_0045: callvirt "ref Buffer10 Container.this[int].get" + IL_004a: ldind.ref + IL_004b: ldloc.2 + IL_004c: callvirt "ref int Buffer10.this[int].get" + IL_0051: ldc.i4.s 42 + IL_0053: call "int Program.Id(int)" + IL_0058: stind.i4 + IL_0059: ldloc.0 + IL_005a: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_RefReturningIndexer_WithEmptyNesting() + { + string source = """ +M(); + +partial class Program +{ + public static Buffer10 M() + { + return new Buffer10() { [Id(^1)] = { } }; + } + + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +class Buffer10 +{ + public int field = 0; + public int Length => throw null; + public ref object this[int x] => throw null; +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1)"); + verifier.VerifyDiagnostics(); + + verifier.VerifyIL("Program.M", """ +{ + // Code size 19 (0x13) + .maxstack 3 + IL_0000: newobj "Buffer10..ctor()" + IL_0005: ldc.i4.1 + IL_0006: ldc.i4.1 + IL_0007: newobj "System.Index..ctor(int, bool)" + IL_000c: call "System.Index Program.Id(System.Index)" + IL_0011: pop + IL_0012: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_RefReadonlyReturningIndexer_WithNesting() + { + string source = """ +var m = M(); +System.Console.Write("Result: "); +System.Console.Write(m[Id(^1)][Id(^2)]); + +partial class Program +{ + public static Container M() + { + return new Container() { [Id(^1)] = { [Id(^2)] = Id(42) } }; + } + + static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +class Container +{ + public Buffer10 field = new Buffer10(); + public int Length { get { System.Console.Write("ContainerLength "); return 10; } } + public ref readonly Buffer10 this[int x] + { + get { System.Console.Write($"ContainerIndex={x} "); return ref field; } + } +} + +class Buffer10 +{ + public Buffer10() { } + + public int field = 0; + public int Length { get { System.Console.Write("Length "); return 10; } } + public ref int this[int x] + { + get { System.Console.Write($"Index={x} "); return ref field; } + } +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1) ContainerLength Index(^2) ContainerIndex=9 Length ContainerIndex=9 Index=8 Id(42)" + + " Result: Index(^1) ContainerLength ContainerIndex=9 Index(^2) Length Index=8 42"); + verifier.VerifyDiagnostics(); + + verifier.VerifyIL("Program.M", """ +{ + // Code size 91 (0x5b) + .maxstack 3 + .locals init (Container V_0, + int V_1, + int V_2, + System.Index V_3) + IL_0000: newobj "Container..ctor()" + IL_0005: stloc.0 + IL_0006: ldc.i4.1 + IL_0007: ldc.i4.1 + IL_0008: newobj "System.Index..ctor(int, bool)" + IL_000d: call "System.Index Program.Id(System.Index)" + IL_0012: stloc.3 + IL_0013: ldloca.s V_3 + IL_0015: ldloc.0 + IL_0016: callvirt "int Container.Length.get" + IL_001b: call "int System.Index.GetOffset(int)" + IL_0020: stloc.1 + IL_0021: ldc.i4.2 + IL_0022: ldc.i4.1 + IL_0023: newobj "System.Index..ctor(int, bool)" + IL_0028: call "System.Index Program.Id(System.Index)" + IL_002d: stloc.3 + IL_002e: ldloca.s V_3 + IL_0030: ldloc.0 + IL_0031: ldloc.1 + IL_0032: callvirt "ref readonly Buffer10 Container.this[int].get" + IL_0037: ldind.ref + IL_0038: callvirt "int Buffer10.Length.get" + IL_003d: call "int System.Index.GetOffset(int)" + IL_0042: stloc.2 + IL_0043: ldloc.0 + IL_0044: ldloc.1 + IL_0045: callvirt "ref readonly Buffer10 Container.this[int].get" + IL_004a: ldind.ref + IL_004b: ldloc.2 + IL_004c: callvirt "ref int Buffer10.this[int].get" + IL_0051: ldc.i4.s 42 + IL_0053: call "int Program.Id(int)" + IL_0058: stind.i4 + IL_0059: ldloc.0 + IL_005a: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_RefReadonlyReturningIndexer_WithEmptyNesting() + { + string source = """ +M(); + +partial class Program +{ + public static Buffer10 M() + { + return new Buffer10() { [Id(^1)] = { } }; + } + + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +class Buffer10 +{ + public int field = 0; + public int Length => throw null; + public ref readonly object this[int x] => throw null; +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1)"); + verifier.VerifyDiagnostics(); + + verifier.VerifyIL("Program.M", """ +{ + // Code size 19 (0x13) + .maxstack 3 + IL_0000: newobj "Buffer10..ctor()" + IL_0005: ldc.i4.1 + IL_0006: ldc.i4.1 + IL_0007: newobj "System.Index..ctor(int, bool)" + IL_000c: call "System.Index Program.Id(System.Index)" + IL_0011: pop + IL_0012: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_RefReturningIndexer_ByRef() + { + string source = """ +int i = 42; +_ = new Buffer10() { [1] = ref i }; // 1 +_ = new Buffer10() { [^1] = ref i }; // 2 + +Buffer10 b = new Buffer10(); +b[1] = ref i; // 3 +b[^1] = ref i; // 4 + +class Buffer10 +{ + public Buffer10() { } + + public int field = 0; + public int Length => 10; + public ref int this[int x] + { + get { System.Console.Write($"Index={x} "); return ref field; } + } +} +"""; + var comp = CreateCompilationWithIndex(source); + comp.VerifyDiagnostics( + // (2,22): error CS8373: The left-hand side of a ref assignment must be a ref variable. + // _ = new Buffer10() { [1] = ref i }; // 1 + Diagnostic(ErrorCode.ERR_RefLocalOrParamExpected, "[1]").WithLocation(2, 22), + // (3,22): error CS8373: The left-hand side of a ref assignment must be a ref variable. + // _ = new Buffer10() { [^1] = ref i }; // 2 + Diagnostic(ErrorCode.ERR_RefLocalOrParamExpected, "[^1]").WithLocation(3, 22), + // (6,1): error CS8373: The left-hand side of a ref assignment must be a ref variable. + // b[1] = ref i; // 3 + Diagnostic(ErrorCode.ERR_RefLocalOrParamExpected, "b[1]").WithLocation(6, 1), + // (7,1): error CS8373: The left-hand side of a ref assignment must be a ref variable. + // b[^1] = ref i; // 4 + Diagnostic(ErrorCode.ERR_RefLocalOrParamExpected, "b[^1]").WithLocation(7, 1) + ); + } + + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_WithNesting(bool useCsharp13) + { + string source = """ +M(^1, ^2, ^3); + +partial class Program +{ + public static Buffer10Container M(System.Index i1, System.Index i2, System.Index i3) + { + return new Buffer10Container() { [i1] = { [i2] = 42, [i3] = 43 } }; + } +} + +class Buffer10Container +{ + public int Length { get { System.Console.Write("ContainerLength "); return 10; } } + public Buffer10 this[int x] + { + get { System.Console.Write($"ContainerIndex={x} "); return new Buffer10(); } + } +} + +class Buffer10 +{ + public int Length { get { System.Console.Write("Length "); return 10; } } + public int this[int x] + { + set { System.Console.Write($"Index={x} Value={value} "); } + } +} +"""; + var comp = CreateCompilationWithIndex(source, parseOptions: useCsharp13 ? TestOptions.RegularNext : TestOptions.RegularPreview); + var verifier = CompileAndVerify(comp, expectedOutput: "ContainerLength ContainerIndex=9 Length ContainerIndex=9 Index=8 Value=42 ContainerIndex=9 Length ContainerIndex=9 Index=7 Value=43"); + verifier.VerifyDiagnostics(); + + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + Assert.Equal("new Buffer10Container() { [i1] = { [i2] = 42, [i3] = 43 } }", node.ToString()); + + comp.VerifyOperationTree(node, expectedOperationTree: """ +IObjectCreationOperation (Constructor: Buffer10Container..ctor()) (OperationKind.ObjectCreation, Type: Buffer10Container) (Syntax: 'new Buffer1 ... 3] = 43 } }') +Arguments(0) +Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: Buffer10Container) (Syntax: '{ [i1] = { ... 3] = 43 } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: Buffer10) (Syntax: '[i1] = { [i ... [i3] = 43 }') + InitializedMember: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: Buffer10) (Syntax: '[i1]') + Instance: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: Buffer10Container, IsImplicit) (Syntax: 'Buffer10Container') + Argument: + IParameterReferenceOperation: i1 (OperationKind.ParameterReference, Type: System.Index) (Syntax: 'i1') + LengthSymbol: System.Int32 Buffer10Container.Length { get; } + IndexerSymbol: Buffer10 Buffer10Container.this[System.Int32 x] { get; } + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: Buffer10) (Syntax: '{ [i2] = 42, [i3] = 43 }') + Initializers(2): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[i2] = 42') + Left: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: System.Int32) (Syntax: '[i2]') + Instance: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: Buffer10, IsImplicit) (Syntax: '[i1]') + Argument: + IParameterReferenceOperation: i2 (OperationKind.ParameterReference, Type: System.Index) (Syntax: 'i2') + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: System.Int32 Buffer10.this[System.Int32 x] { set; } + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 42) (Syntax: '42') + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[i3] = 43') + Left: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: System.Int32) (Syntax: '[i3]') + Instance: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: Buffer10, IsImplicit) (Syntax: '[i1]') + Argument: + IParameterReferenceOperation: i3 (OperationKind.ParameterReference, Type: System.Index) (Syntax: 'i3') + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: System.Int32 Buffer10.this[System.Int32 x] { set; } + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 43) (Syntax: '43') +"""); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (1) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new Buffer1 ... 3] = 43 } }') + Value: + IObjectCreationOperation (Constructor: Buffer10Container..ctor()) (OperationKind.ObjectCreation, Type: Buffer10Container) (Syntax: 'new Buffer1 ... 3] = 43 } }') + Arguments(0) + Initializer: + null + Next (Regular) Block[B2] + Entering: {R2} + .locals {R2} + { + CaptureIds: [1] + Block[B2] - Block + Predecessors: [B1] + Statements (1) + IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'i1') + Value: + IParameterReferenceOperation: i1 (OperationKind.ParameterReference, Type: System.Index) (Syntax: 'i1') + Next (Regular) Block[B3] + Entering: {R3} + .locals {R3} + { + CaptureIds: [2] + Block[B3] - Block + Predecessors: [B2] + Statements (2) + IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'i2') + Value: + IParameterReferenceOperation: i2 (OperationKind.ParameterReference, Type: System.Index) (Syntax: 'i2') + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[i2] = 42') + Left: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: System.Int32) (Syntax: '[i2]') + Instance: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: Buffer10) (Syntax: '[i1]') + Instance: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10Container, IsImplicit) (Syntax: 'new Buffer1 ... 3] = 43 } }') + Argument: + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Index, IsImplicit) (Syntax: 'i1') + LengthSymbol: System.Int32 Buffer10Container.Length { get; } + IndexerSymbol: Buffer10 Buffer10Container.this[System.Int32 x] { get; } + Argument: + IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Index, IsImplicit) (Syntax: 'i2') + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: System.Int32 Buffer10.this[System.Int32 x] { set; } + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 42) (Syntax: '42') + Next (Regular) Block[B4] + Leaving: {R3} + Entering: {R4} + } + .locals {R4} + { + CaptureIds: [3] + Block[B4] - Block + Predecessors: [B3] + Statements (2) + IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'i3') + Value: + IParameterReferenceOperation: i3 (OperationKind.ParameterReference, Type: System.Index) (Syntax: 'i3') + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[i3] = 43') + Left: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: System.Int32) (Syntax: '[i3]') + Instance: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: Buffer10) (Syntax: '[i1]') + Instance: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10Container, IsImplicit) (Syntax: 'new Buffer1 ... 3] = 43 } }') + Argument: + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Index, IsImplicit) (Syntax: 'i1') + LengthSymbol: System.Int32 Buffer10Container.Length { get; } + IndexerSymbol: Buffer10 Buffer10Container.this[System.Int32 x] { get; } + Argument: + IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Index, IsImplicit) (Syntax: 'i3') + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: System.Int32 Buffer10.this[System.Int32 x] { set; } + Right: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 43) (Syntax: '43') + Next (Regular) Block[B5] + Leaving: {R4} {R2} + } + } + Block[B5] - Block + Predecessors: [B4] + Statements (0) + Next (Return) Block[B6] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10Container, IsImplicit) (Syntax: 'new Buffer1 ... 3] = 43 } }') + Leaving: {R1} +} +Block[B6] - Exit + Predecessors: [B5] + Statements (0) +""", graph, symbol); + + comp = CreateCompilationWithIndex(source, parseOptions: TestOptions.Regular12); + comp.VerifyDiagnostics( + // (7,42): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // return new Buffer10Container() { [i1] = { [i2] = 42, [i3] = 43 } }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[i1]").WithArguments("implicit indexer initializer").WithLocation(7, 42), + // (7,51): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // return new Buffer10Container() { [i1] = { [i2] = 42, [i3] = 43 } }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[i2]").WithArguments("implicit indexer initializer").WithLocation(7, 51), + // (7,62): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // return new Buffer10Container() { [i1] = { [i2] = 42, [i3] = 43 } }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[i3]").WithArguments("implicit indexer initializer").WithLocation(7, 62) + ); + } + + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_WithEmptyNesting(bool useCsharp13) + { + string source = """ +M(^1); + +partial class Program +{ + public static Buffer10Container M(System.Index i1) + { + return new Buffer10Container() { [Id(i1)] = { } }; + } + + static System.Index Id(System.Index i) { System.Console.Write($"Index({i}) "); return i; } +} + +class Buffer10Container +{ + public int Length => throw null; + public Buffer10 this[int x] => throw null; +} + +class Buffer10 { } +"""; + var comp = CreateCompilationWithIndex(source, parseOptions: useCsharp13 ? TestOptions.RegularNext : TestOptions.RegularPreview); + var verifier = CompileAndVerify(comp, expectedOutput: "Index(^1)"); + verifier.VerifyDiagnostics(); + + comp = CreateCompilationWithIndex(source, parseOptions: TestOptions.Regular12); + comp.VerifyDiagnostics( + // (7,42): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // return new Buffer10Container() { [Id(i1)] = { } }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[Id(i1)]").WithArguments("implicit indexer initializer").WithLocation(7, 42) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_WithEmptyNestingBetweenMeaningfulNestings() + { + string source = """ +M(^1, ^2, ^3); + +partial class Program +{ + public static Buffer10 M(System.Index i1, System.Index i2, System.Index i3) + { + return new Buffer10() { [Id(i1)] = { X = Id(1) }, [Id(i2)] = { }, [Id(i3)] = { X = Id(2) } }; + } + + static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + static System.Index Id(System.Index i) { System.Console.Write($"Id({i}) "); return i; } +} + +public class C +{ + public int X { set { System.Console.Write($"X={value} "); } } +} + +class Buffer10 +{ + public int Length { get { System.Console.Write("Length "); return 10; } } + public C this[int x] + { + get { System.Console.Write($"Index={x} "); return new C(); } + } +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Id(^1) Length Index=9 Id(1) X=1 Id(^2) Id(^3) Length Index=7 Id(2) X=2"); + verifier.VerifyDiagnostics(); + + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().First(); + Assert.Equal("new Buffer10() { [Id(i1)] = { X = Id(1) }, [Id(i2)] = { }, [Id(i3)] = { X = Id(2) } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (1) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new Buffer1 ... = Id(2) } }') + Value: + IObjectCreationOperation (Constructor: Buffer10..ctor()) (OperationKind.ObjectCreation, Type: Buffer10) (Syntax: 'new Buffer1 ... = Id(2) } }') + Arguments(0) + Initializer: + null + Next (Regular) Block[B2] + Entering: {R2} + .locals {R2} + { + CaptureIds: [1] + Block[B2] - Block + Predecessors: [B1] + Statements (2) + IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(i1)') + Value: + IInvocationOperation (System.Index Program.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(i1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i1') + IParameterReferenceOperation: i1 (OperationKind.ParameterReference, Type: System.Index) (Syntax: 'i1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'X = Id(1)') + Left: + IPropertyReferenceOperation: System.Int32 C.X { set; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'X') + Instance Receiver: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: C) (Syntax: '[Id(i1)]') + Instance: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10, IsImplicit) (Syntax: 'new Buffer1 ... = Id(2) } }') + Argument: + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Index, IsImplicit) (Syntax: 'Id(i1)') + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: C Buffer10.this[System.Int32 x] { get; } + Right: + IInvocationOperation (System.Int32 Program.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B3] + Leaving: {R2} + } + Block[B3] - Block + Predecessors: [B2] + Statements (1) + IInvocationOperation (System.Index Program.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(i2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i2') + IParameterReferenceOperation: i2 (OperationKind.ParameterReference, Type: System.Index) (Syntax: 'i2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B4] + Entering: {R3} + .locals {R3} + { + CaptureIds: [2] + Block[B4] - Block + Predecessors: [B3] + Statements (2) + IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(i3)') + Value: + IInvocationOperation (System.Index Program.Id(System.Index i)) (OperationKind.Invocation, Type: System.Index) (Syntax: 'Id(i3)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i3') + IParameterReferenceOperation: i3 (OperationKind.ParameterReference, Type: System.Index) (Syntax: 'i3') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'X = Id(2)') + Left: + IPropertyReferenceOperation: System.Int32 C.X { set; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'X') + Instance Receiver: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: C) (Syntax: '[Id(i3)]') + Instance: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10, IsImplicit) (Syntax: 'new Buffer1 ... = Id(2) } }') + Argument: + IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Index, IsImplicit) (Syntax: 'Id(i3)') + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: C Buffer10.this[System.Int32 x] { get; } + Right: + IInvocationOperation (System.Int32 Program.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '2') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B5] + Leaving: {R3} + } + Block[B5] - Block + Predecessors: [B4] + Statements (0) + Next (Return) Block[B6] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: Buffer10, IsImplicit) (Syntax: 'new Buffer1 ... = Id(2) } }') + Leaving: {R1} +} +Block[B6] - Exit + Predecessors: [B5] + Statements (0) +""", graph, symbol); + } + + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_Array_WithNesting(bool useCsharp13) + { + string source = """ +var x = M(); +System.Console.Write($"{x.F[^1][^2]} {x.F[^1][^3]} {x.F[^2][^4]}"); + +partial class Program +{ + public static Container M() + { + return new Container() { F = { [^1] = { [^2] = 42, [^3] = 43 }, [^2] = { [^4] = 44 } } }; + } +} + +class Container +{ + public int[][] F = new int[2][] { new int[4], new int[4] }; + public int Length { get { System.Console.Write("ContainerLength "); return 10; } } +} +"""; + + var comp = CreateCompilationWithIndex(source, parseOptions: TestOptions.Regular12); + comp.VerifyDiagnostics( + // (8,40): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // return new Container() { F = { [^1] = { [^2] = 42, [^3] = 43 }, [^2] = { [^4] = 44 } } }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[^1]").WithArguments("implicit indexer initializer").WithLocation(8, 40), + // (8,49): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // return new Container() { F = { [^1] = { [^2] = 42, [^3] = 43 }, [^2] = { [^4] = 44 } } }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[^2]").WithArguments("implicit indexer initializer").WithLocation(8, 49), + // (8,60): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // return new Container() { F = { [^1] = { [^2] = 42, [^3] = 43 }, [^2] = { [^4] = 44 } } }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[^3]").WithArguments("implicit indexer initializer").WithLocation(8, 60), + // (8,73): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // return new Container() { F = { [^1] = { [^2] = 42, [^3] = 43 }, [^2] = { [^4] = 44 } } }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[^2]").WithArguments("implicit indexer initializer").WithLocation(8, 73), + // (8,82): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // return new Container() { F = { [^1] = { [^2] = 42, [^3] = 43 }, [^2] = { [^4] = 44 } } }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[^4]").WithArguments("implicit indexer initializer").WithLocation(8, 82) + ); + + comp = CreateCompilationWithIndex(source, parseOptions: useCsharp13 ? TestOptions.RegularNext : TestOptions.RegularPreview); + var verifier = CompileAndVerify(comp, expectedOutput: "42 43 44"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("Program.M", """ +{ + // Code size 105 (0x69) + .maxstack 4 + .locals init (int V_0, + int V_1, + int V_2, + int V_3, + int V_4) + IL_0000: newobj "Container..ctor()" + IL_0005: dup + IL_0006: ldfld "int[][] Container.F" + IL_000b: ldlen + IL_000c: conv.i4 + IL_000d: ldc.i4.1 + IL_000e: sub + IL_000f: stloc.0 + IL_0010: dup + IL_0011: ldfld "int[][] Container.F" + IL_0016: ldloc.0 + IL_0017: ldelem.ref + IL_0018: ldlen + IL_0019: conv.i4 + IL_001a: ldc.i4.2 + IL_001b: sub + IL_001c: stloc.1 + IL_001d: dup + IL_001e: ldfld "int[][] Container.F" + IL_0023: ldloc.0 + IL_0024: ldelem.ref + IL_0025: ldloc.1 + IL_0026: ldc.i4.s 42 + IL_0028: stelem.i4 + IL_0029: dup + IL_002a: ldfld "int[][] Container.F" + IL_002f: ldloc.0 + IL_0030: ldelem.ref + IL_0031: ldlen + IL_0032: conv.i4 + IL_0033: ldc.i4.3 + IL_0034: sub + IL_0035: stloc.2 + IL_0036: dup + IL_0037: ldfld "int[][] Container.F" + IL_003c: ldloc.0 + IL_003d: ldelem.ref + IL_003e: ldloc.2 + IL_003f: ldc.i4.s 43 + IL_0041: stelem.i4 + IL_0042: dup + IL_0043: ldfld "int[][] Container.F" + IL_0048: ldlen + IL_0049: conv.i4 + IL_004a: ldc.i4.2 + IL_004b: sub + IL_004c: stloc.3 + IL_004d: dup + IL_004e: ldfld "int[][] Container.F" + IL_0053: ldloc.3 + IL_0054: ldelem.ref + IL_0055: ldlen + IL_0056: conv.i4 + IL_0057: ldc.i4.4 + IL_0058: sub + IL_0059: stloc.s V_4 + IL_005b: dup + IL_005c: ldfld "int[][] Container.F" + IL_0061: ldloc.3 + IL_0062: ldelem.ref + IL_0063: ldloc.s V_4 + IL_0065: ldc.i4.s 44 + IL_0067: stelem.i4 + IL_0068: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_WithNesting_Struct() + { + string source = """ +_ = new Buffer10Container() { [1] = { [2] = 42 } }; // 1 +_ = new Buffer10Container() { [^1] = { [^2] = 42 } }; // 2 + +struct Buffer10Container +{ + public Buffer10Container() { } + + public int Length { get { System.Console.Write("ContainerLength "); return 10; } } + public Buffer10 this[int x] + { + get => throw null; + } +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length { get { System.Console.Write("Length "); return 10; } } + public int this[int x] + { + set => throw null; + } +} +"""; + var comp = CreateCompilationWithIndex(source); + comp.VerifyDiagnostics( + // (1,31): error CS1918: Members of property 'Buffer10Container.this[int]' of type 'Buffer10' cannot be assigned with an object initializer because it is of a value type + // _ = new Buffer10Container() { [1] = { [2] = 42 } }; // 1 + Diagnostic(ErrorCode.ERR_ValueTypePropertyInObjectInitializer, "[1]").WithArguments("Buffer10Container.this[int]", "Buffer10").WithLocation(1, 31), + // (2,31): error CS1918: Members of property 'Buffer10Container.this[int]' of type 'Buffer10' cannot be assigned with an object initializer because it is of a value type + // _ = new Buffer10Container() { [^1] = { [^2] = 42 } }; // 2 + Diagnostic(ErrorCode.ERR_ValueTypePropertyInObjectInitializer, "[^1]").WithArguments("Buffer10Container.this[int]", "Buffer10").WithLocation(2, 31) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_WithNesting_Struct_WriteOnly() + { + string source = """ +_ = new Buffer10Container() { [1] = { [2] = 42 } }; // 1 +_ = new Buffer10Container() { [^1] = { [^2] = 42 } }; // 2 + +struct Buffer10Container +{ + public Buffer10Container() { } + + public int Length { get { System.Console.Write("ContainerLength "); return 10; } } + public Buffer10 this[int x] + { + set => throw null; + } +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length { get { System.Console.Write("Length "); return 10; } } + public int this[int x] + { + set => throw null; + } +} +"""; + var comp = CreateCompilationWithIndex(source); + comp.VerifyDiagnostics( + // (1,31): error CS1918: Members of property 'Buffer10Container.this[int]' of type 'Buffer10' cannot be assigned with an object initializer because it is of a value type + // _ = new Buffer10Container() { [1] = { [2] = 42 } }; // 1 + Diagnostic(ErrorCode.ERR_ValueTypePropertyInObjectInitializer, "[1]").WithArguments("Buffer10Container.this[int]", "Buffer10").WithLocation(1, 31), + // (2,31): error CS1918: Members of property 'Buffer10Container.this[int]' of type 'Buffer10' cannot be assigned with an object initializer because it is of a value type + // _ = new Buffer10Container() { [^1] = { [^2] = 42 } }; // 2 + Diagnostic(ErrorCode.ERR_ValueTypePropertyInObjectInitializer, "[^1]").WithArguments("Buffer10Container.this[int]", "Buffer10").WithLocation(2, 31) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Range() + { + string source = """ +Buffer10 b = default; +b[..] = null; // 1 + +_ = new Buffer10() { [..] = null }; // 2 +_ = new C() { F = { [..] = null } }; // 3 + +struct Buffer10 +{ + public Buffer10() { } + public int Length => throw null; + public int[] Slice(int start, int length) => throw null; +} + +class C +{ + public Buffer10 F = new Buffer10(); +} +"""; + var comp = CreateCompilationWithIndexAndRange(source); + comp.VerifyDiagnostics( + // (2,1): error CS0131: The left-hand side of an assignment must be a variable, property or indexer + // b[..] = null; // 1 + Diagnostic(ErrorCode.ERR_AssgLvalueExpected, "b[..]").WithLocation(2, 1), + // (4,22): error CS0131: The left-hand side of an assignment must be a variable, property or indexer + // _ = new Buffer10() { [..] = null }; // 2 + Diagnostic(ErrorCode.ERR_AssgLvalueExpected, "[..]").WithLocation(4, 22), + // (5,21): error CS0131: The left-hand side of an assignment must be a variable, property or indexer + // _ = new C() { F = { [..] = null } }; // 3 + Diagnostic(ErrorCode.ERR_AssgLvalueExpected, "[..]").WithLocation(5, 21) + ); + } + + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Range_WithNesting(bool useCsharp13) + { + string source = """ +var c = C.M(3..^6); +System.Console.Write($"Results={c.F._array[1]},{c.F._array[2]}"); + +class Buffer10 +{ + public int[] _array = new int[10]; + public int Length { get { System.Console.Write("Length "); return 10; } } + public int[] Slice(int start, int length) { System.Console.Write($"Slice({start}, {length}) "); return _array; } +} + +class C +{ + public Buffer10 F = new Buffer10(); + public static C M(System.Range r) + { + return new C() { F = { [Id(r)] = { [Id(1)] = Id(42), [Id(2)] = Id(43) } } }; + } + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + public static System.Range Id(System.Range r) { System.Console.Write($"Range({r}) "); return r; } +} +"""; + var comp = CreateCompilationWithIndexAndRange(source, parseOptions: useCsharp13 ? TestOptions.RegularNext : TestOptions.RegularPreview); + comp.VerifyDiagnostics(); + var verifier = CompileAndVerify(comp, expectedOutput: "Range(3..^6) Length Id(1) Slice(3, 1) Id(42) Id(2) Slice(3, 1) Id(43) Results=42,43"); + verifier.VerifyIL("C.M", """ +{ + // Code size 115 (0x73) + .maxstack 5 + .locals init (System.Range V_0, + int V_1, + int V_2, + int V_3, + int V_4, + int V_5, + System.Index V_6) + IL_0000: newobj "C..ctor()" + IL_0005: dup + IL_0006: ldfld "Buffer10 C.F" + IL_000b: ldarg.0 + IL_000c: call "System.Range C.Id(System.Range)" + IL_0011: stloc.0 + IL_0012: dup + IL_0013: callvirt "int Buffer10.Length.get" + IL_0018: stloc.1 + IL_0019: ldloca.s V_0 + IL_001b: call "System.Index System.Range.Start.get" + IL_0020: stloc.s V_6 + IL_0022: ldloca.s V_6 + IL_0024: ldloc.1 + IL_0025: call "int System.Index.GetOffset(int)" + IL_002a: stloc.2 + IL_002b: ldloca.s V_0 + IL_002d: call "System.Index System.Range.End.get" + IL_0032: stloc.s V_6 + IL_0034: ldloca.s V_6 + IL_0036: ldloc.1 + IL_0037: call "int System.Index.GetOffset(int)" + IL_003c: ldloc.2 + IL_003d: sub + IL_003e: stloc.3 + IL_003f: ldc.i4.1 + IL_0040: call "int C.Id(int)" + IL_0045: stloc.s V_4 + IL_0047: dup + IL_0048: ldloc.2 + IL_0049: ldloc.3 + IL_004a: callvirt "int[] Buffer10.Slice(int, int)" + IL_004f: ldloc.s V_4 + IL_0051: ldc.i4.s 42 + IL_0053: call "int C.Id(int)" + IL_0058: stelem.i4 + IL_0059: ldc.i4.2 + IL_005a: call "int C.Id(int)" + IL_005f: stloc.s V_5 + IL_0061: ldloc.2 + IL_0062: ldloc.3 + IL_0063: callvirt "int[] Buffer10.Slice(int, int)" + IL_0068: ldloc.s V_5 + IL_006a: ldc.i4.s 43 + IL_006c: call "int C.Id(int)" + IL_0071: stelem.i4 + IL_0072: ret +} +"""); + + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C() { F = { [Id(r)] = { [Id(1)] = Id(42), [Id(2)] = Id(43) } } }", node.ToString()); + + comp.VerifyOperationTree(node, expectedOperationTree: """ +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... d(43) } } }') +Arguments(0) +Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C) (Syntax: '{ F = { [Id ... d(43) } } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: Buffer10) (Syntax: 'F = { [Id(r ... Id(43) } }') + InitializedMember: + IFieldReferenceOperation: Buffer10 C.F (OperationKind.FieldReference, Type: Buffer10) (Syntax: 'F') + Instance Receiver: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'F') + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: Buffer10) (Syntax: '{ [Id(r)] = ... Id(43) } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: System.Int32[]) (Syntax: '[Id(r)] = { ... = Id(43) }') + InitializedMember: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: System.Int32[]) (Syntax: '[Id(r)]') + Instance: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: Buffer10, IsImplicit) (Syntax: 'F') + Argument: + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r') + IParameterReferenceOperation: r (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: System.Int32[] Buffer10.Slice(System.Int32 start, System.Int32 length) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: System.Int32[]) (Syntax: '{ [Id(1)] = ... = Id(43) }') + Initializers(2): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(1)] = Id(42)') + Left: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32) (Syntax: '[Id(1)]') + Array reference: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: System.Int32[], IsImplicit) (Syntax: '[Id(r)]') + Indices(1): + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(42)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '42') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 42) (Syntax: '42') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(2)] = Id(43)') + Left: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32) (Syntax: '[Id(2)]') + Array reference: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: System.Int32[], IsImplicit) (Syntax: '[Id(r)]') + Indices(1): + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '2') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(43)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '43') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 43) (Syntax: '43') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +"""); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (1) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C() { F ... d(43) } } }') + Value: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... d(43) } } }') + Arguments(0) + Initializer: + null + Next (Regular) Block[B2] + Entering: {R2} + .locals {R2} + { + CaptureIds: [1] + Block[B2] - Block + Predecessors: [B1] + Statements (1) + IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(r)') + Value: + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r') + IParameterReferenceOperation: r (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B3] + Entering: {R3} + .locals {R3} + { + CaptureIds: [2] + Block[B3] - Block + Predecessors: [B2] + Statements (2) + IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(1)') + Value: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(1)] = Id(42)') + Left: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32) (Syntax: '[Id(1)]') + Array reference: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: System.Int32[]) (Syntax: '[Id(r)]') + Instance: + IFieldReferenceOperation: Buffer10 C.F (OperationKind.FieldReference, Type: Buffer10) (Syntax: 'F') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... d(43) } } }') + Argument: + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Range, IsImplicit) (Syntax: 'Id(r)') + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: System.Int32[] Buffer10.Slice(System.Int32 start, System.Int32 length) + Indices(1): + IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'Id(1)') + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(42)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '42') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 42) (Syntax: '42') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B4] + Leaving: {R3} + Entering: {R4} + } + .locals {R4} + { + CaptureIds: [3] + Block[B4] - Block + Predecessors: [B3] + Statements (2) + IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(2)') + Value: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '2') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(2)] = Id(43)') + Left: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32) (Syntax: '[Id(2)]') + Array reference: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: System.Int32[]) (Syntax: '[Id(r)]') + Instance: + IFieldReferenceOperation: Buffer10 C.F (OperationKind.FieldReference, Type: Buffer10) (Syntax: 'F') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... d(43) } } }') + Argument: + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Range, IsImplicit) (Syntax: 'Id(r)') + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: System.Int32[] Buffer10.Slice(System.Int32 start, System.Int32 length) + Indices(1): + IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'Id(2)') + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(43)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '43') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 43) (Syntax: '43') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B5] + Leaving: {R4} {R2} + } + } + Block[B5] - Block + Predecessors: [B4] + Statements (0) + Next (Return) Block[B6] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... d(43) } } }') + Leaving: {R1} +} +Block[B6] - Exit + Predecessors: [B5] + Statements (0) +""", graph, symbol); + + comp = CreateCompilationWithIndexAndRange(source, parseOptions: TestOptions.Regular12); + comp.VerifyDiagnostics( + // (16,32): error CS8652: The feature 'implicit indexer initializer' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. + // return new C() { F = { [Id(r)] = { [Id(1)] = Id(42), [Id(2)] = Id(43) } } }; + Diagnostic(ErrorCode.ERR_FeatureInPreview, "[Id(r)]").WithArguments("implicit indexer initializer").WithLocation(16, 32) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Range_WithNestedNesting() + { + string source = """ +var c = C.M(1..^1, 2..^2); +System.Console.Write($"Results={c.F._array._array[2]},{c.F._array._array[3]}"); + +class Container +{ + public Buffer10 _array = new Buffer10(); + public int Length { get { System.Console.Write("ContainerLength "); return 10; } } + public Buffer10 Slice(int start, int length) { System.Console.Write($"ContainerSlice({start}, {length}) "); return _array; } +} + +class Buffer10 +{ + public int[] _array = new int[10]; + public int Length { get { System.Console.Write("Length "); return 10; } } + public int[] Slice(int start, int length) { System.Console.Write($"Slice({start}, {length}) "); return _array; } +} + +class C +{ + public Container F = new Container(); + public static C M(System.Range r, System.Range r2) + { + return new C() + { + F = + { + [Id(r)] = + { + [Id(r2)] = { [Id(2)] = Id(42), [Id(3)] = Id(43) }, + } + } + }; + } + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + public static System.Range Id(System.Range r) { System.Console.Write($"Range({r}) "); return r; } +} +"""; + var comp = CreateCompilationWithIndexAndRange(new[] { source, TestSources.GetSubArray }); + var verifier = CompileAndVerify(comp, expectedOutput: "Range(1..^1) ContainerLength ContainerSlice(1, 8) Range(2..^2) Length Id(2) Slice(2, 6) Id(42) Id(3) Slice(2, 6) Id(43) Results=42,43"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 185 (0xb9) + .maxstack 5 + .locals init (System.Range V_0, + int V_1, + int V_2, + int V_3, + System.Range V_4, + int V_5, + int V_6, + int V_7, + int V_8, + int V_9, + System.Index V_10) + IL_0000: newobj "C..ctor()" + IL_0005: dup + IL_0006: ldfld "Container C.F" + IL_000b: ldarg.0 + IL_000c: call "System.Range C.Id(System.Range)" + IL_0011: stloc.0 + IL_0012: dup + IL_0013: callvirt "int Container.Length.get" + IL_0018: stloc.1 + IL_0019: ldloca.s V_0 + IL_001b: call "System.Index System.Range.Start.get" + IL_0020: stloc.s V_10 + IL_0022: ldloca.s V_10 + IL_0024: ldloc.1 + IL_0025: call "int System.Index.GetOffset(int)" + IL_002a: stloc.2 + IL_002b: ldloca.s V_0 + IL_002d: call "System.Index System.Range.End.get" + IL_0032: stloc.s V_10 + IL_0034: ldloca.s V_10 + IL_0036: ldloc.1 + IL_0037: call "int System.Index.GetOffset(int)" + IL_003c: ldloc.2 + IL_003d: sub + IL_003e: stloc.3 + IL_003f: ldloc.2 + IL_0040: ldloc.3 + IL_0041: callvirt "Buffer10 Container.Slice(int, int)" + IL_0046: ldarg.1 + IL_0047: call "System.Range C.Id(System.Range)" + IL_004c: stloc.s V_4 + IL_004e: dup + IL_004f: callvirt "int Buffer10.Length.get" + IL_0054: stloc.s V_5 + IL_0056: ldloca.s V_4 + IL_0058: call "System.Index System.Range.Start.get" + IL_005d: stloc.s V_10 + IL_005f: ldloca.s V_10 + IL_0061: ldloc.s V_5 + IL_0063: call "int System.Index.GetOffset(int)" + IL_0068: stloc.s V_6 + IL_006a: ldloca.s V_4 + IL_006c: call "System.Index System.Range.End.get" + IL_0071: stloc.s V_10 + IL_0073: ldloca.s V_10 + IL_0075: ldloc.s V_5 + IL_0077: call "int System.Index.GetOffset(int)" + IL_007c: ldloc.s V_6 + IL_007e: sub + IL_007f: stloc.s V_7 + IL_0081: ldc.i4.2 + IL_0082: call "int C.Id(int)" + IL_0087: stloc.s V_8 + IL_0089: dup + IL_008a: ldloc.s V_6 + IL_008c: ldloc.s V_7 + IL_008e: callvirt "int[] Buffer10.Slice(int, int)" + IL_0093: ldloc.s V_8 + IL_0095: ldc.i4.s 42 + IL_0097: call "int C.Id(int)" + IL_009c: stelem.i4 + IL_009d: ldc.i4.3 + IL_009e: call "int C.Id(int)" + IL_00a3: stloc.s V_9 + IL_00a5: ldloc.s V_6 + IL_00a7: ldloc.s V_7 + IL_00a9: callvirt "int[] Buffer10.Slice(int, int)" + IL_00ae: ldloc.s V_9 + IL_00b0: ldc.i4.s 43 + IL_00b2: call "int C.Id(int)" + IL_00b7: stelem.i4 + IL_00b8: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Range_WithEmptyNestedNesting() + { + string source = """ +C.M(1..^1, 2..^2); + +class Container +{ + public Buffer10 _array = new Buffer10(); + public int Length { get { System.Console.Write("ContainerLength "); return 10; } } + public Buffer10 Slice(int start, int length) => throw null; +} + +class Buffer10 +{ + public int Length => throw null; + public int[] Slice(int start, int length) => throw null; +} + +class C +{ + public Container F = new Container(); + public static C M(System.Range r, System.Range r2) + { + return new C() { F = { [Id(r)] = { [Id(r2)] = { } } } }; + } + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + public static System.Range Id(System.Range r) { System.Console.Write($"Range({r}) "); return r; } +} +"""; + var comp = CreateCompilationWithIndexAndRange(new[] { source, TestSources.GetSubArray }); + var verifier = CompileAndVerify(comp, expectedOutput: "Range(1..^1) Range(2..^2)"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 20 (0x14) + .maxstack 2 + IL_0000: newobj "C..ctor()" + IL_0005: ldarg.0 + IL_0006: call "System.Range C.Id(System.Range)" + IL_000b: pop + IL_000c: ldarg.1 + IL_000d: call "System.Range C.Id(System.Range)" + IL_0012: pop + IL_0013: ret +} +"""); + + var tree = comp.SyntaxTrees.First(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C() { F = { [Id(r)] = { [Id(r2)] = { } } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (3) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C() { F ... = { } } } }') + Value: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... = { } } } }') + Arguments(0) + Initializer: + null + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r') + IParameterReferenceOperation: r (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r2') + IParameterReferenceOperation: r2 (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Return) Block[B2] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... = { } } } }') + Leaving: {R1} +} +Block[B2] - Exit + Predecessors: [B1] + Statements (0) +""", + graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Range_WithMixedNestedNesting() + { + string source = """ +C.M(1..^1, 2..^2, 3..^3, 4, 5); + +class Container +{ + public int Length { get { System.Console.Write("ContainerLength "); return 10; } } + public Buffer10 Slice(int start, int length) { System.Console.Write($"ContainerSlice({start}, {length}) "); return new Buffer10(); } +} + +class Buffer10 +{ + public int Length { get { System.Console.Write("Length "); return 10; } } + public int[] Slice(int start, int length) { System.Console.Write($"Slice({start}, {length}) "); return new int[10]; } +} + +class C +{ + public Container F = new Container(); + public static C M(System.Range r, System.Range r2, System.Range r3, int i4, int i5) + { + return new C() { F = { [Id(r)] = { [Id(r2)] = { }, [Id(r3)] = { [Id(i4)] = Id(i5) } } } }; + } + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + public static System.Range Id(System.Range r) { System.Console.Write($"Range({r}) "); return r; } +} +"""; + var comp = CreateCompilationWithIndexAndRange(new[] { source, TestSources.GetSubArray }); + var verifier = CompileAndVerify(comp, expectedOutput: "Range(1..^1) ContainerLength Range(2..^2) ContainerSlice(1, 8) Range(3..^3) Length Id(4) Slice(3, 4) Id(5)"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 164 (0xa4) + .maxstack 4 + .locals init (System.Range V_0, + int V_1, + int V_2, + int V_3, + System.Range V_4, + int V_5, + int V_6, + int V_7, + int V_8, + System.Index V_9) + IL_0000: newobj "C..ctor()" + IL_0005: dup + IL_0006: ldfld "Container C.F" + IL_000b: ldarg.0 + IL_000c: call "System.Range C.Id(System.Range)" + IL_0011: stloc.0 + IL_0012: dup + IL_0013: callvirt "int Container.Length.get" + IL_0018: stloc.1 + IL_0019: ldloca.s V_0 + IL_001b: call "System.Index System.Range.Start.get" + IL_0020: stloc.s V_9 + IL_0022: ldloca.s V_9 + IL_0024: ldloc.1 + IL_0025: call "int System.Index.GetOffset(int)" + IL_002a: stloc.2 + IL_002b: ldloca.s V_0 + IL_002d: call "System.Index System.Range.End.get" + IL_0032: stloc.s V_9 + IL_0034: ldloca.s V_9 + IL_0036: ldloc.1 + IL_0037: call "int System.Index.GetOffset(int)" + IL_003c: ldloc.2 + IL_003d: sub + IL_003e: stloc.3 + IL_003f: ldarg.1 + IL_0040: call "System.Range C.Id(System.Range)" + IL_0045: pop + IL_0046: ldloc.2 + IL_0047: ldloc.3 + IL_0048: callvirt "Buffer10 Container.Slice(int, int)" + IL_004d: ldarg.2 + IL_004e: call "System.Range C.Id(System.Range)" + IL_0053: stloc.s V_4 + IL_0055: dup + IL_0056: callvirt "int Buffer10.Length.get" + IL_005b: stloc.s V_5 + IL_005d: ldloca.s V_4 + IL_005f: call "System.Index System.Range.Start.get" + IL_0064: stloc.s V_9 + IL_0066: ldloca.s V_9 + IL_0068: ldloc.s V_5 + IL_006a: call "int System.Index.GetOffset(int)" + IL_006f: stloc.s V_6 + IL_0071: ldloca.s V_4 + IL_0073: call "System.Index System.Range.End.get" + IL_0078: stloc.s V_9 + IL_007a: ldloca.s V_9 + IL_007c: ldloc.s V_5 + IL_007e: call "int System.Index.GetOffset(int)" + IL_0083: ldloc.s V_6 + IL_0085: sub + IL_0086: stloc.s V_7 + IL_0088: ldarg.3 + IL_0089: call "int C.Id(int)" + IL_008e: stloc.s V_8 + IL_0090: ldloc.s V_6 + IL_0092: ldloc.s V_7 + IL_0094: callvirt "int[] Buffer10.Slice(int, int)" + IL_0099: ldloc.s V_8 + IL_009b: ldarg.s V_4 + IL_009d: call "int C.Id(int)" + IL_00a2: stelem.i4 + IL_00a3: ret +} +"""); + + var tree = comp.SyntaxTrees.First(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C() { F = { [Id(r)] = { [Id(r2)] = { }, [Id(r3)] = { [Id(i4)] = Id(i5) } } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (1) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C() { F ... i5) } } } }') + Value: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... i5) } } } }') + Arguments(0) + Initializer: + null + Next (Regular) Block[B2] + Entering: {R2} + .locals {R2} + { + CaptureIds: [1] + Block[B2] - Block + Predecessors: [B1] + Statements (2) + IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(r)') + Value: + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r') + IParameterReferenceOperation: r (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r2') + IParameterReferenceOperation: r2 (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B3] + Entering: {R3} + .locals {R3} + { + CaptureIds: [2] + Block[B3] - Block + Predecessors: [B2] + Statements (1) + IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(r3)') + Value: + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r3)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r3') + IParameterReferenceOperation: r3 (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r3') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B4] + Entering: {R4} + .locals {R4} + { + CaptureIds: [3] + Block[B4] - Block + Predecessors: [B3] + Statements (2) + IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(i4)') + Value: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(i4)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i4') + IParameterReferenceOperation: i4 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i4') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(i4)] = Id(i5)') + Left: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32) (Syntax: '[Id(i4)]') + Array reference: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: System.Int32[]) (Syntax: '[Id(r3)]') + Instance: + IImplicitIndexerReferenceOperation (OperationKind.ImplicitIndexerReference, Type: Buffer10) (Syntax: '[Id(r)]') + Instance: + IFieldReferenceOperation: Container C.F (OperationKind.FieldReference, Type: Container) (Syntax: 'F') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... i5) } } } }') + Argument: + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Range, IsImplicit) (Syntax: 'Id(r)') + LengthSymbol: System.Int32 Container.Length { get; } + IndexerSymbol: Buffer10 Container.Slice(System.Int32 start, System.Int32 length) + Argument: + IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Range, IsImplicit) (Syntax: 'Id(r3)') + LengthSymbol: System.Int32 Buffer10.Length { get; } + IndexerSymbol: System.Int32[] Buffer10.Slice(System.Int32 start, System.Int32 length) + Indices(1): + IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'Id(i4)') + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(i5)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i5') + IParameterReferenceOperation: i5 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i5') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B5] + Leaving: {R4} {R3} {R2} + } + } + } + Block[B5] - Block + Predecessors: [B4] + Statements (0) + Next (Return) Block[B6] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... i5) } } } }') + Leaving: {R1} +} +Block[B6] - Exit + Predecessors: [B5] + Statements (0) +""", + graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Integer_WithEmptyNestedNesting() + { + string source = """ +C.M(1, 2); + +class Container +{ + public Buffer10 this[int i] => throw null; +} + +class Buffer10 +{ + public int[] this[int i] => throw null; +} + +class C +{ + public Container F = new Container(); + public static C M(int i1, int i2) + { + return new C() { F = { [Id(i1)] = { [Id(i2)] = { } } } }; + } + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } +} +"""; + var comp = CreateCompilation(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Id(1) Id(2)"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 20 (0x14) + .maxstack 2 + IL_0000: newobj "C..ctor()" + IL_0005: ldarg.0 + IL_0006: call "int C.Id(int)" + IL_000b: pop + IL_000c: ldarg.1 + IL_000d: call "int C.Id(int)" + IL_0012: pop + IL_0013: ret +} +"""); + + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C() { F = { [Id(i1)] = { [Id(i2)] = { } } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (3) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C() { F ... = { } } } }') + Value: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... = { } } } }') + Arguments(0) + Initializer: + null + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(i1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i1') + IParameterReferenceOperation: i1 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(i2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i2') + IParameterReferenceOperation: i2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Return) Block[B2] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... = { } } } }') + Leaving: {R1} +} +Block[B2] - Exit + Predecessors: [B1] + Statements (0) +""", + graph, symbol); + + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Integer_WithMixedNestedNesting() + { + string source = """ +C.M(1, 2, 3, 4, 5); + +class Container +{ + public Buffer10 this[int i] { get { return new Buffer10(); } } +} + +class Buffer10 +{ + public int[] this[int i] { get { return new int[10]; } } +} + +class C +{ + public Container F = new Container(); + public static C M(int i1, int i2, int i3, int i4, int i5) + { + return new C() { F = { [Id(i1)] = { [Id(i2)] = { }, [Id(i3)] = { [Id(i4)] = Id(i5) } } } }; + } + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } +} +"""; + var comp = CreateCompilation(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Id(1) Id(2) Id(3) Id(4) Id(5)"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 61 (0x3d) + .maxstack 4 + .locals init (int V_0, + int V_1, + int V_2) + IL_0000: newobj "C..ctor()" + IL_0005: ldarg.0 + IL_0006: call "int C.Id(int)" + IL_000b: stloc.0 + IL_000c: ldarg.1 + IL_000d: call "int C.Id(int)" + IL_0012: pop + IL_0013: ldarg.2 + IL_0014: call "int C.Id(int)" + IL_0019: stloc.1 + IL_001a: ldarg.3 + IL_001b: call "int C.Id(int)" + IL_0020: stloc.2 + IL_0021: dup + IL_0022: ldfld "Container C.F" + IL_0027: ldloc.0 + IL_0028: callvirt "Buffer10 Container.this[int].get" + IL_002d: ldloc.1 + IL_002e: callvirt "int[] Buffer10.this[int].get" + IL_0033: ldloc.2 + IL_0034: ldarg.s V_4 + IL_0036: call "int C.Id(int)" + IL_003b: stelem.i4 + IL_003c: ret +} +"""); + + var tree = comp.SyntaxTrees.Single(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C() { F = { [Id(i1)] = { [Id(i2)] = { }, [Id(i3)] = { [Id(i4)] = Id(i5) } } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (1) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C() { F ... i5) } } } }') + Value: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... i5) } } } }') + Arguments(0) + Initializer: + null + Next (Regular) Block[B2] + Entering: {R2} + .locals {R2} + { + CaptureIds: [1] + Block[B2] - Block + Predecessors: [B1] + Statements (2) + IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(i1)') + Value: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(i1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i1') + IParameterReferenceOperation: i1 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(i2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i2') + IParameterReferenceOperation: i2 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B3] + Entering: {R3} + .locals {R3} + { + CaptureIds: [2] + Block[B3] - Block + Predecessors: [B2] + Statements (1) + IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(i3)') + Value: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(i3)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i3') + IParameterReferenceOperation: i3 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i3') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B4] + Entering: {R4} + .locals {R4} + { + CaptureIds: [3] + Block[B4] - Block + Predecessors: [B3] + Statements (2) + IFlowCaptureOperation: 3 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(i4)') + Value: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(i4)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i4') + IParameterReferenceOperation: i4 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i4') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: '[Id(i4)] = Id(i5)') + Left: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32) (Syntax: '[Id(i4)]') + Array reference: + IPropertyReferenceOperation: System.Int32[] Buffer10.this[System.Int32 i] { get; } (OperationKind.PropertyReference, Type: System.Int32[]) (Syntax: '[Id(i3)]') + Instance Receiver: + IPropertyReferenceOperation: Buffer10 Container.this[System.Int32 i] { get; } (OperationKind.PropertyReference, Type: Buffer10) (Syntax: '[Id(i1)]') + Instance Receiver: + IFieldReferenceOperation: Container C.F (OperationKind.FieldReference, Type: Container) (Syntax: 'F') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... i5) } } } }') + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'Id(i1)') + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'Id(i1)') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'Id(i3)') + IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'Id(i3)') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Indices(1): + IFlowCaptureReferenceOperation: 3 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'Id(i4)') + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(i5)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'i5') + IParameterReferenceOperation: i5 (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'i5') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B5] + Leaving: {R4} {R3} {R2} + } + } + } + Block[B5] - Block + Predecessors: [B4] + Statements (0) + Next (Return) Block[B6] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... i5) } } } }') + Leaving: {R1} +} +Block[B6] - Exit + Predecessors: [B5] + Statements (0) +""", + graph, symbol); + + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Range_ArrayAccess_WithEmptyNestedNesting() + { + string source = """ +C.M(1..^1, 2..^2); + +class C +{ + public int[][] F = new int[][] { new int[10], new int[10] }; + public static C M(System.Range r1, System.Range r2) + { + return new C() { F = { [Id(r1)] = { [Id(r2)] = { } } } }; + } + public static System.Range Id(System.Range r) { System.Console.Write($"Range({r}) "); return r; } +} +"""; + var comp = CreateCompilationWithIndexAndRange(new[] { source, TestSources.GetSubArray }); + var verifier = CompileAndVerify(comp, expectedOutput: "Range(1..^1) Range(2..^2)"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 20 (0x14) + .maxstack 2 + IL_0000: newobj "C..ctor()" + IL_0005: ldarg.0 + IL_0006: call "System.Range C.Id(System.Range)" + IL_000b: pop + IL_000c: ldarg.1 + IL_000d: call "System.Range C.Id(System.Range)" + IL_0012: pop + IL_0013: ret +} +"""); + + var tree = comp.SyntaxTrees.First(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C() { F = { [Id(r1)] = { [Id(r2)] = { } } } }", node.ToString()); + + comp.VerifyOperationTree(node, expectedOperationTree: """ +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... = { } } } }') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C) (Syntax: '{ F = { [Id ... = { } } } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: System.Int32[][]) (Syntax: 'F = { [Id(r ... ] = { } } }') + InitializedMember: + IFieldReferenceOperation: System.Int32[][] C.F (OperationKind.FieldReference, Type: System.Int32[][]) (Syntax: 'F') + Instance Receiver: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'F') + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: System.Int32[][]) (Syntax: '{ [Id(r1)] ... ] = { } } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: System.Int32[][]) (Syntax: '[Id(r1)] = ... 2)] = { } }') + InitializedMember: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32[][]) (Syntax: '[Id(r1)]') + Array reference: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: System.Int32[][], IsImplicit) (Syntax: 'F') + Indices(1): + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r1') + IParameterReferenceOperation: r1 (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: System.Int32[][]) (Syntax: '{ [Id(r2)] = { } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: System.Int32[][]) (Syntax: '[Id(r2)] = { }') + InitializedMember: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: System.Int32[][]) (Syntax: '[Id(r2)]') + Array reference: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: System.Int32[][], IsImplicit) (Syntax: '[Id(r1)]') + Indices(1): + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r2') + IParameterReferenceOperation: r2 (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: System.Int32[][]) (Syntax: '{ }') + Initializers(0) +"""); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (3) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C() { F ... = { } } } }') + Value: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... = { } } } }') + Arguments(0) + Initializer: + null + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r1') + IParameterReferenceOperation: r1 (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r2') + IParameterReferenceOperation: r2 (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Return) Block[B2] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... = { } } } }') + Leaving: {R1} +} +Block[B2] - Exit + Predecessors: [B1] + Statements (0) +""", + graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Range_ArrayAccess_WithNestedNesting() + { + string source = """ +C.M(1..^1); + +public class D +{ + public int X { set { System.Console.Write($"X={value} "); } } +} +class C +{ + public D[] F = new D[] { new D(), new D(), new D() }; + public static C M(System.Range r1) + { + return new C() { F = { [Id(r1)] = { [Id(0)] = { X = Id(42) } } } }; + } + + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + public static System.Range Id(System.Range r) { System.Console.Write($"Range({r}) "); return r; } +} +"""; + var comp = CreateCompilationWithIndexAndRange(new[] { source, TestSources.GetSubArray }); + var verifier = CompileAndVerify(comp, expectedOutput: "Range(1..^1) Id(0) Id(42) X=42"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 46 (0x2e) + .maxstack 3 + .locals init (System.Range V_0, + int V_1) + IL_0000: newobj "C..ctor()" + IL_0005: ldarg.0 + IL_0006: call "System.Range C.Id(System.Range)" + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: call "int C.Id(int)" + IL_0012: stloc.1 + IL_0013: dup + IL_0014: ldfld "D[] C.F" + IL_0019: ldloc.0 + IL_001a: call "D[] System.Runtime.CompilerServices.RuntimeHelpers.GetSubArray(D[], System.Range)" + IL_001f: ldloc.1 + IL_0020: ldelem.ref + IL_0021: ldc.i4.s 42 + IL_0023: call "int C.Id(int)" + IL_0028: callvirt "void D.X.set" + IL_002d: ret +} +"""); + + var tree = comp.SyntaxTrees.First(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C() { F = { [Id(r1)] = { [Id(0)] = { X = Id(42) } } } }", node.ToString()); + + comp.VerifyOperationTree(node, expectedOperationTree: """ +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... 42) } } } }') +Arguments(0) +Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C) (Syntax: '{ F = { [Id ... 42) } } } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: D[]) (Syntax: 'F = { [Id(r ... d(42) } } }') + InitializedMember: + IFieldReferenceOperation: D[] C.F (OperationKind.FieldReference, Type: D[]) (Syntax: 'F') + Instance Receiver: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'F') + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: D[]) (Syntax: '{ [Id(r1)] ... d(42) } } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: D[]) (Syntax: '[Id(r1)] = ... Id(42) } }') + InitializedMember: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: D[]) (Syntax: '[Id(r1)]') + Array reference: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: D[], IsImplicit) (Syntax: 'F') + Indices(1): + IInvocationOperation (System.Range C.Id(System.Range r)) (OperationKind.Invocation, Type: System.Range) (Syntax: 'Id(r1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: r) (OperationKind.Argument, Type: null) (Syntax: 'r1') + IParameterReferenceOperation: r1 (OperationKind.ParameterReference, Type: System.Range) (Syntax: 'r1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: D[]) (Syntax: '{ [Id(0)] = ... Id(42) } }') + Initializers(1): + IMemberInitializerOperation (OperationKind.MemberInitializer, Type: D) (Syntax: '[Id(0)] = { X = Id(42) }') + InitializedMember: + IArrayElementReferenceOperation (OperationKind.ArrayElementReference, Type: D) (Syntax: '[Id(0)]') + Array reference: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: D[], IsImplicit) (Syntax: '[Id(r1)]') + Indices(1): + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(0)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '0') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: D) (Syntax: '{ X = Id(42) }') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'X = Id(42)') + Left: + IPropertyReferenceOperation: System.Int32 D.X { set; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'X') + Instance Receiver: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: D, IsImplicit) (Syntax: 'X') + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(42)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '42') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 42) (Syntax: '42') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Range_ArrayAccess_WithMultipleNestedNesting() + { + string source = """ +C.M(1..^1); + +public class D +{ + public int X { set { System.Console.Write($"X={value} "); } } +} +class C +{ + public D[] F = new D[] { new D(), new D(), new D(), new D() }; + public static C M(System.Range r1) + { + return new C() { F = { [Id(r1)] = { [Id(0)] = { X = Id(42) }, [Id(1)] = { X = Id(43) } } } }; + } + + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } + public static System.Range Id(System.Range r) { System.Console.Write($"Range({r}) "); return r; } +} +"""; + var comp = CreateCompilationWithIndexAndRange(new[] { source, TestSources.GetSubArray }); + var verifier = CompileAndVerify(comp, expectedOutput: "Range(1..^1) Id(0) Id(42) X=42 Id(1) Id(43) X=43"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 79 (0x4f) + .maxstack 3 + .locals init (System.Range V_0, + int V_1, + int V_2) + IL_0000: newobj "C..ctor()" + IL_0005: ldarg.0 + IL_0006: call "System.Range C.Id(System.Range)" + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: call "int C.Id(int)" + IL_0012: stloc.1 + IL_0013: dup + IL_0014: ldfld "D[] C.F" + IL_0019: ldloc.0 + IL_001a: call "D[] System.Runtime.CompilerServices.RuntimeHelpers.GetSubArray(D[], System.Range)" + IL_001f: ldloc.1 + IL_0020: ldelem.ref + IL_0021: ldc.i4.s 42 + IL_0023: call "int C.Id(int)" + IL_0028: callvirt "void D.X.set" + IL_002d: ldc.i4.1 + IL_002e: call "int C.Id(int)" + IL_0033: stloc.2 + IL_0034: dup + IL_0035: ldfld "D[] C.F" + IL_003a: ldloc.0 + IL_003b: call "D[] System.Runtime.CompilerServices.RuntimeHelpers.GetSubArray(D[], System.Range)" + IL_0040: ldloc.2 + IL_0041: ldelem.ref + IL_0042: ldc.i4.s 43 + IL_0044: call "int C.Id(int)" + IL_0049: callvirt "void D.X.set" + IL_004e: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Integer_PointerAccess_WithEmptyNestedNesting() + { + string source = """ +unsafe class C +{ + public int** F; + public C(int** pp) { F = pp; } + + public static void Main() + { + var array = new[] { 0, 0 }; + + fixed (int* p = array) + { + var array2 = new[] { p }; + + fixed (int** pp = array2 ) + { + M(pp); + } + } + } + + public static C M(int** pp) + { + return new C(pp) { F = { [Id(0)] = { [Id(1)] = { } } } }; + } + + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } +} +"""; + var comp = CreateCompilation(source, options: TestOptions.UnsafeReleaseExe); + var verifier = CompileAndVerify(comp, expectedOutput: "Id(0) Id(1)", verify: Verification.Skipped); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 21 (0x15) + .maxstack 2 + IL_0000: ldarg.0 + IL_0001: newobj "C..ctor(int**)" + IL_0006: ldc.i4.0 + IL_0007: call "int C.Id(int)" + IL_000c: pop + IL_000d: ldc.i4.1 + IL_000e: call "int C.Id(int)" + IL_0013: pop + IL_0014: ret +} +"""); + + var tree = comp.SyntaxTrees.First(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C(pp) { F = { [Id(0)] = { [Id(1)] = { } } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (3) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C(pp) { ... = { } } } }') + Value: + IObjectCreationOperation (Constructor: C..ctor(System.Int32** pp)) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C(pp) { ... = { } } } }') + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: pp) (OperationKind.Argument, Type: null) (Syntax: 'pp') + IParameterReferenceOperation: pp (OperationKind.ParameterReference, Type: System.Int32**) (Syntax: 'pp') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Initializer: + null + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(0)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '0') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Return) Block[B2] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C(pp) { ... = { } } } }') + Leaving: {R1} +} +Block[B2] - Exit + Predecessors: [B1] + Statements (0) +""", + graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Integer_DynamicAccess_WithEmptyNestedNesting() + { + string source = """ +C.M(); + +class C +{ + public dynamic F; + + public static C M() + { + return new C() { F = { [Id(0)] = { [Id(1)] = { } } } }; + } + + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } +} +"""; + var comp = CreateCompilation(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Id(0) Id(1)"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 20 (0x14) + .maxstack 2 + IL_0000: newobj "C..ctor()" + IL_0005: ldc.i4.0 + IL_0006: call "int C.Id(int)" + IL_000b: pop + IL_000c: ldc.i4.1 + IL_000d: call "int C.Id(int)" + IL_0012: pop + IL_0013: ret +} +"""); + + var tree = comp.SyntaxTrees.First(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C() { F = { [Id(0)] = { [Id(1)] = { } } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (3) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C() { F ... = { } } } }') + Value: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { F ... = { } } } }') + Arguments(0) + Initializer: + null + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(0)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '0') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Return) Block[B2] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { F ... = { } } } }') + Leaving: {R1} +} +Block[B2] - Exit + Predecessors: [B1] + Statements (0) +""", + graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Integer_DynamicAccess2_WithEmptyNestedNesting() + { + string source = """ +C.M(); + +class C +{ + public dynamic this[int i] => throw null; + + public static C M() + { + return new C() { [Id(0)] = { [Id(1)] = { } } }; + } + + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } +} +"""; + var comp = CreateCompilation(source, targetFramework: TargetFramework.StandardAndCSharp); + var verifier = CompileAndVerify(comp, expectedOutput: "Id(0) Id(1)"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 20 (0x14) + .maxstack 2 + IL_0000: newobj "C..ctor()" + IL_0005: ldc.i4.0 + IL_0006: call "int C.Id(int)" + IL_000b: pop + IL_000c: ldc.i4.1 + IL_000d: call "int C.Id(int)" + IL_0012: pop + IL_0013: ret +} +"""); + + var tree = comp.SyntaxTrees.First(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C() { [Id(0)] = { [Id(1)] = { } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (3) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C() { [ ... ] = { } } }') + Value: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { [ ... ] = { } } }') + Arguments(0) + Initializer: + null + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(0)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '0') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Return) Block[B2] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { [ ... ] = { } } }') + Leaving: {R1} +} +Block[B2] - Exit + Predecessors: [B1] + Statements (0) +""", + graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Integer_DynamicAccess2_WithMixedNestedNesting() + { + string source = """ +C.M(); + +public class C +{ + public dynamic this[int i] => new C(); + public int F; + + public static C M() + { + return new C() { [Id(0)] = { [Id(1)] = { }, [Id(2)] = { F = Id(3) } } }; + } + + public static int Id(int i) { System.Console.Write($"Id({i}) "); return i; } +} +"""; + var comp = CreateCompilation(source, targetFramework: TargetFramework.StandardAndCSharp); + var verifier = CompileAndVerify(comp, expectedOutput: "Id(0) Id(1) Id(2) Id(3)"); + verifier.VerifyDiagnostics(); + + var tree = comp.SyntaxTrees.First(); + var model = comp.GetSemanticModel(tree); + var node = tree.GetRoot().DescendantNodes().OfType().Last(); + Assert.Equal("new C() { [Id(0)] = { [Id(1)] = { }, [Id(2)] = { F = Id(3) } } }", node.ToString()); + + var (graph, symbol) = ControlFlowGraphVerifier.GetControlFlowGraph(node.Parent.Parent, model); + ControlFlowGraphVerifier.VerifyGraph(comp, """ +Block[B0] - Entry + Statements (0) + Next (Regular) Block[B1] + Entering: {R1} +.locals {R1} +{ + CaptureIds: [0] + Block[B1] - Block + Predecessors: [B0] + Statements (1) + IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new C() { [ ... Id(3) } } }') + Value: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C() { [ ... Id(3) } } }') + Arguments(0) + Initializer: + null + Next (Regular) Block[B2] + Entering: {R2} + .locals {R2} + { + CaptureIds: [1] + Block[B2] - Block + Predecessors: [B1] + Statements (2) + IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(0)') + Value: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(0)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '0') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(1)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '1') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B3] + Entering: {R3} + .locals {R3} + { + CaptureIds: [2] + Block[B3] - Block + Predecessors: [B2] + Statements (2) + IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Id(2)') + Value: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(2)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '2') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: dynamic) (Syntax: 'F = Id(3)') + Left: + IDynamicMemberReferenceOperation (Member Name: "F", Containing Type: dynamic) (OperationKind.DynamicMemberReference, Type: dynamic) (Syntax: 'F') + Type Arguments(0) + Instance Receiver: + IDynamicIndexerAccessOperation (OperationKind.DynamicIndexerAccess, Type: dynamic) (Syntax: '[Id(2)]') + Expression: + IPropertyReferenceOperation: dynamic C.this[System.Int32 i] { get; } (OperationKind.PropertyReference, Type: dynamic) (Syntax: '[Id(0)]') + Instance Receiver: + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { [ ... Id(3) } } }') + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: 'Id(0)') + IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'Id(0)') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Arguments(1): + IFlowCaptureReferenceOperation: 2 (OperationKind.FlowCaptureReference, Type: System.Int32, IsImplicit) (Syntax: 'Id(2)') + ArgumentNames(0) + ArgumentRefKinds(0) + Right: + IInvocationOperation (System.Int32 C.Id(System.Int32 i)) (OperationKind.Invocation, Type: System.Int32) (Syntax: 'Id(3)') + Instance Receiver: + null + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '3') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 3) (Syntax: '3') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Next (Regular) Block[B4] + Leaving: {R3} {R2} + } + } + Block[B4] - Block + Predecessors: [B3] + Statements (0) + Next (Return) Block[B5] + IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: C, IsImplicit) (Syntax: 'new C() { [ ... Id(3) } } }') + Leaving: {R1} +} +Block[B5] - Exit + Predecessors: [B4] + Statements (0) +""", + graph, symbol); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Range_WithEmptyNestedInitializer() + { + string source = """ +C.M(3..^6); + +class Buffer10 +{ + public int[] _array = new int[10]; + public int Length => throw null; + public int[] Slice(int start, int length) => throw null; +} + +class C +{ + public Buffer10 F = new Buffer10(); + public static C M(System.Range r) + { + return new C() { F = { [Id(r)] = { } } }; + } + public static System.Range Id(System.Range r) { System.Console.Write($"Range({r}) "); return r; } +} +"""; + var comp = CreateCompilationWithIndexAndRange(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Range(3..^6)"); + verifier.VerifyDiagnostics(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_RangeLiteral_WithEmptyNestedInitializer() + { + string source = """ +C.M(3, 6); + +class Buffer10 +{ + public int Length => throw null; + public int[] Slice(int start, int length) => throw null; +} + +class C +{ + public Buffer10 F = new Buffer10(); + public static C M(int i, int j) + { + return new C() { F = { [^Id(i)..^Id(j)] = { } } }; + } + public static int Id(int i) { System.Console.Write($"{i} "); return i; } +} +"""; + var comp = CreateCompilationWithIndexAndRange(source); + var verifier = CompileAndVerify(comp, expectedOutput: "3 6"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", """ +{ + // Code size 36 (0x24) + .maxstack 4 + IL_0000: newobj "C..ctor()" + IL_0005: ldarg.0 + IL_0006: call "int C.Id(int)" + IL_000b: ldc.i4.1 + IL_000c: newobj "System.Index..ctor(int, bool)" + IL_0011: ldarg.1 + IL_0012: call "int C.Id(int)" + IL_0017: ldc.i4.1 + IL_0018: newobj "System.Index..ctor(int, bool)" + IL_001d: newobj "System.Range..ctor(System.Index, System.Index)" + IL_0022: pop + IL_0023: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Range_Indexed() + { + string source = """ +Buffer10 b = default; +b[..][0] = 1; + +_ = new Buffer10() { [..][0] = 2 }; // 1 + +struct Buffer10 +{ + public Buffer10() { } + public int Length => throw null; + public int[] Slice(int start, int length) => throw null; +} +"""; + var comp = CreateCompilationWithIndexAndRange(source); + comp.VerifyDiagnostics( + // (4,22): error CS0131: The left-hand side of an assignment must be a variable, property or indexer + // _ = new Buffer10() { [..][0] = 2 }; // 1 + Diagnostic(ErrorCode.ERR_AssgLvalueExpected, "[..]").WithLocation(4, 22), + // (4,26): error CS1003: Syntax error, '=' expected + // _ = new Buffer10() { [..][0] = 2 }; // 1 + Diagnostic(ErrorCode.ERR_SyntaxError, "[").WithArguments("=").WithLocation(4, 26), + // (4,26): error CS0131: The left-hand side of an assignment must be a variable, property or indexer + // _ = new Buffer10() { [..][0] = 2 }; // 1 + Diagnostic(ErrorCode.ERR_AssgLvalueExpected, "[0]").WithLocation(4, 26) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_Indexed() + { + string source = """ +Buffer10 b = default; +b[^1][0] = 1; + +_ = new Buffer10() { [^1][0] = 2 }; // 1 + +struct Buffer10 +{ + public Buffer10() { } + public int Length => throw null; + public int[] this[int i] { get => throw null; set => throw null; } +} +"""; + var comp = CreateCompilationWithIndexAndRange(source); + comp.VerifyDiagnostics( + // (4,26): error CS1003: Syntax error, '=' expected + // _ = new Buffer10() { [^1][0] = 2 }; // 1 + Diagnostic(ErrorCode.ERR_SyntaxError, "[").WithArguments("=").WithLocation(4, 26), + // (4,26): error CS0131: The left-hand side of an assignment must be a variable, property or indexer + // _ = new Buffer10() { [^1][0] = 2 }; // 1 + Diagnostic(ErrorCode.ERR_AssgLvalueExpected, "[0]").WithLocation(4, 26) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_Indexed_Array() + { + string source = """ +_ = new C() { F = { [^1][0] = 2 } }; // 1 + +public class C +{ + public int[][] F; +} +"""; + var comp = CreateCompilationWithIndexAndRange(source); + comp.VerifyDiagnostics( + // (1,25): error CS1003: Syntax error, '=' expected + // _ = new C() { F = { [^1][0] = 2 } }; // 1 + Diagnostic(ErrorCode.ERR_SyntaxError, "[").WithArguments("=").WithLocation(1, 25), + // (1,25): error CS0131: The left-hand side of an assignment must be a variable, property or indexer + // _ = new C() { F = { [^1][0] = 2 } }; // 1 + Diagnostic(ErrorCode.ERR_AssgLvalueExpected, "[0]").WithLocation(1, 25) + ); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_IndexCreation_FromEnd() + { + string source = """ +M(); + +partial class Program +{ + public static Buffer10 M() => new Buffer10() { [new System.Index(1, fromEnd: true)] = 2 }; +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length => 10; + public int this[int x] + { + get => throw null; + set { System.Console.Write($"Index={x} Value={value} "); } + } +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index=9 Value=2"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("Program.M", """ +{ + // Code size 28 (0x1c) + .maxstack 3 + .locals init (Buffer10 V_0, + int V_1) + IL_0000: ldloca.s V_0 + IL_0002: call "Buffer10..ctor()" + IL_0007: ldloca.s V_0 + IL_0009: call "int Buffer10.Length.get" + IL_000e: ldc.i4.1 + IL_000f: sub + IL_0010: stloc.1 + IL_0011: ldloca.s V_0 + IL_0013: ldloc.1 + IL_0014: ldc.i4.2 + IL_0015: call "void Buffer10.this[int].set" + IL_001a: ldloc.0 + IL_001b: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_IndexCreation_FromStart() + { + string source = """ +M(); + +partial class Program +{ + static Buffer10 M() => new Buffer10() { [new System.Index(1, fromEnd: false)] = 2 }; +} + +struct Buffer10 +{ + public Buffer10() { } + + public int Length => 10; + public int this[int x] + { + get => throw null; + set { System.Console.Write($"Index={x} Value={value} "); } + } +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index=1 Value=2"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("Program.M", """ +{ + // Code size 18 (0x12) + .maxstack 3 + .locals init (Buffer10 V_0) + IL_0000: ldloca.s V_0 + IL_0002: call "Buffer10..ctor()" + IL_0007: ldloca.s V_0 + IL_0009: ldc.i4.1 + IL_000a: ldc.i4.2 + IL_000b: call "void Buffer10.this[int].set" + IL_0010: ldloc.0 + IL_0011: ret +} +"""); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_IndexConversion() + { + string source = """ +M(); + +partial class Program +{ + static Buffer10 M() => new Buffer10() { [2] = 2 }; +} + +class Buffer10 +{ + public int this[System.Index x] + { + set { System.Console.Write($"Index={x} Value={value} "); } + } +} +"""; + var comp = CreateCompilationWithIndex(source); + var verifier = CompileAndVerify(comp, expectedOutput: "Index=2 Value=2"); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("Program.M", """ +{ + // Code size 21 (0x15) + .maxstack 4 + .locals init (System.Index V_0) + IL_0000: newobj "Buffer10..ctor()" + IL_0005: ldc.i4.2 + IL_0006: call "System.Index System.Index.op_Implicit(int)" + IL_000b: stloc.0 + IL_000c: dup + IL_000d: ldloc.0 + IL_000e: ldc.i4.2 + IL_000f: callvirt "void Buffer10.this[System.Index].set" + IL_0014: ret +} +"""); + } + + private const string IndexWithSideEffects = """ + namespace System + { + using System.Runtime.CompilerServices; + public readonly struct Index : IEquatable + { + private readonly int _value; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public Index(int value, bool fromEnd = false) + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(); + } + + if (fromEnd) + _value = ~value; + else + _value = value; + } + + // The following private constructors mainly created for perf reason to avoid the checks + private Index(int value) + { + _value = value; + } + + public static Index Start => new Index(0); + public static Index End => new Index(~0); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Index FromStart(int value) + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(); + } + + return new Index(value); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Index FromEnd(int value) + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(); + } + + return new Index(~value); + } + + public int Value + { + get + { + if (_value < 0) + return ~_value; + else + return _value; + } + } + + public bool IsFromEnd => _value < 0; + + public int GetOffset(int length) + { + int offset; + + if (IsFromEnd) + offset = length - (~_value); + else + offset = _value; + + return offset; + } + + public override bool Equals(object value) => value is Index && _value == ((Index)value)._value; + + public bool Equals (Index other) => _value == other._value; + + public override int GetHashCode() => _value; + + public static implicit operator Index(int value) => FromStart(value); + public static Index operator ++(Index index) + { + System.Console.Write("++ "); + if (index.IsFromEnd) + { + return new Index(index.Value - 1, fromEnd: true); + } + else + { + return new Index(index.Value + 1); + } + } + + public override string ToString() => IsFromEnd ? "^" + Value.ToString() : Value.ToString(); + } + } + """; + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_SideEffects() + { + string source = """ +M(^3); + +partial class Program +{ + static Buffer10 M(System.Index i) => new Buffer10() { [i++] = { X = 42, Y = 43, Z = 44 } }; +} + +class Triple +{ + public int X { set { System.Console.Write($"X={value} "); } } + public int Y { set { System.Console.Write($"Y={value} "); } } + public int Z { set { System.Console.Write($"Z={value} "); } } +} + +class Buffer10 +{ + public int Length { get { System.Console.Write("Length "); return 10; } } + public Triple this[int x] + { + get { System.Console.Write($"Index={x} "); return new Triple(); } + } +} +"""; + var comp = CreateCompilation(new[] { source, IndexWithSideEffects }); + var verifier = CompileAndVerify(comp, expectedOutput: "++ Length Index=7 X=42 Index=7 Y=43 Index=7 Z=44", verify: Verification.Skipped); + verifier.VerifyDiagnostics(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/67533")] + public void InObjectInitializer_Index_SideEffects_WithNesting() + { + string source = """ +M(^10, ^8); + +partial class Program +{ + static Buffer10Container M(System.Index i, System.Index j) + => new Buffer10Container() { + [i++] = { [j++] = { X = 42, Y = 43 } }, + [i++] = { [j++] = { X = 101, Y = 102 } } }; +} + +class Pair +{ + public int X { set { System.Console.Write($"X={value} "); } } + public int Y { set { System.Console.Write($"Y={value} "); } } +} + +class Buffer10 +{ + public int Length { get { System.Console.Write("Length "); return 10; } } + public Pair this[int x] + { + get { System.Console.Write($"Index={x} "); return new Pair(); } + } +} + +class Buffer10Container +{ + public int Length { get { System.Console.Write("ContainerLength "); return 10; } } + public Buffer10 this[int x] + { + get { System.Console.Write($"ContainerIndex={x} "); return new Buffer10(); } + } +} +"""; + var comp = CreateCompilation(new[] { source, IndexWithSideEffects }); + var verifier = CompileAndVerify(comp, verify: Verification.Skipped, + expectedOutput: "++ ContainerLength ++ ContainerIndex=0 Length ContainerIndex=0 Index=2 X=42 ContainerIndex=0 Index=2 Y=43 " + + "++ ContainerLength ++ ContainerIndex=1 Length ContainerIndex=1 Index=3 X=101 ContainerIndex=1 Index=3 Y=102"); + verifier.VerifyDiagnostics(); + } + + [Fact] + public void InObjectInitializer_ExpressionTreePatternIndexAndRange() + { + var src = """ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; + +class Program +{ + static void Main() + { + Expression> e1 = (System.Index i) => new S { [i] = 42 }; // 1 + Expression> e2 = (System.Range r) => new S { [r] = { [0] = 1 } }; // 2 + } +} + +class S +{ + public int Length => 0; + + public int this[int x] + { + get => throw null; + set => throw null; + } + + public int[] Slice(int start, int length) => null; +} + +"""; + var comp = CreateCompilationWithIndexAndRange(new[] { src, TestSources.GetSubArray }); + comp.VerifyEmitDiagnostics( + // 0.cs(10,76): error CS0832: An expression tree may not contain an assignment operator + // Expression> e1 = (System.Index i) => new S { [i] = 42 }; // 1 + Diagnostic(ErrorCode.ERR_ExpressionTreeContainsAssignment, "[i] = 42").WithLocation(10, 76), + // 0.cs(10,76): error CS8790: An expression tree may not contain a pattern System.Index or System.Range indexer access + // Expression> e1 = (System.Index i) => new S { [i] = 42 }; // 1 + Diagnostic(ErrorCode.ERR_ExpressionTreeContainsPatternImplicitIndexer, "[i]").WithLocation(10, 76), + // 0.cs(11,76): error CS0832: An expression tree may not contain an assignment operator + // Expression> e2 = (System.Range r) => new S { [r] = { [0] = 1 } }; // 2 + Diagnostic(ErrorCode.ERR_ExpressionTreeContainsAssignment, "[r] = { [0] = 1 }").WithLocation(11, 76), + // 0.cs(11,76): error CS8790: An expression tree may not contain a pattern System.Index or System.Range indexer access + // Expression> e2 = (System.Range r) => new S { [r] = { [0] = 1 } }; // 2 + Diagnostic(ErrorCode.ERR_ExpressionTreeContainsPatternImplicitIndexer, "[r]").WithLocation(11, 76), + // 0.cs(11,84): error CS0832: An expression tree may not contain an assignment operator + // Expression> e2 = (System.Range r) => new S { [r] = { [0] = 1 } }; // 2 + Diagnostic(ErrorCode.ERR_ExpressionTreeContainsAssignment, "[0] = 1").WithLocation(11, 84) + ); + } + } +} diff --git a/src/Compilers/CSharp/Test/Emit2/Semantics/InlineArrayTests.cs b/src/Compilers/CSharp/Test/Emit2/Semantics/InlineArrayTests.cs index 92f1dc105bcdd..1963a7532e9f2 100644 --- a/src/Compilers/CSharp/Test/Emit2/Semantics/InlineArrayTests.cs +++ b/src/Compilers/CSharp/Test/Emit2/Semantics/InlineArrayTests.cs @@ -8054,7 +8054,7 @@ static void Main() ); } - [Fact] + [ConditionalFact(typeof(CoreClrOnly))] public void ElementAccess_ObjectInitializer_Index_02() { var src = @" @@ -8090,15 +8090,13 @@ public T this[int i] var comp = CreateCompilation(src, targetFramework: TargetFramework.Net80, options: TestOptions.ReleaseExe); - // This scenario fails due to https://github.com/dotnet/roslyn/issues/67533 comp.VerifyDiagnostics( - // (14,37): error CS1913: Member '[^10]' cannot be initialized. It is not a field or property. - // static C M2() => new C() { F = {[^10] = 111} }; - Diagnostic(ErrorCode.ERR_MemberCannotBeInitialized, "[^10]").WithArguments("[^10]").WithLocation(14, 37), // (22,14): warning CS9181: Inline array indexer will not be used for element access expression. // public T this[int i] Diagnostic(ErrorCode.WRN_InlineArrayIndexerNotUsed, "this").WithLocation(22, 14) ); + + CompileAndVerify(comp, expectedOutput: "111", verify: Verification.Skipped); } [Fact] diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IObjectCreationExpression.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IObjectCreationExpression.cs index 23a49c6196dc6..625028f7c526e 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IObjectCreationExpression.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IObjectCreationExpression.cs @@ -14600,7 +14600,6 @@ class A Statements (0) Next (Regular) Block[B1] Entering: {R1} - .locals {R1} { Locals: [dynamic x] @@ -14608,66 +14607,39 @@ class A Predecessors: [B0] Statements (1) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: dynamic, IsImplicit) (Syntax: 'x = 1') - Left: + Left: ILocalReferenceOperation: x (IsDeclaration: True) (OperationKind.LocalReference, Type: dynamic, IsImplicit) (Syntax: 'x = 1') - Right: + Right: IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: dynamic, IsImplicit) (Syntax: '1') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) (Boxing) - Operand: + Operand: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') - Next (Regular) Block[B2] Entering: {R2} - .locals {R2} { CaptureIds: [0] Block[B2] - Block Predecessors: [B1] - Statements (1) + Statements (4) IFlowCaptureOperation: 0 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'new A {[y: ... x] = { } }') - Value: + Value: IObjectCreationOperation (Constructor: A..ctor()) (OperationKind.ObjectCreation, Type: A) (Syntax: 'new A {[y: ... x] = { } }') Arguments(0) - Initializer: + Initializer: null - - Next (Regular) Block[B3] - Entering: {R3} - - .locals {R3} - { - CaptureIds: [1] [2] - Block[B3] - Block - Predecessors: [B2] - Statements (2) - IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x') - Value: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: dynamic) (Syntax: 'x') - - IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'x') - Value: - ILocalReferenceOperation: x (OperationKind.LocalReference, Type: dynamic) (Syntax: 'x') - - Next (Regular) Block[B4] - Leaving: {R3} - } - - Block[B4] - Block - Predecessors: [B3] - Statements (1) + ILocalReferenceOperation: x (OperationKind.LocalReference, Type: dynamic) (Syntax: 'x') + ILocalReferenceOperation: x (OperationKind.LocalReference, Type: dynamic) (Syntax: 'x') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'new A {[y: ... x] = { } };') - Expression: + Expression: IFlowCaptureReferenceOperation: 0 (OperationKind.FlowCaptureReference, Type: A, IsImplicit) (Syntax: 'new A {[y: ... x] = { } }') - - Next (Regular) Block[B5] + Next (Regular) Block[B3] Leaving: {R2} {R1} } } - -Block[B5] - Exit - Predecessors: [B4] +Block[B3] - Exit + Predecessors: [B2] Statements (0) "; VerifyFlowGraphAndDiagnosticsForTest(source, expectedFlowGraph, expectedDiagnostics); diff --git a/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs b/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs index 532efb30f82ce..b5b3ae0dfaad2 100644 --- a/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs +++ b/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs @@ -6070,6 +6070,14 @@ void handleMemberInitializer(IMemberInitializerOperation memberInitializer) // We therefore visit the InitializedMember to get the implicit receiver for the contained initializer, and that implicit receiver will be cloned everywhere it encounters // an IInstanceReferenceOperation with ReferenceKind InstanceReferenceKind.ImplicitReceiver + if (onlyContainsEmptyLeafNestedInitializers(memberInitializer)) + { + // However, when the leaf nested initializers are empty, we won't access the chain of initialized members + // and we only evaluate the arguments/indexes they contain. + addIndexes(memberInitializer); + return; + } + EvalStackFrame frame = PushStackFrame(); bool pushSuccess = tryPushTarget(memberInitializer.InitializedMember); IOperation instance = pushSuccess ? popTarget(memberInitializer.InitializedMember) : VisitRequired(memberInitializer.InitializedMember); @@ -6112,6 +6120,13 @@ bool tryPushTarget(IOperation instance) PushOperand(VisitRequired(arrayReference.ArrayReference)); return true; + case OperationKind.ImplicitIndexerReference: + var implicitIndexerReference = (IImplicitIndexerReferenceOperation)instance; + PushOperand(VisitRequired(implicitIndexerReference.Argument)); + SpillEvalStack(); + PushOperand(VisitRequired(implicitIndexerReference.Instance)); + return true; + case OperationKind.DynamicIndexerAccess: var dynamicIndexer = (IDynamicIndexerAccessOperation)instance; VisitAndPushArray(dynamicIndexer.Arguments); @@ -6163,6 +6178,14 @@ IOperation popTarget(IOperation originalTarget) instance = PopOperand(); ImmutableArray indices = PopArray(arrayElementReference.Indices); return new ArrayElementReferenceOperation(instance, indices, semanticModel: null, originalTarget.Syntax, originalTarget.Type, IsImplicit(originalTarget)); + + case OperationKind.ImplicitIndexerReference: + var indexerReference = (IImplicitIndexerReferenceOperation)originalTarget; + instance = PopOperand(); + IOperation index = PopOperand(); + return new ImplicitIndexerReferenceOperation(instance, index, indexerReference.LengthSymbol, indexerReference.IndexerSymbol, + semanticModel: null, originalTarget.Syntax, originalTarget.Type, IsImplicit(originalTarget)); + case OperationKind.DynamicIndexerAccess: var dynamicAccess = (DynamicIndexerAccessOperation)originalTarget; instance = PopOperand(); @@ -6181,6 +6204,84 @@ IOperation popTarget(IOperation originalTarget) throw ExceptionUtilities.UnexpectedValue(originalTarget.Kind); } } + + static bool onlyContainsEmptyLeafNestedInitializers(IMemberInitializerOperation memberInitializer) + { + // Guard on the cases understood by addIndexes below + if (memberInitializer.InitializedMember is IPropertyReferenceOperation + or IImplicitIndexerReferenceOperation + or IArrayElementReferenceOperation + or IDynamicIndexerAccessOperation + or IFieldReferenceOperation + or IEventReferenceOperation + || memberInitializer.InitializedMember is NoneOperation { ChildOperations: var children } && children.ToImmutableArray() is [IInstanceReferenceOperation, _]) + { + // Since there are no empty collection initializers, we don't need to differentiate object vs. collection initializers + return memberInitializer.Initializer is IObjectOrCollectionInitializerOperation initializer + && initializer.Initializers.All(e => e is IMemberInitializerOperation assignment && onlyContainsEmptyLeafNestedInitializers(assignment)); + } + + return false; + } + + void addIndexes(IMemberInitializerOperation memberInitializer) + { + var lhs = memberInitializer.InitializedMember; + // If we have an element access of the form `[arguments] = { ... }`, we'll evaluate `arguments` only + if (lhs is IPropertyReferenceOperation propertyReference) + { + foreach (var argument in propertyReference.Arguments) + { + if (argument is { ArgumentKind: ArgumentKind.ParamArray, Value: IArrayCreationOperation array }) + { + Debug.Assert(array.Initializer is not null); + + foreach (var element in array.Initializer.ElementValues) + { + AddStatement(Visit(element)); + } + } + else + { + AddStatement(Visit(argument.Value)); + } + } + } + else if (lhs is IImplicitIndexerReferenceOperation implicitIndexer) + { + AddStatement(Visit(implicitIndexer.Argument)); + } + else if (lhs is IArrayElementReferenceOperation arrayAccess) + { + foreach (var index in arrayAccess.Indices) + { + AddStatement(Visit(index)); + } + } + else if (lhs is IDynamicIndexerAccessOperation dynamicIndexerAccess) + { + foreach (var argument in dynamicIndexerAccess.Arguments) + { + AddStatement(Visit(argument)); + } + } + else if (lhs is NoneOperation { ChildOperations: var children } && + children.ToImmutableArray() is [IInstanceReferenceOperation, var index]) + { + // Proper pointer element access support tracked by https://github.com/dotnet/roslyn/issues/21295 + AddStatement(Visit(index)); + } + else if (lhs is not (FieldReferenceOperation or EventReferenceOperation)) + { + throw ExceptionUtilities.UnexpectedValue(lhs.Kind); + } + + // And any nested indexes + foreach (var initializer in memberInitializer.Initializer.Initializers) + { + addIndexes((IMemberInitializerOperation)initializer); + } + } } public override IOperation VisitObjectOrCollectionInitializer(IObjectOrCollectionInitializerOperation operation, int? captureIdForResult) diff --git a/src/Compilers/Test/Core/Compilation/ControlFlowGraphVerifier.cs b/src/Compilers/Test/Core/Compilation/ControlFlowGraphVerifier.cs index 031f26f985a6e..59c078def46fb 100644 --- a/src/Compilers/Test/Core/Compilation/ControlFlowGraphVerifier.cs +++ b/src/Compilers/Test/Core/Compilation/ControlFlowGraphVerifier.cs @@ -504,7 +504,6 @@ void verifyLeftRegions(BasicBlock block, PooledHashSet longLivedIds, { if (referencedInLastOperation.Contains(id) || longLivedIds.Contains(id) || - isCSharpEmptyObjectInitializerCapture(region, block, id) || isWithStatementTargetCapture(region, block, id) || isSwitchTargetCapture(region, block, id) || isForEachEnumeratorCapture(region, block, id) || @@ -532,43 +531,6 @@ void verifyLeftRegions(BasicBlock block, PooledHashSet longLivedIds, } } - bool isCSharpEmptyObjectInitializerCapture(ControlFlowRegion region, BasicBlock block, CaptureId id) - { - if (graph.OriginalOperation.Language != LanguageNames.CSharp) - { - return false; - } - - foreach (IFlowCaptureOperation candidate in getFlowCaptureOperationsFromBlocksInRegion(region, block.Ordinal)) - { - if (candidate.Id.Equals(id)) - { - CSharpSyntaxNode syntax = applyParenthesizedOrNullSuppressionIfAnyCS((CSharpSyntaxNode)candidate.Syntax); - CSharpSyntaxNode parent = syntax; - - do - { - parent = parent.Parent; - } - while (parent != null && parent.Kind() != CSharp.SyntaxKind.SimpleAssignmentExpression); - - if (parent is AssignmentExpressionSyntax assignment && - assignment.Parent?.Kind() == CSharp.SyntaxKind.ObjectInitializerExpression && - assignment.Left.DescendantNodesAndSelf().Contains(syntax) && - assignment.Right is InitializerExpressionSyntax initializer && - initializer.Kind() == CSharp.SyntaxKind.ObjectInitializerExpression && - !initializer.Expressions.Any()) - { - return true; - } - - break; - } - } - - return false; - } - bool isWithStatementTargetCapture(ControlFlowRegion region, BasicBlock block, CaptureId id) { if (graph.OriginalOperation.Language != LanguageNames.VisualBasic) From 620aaf060a94c99b74df999be2f21fa85e845ba6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 14:49:53 +0000 Subject: [PATCH 045/141] [main] Update dependencies from dotnet/arcade (#71116) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 12 ++++++------ global.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 97579ea15739a..b33675e07c3f0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -27,14 +27,14 @@ - + https://github.com/dotnet/arcade - 29736c3a40dc33e94b8a7fdf72dad6d441f9e46f + 71149d1f281ab5e066d1f524f4862152683f5144 - + https://github.com/dotnet/arcade - 29736c3a40dc33e94b8a7fdf72dad6d441f9e46f + 71149d1f281ab5e066d1f524f4862152683f5144 https://github.com/dotnet/symreader @@ -49,9 +49,9 @@ https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - 29736c3a40dc33e94b8a7fdf72dad6d441f9e46f + 71149d1f281ab5e066d1f524f4862152683f5144 https://github.com/dotnet/roslyn-analyzers diff --git a/global.json b/global.json index db1230b58469a..1d00cc6c95d3c 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "xcopy-msbuild": "17.8.1-2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23604.3", - "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23604.3" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23606.1", + "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23606.1" } } From 376b78a73ab5c612ea23abca3cd6efd044935d0e Mon Sep 17 00:00:00 2001 From: AlekseyTs Date: Thu, 7 Dec 2023 06:58:29 -0800 Subject: [PATCH 046/141] Add "Params Collections" feature to Language Feature Status.md (#71138) --- docs/Language Feature Status.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Language Feature Status.md b/docs/Language Feature Status.md index 671b4d72e066a..541426db236d1 100644 --- a/docs/Language Feature Status.md +++ b/docs/Language Feature Status.md @@ -10,6 +10,7 @@ efforts behind them. | Feature | Branch | State | Developer | Reviewer | IDE Buddy | LDM Champ | | ------- | ------ | ----- | --------- | -------- | --------- | --------- | +| [Params-collections](https://github.com/dotnet/csharplang/issues/7700) | [ParamsCollections](https://github.com/dotnet/roslyn/tree/features/ParamsCollections) | [In Progress](https://github.com/dotnet/roslyn/issues/71137) | [AlekseyTs](https://github.com/AlekseyTs) | [RikkiGibson](https://github.com/RikkiGibson), [333fred](https://github.com/333fred) | | [MadsTorgersen](https://github.com/MadsTorgersen), [AlekseyTs](https://github.com/AlekseyTs) | | [Semi-auto-properties](https://github.com/dotnet/csharplang/issues/140) | [semi-auto-props](https://github.com/dotnet/roslyn/tree/features/semi-auto-props) | [In Progress](https://github.com/dotnet/roslyn/issues/57012) | [Youssef1313](https://github.com/Youssef1313) | [333fred](https://github.com/333fred), [RikkiGibson](https://github.com/RikkiGibson) | | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | | [Params Span\ + Stackalloc any array type](https://github.com/dotnet/csharplang/issues/1757) | [params-span](https://github.com/dotnet/roslyn/tree/features/params-span) | [In Progress](https://github.com/dotnet/roslyn/issues/57049) | [cston](https://github.com/cston) | TBD | | [jaredpar](https://github.com/jaredpar) | | [Default in deconstruction](https://github.com/dotnet/roslyn/pull/25562) | [decon-default](https://github.com/dotnet/roslyn/tree/features/decon-default) | [In Progress](https://github.com/dotnet/roslyn/issues/25559) | [jcouv](https://github.com/jcouv) | [gafter](https://github.com/gafter) | | [jcouv](https://github.com/jcouv) | From 2a0987806a02065246aef0cf3c8ca464ab7ed1ac Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 7 Dec 2023 11:20:53 -0600 Subject: [PATCH 047/141] Skip the signing step in integration tests --- eng/pipelines/test-integration-job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/test-integration-job.yml b/eng/pipelines/test-integration-job.yml index 7598a58e681d8..4b416987a31e6 100644 --- a/eng/pipelines/test-integration-job.yml +++ b/eng/pipelines/test-integration-job.yml @@ -27,7 +27,7 @@ steps: displayName: Build and Test inputs: filePath: eng/build.ps1 - arguments: -ci -restore -build -pack -sign -publish -binaryLog -configuration ${{ parameters.configuration }} -prepareMachine -testVsi -oop64bit:$${{ parameters.oop64bit }} -oopCoreClr:$${{ parameters.oopCoreClr }} -collectDumps -lspEditor:$${{ parameters.lspEditor }} + arguments: -ci -restore -build -pack -publish -binaryLog -configuration ${{ parameters.configuration }} -prepareMachine -testVsi -oop64bit:$${{ parameters.oop64bit }} -oopCoreClr:$${{ parameters.oopCoreClr }} -collectDumps -lspEditor:$${{ parameters.lspEditor }} - task: PublishTestResults@2 displayName: Publish xUnit Test Results From cea05e85befb73430f3d453769729218e36b833f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 7 Dec 2023 10:59:20 -0800 Subject: [PATCH 048/141] Block 'use collection expression' on certain types --- ...onExpressionForFluentDiagnosticAnalyzer.cs | 69 +++++++++++++------ .../UseCollectionExpressionForFluentTests.cs | 30 ++++++++ 2 files changed, 79 insertions(+), 20 deletions(-) diff --git a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs index 42d44dfc38353..e6ac9859397c7 100644 --- a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; -using System.Runtime.CompilerServices; using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.LanguageService; @@ -59,6 +58,15 @@ internal sealed partial class CSharpUseCollectionExpressionForFluentDiagnosticAn nameof(ImmutableStack), nameof(System.Collections.Immutable)); + /// + /// Set of type-names that are blocked from moving over to collection expressions because the semantics of them are + /// known to be specialized, and thus could change semantics in undesirable ways if the compiler emitted its own + /// code as an replacement. + /// + private static readonly ImmutableHashSet s_bannedTypes = ImmutableHashSet.Create( + nameof(ParallelEnumerable), + nameof(ParallelQuery)); + protected override void InitializeWorker(CodeBlockStartAnalysisContext context, INamedTypeSymbol? expressionType) => context.RegisterSyntaxNodeAction(context => AnalyzeMemberAccess(context, expressionType), SyntaxKind.SimpleMemberAccessExpression); @@ -82,7 +90,7 @@ private void AnalyzeMemberAccess(SyntaxNodeAnalysisContext context, INamedTypeSy // We want to analyze and report on the highest applicable invocation in an invocation chain. // So bail out if our parent is a match. if (invocation.Parent is MemberAccessExpressionSyntax { Parent: InvocationExpressionSyntax parentInvocation } parentMemberAccess && - IsSyntacticMatch(state, parentMemberAccess, parentInvocation, allowLinq: true, matchesInReverse: null, out _, cancellationToken)) + IsMatch(state, parentMemberAccess, parentInvocation, allowLinq: true, matchesInReverse: null, out _, cancellationToken)) { return; } @@ -142,7 +150,7 @@ private static bool AnalyzeInvocation( // Topmost invocation must be a syntactic match for one of our collection manipulation forms. At the top level // we don't want to end with a linq method as that would be lazy, and a collection expression will eagerly // realize the collection. - if (!IsSyntacticMatch(state, memberAccess, invocation, allowLinq: false, matchesInReverse, out var isAdditionMatch, cancellationToken)) + if (!IsMatch(state, memberAccess, invocation, allowLinq: false, matchesInReverse, out var isAdditionMatch, cancellationToken)) return false; // We don't want to offer this feature on top of some builder-type. They will commonly end with something like @@ -168,7 +176,7 @@ private static bool AnalyzeInvocation( // left hand side of the expression. In the inner expressions we can have things like `.Concat/.Append` // calls as the outer expressions will realize the collection. if (current is InvocationExpressionSyntax { Expression: MemberAccessExpressionSyntax currentMemberAccess } currentInvocation && - IsSyntacticMatch(state, currentMemberAccess, currentInvocation, allowLinq: true, matchesInReverse, out _, cancellationToken)) + IsMatch(state, currentMemberAccess, currentInvocation, allowLinq: true, matchesInReverse, out _, cancellationToken)) { copiedData = true; stack.Push(currentMemberAccess.Expression); @@ -310,6 +318,9 @@ bool IsIterable(ExpressionSyntax expression) if (type is null or IErrorTypeSymbol) return false; + if (s_bannedTypes.Contains(type.Name)) + return false; + return Implements(type, compilation.IEnumerableOfTType()) || type.Equals(compilation.SpanOfTType()) || type.Equals(compilation.ReadOnlySpanOfTType()); @@ -362,7 +373,7 @@ private static void AddArgumentsInReverse( /// particular method call. If is provided, the arguments to the method will be /// appropriately extracted so that they can be placed in the final collection expression. /// - private static bool IsSyntacticMatch( + private static bool IsMatch( FluentState state, MemberAccessExpressionSyntax memberAccess, InvocationExpressionSyntax invocation, @@ -371,29 +382,47 @@ private static bool IsSyntacticMatch( out bool isAdditionMatch, CancellationToken cancellationToken) { - isAdditionMatch = false; - if (memberAccess.Kind() != SyntaxKind.SimpleMemberAccessExpression) + // Check for syntactic match first. + if (!IsMatchWorker(out isAdditionMatch)) return false; - var name = memberAccess.Name.Identifier.ValueText; + // Check to make sure we're not calling something banned because it would change semantics. First check if the + // method itself comes from a banned type (like with an extension method). + var member = state.SemanticModel.GetSymbolInfo(memberAccess, cancellationToken).Symbol; + if (s_bannedTypes.Contains(member?.ContainingType.Name)) + return false; - // Check for Add/AddRange/Concat - if (state.TryAnalyzeInvocationForCollectionExpression(invocation, allowLinq, cancellationToken, out _, out var useSpread)) + // Next, check if we're invoking this on a banned type. + var type = state.SemanticModel.GetTypeInfo(memberAccess.Expression, cancellationToken).Type; + if (s_bannedTypes.Contains(type?.Name)) + return false; + + return true; + + bool IsMatchWorker(out bool isAdditionMatch) { - if (matchesInReverse != null) + isAdditionMatch = false; + if (memberAccess.Kind() != SyntaxKind.SimpleMemberAccessExpression) + return false; + + var name = memberAccess.Name.Identifier.ValueText; + + // Check for Add/AddRange/Concat + if (state.TryAnalyzeInvocationForCollectionExpression(invocation, allowLinq, cancellationToken, out _, out var useSpread)) { - AddArgumentsInReverse(matchesInReverse, invocation.ArgumentList.Arguments, useSpread); - } + if (matchesInReverse != null) + AddArgumentsInReverse(matchesInReverse, invocation.ArgumentList.Arguments, useSpread); - isAdditionMatch = true; - return true; - } + isAdditionMatch = true; + return true; + } - // Now check for ToXXX/AsXXX. All of these need no args. - if (invocation.ArgumentList.Arguments.Count > 0) - return false; + // Now check for ToXXX/AsXXX. All of these need no args. + if (invocation.ArgumentList.Arguments.Count > 0) + return false; - return IsAnyNameMatch(name); + return IsAnyNameMatch(name); + } static bool IsAnyNameMatch(string name) { diff --git a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForFluentTests.cs b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForFluentTests.cs index 5fedeb6e968a7..45c51a449b832 100644 --- a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForFluentTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForFluentTests.cs @@ -2698,4 +2698,34 @@ void M() LanguageVersion = LanguageVersion.CSharp12, }.RunAsync(); } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71145")] + public async Task TestNotInParallelEnumerable() + { + await new VerifyCS.Test + { + TestCode = + """ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Linq.Expressions; + + class C + { + void M() + { + const bool shouldParallelize = false; + + IEnumerable sequence = null!; + + var result = shouldParallelize + ? sequence.AsParallel().ToArray() + : sequence.ToArray(); + } + } + """, + LanguageVersion = LanguageVersion.CSharp12, + }.RunAsync(); + } } From a09b800204b35e769f5d98e52d50131c92caa9bc Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 7 Dec 2023 12:03:42 -0600 Subject: [PATCH 049/141] Skip the pack and publish steps in integration tests --- eng/pipelines/test-integration-job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/test-integration-job.yml b/eng/pipelines/test-integration-job.yml index 4b416987a31e6..92a4b46c26928 100644 --- a/eng/pipelines/test-integration-job.yml +++ b/eng/pipelines/test-integration-job.yml @@ -27,7 +27,7 @@ steps: displayName: Build and Test inputs: filePath: eng/build.ps1 - arguments: -ci -restore -build -pack -publish -binaryLog -configuration ${{ parameters.configuration }} -prepareMachine -testVsi -oop64bit:$${{ parameters.oop64bit }} -oopCoreClr:$${{ parameters.oopCoreClr }} -collectDumps -lspEditor:$${{ parameters.lspEditor }} + arguments: -ci -restore -build -binaryLog -configuration ${{ parameters.configuration }} -prepareMachine -testVsi -oop64bit:$${{ parameters.oop64bit }} -oopCoreClr:$${{ parameters.oopCoreClr }} -collectDumps -lspEditor:$${{ parameters.lspEditor }} - task: PublishTestResults@2 displayName: Publish xUnit Test Results From 1968a195edb50f14dd908439dc8bda414e73f2b9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 7 Dec 2023 11:33:07 -0800 Subject: [PATCH 050/141] Block 'use primary constructor' when constructor has out-vars that span multiple statements --- ...UsePrimaryConstructorDiagnosticAnalyzer.cs | 9 ++++ .../UsePrimaryConstructorTests.cs | 48 +++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs index c9524f5a5694f..d9335af12dd8e 100644 --- a/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs @@ -488,6 +488,15 @@ bool IsAssignmentToInstanceMember( var isWrittenTo = parameterName.IsWrittenTo(semanticModel, cancellationToken); orderedParameterAssignments.Add((parameterReference.Parameter, assignedMemberDeclaration, isWrittenTo)); } + + // If we're referencing a local, then it must have been a local generated by an out-var, or a + // pattern. And, if so, it's only safe to move this if the local we're referencing was produced + // under the same expression we're moving (not a prior statement). + if (operation is ILocalReferenceOperation { Local.DeclaringSyntaxReferences: [var syntaxRef, ..] } && + !syntaxRef.GetSyntax(cancellationToken).AncestorsAndSelf().Any(a => a == assignmentExpression)) + { + return false; + } } // Looks good, both the left and right sides are legal. diff --git a/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs b/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs index f115bb5d3a1d1..ac0247748e4f5 100644 --- a/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs +++ b/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs @@ -3691,4 +3691,52 @@ public void Remove() LanguageVersion = LanguageVersion.CSharp12, }.RunAsync(); } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71152")] + public async Task TestOutVarInConstructor1() + { + await new VerifyCS.Test + { + TestCode = """ + public class Test + { + private int i; + + public [|Test|](string x) + { + i = int.TryParse(x, out var result) ? result : 0; + } + } + """, + FixedCode = """ + public class Test(string x) + { + private int i = int.TryParse(x, out var result) ? result : 0; + } + """, + LanguageVersion = LanguageVersion.CSharp12, + }.RunAsync(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71152")] + public async Task TestOutVarInConstructor2() + { + await new VerifyCS.Test + { + TestCode = """ + public class Test + { + private int i; + private int r; + + public Test(string x) + { + i = int.TryParse(x, out var result) ? result : 0; + r = result; + } + } + """, + LanguageVersion = LanguageVersion.CSharp12, + }.RunAsync(); + } } From 527c8620b05cfb4ba784acc439725dfbabf4ea45 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 7 Dec 2023 11:37:58 -0800 Subject: [PATCH 051/141] About to merge --- .../UsePrimaryConstructorTests.cs | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs b/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs index ac0247748e4f5..f115bb5d3a1d1 100644 --- a/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs +++ b/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs @@ -3691,52 +3691,4 @@ public void Remove() LanguageVersion = LanguageVersion.CSharp12, }.RunAsync(); } - - [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71152")] - public async Task TestOutVarInConstructor1() - { - await new VerifyCS.Test - { - TestCode = """ - public class Test - { - private int i; - - public [|Test|](string x) - { - i = int.TryParse(x, out var result) ? result : 0; - } - } - """, - FixedCode = """ - public class Test(string x) - { - private int i = int.TryParse(x, out var result) ? result : 0; - } - """, - LanguageVersion = LanguageVersion.CSharp12, - }.RunAsync(); - } - - [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71152")] - public async Task TestOutVarInConstructor2() - { - await new VerifyCS.Test - { - TestCode = """ - public class Test - { - private int i; - private int r; - - public Test(string x) - { - i = int.TryParse(x, out var result) ? result : 0; - r = result; - } - } - """, - LanguageVersion = LanguageVersion.CSharp12, - }.RunAsync(); - } } From a939e33fa6ae1b783a27250dfc8585d9c63b2909 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 7 Dec 2023 11:38:32 -0800 Subject: [PATCH 052/141] Add back --- .../UsePrimaryConstructorTests.cs | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs b/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs index 5d91511f61f9d..2f8471a17c785 100644 --- a/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs +++ b/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs @@ -3764,4 +3764,78 @@ public class Test(object value2) LanguageVersion = LanguageVersion.CSharp12, }.RunAsync(); } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71152")] + public async Task TestOutVariableInConstructor1() + { + await new VerifyCS.Test + { + TestCode = """ + public class Test + { + private int i; + + public [|Test|](string x) + { + i = int.TryParse(x, out var result) ? result : 0; + } + } + """, + FixedCode = """ + public class Test(string x) + { + private int i = int.TryParse(x, out var result) ? result : 0; + } + """, + LanguageVersion = LanguageVersion.CSharp12, + }.RunAsync(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71152")] + public async Task TestOutVariableInConstructor2() + { + await new VerifyCS.Test + { + TestCode = """ + public class Test + { + private int i; + private int r; + + public Test(string x) + { + i = int.TryParse(x, out var result) ? result : 0; + r = result; + } + } + """, + LanguageVersion = LanguageVersion.CSharp12, + }.RunAsync(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71152")] + public async Task TestPatternVariableInConstructor1() + { + await new VerifyCS.Test + { + TestCode = """ + public class Test + { + private int i; + + public [|Test|](object x) + { + i = x is string s ? s.Length : 0; + } + } + """, + FixedCode = """ + public class Test(object x) + { + private int i = x is string s ? s.Length : 0; + } + """, + LanguageVersion = LanguageVersion.CSharp12, + }.RunAsync(); + } } From 63f6ee3dfd1de1236232446fd079ad97fa44b6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Thu, 7 Dec 2023 12:16:35 -0800 Subject: [PATCH 053/141] EnC: Defer lambda rude edit reporting to runtime (#70418) --- .../Portable/Compiler/MethodCompiler.cs | 45 +- .../EditAndContinue/CSharpDefinitionMap.cs | 7 +- .../AsyncMethodToStateMachineRewriter.cs | 2 +- .../ClosureConversion.Analysis.Tree.cs | 32 +- .../ClosureConversion.Analysis.cs | 39 +- .../ClosureConversion/ClosureConversion.cs | 96 +- .../LambdaCapturedVariable.cs | 17 +- .../SynthesizedClosureEnvironment.cs | 21 +- .../IteratorMethodToStateMachineRewriter.cs | 2 +- .../Lowering/MethodToClassRewriter.cs | 6 +- .../MethodToStateMachineRewriter.cs | 4 +- .../CSharp/Portable/Symbols/FieldSymbol.cs | 3 +- .../Portable/Symbols/ParameterSymbol.cs | 1 + .../CSharp/Portable/Syntax/LambdaUtilities.cs | 4 +- .../EditAndContinueClosureTests.cs | 5047 ++++++++++++++++- .../EditAndContinueTestBase.cs | 10 +- .../EditAndContinue/EditAndContinueTests.cs | 632 ++- .../ImmutableArrayExtensionsTests.cs | 23 + .../Core/Portable/CodeAnalysisResources.resx | 12 + .../Core/Portable/CodeGen/ClosureDebugInfo.cs | 48 +- .../Core/Portable/CodeGen/LambdaDebugInfo.cs | 36 +- .../CodeGen/LambdaRuntimeRudeEditInfo.cs | 13 + .../Core/Portable/CodeGen/MethodBody.cs | 20 +- .../Portable/CodeGen/VariableSlotAllocator.cs | 25 +- .../Collections/ImmutableArrayExtensions.cs | 38 + .../AddedOrChangedMethodInfo.cs | 8 +- .../Emit/EditAndContinue/DefinitionMap.cs | 301 +- .../Emit/EditAndContinue/DeletedMethodBody.cs | 56 +- .../DeletedPEMethodDefinition.cs | 9 +- .../DeletedSourceMethodDefinition.cs | 12 +- .../EditAndContinue/DeltaMetadataWriter.cs | 32 +- .../Emit/EditAndContinue/EncClosureInfo.cs | 27 + .../EditAndContinue/EncClosureMapValue.cs | 34 + .../Emit/EditAndContinue/EncLambdaInfo.cs | 14 + .../Emit/EditAndContinue/EncLambdaMapValue.cs | 38 + .../Emit/EditAndContinue/EncMappedMethod.cs | 15 + .../EncVariableSlotAllocator.cs | 84 +- .../IDeletedMethodDefinition.cs | 2 +- .../Emit/NoPia/CommonEmbeddedMethod.cs | 11 +- .../Core/Portable/Emit/RuntimeRudeEdit.cs | 17 + .../Core/Portable/Emit/SemanticEdit.cs | 17 +- .../Core/Portable/PEWriter/Members.cs | 10 +- .../Core/Portable/PEWriter/MetadataWriter.cs | 17 +- .../PEWriter/RootModuleStaticConstructor.cs | 6 +- .../Core/Portable/PublicAPI.Unshipped.txt | 7 +- .../Portable/Symbols/IFieldSymbolInternal.cs | 5 + .../Symbols/IParameterSymbolInternal.cs | 1 + .../Core/Portable/WellKnownMember.cs | 2 +- .../Core/Portable/WellKnownMembers.cs | 9 +- .../Portable/xlf/CodeAnalysisResources.cs.xlf | 20 + .../Portable/xlf/CodeAnalysisResources.de.xlf | 20 + .../Portable/xlf/CodeAnalysisResources.es.xlf | 20 + .../Portable/xlf/CodeAnalysisResources.fr.xlf | 20 + .../Portable/xlf/CodeAnalysisResources.it.xlf | 20 + .../Portable/xlf/CodeAnalysisResources.ja.xlf | 20 + .../Portable/xlf/CodeAnalysisResources.ko.xlf | 20 + .../Portable/xlf/CodeAnalysisResources.pl.xlf | 20 + .../xlf/CodeAnalysisResources.pt-BR.xlf | 20 + .../Portable/xlf/CodeAnalysisResources.ru.xlf | 20 + .../Portable/xlf/CodeAnalysisResources.tr.xlf | 20 + .../xlf/CodeAnalysisResources.zh-Hans.xlf | 20 + .../xlf/CodeAnalysisResources.zh-Hant.xlf | 20 + .../SourceWithMarkedNodes.MarkedSpan.cs | 2 - .../MarkedSource/SourceWithMarkedNodes.cs | 48 +- .../Portable/Compilation/MethodCompiler.vb | 185 +- .../VisualBasicDefinitionMap.vb | 22 +- .../LambdaRewriter/LambdaCapturedVariable.vb | 20 + .../Lowering/LambdaRewriter/LambdaFrame.vb | 16 +- .../Lowering/LambdaRewriter/LambdaRewriter.vb | 94 +- .../VisualBasic/Portable/Lowering/Rewriter.vb | 6 +- .../Portable/Symbols/FieldSymbol.vb | 6 + .../Portable/Symbols/ParameterSymbol.vb | 2 +- .../EditAndContinueClosureTests.vb | 1603 +++++- .../EditAndContinueTestBase.vb | 3 +- .../EditAndContinue/EditAndContinueTests.vb | 151 +- .../CSharpEditAndContinueAnalyzerTests.cs | 6 +- .../Helpers/EditingTestBase.cs | 12 +- .../EditAndContinue/StatementEditingTests.cs | 1041 ++-- .../EditAndContinue/TopLevelEditingTests.cs | 9 +- .../RudeEditDiagnosticTests.cs | 4 - .../DeclaratorMapDescription.cs | 41 - .../EditAndContinueTestHelpers.cs | 45 +- .../RuntimeRudeEditDescription.cs | 15 + .../SemanticEditDescription.cs | 57 +- .../EditAndContinue/SourceMarkers.cs | 12 +- .../EditAndContinue/SyntaxMapDescription.cs | 31 + .../Helpers/EditAndContinueValidation.vb | 17 + .../Helpers/EditingTestBase.vb | 9 +- .../EditAndContinue/StatementEditingTests.vb | 533 +- .../EditAndContinue/TopLevelEditingTests.vb | 5 +- ...VisualBasicEditAndContinueAnalyzerTests.vb | 6 +- .../ExpressionCompiler/EEAssemblyBuilder.cs | 6 +- .../Symbols/EEMethodSymbol.cs | 13 +- .../ExpressionCompiler/EEAssemblyBuilder.vb | 6 +- .../CSharpEditAndContinueAnalyzer.cs | 17 + .../DeclarationBody/CSharpLambdaBody.cs | 10 + .../CopyConstructorDeclarationBody.cs | 3 + .../InstanceConstructorDeclarationBody.cs | 18 + ...inaryInstanceConstructorDeclarationBody.cs | 3 + .../PrimaryConstructorDeclarationBody.cs | 3 + .../AbstractEditAndContinueAnalyzer.cs | 783 +-- .../EditAndContinue/DeclarationBody.cs | 4 +- .../EditAndContinue/DeclarationBodyMap.cs | 41 + .../EditAndContinueDiagnosticDescriptors.cs | 7 - .../Portable/EditAndContinue/EditSession.cs | 27 +- .../Portable/EditAndContinue/RudeEditKind.cs | 14 +- .../EditAndContinue/SemanticEditInfo.cs | 57 +- .../Utilities/BidirectionalMap.cs | 16 + .../Core/Portable/FeaturesResources.resx | 21 - .../Portable/xlf/FeaturesResources.cs.xlf | 35 - .../Portable/xlf/FeaturesResources.de.xlf | 35 - .../Portable/xlf/FeaturesResources.es.xlf | 35 - .../Portable/xlf/FeaturesResources.fr.xlf | 35 - .../Portable/xlf/FeaturesResources.it.xlf | 35 - .../Portable/xlf/FeaturesResources.ja.xlf | 35 - .../Portable/xlf/FeaturesResources.ko.xlf | 35 - .../Portable/xlf/FeaturesResources.pl.xlf | 35 - .../Portable/xlf/FeaturesResources.pt-BR.xlf | 35 - .../Portable/xlf/FeaturesResources.ru.xlf | 35 - .../Portable/xlf/FeaturesResources.tr.xlf | 35 - .../xlf/FeaturesResources.zh-Hans.xlf | 35 - .../xlf/FeaturesResources.zh-Hant.xlf | 35 - .../VisualBasicEditAndContinueAnalyzer.vb | 4 + .../EditAndContinueTest.GenerationVerifier.cs | 223 +- .../EditAndContinue/EditAndContinueTest.cs | 34 +- .../EditAndContinueTestUtilities.cs | 2 +- .../SemanticEditDescription.cs | 2 + src/Test/PdbUtilities/Reader/PdbValidation.cs | 39 +- .../Core/Extensions/ListExtensions.cs | 16 +- 129 files changed, 10080 insertions(+), 2922 deletions(-) create mode 100644 src/Compilers/Core/Portable/CodeGen/LambdaRuntimeRudeEditInfo.cs create mode 100644 src/Compilers/Core/Portable/Emit/EditAndContinue/EncClosureInfo.cs create mode 100644 src/Compilers/Core/Portable/Emit/EditAndContinue/EncClosureMapValue.cs create mode 100644 src/Compilers/Core/Portable/Emit/EditAndContinue/EncLambdaInfo.cs create mode 100644 src/Compilers/Core/Portable/Emit/EditAndContinue/EncLambdaMapValue.cs create mode 100644 src/Compilers/Core/Portable/Emit/EditAndContinue/EncMappedMethod.cs create mode 100644 src/Compilers/Core/Portable/Emit/RuntimeRudeEdit.cs delete mode 100644 src/EditorFeatures/TestUtilities/EditAndContinue/DeclaratorMapDescription.cs create mode 100644 src/EditorFeatures/TestUtilities/EditAndContinue/RuntimeRudeEditDescription.cs create mode 100644 src/EditorFeatures/TestUtilities/EditAndContinue/SyntaxMapDescription.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/DeclarationBodyMap.cs diff --git a/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs b/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs index e12c319732450..15441c656ad79 100644 --- a/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs +++ b/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs @@ -254,8 +254,9 @@ private static MethodSymbol GetEntryPoint(CSharpCompilation compilation, PEModul } VariableSlotAllocator lazyVariableSlotAllocator = null; - var lambdaDebugInfoBuilder = ArrayBuilder.GetInstance(); - var closureDebugInfoBuilder = ArrayBuilder.GetInstance(); + var lambdaDebugInfoBuilder = ArrayBuilder.GetInstance(); + var lambdaRuntimeRudeEditsBuilder = ArrayBuilder.GetInstance(); + var closureDebugInfoBuilder = ArrayBuilder.GetInstance(); var stateMachineStateDebugInfoBuilder = ArrayBuilder.GetInstance(); StateMachineTypeSymbol stateMachineTypeOpt = null; const int methodOrdinal = -1; @@ -272,6 +273,7 @@ private static MethodSymbol GetEntryPoint(CSharpCompilation compilation, PEModul diagnostics, ref lazyVariableSlotAllocator, lambdaDebugInfoBuilder, + lambdaRuntimeRudeEditsBuilder, closureDebugInfoBuilder, stateMachineStateDebugInfoBuilder, out stateMachineTypeOpt); @@ -280,10 +282,12 @@ private static MethodSymbol GetEntryPoint(CSharpCompilation compilation, PEModul Debug.Assert(stateMachineTypeOpt is null); Debug.Assert(codeCoverageSpans.IsEmpty); Debug.Assert(lambdaDebugInfoBuilder.IsEmpty()); + Debug.Assert(lambdaRuntimeRudeEditsBuilder.IsEmpty()); Debug.Assert(closureDebugInfoBuilder.IsEmpty()); Debug.Assert(stateMachineStateDebugInfoBuilder.IsEmpty()); lambdaDebugInfoBuilder.Free(); + lambdaRuntimeRudeEditsBuilder.Free(); closureDebugInfoBuilder.Free(); stateMachineStateDebugInfoBuilder.Free(); @@ -294,8 +298,9 @@ private static MethodSymbol GetEntryPoint(CSharpCompilation compilation, PEModul synthesizedEntryPoint, methodOrdinal, loweredBody, - ImmutableArray.Empty, - ImmutableArray.Empty, + ImmutableArray.Empty, + ImmutableArray.Empty, + ImmutableArray.Empty, ImmutableArray.Empty, stateMachineTypeOpt: null, variableSlotAllocatorOpt: null, @@ -750,8 +755,9 @@ private void CompileSynthesizedMethods(TypeCompilationState compilationState) method, methodOrdinal, loweredBody, - ImmutableArray.Empty, - ImmutableArray.Empty, + ImmutableArray.Empty, + ImmutableArray.Empty, + ImmutableArray.Empty, stateMachineStateDebugInfoBuilder.ToImmutable(), stateMachine, variableSlotAllocatorOpt, @@ -1138,8 +1144,9 @@ forSemanticModel.Syntax is { } semanticModelSyntax && bool hasBody = flowAnalyzedBody != null; VariableSlotAllocator lazyVariableSlotAllocator = null; StateMachineTypeSymbol stateMachineTypeOpt = null; - var lambdaDebugInfoBuilder = ArrayBuilder.GetInstance(); - var closureDebugInfoBuilder = ArrayBuilder.GetInstance(); + var lambdaDebugInfoBuilder = ArrayBuilder.GetInstance(); + var lambdaRuntimeRudeEditsBuilder = ArrayBuilder.GetInstance(); + var closureDebugInfoBuilder = ArrayBuilder.GetInstance(); var stateMachineStateDebugInfoBuilder = ArrayBuilder.GetInstance(); BoundStatement loweredBodyOpt = null; @@ -1159,6 +1166,7 @@ forSemanticModel.Syntax is { } semanticModelSyntax && diagsForCurrentMethod, ref lazyVariableSlotAllocator, lambdaDebugInfoBuilder, + lambdaRuntimeRudeEditsBuilder, closureDebugInfoBuilder, stateMachineStateDebugInfoBuilder, out stateMachineTypeOpt); @@ -1234,6 +1242,7 @@ forSemanticModel.Syntax is { } semanticModelSyntax && diagsForCurrentMethod, ref lazyVariableSlotAllocator, lambdaDebugInfoBuilder, + lambdaRuntimeRudeEditsBuilder, closureDebugInfoBuilder, stateMachineStateDebugInfoBuilder, out StateMachineTypeSymbol initializerStateMachineTypeOpt); @@ -1285,16 +1294,19 @@ forSemanticModel.Syntax is { } semanticModelSyntax && return; } } - if (_emitMethodBodies && (!(methodSymbol is SynthesizedStaticConstructor cctor) || cctor.ShouldEmit(processedInitializers.BoundInitializers))) + if (_emitMethodBodies && (methodSymbol is not SynthesizedStaticConstructor cctor || cctor.ShouldEmit(processedInitializers.BoundInitializers))) { var boundBody = BoundStatementList.Synthesized(syntax, boundStatements); + lambdaRuntimeRudeEditsBuilder.Sort(static (x, y) => x.LambdaId.CompareTo(y.LambdaId)); + var emittedBody = GenerateMethodBody( _moduleBeingBuiltOpt, methodSymbol, methodOrdinal, boundBody, lambdaDebugInfoBuilder.ToImmutable(), + lambdaRuntimeRudeEditsBuilder.ToImmutable(), closureDebugInfoBuilder.ToImmutable(), stateMachineStateDebugInfoBuilder.ToImmutable(), stateMachineTypeOpt, @@ -1315,6 +1327,7 @@ forSemanticModel.Syntax is { } semanticModelSyntax && finally { lambdaDebugInfoBuilder.Free(); + lambdaRuntimeRudeEditsBuilder.Free(); closureDebugInfoBuilder.Free(); stateMachineStateDebugInfoBuilder.Free(); } @@ -1338,8 +1351,9 @@ internal static BoundStatement LowerBodyOrInitializer( out ImmutableArray codeCoverageSpans, BindingDiagnosticBag diagnostics, ref VariableSlotAllocator lazyVariableSlotAllocator, - ArrayBuilder lambdaDebugInfoBuilder, - ArrayBuilder closureDebugInfoBuilder, + ArrayBuilder lambdaDebugInfoBuilder, + ArrayBuilder lambdaRuntimeRudeEditsBuilder, + ArrayBuilder closureDebugInfoBuilder, ArrayBuilder stateMachineStateDebugInfoBuilder, out StateMachineTypeSymbol stateMachineTypeOpt) { @@ -1407,8 +1421,9 @@ internal static BoundStatement LowerBodyOrInitializer( method.ThisParameter, method, methodOrdinal, - null, + substitutedSourceMethod: null, lambdaDebugInfoBuilder, + lambdaRuntimeRudeEditsBuilder, closureDebugInfoBuilder, lazyVariableSlotAllocator, compilationState, @@ -1453,8 +1468,9 @@ private static MethodBody GenerateMethodBody( MethodSymbol method, int methodOrdinal, BoundStatement block, - ImmutableArray lambdaDebugInfo, - ImmutableArray closureDebugInfo, + ImmutableArray lambdaDebugInfo, + ImmutableArray orderedLambdaRuntimeRudeEdits, + ImmutableArray closureDebugInfo, ImmutableArray stateMachineStateDebugInfos, StateMachineTypeSymbol stateMachineTypeOpt, VariableSlotAllocator variableSlotAllocatorOpt, @@ -1589,6 +1605,7 @@ private static MethodBody GenerateMethodBody( builder.HasDynamicLocal, importScopeOpt, lambdaDebugInfo, + orderedLambdaRuntimeRudeEdits, closureDebugInfo, stateMachineTypeOpt?.Name, stateMachineHoistedLocalScopes, diff --git a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpDefinitionMap.cs b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpDefinitionMap.cs index 7ac713dc48ca4..7ee5dbd48b551 100644 --- a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpDefinitionMap.cs +++ b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpDefinitionMap.cs @@ -193,10 +193,12 @@ protected override bool TryParseDisplayClassOrLambdaName( out int suffixIndex, out char idSeparator, out bool isDisplayClass, + out bool isDisplayClassParentField, out bool hasDebugIds) { suffixIndex = 0; isDisplayClass = false; + isDisplayClassParentField = false; hasDebugIds = false; idSeparator = GeneratedNameConstants.IdSeparator; @@ -205,7 +207,7 @@ protected override bool TryParseDisplayClassOrLambdaName( return false; } - if (generatedKind is not (GeneratedNameKind.LambdaDisplayClass or GeneratedNameKind.LambdaMethod or GeneratedNameKind.LocalFunction)) + if (generatedKind is not (GeneratedNameKind.LambdaDisplayClass or GeneratedNameKind.LambdaMethod or GeneratedNameKind.LocalFunction or GeneratedNameKind.DisplayClassLocalOrField)) { return false; } @@ -214,9 +216,10 @@ protected override bool TryParseDisplayClassOrLambdaName( Debug.Assert(name.Length >= closeBracketOffset + 1); isDisplayClass = generatedKind == GeneratedNameKind.LambdaDisplayClass; + isDisplayClassParentField = generatedKind == GeneratedNameKind.DisplayClassLocalOrField; suffixIndex = closeBracketOffset + 2; - hasDebugIds = name.AsSpan(suffixIndex).StartsWith(GeneratedNameConstants.SuffixSeparator.AsSpan(), StringComparison.Ordinal); + hasDebugIds = !isDisplayClassParentField && name.AsSpan(suffixIndex).StartsWith(GeneratedNameConstants.SuffixSeparator.AsSpan(), StringComparison.Ordinal); if (hasDebugIds) { diff --git a/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs index 0f4b9ce1c020d..d5d42d092c859 100644 --- a/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs @@ -109,7 +109,7 @@ private FieldSymbol GetAwaiterField(TypeSymbol awaiterType) if (!_awaiterFields.TryGetValue(awaiterType, out result)) { int slotIndex; - if (slotAllocatorOpt == null || !slotAllocatorOpt.TryGetPreviousAwaiterSlotIndex(F.ModuleBuilderOpt.Translate(awaiterType, F.Syntax, F.Diagnostics.DiagnosticBag), F.Diagnostics.DiagnosticBag, out slotIndex)) + if (slotAllocator == null || !slotAllocator.TryGetPreviousAwaiterSlotIndex(F.ModuleBuilderOpt.Translate(awaiterType, F.Syntax, F.Diagnostics.DiagnosticBag), F.Diagnostics.DiagnosticBag, out slotIndex)) { slotIndex = _nextAwaiterId++; } diff --git a/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.Tree.cs b/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.Tree.cs index 3df3e82b21da3..861a69e682754 100644 --- a/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.Tree.cs +++ b/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.Tree.cs @@ -5,6 +5,7 @@ #nullable disable using System; +using System.Linq; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; @@ -134,9 +135,9 @@ public sealed class NestedFunction public readonly ArrayBuilder CapturedEnvironments = ArrayBuilder.GetInstance(); - - public ClosureEnvironment ContainingEnvironmentOpt; - +#nullable enable + public ClosureEnvironment? ContainingEnvironmentOpt; +#nullable disable private bool _capturesThis; /// @@ -170,16 +171,15 @@ public void Free() } } + [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] public sealed class ClosureEnvironment { public readonly SetWithInsertionOrder CapturedVariables; /// - /// True if this environment captures a reference to a class environment - /// declared in a higher scope. Assigned by - /// + /// Assigned by . /// - public bool CapturesParent; + public ClosureEnvironment Parent; public readonly bool IsStruct; internal SynthesizedClosureEnvironment SynthesizedEnvironment; @@ -193,6 +193,24 @@ public ClosureEnvironment(IEnumerable capturedVariables, bool isStruct) } IsStruct = isStruct; } + + /// + /// True if this environment references a class environment declared in a higher scope. + /// + public bool CapturesParent => Parent != null; + + private string GetDebuggerDisplay() + { + int depth = 0; + var current = Parent; + while (current != null) + { + depth++; + current = current.Parent; + } + + return $"{depth}: captures [{string.Join(", ", CapturedVariables.Select(v => v.Name))}]"; + } } /// diff --git a/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.cs b/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.cs index e493b25e03547..123b2a23e4f7d 100644 --- a/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.cs +++ b/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.cs @@ -4,12 +4,13 @@ #nullable disable -using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using Microsoft.CodeAnalysis.CodeGen; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.PooledObjects; using Roslyn.Utilities; @@ -23,6 +24,7 @@ internal partial class ClosureConversion /// internal sealed partial class Analysis { +#nullable enable /// /// If a local function is in the set, at some point in the code it is converted to a delegate and should then not be optimized to a struct closure. /// Also contains all lambdas (as they are converted to delegates implicitly). @@ -44,7 +46,7 @@ public bool CanTakeRefParameters(MethodSymbol function) private readonly MethodSymbol _topLevelMethod; private readonly int _topLevelMethodOrdinal; - private readonly VariableSlotAllocator _slotAllocatorOpt; + private readonly VariableSlotAllocator? _slotAllocator; private readonly TypeCompilationState _compilationState; private Analysis( @@ -52,16 +54,17 @@ private Analysis( PooledHashSet methodsConvertedToDelegates, MethodSymbol topLevelMethod, int topLevelMethodOrdinal, - VariableSlotAllocator slotAllocatorOpt, + VariableSlotAllocator? slotAllocator, TypeCompilationState compilationState) { ScopeTree = scopeTree; MethodsConvertedToDelegates = methodsConvertedToDelegates; _topLevelMethod = topLevelMethod; _topLevelMethodOrdinal = topLevelMethodOrdinal; - _slotAllocatorOpt = slotAllocatorOpt; + _slotAllocator = slotAllocator; _compilationState = compilationState; } +#nullable disable public static Analysis Analyze( BoundNode node, @@ -175,7 +178,8 @@ private void ComputeLambdaScopesAndFrameCaptures() if (!env.IsStruct) { Debug.Assert(!oldEnv.IsStruct); - oldEnv.CapturesParent = true; + Debug.Assert(oldEnv.Parent == null || oldEnv.Parent == env); + oldEnv.Parent = env; oldEnv = env; } capturedEnvs.Remove(env); @@ -517,16 +521,31 @@ private void MergeEnvironments() internal DebugId GetTopLevelMethodId() { - return _slotAllocatorOpt?.MethodId ?? new DebugId(_topLevelMethodOrdinal, _compilationState.ModuleBuilderOpt.CurrentGenerationOrdinal); + return _slotAllocator?.MethodId ?? new DebugId(_topLevelMethodOrdinal, _compilationState.ModuleBuilderOpt.CurrentGenerationOrdinal); } - internal DebugId GetClosureId(SyntaxNode syntax, ArrayBuilder closureDebugInfo) + internal DebugId GetClosureId(ClosureEnvironment environment, SyntaxNode syntax, ArrayBuilder closureDebugInfo, out RuntimeRudeEdit? rudeEdit) { Debug.Assert(syntax != null); + var parentClosure = environment.Parent?.SynthesizedEnvironment; + + // Frames are created and assigned top-down, so the parent scope's environment has to be assigned at this point. + // This may not be true if environments are merged in release build. + Debug.Assert(_slotAllocator == null || environment.Parent is null || parentClosure is not null); + + rudeEdit = parentClosure?.RudeEdit; + var parentClosureId = parentClosure?.ClosureId; + + var structCaptures = _slotAllocator != null && environment.IsStruct + ? environment.CapturedVariables.SelectAsArray(v => v is ThisParameterSymbol ? GeneratedNames.ThisProxyFieldName() : v.Name) + : default; + DebugId closureId; - DebugId previousClosureId; - if (_slotAllocatorOpt != null && _slotAllocatorOpt.TryGetPreviousClosure(syntax, out previousClosureId)) + if (rudeEdit == null && + _slotAllocator != null && + _slotAllocator.TryGetPreviousClosure(syntax, parentClosureId, structCaptures, out var previousClosureId, out rudeEdit) && + rudeEdit == null) { closureId = previousClosureId; } @@ -536,7 +555,7 @@ internal DebugId GetClosureId(SyntaxNode syntax, ArrayBuilder } int syntaxOffset = _topLevelMethod.CalculateLocalSyntaxOffset(LambdaUtilities.GetDeclaratorPosition(syntax), syntax.SyntaxTree); - closureDebugInfo.Add(new ClosureDebugInfo(syntaxOffset, closureId)); + closureDebugInfo.Add(new EncClosureInfo(new ClosureDebugInfo(syntaxOffset, closureId), parentClosureId, structCaptures)); return closureId; } diff --git a/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.cs b/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.cs index 925513e53c794..9b8ef08daff9e 100644 --- a/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.cs +++ b/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.cs @@ -17,6 +17,7 @@ using Microsoft.CodeAnalysis.CodeGen; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.PooledObjects; using Roslyn.Utilities; @@ -101,7 +102,8 @@ internal sealed partial class ClosureConversion : MethodToClassRewriter // The "this" symbol for the current method. private ParameterSymbol _currentFrameThis; - private readonly ArrayBuilder _lambdaDebugInfoBuilder; + private readonly ArrayBuilder _lambdaDebugInfoBuilder; + private readonly ArrayBuilder _lambdaRuntimeRudeEditsBuilder; // ID dispenser for field names of frame references private int _synthesizedFieldNameIdDispenser; @@ -154,16 +156,17 @@ internal sealed partial class ClosureConversion : MethodToClassRewriter private ClosureConversion( Analysis analysis, NamedTypeSymbol thisType, - ParameterSymbol thisParameterOpt, + ParameterSymbol? thisParameter, MethodSymbol method, int methodOrdinal, MethodSymbol substitutedSourceMethod, - ArrayBuilder lambdaDebugInfoBuilder, - VariableSlotAllocator slotAllocatorOpt, + ArrayBuilder lambdaDebugInfoBuilder, + ArrayBuilder lambdaRuntimeRudeEditsBuilder, + VariableSlotAllocator? slotAllocator, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, HashSet assignLocals) - : base(slotAllocatorOpt, compilationState, diagnostics) + : base(slotAllocator, compilationState, diagnostics) { RoslynDebug.Assert(analysis != null); RoslynDebug.Assert((object)thisType != null); @@ -175,13 +178,14 @@ private ClosureConversion( _substitutedSourceMethod = substitutedSourceMethod; _topLevelMethodOrdinal = methodOrdinal; _lambdaDebugInfoBuilder = lambdaDebugInfoBuilder; + _lambdaRuntimeRudeEditsBuilder = lambdaRuntimeRudeEditsBuilder; _currentMethod = method; _analysis = analysis; _assignLocals = assignLocals; _currentTypeParameters = method.TypeParameters; _currentLambdaBodyTypeMap = TypeMap.Empty; - _innermostFramePointer = _currentFrameThis = thisParameterOpt; - _framePointers[thisType] = thisParameterOpt; + _innermostFramePointer = _currentFrameThis = thisParameter; + _framePointers[thisType] = thisParameter; _seenBaseCall = method.MethodKind != MethodKind.Constructor; // only used for ctors _synthesizedFieldNameIdDispenser = 1; @@ -193,8 +197,6 @@ private ClosureConversion( _allCapturedVariables = allCapturedVars.ToImmutable(); } -#nullable disable - protected override bool NeedsProxy(Symbol localOrParameter) { Debug.Assert(localOrParameter is LocalSymbol || localOrParameter is ParameterSymbol || @@ -215,35 +217,37 @@ protected override bool NeedsProxy(Symbol localOrParameter) /// Index of the method symbol in its containing type member list. /// If this is non-null, then will be treated as this for uses of parent symbols. For use in EE. /// Information on lambdas defined in needed for debugging. + /// EnC rude edit information on lambdas defined in . /// Information on closures defined in needed for debugging. - /// Slot allocator. + /// Slot allocator. /// The caller's buffer into which we produce additional methods to be emitted by the caller /// Diagnostic bag for diagnostics /// The set of original locals that should be assigned to proxies if lifted public static BoundStatement Rewrite( BoundStatement loweredBody, NamedTypeSymbol thisType, - ParameterSymbol thisParameter, + ParameterSymbol? thisParameter, MethodSymbol method, int methodOrdinal, MethodSymbol substitutedSourceMethod, - ArrayBuilder lambdaDebugInfoBuilder, - ArrayBuilder closureDebugInfoBuilder, - VariableSlotAllocator slotAllocatorOpt, + ArrayBuilder lambdaDebugInfoBuilder, + ArrayBuilder lambdaRuntimeRudeEditsBuilder, + ArrayBuilder closureDebugInfoBuilder, + VariableSlotAllocator? slotAllocator, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, HashSet assignLocals) { - Debug.Assert((object)thisType != null); - Debug.Assert(((object)thisParameter == null) || (TypeSymbol.Equals(thisParameter.Type, thisType, TypeCompareKind.ConsiderEverything2))); + Debug.Assert(thisType is not null); + Debug.Assert(thisParameter is null || TypeSymbol.Equals(thisParameter.Type, thisType, TypeCompareKind.ConsiderEverything2)); Debug.Assert(compilationState.ModuleBuilderOpt != null); - Debug.Assert(diagnostics.DiagnosticBag is object); + Debug.Assert(diagnostics.DiagnosticBag != null); var analysis = Analysis.Analyze( loweredBody, method, methodOrdinal, - slotAllocatorOpt, + slotAllocator, compilationState, diagnostics.DiagnosticBag); @@ -256,7 +260,8 @@ public static BoundStatement Rewrite( methodOrdinal, substitutedSourceMethod, lambdaDebugInfoBuilder, - slotAllocatorOpt, + lambdaRuntimeRudeEditsBuilder, + slotAllocator, compilationState, diagnostics, assignLocals); @@ -287,7 +292,7 @@ public static BoundStatement Rewrite( return body; } - +#nullable disable private BoundStatement AddStatementsIfNeeded(BoundStatement body) { if (_addedLocals != null) @@ -330,7 +335,7 @@ protected override NamedTypeSymbol ContainingType /// Adds synthesized types to the compilation state /// and creates hoisted fields for all locals captured by the environments. /// - private void SynthesizeClosureEnvironments(ArrayBuilder closureDebugInfo) + private void SynthesizeClosureEnvironments(ArrayBuilder closureDebugInfo) { Analysis.VisitScopeTree(_analysis.ScopeTree, scope => { @@ -363,7 +368,7 @@ SynthesizedClosureEnvironment MakeFrame(Analysis.Scope scope, Analysis.ClosureEn Debug.Assert(syntax != null); DebugId methodId = _analysis.GetTopLevelMethodId(); - DebugId closureId = _analysis.GetClosureId(syntax, closureDebugInfo); + DebugId closureId = _analysis.GetClosureId(env, syntax, closureDebugInfo, out var rudeEdit); var containingMethod = scope.ContainingFunctionOpt?.OriginalMethodSymbol ?? _topLevelMethod; if ((object)_substitutedSourceMethod != null && containingMethod == _topLevelMethod) @@ -377,7 +382,8 @@ SynthesizedClosureEnvironment MakeFrame(Analysis.Scope scope, Analysis.ClosureEn env.IsStruct, syntax, methodId, - closureId); + closureId, + rudeEdit); foreach (var captured in env.CapturedVariables) { @@ -413,10 +419,10 @@ private void SynthesizeClosureMethods() if (nestedFunction.ContainingEnvironmentOpt != null) { containerAsFrame = nestedFunction.ContainingEnvironmentOpt.SynthesizedEnvironment; + translatedLambdaContainer = containerAsFrame; closureKind = ClosureKind.General; - translatedLambdaContainer = containerAsFrame; - closureOrdinal = containerAsFrame.ClosureOrdinal; + closureOrdinal = containerAsFrame.ClosureId.Ordinal; } else if (nestedFunction.CapturesThis) { @@ -442,8 +448,8 @@ private void SynthesizeClosureMethods() else { // Lower directly onto the containing type - translatedLambdaContainer = _topLevelMethod.ContainingType; containerAsFrame = null; + translatedLambdaContainer = _topLevelMethod.ContainingType; closureKind = ClosureKind.Static; closureOrdinal = LambdaDebugInfo.StaticClosureOrdinal; } @@ -451,13 +457,15 @@ private void SynthesizeClosureMethods() Debug.Assert((object)translatedLambdaContainer != _topLevelMethod.ContainingType || VarianceSafety.GetEnclosingVariantInterface(_topLevelMethod) is null); + var structEnvironments = getStructEnvironments(nestedFunction); + // Move the body of the lambda to a freshly generated synthetic method on its frame. topLevelMethodId = _analysis.GetTopLevelMethodId(); - lambdaId = GetLambdaId(syntax, closureKind, closureOrdinal); + lambdaId = GetLambdaId(syntax, closureKind, closureOrdinal, structEnvironments.SelectAsArray(e => e.ClosureId), containerAsFrame?.RudeEdit); var synthesizedMethod = new SynthesizedClosureMethod( translatedLambdaContainer, - getStructEnvironments(nestedFunction), + structEnvironments, closureKind, _topLevelMethod, topLevelMethodId, @@ -515,7 +523,6 @@ private SynthesizedClosureEnvironment GetStaticFrame(BindingDiagnosticBag diagno methodId = _analysis.GetTopLevelMethodId(); } - DebugId closureId = default(DebugId); // using _topLevelMethod as containing member because the static frame does not have generic parameters, except for the top level method's var containingMethod = isNonGeneric ? null : (_substitutedSourceMethod ?? _topLevelMethod); _lazyStaticLambdaFrame = new SynthesizedClosureEnvironment( @@ -524,7 +531,8 @@ private SynthesizedClosureEnvironment GetStaticFrame(BindingDiagnosticBag diagno isStruct: false, scopeSyntaxOpt: null, methodId: methodId, - closureId: closureId); + closureId: default, + rudeEdit: null); // non-generic static lambdas can share the frame if (isNonGeneric) @@ -1420,12 +1428,14 @@ public override BoundNode VisitLocalFunctionStatement(BoundLocalFunctionStatemen return new BoundNoOpStatement(node.Syntax, NoOpStatementFlavor.Default); } - - private DebugId GetLambdaId(SyntaxNode syntax, ClosureKind closureKind, int closureOrdinal) +#nullable enable + private DebugId GetLambdaId(SyntaxNode syntax, ClosureKind closureKind, int closureOrdinal, ImmutableArray structClosureIds, RuntimeRudeEdit? closureRudeEdit) { Debug.Assert(syntax != null); + Debug.Assert(CompilationState.ModuleBuilderOpt != null); + Debug.Assert(closureOrdinal >= LambdaDebugInfo.MinClosureOrdinal); - SyntaxNode lambdaOrLambdaBodySyntax; + SyntaxNode? lambdaOrLambdaBodySyntax; bool isLambdaBody; if (syntax is AnonymousFunctionExpressionSyntax anonymousFunction) @@ -1435,7 +1445,7 @@ private DebugId GetLambdaId(SyntaxNode syntax, ClosureKind closureKind, int clos } else if (syntax is LocalFunctionStatementSyntax localFunction) { - lambdaOrLambdaBodySyntax = (SyntaxNode)localFunction.Body ?? localFunction.ExpressionBody?.Expression; + lambdaOrLambdaBodySyntax = (SyntaxNode?)localFunction.Body ?? localFunction.ExpressionBody?.Expression; if (lambdaOrLambdaBodySyntax is null) { @@ -1466,21 +1476,31 @@ private DebugId GetLambdaId(SyntaxNode syntax, ClosureKind closureKind, int clos // determine lambda ordinal and calculate syntax offset DebugId lambdaId; - DebugId previousLambdaId; - if (slotAllocatorOpt != null && slotAllocatorOpt.TryGetPreviousLambda(lambdaOrLambdaBodySyntax, isLambdaBody, out previousLambdaId)) + DebugId previousLambdaId = default; + RuntimeRudeEdit? lambdaRudeEdit = null; + + if (closureRudeEdit == null && + slotAllocator?.TryGetPreviousLambda(lambdaOrLambdaBodySyntax, isLambdaBody, closureOrdinal, structClosureIds, out previousLambdaId, out lambdaRudeEdit) == true && + lambdaRudeEdit == null) { lambdaId = previousLambdaId; } else { lambdaId = new DebugId(_lambdaDebugInfoBuilder.Count, CompilationState.ModuleBuilderOpt.CurrentGenerationOrdinal); + + var rudeEdit = closureRudeEdit ?? lambdaRudeEdit; + if (rudeEdit != null) + { + _lambdaRuntimeRudeEditsBuilder.Add(new LambdaRuntimeRudeEditInfo(previousLambdaId, rudeEdit.Value)); + } } int syntaxOffset = _topLevelMethod.CalculateLocalSyntaxOffset(LambdaUtilities.GetDeclaratorPosition(lambdaOrLambdaBodySyntax), lambdaOrLambdaBodySyntax.SyntaxTree); - _lambdaDebugInfoBuilder.Add(new LambdaDebugInfo(syntaxOffset, lambdaId, closureOrdinal)); + _lambdaDebugInfoBuilder.Add(new EncLambdaInfo(new LambdaDebugInfo(syntaxOffset, lambdaId, closureOrdinal), structClosureIds)); return lambdaId; } - +#nullable disable private SynthesizedClosureMethod RewriteLambdaOrLocalFunction( IBoundLambdaOrFunction node, out ClosureKind closureKind, diff --git a/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/LambdaCapturedVariable.cs b/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/LambdaCapturedVariable.cs index 6ffdada33af86..66c567bc3a8f4 100644 --- a/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/LambdaCapturedVariable.cs +++ b/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/LambdaCapturedVariable.cs @@ -9,18 +9,19 @@ using Microsoft.CodeAnalysis.CSharp.Symbols; using Roslyn.Utilities; using System.Collections.Immutable; +using Microsoft.CodeAnalysis.Symbols; namespace Microsoft.CodeAnalysis.CSharp { /// /// A field of a frame class that represents a variable that has been captured in a lambda. /// - internal sealed class LambdaCapturedVariable : SynthesizedFieldSymbolBase + internal sealed class LambdaCapturedVariable : SynthesizedFieldSymbolBase, ISynthesizedMethodBodyImplementationSymbol { private readonly TypeWithAnnotations _type; private readonly bool _isThis; - private LambdaCapturedVariable(SynthesizedContainer frame, TypeWithAnnotations type, string fieldName, bool isThisParameter) + private LambdaCapturedVariable(SynthesizedClosureEnvironment frame, TypeWithAnnotations type, string fieldName, bool isThisParameter) : base(frame, fieldName, isPublic: true, @@ -35,6 +36,9 @@ private LambdaCapturedVariable(SynthesizedContainer frame, TypeWithAnnotations t _isThis = isThisParameter; } + public SynthesizedClosureEnvironment Frame + => (SynthesizedClosureEnvironment)ContainingType; + public static LambdaCapturedVariable Create(SynthesizedClosureEnvironment frame, Symbol captured, ref int uniqueId) { Debug.Assert(captured is LocalSymbol || captured is ParameterSymbol); @@ -137,5 +141,14 @@ internal override bool SuppressDynamicAttribute return false; } } + + public IMethodSymbolInternal Method + => Frame.TopLevelMethod; + + /// + /// When the containing top-level method body is updated we don't need to attempt to update field (it has no "body"). + /// + public bool HasMethodBodyDependency + => false; } } diff --git a/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/SynthesizedClosureEnvironment.cs b/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/SynthesizedClosureEnvironment.cs index c12e16225b510..49797ec0c86cd 100644 --- a/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/SynthesizedClosureEnvironment.cs +++ b/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/SynthesizedClosureEnvironment.cs @@ -21,9 +21,9 @@ namespace Microsoft.CodeAnalysis.CSharp /// internal sealed class SynthesizedClosureEnvironment : SynthesizedContainer, ISynthesizedMethodBodyImplementationSymbol { - private readonly MethodSymbol _topLevelMethod; + internal readonly MethodSymbol TopLevelMethod; internal readonly SyntaxNode ScopeSyntaxOpt; - internal readonly int ClosureOrdinal; + /// /// The closest method/lambda that this frame is originally from. Null if nongeneric static closure. /// Useful because this frame's type parameters are constructed from this method and all methods containing this method. @@ -38,20 +38,27 @@ internal sealed class SynthesizedClosureEnvironment : SynthesizedContainer, ISyn public override TypeKind TypeKind { get; } internal override MethodSymbol Constructor { get; } + // debug info: + public readonly DebugId ClosureId; + public readonly RuntimeRudeEdit? RudeEdit; + internal SynthesizedClosureEnvironment( MethodSymbol topLevelMethod, MethodSymbol containingMethod, bool isStruct, SyntaxNode scopeSyntaxOpt, DebugId methodId, - DebugId closureId) + DebugId closureId, + RuntimeRudeEdit? rudeEdit) : base(MakeName(scopeSyntaxOpt, methodId, closureId), containingMethod) { TypeKind = isStruct ? TypeKind.Struct : TypeKind.Class; - _topLevelMethod = topLevelMethod; + TopLevelMethod = topLevelMethod; OriginalContainingMethodOpt = containingMethod; Constructor = isStruct ? null : new SynthesizedClosureEnvironmentConstructor(this); - this.ClosureOrdinal = closureId.Ordinal; + + ClosureId = closureId; + RudeEdit = rudeEdit; // static lambdas technically have the class scope so the scope syntax is null if (scopeSyntaxOpt == null) @@ -129,7 +136,7 @@ internal override IEnumerable GetFieldsToEmit() // display classes for static lambdas do not have any data and can be serialized. public override bool IsSerializable => (object)SingletonCache != null; - public override Symbol ContainingSymbol => _topLevelMethod.ContainingSymbol; + public override Symbol ContainingSymbol => TopLevelMethod.ContainingSymbol; // Closures in the same method share the same SynthesizedClosureEnvironment. We must // always return true because two closures in the same method might have different @@ -139,7 +146,7 @@ internal override IEnumerable GetFieldsToEmit() // The lambda method contains user code from the lambda bool ISynthesizedMethodBodyImplementationSymbol.HasMethodBodyDependency => true; - IMethodSymbolInternal ISynthesizedMethodBodyImplementationSymbol.Method => _topLevelMethod; + IMethodSymbolInternal ISynthesizedMethodBodyImplementationSymbol.Method => TopLevelMethod; internal override bool IsRecord => false; internal override bool IsRecordStruct => false; diff --git a/src/Compilers/CSharp/Portable/Lowering/IteratorRewriter/IteratorMethodToStateMachineRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/IteratorRewriter/IteratorMethodToStateMachineRewriter.cs index 15a83f4890660..6b4d5e646a5e0 100644 --- a/src/Compilers/CSharp/Portable/Lowering/IteratorRewriter/IteratorMethodToStateMachineRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/IteratorRewriter/IteratorMethodToStateMachineRewriter.cs @@ -464,7 +464,7 @@ private IteratorFinallyFrame PushFrame(BoundTryStatement statement) { var syntax = statement.Syntax; - if (slotAllocatorOpt?.TryGetPreviousStateMachineState(syntax, awaitId: default, out var finalizeState) != true) + if (slotAllocator?.TryGetPreviousStateMachineState(syntax, awaitId: default, out var finalizeState) != true) { finalizeState = _nextFinalizeState--; } diff --git a/src/Compilers/CSharp/Portable/Lowering/MethodToClassRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/MethodToClassRewriter.cs index 73354f5877643..49236fa2a3a89 100644 --- a/src/Compilers/CSharp/Portable/Lowering/MethodToClassRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/MethodToClassRewriter.cs @@ -49,11 +49,11 @@ internal abstract partial class MethodToClassRewriter : BoundTreeRewriterWithSta protected readonly TypeCompilationState CompilationState; protected readonly BindingDiagnosticBag Diagnostics; - protected readonly VariableSlotAllocator? slotAllocatorOpt; + protected readonly VariableSlotAllocator? slotAllocator; private readonly Dictionary _placeholderMap; - protected MethodToClassRewriter(VariableSlotAllocator? slotAllocatorOpt, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics) + protected MethodToClassRewriter(VariableSlotAllocator? slotAllocator, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics) { Debug.Assert(compilationState != null); Debug.Assert(diagnostics != null); @@ -61,7 +61,7 @@ protected MethodToClassRewriter(VariableSlotAllocator? slotAllocatorOpt, TypeCom this.CompilationState = compilationState; this.Diagnostics = diagnostics; - this.slotAllocatorOpt = slotAllocatorOpt; + this.slotAllocator = slotAllocator; this._placeholderMap = new Dictionary(); } diff --git a/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs index 43c6ed9c1abde..88240a3be3e5b 100644 --- a/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs @@ -672,8 +672,8 @@ private BoundExpression HoistExpression( // Editing await expression is not allowed. Thus all spilled fields will be present in the previous state machine. // However, it may happen that the type changes, in which case we need to allocate a new slot. int slotIndex; - if (slotAllocatorOpt == null || - !slotAllocatorOpt.TryGetPreviousHoistedLocalSlotIndex( + if (slotAllocator == null || + !slotAllocator.TryGetPreviousHoistedLocalSlotIndex( awaitSyntaxOpt, F.ModuleBuilderOpt.Translate(fieldType, awaitSyntaxOpt, Diagnostics.DiagnosticBag), kind, diff --git a/src/Compilers/CSharp/Portable/Symbols/FieldSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/FieldSymbol.cs index 08d484e953cfd..341314865036a 100644 --- a/src/Compilers/CSharp/Portable/Symbols/FieldSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/FieldSymbol.cs @@ -502,7 +502,8 @@ public virtual int TupleElementIndex } ISymbolInternal IFieldSymbolInternal.AssociatedSymbol => AssociatedSymbol; - bool IFieldSymbolInternal.IsVolatile => this.IsVolatile; + bool IFieldSymbolInternal.IsVolatile => IsVolatile; + ITypeSymbolInternal IFieldSymbolInternal.Type => Type; protected override ISymbol CreateISymbol() { diff --git a/src/Compilers/CSharp/Portable/Symbols/ParameterSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/ParameterSymbol.cs index c3e8c6067efa3..04b50c53ea0de 100644 --- a/src/Compilers/CSharp/Portable/Symbols/ParameterSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/ParameterSymbol.cs @@ -440,6 +440,7 @@ protected override ISymbol CreateISymbol() #region IParameterSymbolInternal ITypeSymbolInternal IParameterSymbolInternal.Type => Type; + RefKind IParameterSymbolInternal.RefKind => RefKind; #endregion } diff --git a/src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs b/src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs index 14bd698f7e106..dce50e032dd1e 100644 --- a/src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs +++ b/src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs @@ -418,7 +418,9 @@ internal static bool IsClosureScope(SyntaxNode node) case SyntaxKind.StructDeclaration: case SyntaxKind.RecordDeclaration: case SyntaxKind.RecordStructDeclaration: - // With dynamic analysis instrumentation, a type declaration can be the syntax associated + // Captured primary constructor parameters. + // + // With dynamic analysis instrumentation, a type declaration can also be the syntax associated // with the analysis payload local of a synthesized constructor. // If the synthesized constructor includes an initializer with a lambda, // that lambda needs a closure that captures the analysis payload of the constructor. diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.cs index 2753a3ff2f6d9..ccba392f338d1 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.cs @@ -9,6 +9,7 @@ using System.Reflection.Metadata.Ecma335; using Microsoft.CodeAnalysis.CodeGen; using Microsoft.CodeAnalysis.CSharp.Symbols; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.CSharp.UnitTests; using Microsoft.CodeAnalysis.Emit; @@ -23,54 +24,194 @@ public class EditAndContinueClosureTests : EditAndContinueTestBase [Fact] public void MethodToMethodWithClosure() { - var source0 = -@"delegate object D(); -class C -{ - static object F(object o) - { - return o; - } -}"; - var source1 = -@"delegate object D(); -class C -{ - static object F(object o) - { - return ((D)(() => o))(); - } -}"; - var compilation0 = CreateCompilation(source0, parseOptions: TestOptions.Regular.WithNoRefSafetyRulesAttribute(), options: TestOptions.DebugDll); - var compilation1 = compilation0.WithSource(source1); - var bytes0 = compilation0.EmitToArray(); - var generation0 = CreateInitialBaseline(compilation0, ModuleMetadata.CreateFromImage(bytes0), EmptyLocalsProvider); + using var _ = new EditAndContinueTest() + .AddBaseline( + """ + delegate object D(); + class C + { + static void F() + { + } + + static void F(object o) + { + } + + static void F(bool a, bool b) + { + } + } + """) + .AddGeneration( + """ + delegate object D(); + class C + { + static void F() + { + int x = 1; + D d = () => x; + } + + static void F(object o) + { + D d1 = () => o; + D d2 = () => o; + } + + static void F(bool a, bool b) + { + D d = () => null; + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMembers("C.F").Single(m => m.Parameters is []), preserveLocalVariables: true), + Edit(SemanticEditKind.Update, c => c.GetMembers("C.F").Single(m => m.Parameters is [_]), preserveLocalVariables: true), + Edit(SemanticEditKind.Update, c => c.GetMembers("C.F").Single(m => m.Parameters is [_, _]), preserveLocalVariables: true), + ], + validator: g => + { + // Note that the synthesized names have generation #1 suffix. This is because baseline methods did not have any lambdas + // and thus no MethodId. + g.VerifySynthesizedMembers( + "C: {<>c, <>c__DisplayClass0#1_0#1, <>c__DisplayClass1#1_0#1}", + "C.<>c: {<>9__2#1_0#1, b__2#1_0#1}", + "C.<>c__DisplayClass0#1_0#1: {x, b__0#1}", + "C.<>c__DisplayClass1#1_0#1: {o, b__0#1, b__1#1}"); + + g.VerifyEncLogDefinitions( + [ + Row(1, TableIndex.StandAloneSig, EditAndContinueOperation.Default), + Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default), + Row(3, TableIndex.StandAloneSig, EditAndContinueOperation.Default), + Row(4, TableIndex.TypeDef, EditAndContinueOperation.Default), + Row(5, TableIndex.TypeDef, EditAndContinueOperation.Default), + Row(6, TableIndex.TypeDef, EditAndContinueOperation.Default), + Row(4, TableIndex.TypeDef, EditAndContinueOperation.AddField), + Row(1, TableIndex.Field, EditAndContinueOperation.Default), + Row(4, TableIndex.TypeDef, EditAndContinueOperation.AddField), + Row(2, TableIndex.Field, EditAndContinueOperation.Default), + Row(5, TableIndex.TypeDef, EditAndContinueOperation.AddField), + Row(3, TableIndex.Field, EditAndContinueOperation.Default), + Row(6, TableIndex.TypeDef, EditAndContinueOperation.AddField), + Row(4, TableIndex.Field, EditAndContinueOperation.Default), + Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(6, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(7, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(4, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), + Row(9, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(4, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), + Row(10, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(4, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), + Row(11, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(5, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), + Row(12, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(5, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), + Row(13, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(6, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), + Row(14, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(6, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), + Row(15, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(6, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), + Row(16, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(6, TableIndex.Param, EditAndContinueOperation.Default), + Row(7, TableIndex.Param, EditAndContinueOperation.Default), + Row(8, TableIndex.Param, EditAndContinueOperation.Default), + Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default), + Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default), + Row(6, TableIndex.CustomAttribute, EditAndContinueOperation.Default), + Row(1, TableIndex.NestedClass, EditAndContinueOperation.Default), + Row(2, TableIndex.NestedClass, EditAndContinueOperation.Default), + Row(3, TableIndex.NestedClass, EditAndContinueOperation.Default) + ]); + }) + .Verify(); + } - var diff1 = compilation1.EmitDifference( - generation0, - ImmutableArray.Create(SemanticEdit.Create(SemanticEditKind.Update, compilation0.GetMember("C.F"), compilation1.GetMember("C.F")))); - - using (var md1 = diff1.GetMetadata()) - { - var reader1 = md1.Reader; - - // Field 'o' - // Methods: 'F', '.ctor', 'b__1' - // Type: display class - CheckEncLogDefinitions(reader1, - Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default), - Row(4, TableIndex.TypeDef, EditAndContinueOperation.Default), - Row(4, TableIndex.TypeDef, EditAndContinueOperation.AddField), - Row(1, TableIndex.Field, EditAndContinueOperation.Default), - Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default), - Row(4, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), - Row(7, TableIndex.MethodDef, EditAndContinueOperation.Default), - Row(4, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), - Row(8, TableIndex.MethodDef, EditAndContinueOperation.Default), - Row(6, TableIndex.Param, EditAndContinueOperation.Default), - Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default), - Row(1, TableIndex.NestedClass, EditAndContinueOperation.Default)); - } + [Fact] + public void MethodToMethodWithClosure_DeletedAndReadded() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + """ + using System; + class C + { + static void F() + { + } + } + """) + .AddGeneration( + """ + using System; + class C + { + static void F() + { + int x = 1; + var d = new Func(() => x); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass0#1_0#1}", + "C.<>c__DisplayClass0#1_0#1: {x, b__0#1}"); + }) + .AddGeneration( + """ + using System; + class C + { + static void F() + { + int x = 1; + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass0#1_0#1}", + "C.<>c__DisplayClass0#1_0#1: {x, b__0#1}"); + }) + .AddGeneration( + """ + using System; + class C + { + static void F() + { + int x = 1; + var d = new Func(() => x == 1); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass0#1_0#3, <>c__DisplayClass0#1_0#1}", + "C.<>c__DisplayClass0#1_0#3: {x, b__0#3}", + "C.<>c__DisplayClass0#1_0#1: {x, b__0#1}"); + }) + .Verify(); } [Fact] @@ -1495,13 +1636,13 @@ static object F() var md1 = diff1.GetMetadata(); var reader1 = md1.Reader; - // new lambda "b__0#1" has been added: + // new lambda "b__1#1_0#1" has been added: diff1.VerifySynthesizedMembers( "C: {<>c}", - "C.<>c: {<>9__0#1, b__0#1}"); + "C.<>c: {<>9__1#1_0#1, b__1#1_0#1}"); // added: - diff1.VerifyIL("C.<>c.b__0#1", @" + diff1.VerifyIL("C.<>c.b__1#1_0#1", @" { // Code size 4 (0x4) .maxstack 2 @@ -1518,10 +1659,10 @@ .maxstack 2 diff2.VerifySynthesizedMembers( "C: {<>c}", - "C.<>c: {<>9__0#1, b__0#1}"); + "C.<>c: {<>9__1#1_0#1, b__1#1_0#1}"); // updated: - diff2.VerifyIL("C.<>c.b__0#1", @" + diff2.VerifyIL("C.<>c.b__1#1_0#1", @" { // Code size 4 (0x4) .maxstack 2 @@ -1594,12 +1735,12 @@ static object F() var md1 = diff1.GetMetadata(); var reader1 = md1.Reader; - // new lambda "b__0#1" has been added: + // new local function has been added: diff1.VerifySynthesizedMembers( - "C: {g__f|0#1}"); + "C: {g__f|1#1_0#1}"); // added: - diff1.VerifyIL("C.g__f|0#1(int)", @" + diff1.VerifyIL("C.g__f|1#1_0#1", @" { // Code size 4 (0x4) .maxstack 2 @@ -1615,10 +1756,10 @@ .maxstack 2 ImmutableArray.Create(SemanticEdit.Create(SemanticEditKind.Update, f1, f2, GetSyntaxMapFromMarkers(source1, source2)))); diff2.VerifySynthesizedMembers( - "C: {g__f|0#1}"); + "C: {g__f|1#1_0#1}"); // updated: - diff2.VerifyIL("C.g__f|0#1(int)", @" + diff2.VerifyIL("C.g__f|1#1_0#1", @" { // Code size 4 (0x4) .maxstack 2 @@ -1685,12 +1826,12 @@ static object F() var md1 = diff1.GetMetadata(); var reader1 = md1.Reader; - // new lambda "b__0#1" has been added: + // new local function has been added: diff1.VerifySynthesizedMembers( - "C: {g__f|0#1}"); + "C: {g__f|0#1_0#1}"); // added: - diff1.VerifyIL("C.g__f|0#1(int)", @" + diff1.VerifyIL("C.g__f|0#1_0#1(int)", @" { // Code size 4 (0x4) .maxstack 2 @@ -1706,10 +1847,10 @@ .maxstack 2 ImmutableArray.Create(SemanticEdit.Create(SemanticEditKind.Update, f1, f2, GetSyntaxMapFromMarkers(source1, source2)))); diff2.VerifySynthesizedMembers( - "C: {g__f|0#1}"); + "C: {g__f|0#1_0#1}"); // updated: - diff2.VerifyIL("C.g__f|0#1(int)", @" + diff2.VerifyIL("C.g__f|0#1_0#1(int)", @" { // Code size 4 (0x4) .maxstack 2 @@ -4367,108 +4508,107 @@ .maxstack 2 [Fact] public void CaptureStructAndThroughClassEnvChain() { - var source0 = MarkedSource(@" -using System; -public class C -{ - public void F(int x) - { - { - int y = 0; - Func f = () => x; - { - Func f2 = () => x + y; - int z = 0; - // Capture struct and through class env chain - int L() => x + y + z; - } - } - } -}"); - - var source1 = MarkedSource(@" -using System; -public class C -{ - public void F(int x) -{ - { - int y = 0; - Func f = () => x; - { - Func f2 = () => x + y; - int z = 0; - // Capture struct and through class env chain - int L() => x + y + z + 1; - } - } - } -}"); - var compilation0 = CreateCompilation(source0.Tree, options: ComSafeDebugDll); - var compilation1 = compilation0.WithSource(source1.Tree); - var v0 = CompileAndVerify(compilation0); - var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); - - var f0 = compilation0.GetMember("C.F"); - var f1 = compilation1.GetMember("C.F"); - - var generation0 = CreateInitialBaseline(compilation0, md0, v0.CreateSymReader().GetEncMethodDebugInfo); - - var diff1 = compilation1.EmitDifference( - generation0, - ImmutableArray.Create(SemanticEdit.Create(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1)))); - - var md1 = diff1.GetMetadata(); - var reader1 = md1.Reader; - - diff1.VerifySynthesizedMembers( - "C.<>c__DisplayClass0_2: {z}", - "C.<>c__DisplayClass0_0: {x, b__0}", - "C: {<>c__DisplayClass0_0, <>c__DisplayClass0_1, <>c__DisplayClass0_2}", - "C.<>c__DisplayClass0_1: {y, CS$<>8__locals1, b__1, g__L|2}"); - - v0.VerifyIL("C.<>c__DisplayClass0_1.g__L|2(ref C.<>c__DisplayClass0_2)", @" -{ - // Code size 26 (0x1a) - .maxstack 2 - IL_0000: ldarg.0 - IL_0001: ldfld ""C.<>c__DisplayClass0_0 C.<>c__DisplayClass0_1.CS$<>8__locals1"" - IL_0006: ldfld ""int C.<>c__DisplayClass0_0.x"" - IL_000b: ldarg.0 - IL_000c: ldfld ""int C.<>c__DisplayClass0_1.y"" - IL_0011: add - IL_0012: ldarg.1 - IL_0013: ldfld ""int C.<>c__DisplayClass0_2.z"" - IL_0018: add - IL_0019: ret -}"); - - diff1.VerifyIL("C.<>c__DisplayClass0_1.g__L|2(ref C.<>c__DisplayClass0_2)", @" -{ - // Code size 28 (0x1c) - .maxstack 2 - IL_0000: ldarg.0 - IL_0001: ldfld ""C.<>c__DisplayClass0_0 C.<>c__DisplayClass0_1.CS$<>8__locals1"" - IL_0006: ldfld ""int C.<>c__DisplayClass0_0.x"" - IL_000b: ldarg.0 - IL_000c: ldfld ""int C.<>c__DisplayClass0_1.y"" - IL_0011: add - IL_0012: ldarg.1 - IL_0013: ldfld ""int C.<>c__DisplayClass0_2.z"" - IL_0018: add - IL_0019: ldc.i4.1 - IL_001a: add - IL_001b: ret -} -"); - - CheckEncLogDefinitions(reader1, - Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default), - Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default), - Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default), - Row(6, TableIndex.MethodDef, EditAndContinueOperation.Default), - Row(7, TableIndex.MethodDef, EditAndContinueOperation.Default), - Row(1, TableIndex.Param, EditAndContinueOperation.Default)); + using var _ = new EditAndContinueTest() + .AddBaseline(""" + using System; + public class C + { + public void F(int x) + { + { + int y = 0; + Func f = () => x; + { + Func f2 = () => x + y; + int z = 0; + // Capture struct and through class env chain + int L() => x + y + z; + } + } + } + } + """, + validator: g => + { + g.VerifyMethodBody("C.<>c__DisplayClass0_1.g__L|2(ref C.<>c__DisplayClass0_2)", """ + { + // Code size 26 (0x1a) + .maxstack 2 + // sequence point: x + y + z + IL_0000: ldarg.0 + IL_0001: ldfld "C.<>c__DisplayClass0_0 C.<>c__DisplayClass0_1.CS$<>8__locals1" + IL_0006: ldfld "int C.<>c__DisplayClass0_0.x" + IL_000b: ldarg.0 + IL_000c: ldfld "int C.<>c__DisplayClass0_1.y" + IL_0011: add + IL_0012: ldarg.1 + IL_0013: ldfld "int C.<>c__DisplayClass0_2.z" + IL_0018: add + IL_0019: ret + } + """); + }) + .AddGeneration(""" + using System; + public class C + { + public void F(int x) + { + { + int y = 0; + Func f = () => x; + { + Func f2 = () => x + y; + int z = 0; + // Capture struct and through class env chain + int L() => x + y + z + 1; + } + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true) + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C.<>c__DisplayClass0_2: {z}", + "C.<>c__DisplayClass0_0: {x, b__0}", + "C: {<>c__DisplayClass0_0, <>c__DisplayClass0_1, <>c__DisplayClass0_2}", + "C.<>c__DisplayClass0_1: {y, CS$<>8__locals1, b__1, g__L|2}"); + + g.VerifyIL("C.<>c__DisplayClass0_1.g__L|2(ref C.<>c__DisplayClass0_2)", """ + { + // Code size 28 (0x1c) + .maxstack 2 + IL_0000: ldarg.0 + IL_0001: ldfld "C.<>c__DisplayClass0_0 C.<>c__DisplayClass0_1.CS$<>8__locals1" + IL_0006: ldfld "int C.<>c__DisplayClass0_0.x" + IL_000b: ldarg.0 + IL_000c: ldfld "int C.<>c__DisplayClass0_1.y" + IL_0011: add + IL_0012: ldarg.1 + IL_0013: ldfld "int C.<>c__DisplayClass0_2.z" + IL_0018: add + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: ret + } + """); + + g.VerifyEncLogDefinitions( + [ + Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default), + Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(6, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(7, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(1, TableIndex.Param, EditAndContinueOperation.Default) + ]); + }) + .Verify(); } [Fact] @@ -4660,5 +4800,4584 @@ class C Handle(2, TableIndex.StandAloneSig), Handle(2, TableIndex.NestedClass)); } + + [Fact] + public void Capture_Local_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + _ = new Action(() => Console.WriteLine(0)); + _ = new Action(() => Console.WriteLine(1)); + } + } + """, + validator: g => + { + }) + + .AddGeneration( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + _ = new Action(() => Console.WriteLine(x)); + _ = new Action(() => Console.WriteLine(2)); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // Static lambda is reused. + // A new display class and method is generated for lambda that captures x. + g.VerifySynthesizedMembers( + "C: {<>c, <>c__DisplayClass0_0#1}", + "C.<>c: {<>9__0_1, b__0_1}", + "C.<>c__DisplayClass0_0#1: {x, b__0#1}"); + + g.VerifyMethodDefNames("F", "b__0_0", "b__0_1", ".ctor", "b__0#1"); + + g.VerifyIL( + """ + { + // Code size 44 (0x2c) + .maxstack 2 + IL_0000: newobj 0x06000007 + IL_0005: stloc.1 + IL_0006: nop + IL_0007: ldloc.1 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000004 + IL_000e: nop + IL_000f: ldsfld 0x04000003 + IL_0014: brtrue.s IL_002b + IL_0016: ldsfld 0x04000001 + IL_001b: ldftn 0x06000006 + IL_0021: newobj 0x0A000009 + IL_0026: stsfld 0x04000003 + IL_002b: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.2 + IL_0001: call 0x0A00000B + IL_0006: nop + IL_0007: ret + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000C + IL_0006: nop + IL_0007: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000004 + IL_0006: call 0x0A00000B + IL_000b: nop + IL_000c: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_Local_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + void L1() => Console.WriteLine(0); + void L2() => Console.WriteLine(1); + } + } + """, + validator: g => + { + g.VerifyMethodBody("C.g__L1|0_0", """ + { + // Code size 8 (0x8) + .maxstack 1 + // sequence point: Console.WriteLine(0) + IL_0000: ldc.i4.0 + IL_0001: call "void System.Console.WriteLine(int)" + IL_0006: nop + IL_0007: ret + } + """); + + g.VerifyMethodBody("C.g__L2|0_1", """ + { + // Code size 8 (0x8) + .maxstack 1 + // sequence point: Console.WriteLine(1) + IL_0000: ldc.i4.1 + IL_0001: call "void System.Console.WriteLine(int)" + IL_0006: nop + IL_0007: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + void L1() => Console.WriteLine(x); + void L2() => Console.WriteLine(2); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L1|0_0#1, g__L2|0_1, <>c__DisplayClass0_0#1}", + "C.<>c__DisplayClass0_0#1: {x}"); + + g.VerifyMethodDefNames("F", "g__L1|0_0", "g__L2|0_1", "g__L1|0_0#1"); + + g.VerifyIL( + """ + { + // Code size 12 (0xc) + .maxstack 2 + IL_0000: nop + IL_0001: ldloca.s V_1 + IL_0003: ldc.i4.1 + IL_0004: stfld 0x04000001 + IL_0009: nop + IL_000a: nop + IL_000b: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.2 + IL_0001: call 0x0A000009 + IL_0006: nop + IL_0007: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: call 0x0A000009 + IL_000b: nop + IL_000c: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_MethodParameter_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F(int x) + { + _ = new Action(() => Console.WriteLine(0)); + _ = new Action(() => Console.WriteLine(1)); + } + } + """, + validator: g => + { + }) + + .AddGeneration( + source: """ + using System; + class C + { + public void F(int x) + { + _ = new Action(() => Console.WriteLine(x)); + _ = new Action(() => Console.WriteLine(2)); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // Static lambda is reused. + // A new display class and method is generated for lambda that captures x. + g.VerifySynthesizedMembers( + "C: {<>c, <>c__DisplayClass0_0#1}", + "C.<>c: {<>9__0_1, b__0_1}", + "C.<>c__DisplayClass0_0#1: {x, b__0#1}"); + + g.VerifyMethodDefNames("F", "b__0_0", "b__0_1", ".ctor", "b__0#1"); + + g.VerifyIL( + """ + { + // Code size 44 (0x2c) + .maxstack 2 + IL_0000: newobj 0x06000007 + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldarg.1 + IL_0008: stfld 0x04000004 + IL_000d: nop + IL_000e: nop + IL_000f: ldsfld 0x04000003 + IL_0014: brtrue.s IL_002b + IL_0016: ldsfld 0x04000001 + IL_001b: ldftn 0x06000006 + IL_0021: newobj 0x0A000009 + IL_0026: stsfld 0x04000003 + IL_002b: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.2 + IL_0001: call 0x0A00000B + IL_0006: nop + IL_0007: ret + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000C + IL_0006: nop + IL_0007: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000004 + IL_0006: call 0x0A00000B + IL_000b: nop + IL_000c: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_MethodParameter_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F(int x) + { + void L1() => Console.WriteLine(0); + void L2() => Console.WriteLine(1); + } + } + """, + validator: g => + { + g.VerifyMethodBody("C.g__L1|0_0", """ + { + // Code size 8 (0x8) + .maxstack 1 + // sequence point: Console.WriteLine(0) + IL_0000: ldc.i4.0 + IL_0001: call "void System.Console.WriteLine(int)" + IL_0006: nop + IL_0007: ret + } + """); + + g.VerifyMethodBody("C.g__L2|0_1", """ + { + // Code size 8 (0x8) + .maxstack 1 + // sequence point: Console.WriteLine(1) + IL_0000: ldc.i4.1 + IL_0001: call "void System.Console.WriteLine(int)" + IL_0006: nop + IL_0007: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + public void F(int x) + { + void L1() => Console.WriteLine(x); + void L2() => Console.WriteLine(2); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L1|0_0#1, g__L2|0_1, <>c__DisplayClass0_0#1}", + "C.<>c__DisplayClass0_0#1: {x}"); + + g.VerifyMethodDefNames("F", "g__L1|0_0", "g__L2|0_1", "g__L1|0_0#1"); + + g.VerifyIL( + """ + { + // Code size 12 (0xc) + .maxstack 2 + IL_0000: ldloca.s V_0 + IL_0002: ldarg.1 + IL_0003: stfld 0x04000001 + IL_0008: nop + IL_0009: nop + IL_000a: nop + IL_000b: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.2 + IL_0001: call 0x0A000009 + IL_0006: nop + IL_0007: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: call 0x0A000009 + IL_000b: nop + IL_000c: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_LambdaParameter_ExpressionBody() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + + class C + { + static int G(Func f) => 1; + + static void F() + { + Func f1 = x => G(() => 1); + } + } + """, + validator: g => + { + }) + + .AddGeneration( + source: """ + using System; + + class C + { + static int G(Func f) => 1; + + static void F() + { + Func f1 = x => G(() => x); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c, <>c__DisplayClass1_0#1}", + "C.<>c: {<>9__1_0, b__1_0}", + "C.<>c__DisplayClass1_0#1: {x, b__1#1}"); + + g.VerifyMethodDefNames("F", "b__1_0", "b__1_1", ".ctor", "b__1#1"); + + g.VerifyIL( + """ + { + // Code size 34 (0x22) + .maxstack 2 + IL_0000: nop + IL_0001: ldsfld 0x04000003 + IL_0006: dup + IL_0007: brtrue.s IL_0020 + IL_0009: pop + IL_000a: ldsfld 0x04000001 + IL_000f: ldftn 0x06000006 + IL_0015: newobj 0x0A000009 + IL_001a: dup + IL_001b: stsfld 0x04000003 + IL_0020: stloc.0 + IL_0021: ret + } + { + // Code size 31 (0x1f) + .maxstack 2 + IL_0000: newobj 0x06000008 + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldarg.1 + IL_0008: stfld 0x04000004 + IL_000d: ldloc.0 + IL_000e: ldftn 0x06000009 + IL_0014: newobj 0x0A00000A + IL_0019: call 0x06000001 + IL_001e: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000B + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000C + IL_0006: nop + IL_0007: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000004 + IL_0006: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_ConstructorParameter() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class B(Func f); + + class C : B + { + public C(int x, int y) + : base(() => 1) + { + _ = new Action(() => Console.WriteLine(0)); + } + } + """, + validator: g => + { + }) + + .AddGeneration( + source: """ + using System; + class B(Func f); + + class C : B + { + public C(int x, int y) + : base(() => x) + { + _ = new Action(() => Console.WriteLine(y)); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C..ctor"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass0_0#1}", + "C.<>c__DisplayClass0_0#1: {x, y, <.ctor>b__0#1, <.ctor>b__1#1}"); + + g.VerifyMethodDefNames( + ".ctor", "<.ctor>b__0_0", "<.ctor>b__0_1", ".ctor", "<.ctor>b__0#1", "<.ctor>b__1#1"); + + g.VerifyIL( + """ + { + // Code size 42 (0x2a) + .maxstack 3 + IL_0000: newobj 0x06000007 + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldarg.1 + IL_0008: stfld 0x04000004 + IL_000d: ldloc.0 + IL_000e: ldarg.2 + IL_000f: stfld 0x04000005 + IL_0014: ldarg.0 + IL_0015: ldloc.0 + IL_0016: ldftn 0x06000008 + IL_001c: newobj 0x0A00000A + IL_0021: call 0x06000001 + IL_0026: nop + IL_0027: nop + IL_0028: nop + IL_0029: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000B + IL_000a: throw + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x700001F4 + IL_0005: newobj 0x0A00000B + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000C + IL_0006: nop + IL_0007: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000004 + IL_0006: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000005 + IL_0006: call 0x0A00000D + IL_000b: nop + IL_000c: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_PrimaryConstructorParameter() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class B(Func f); + + class C(int x) : B(() => 1); + """, + validator: g => + { + }) + + .AddGeneration( + source: """ + using System; + class B(Func f); + + class C(int x) : B(() => x); + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C..ctor"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass0_0#1}", + "C.<>c__DisplayClass0_0#1: {x, <.ctor>b__0#1}"); + + g.VerifyMethodDefNames( + ".ctor", "<.ctor>b__0_0", ".ctor", "<.ctor>b__0#1"); + + g.VerifyIL( + """ + { + // Code size 33 (0x21) + .maxstack 3 + IL_0000: newobj 0x06000006 + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldarg.1 + IL_0008: stfld 0x04000003 + IL_000d: ldarg.0 + IL_000e: ldloc.0 + IL_000f: ldftn 0x06000007 + IL_0015: newobj 0x0A000008 + IL_001a: call 0x06000001 + IL_001f: nop + IL_0020: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000A + IL_0006: nop + IL_0007: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000003 + IL_0006: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_TopLevelArgs() + { + using var _ = new EditAndContinueTest(options: TestOptions.DebugExe) + .AddBaseline( + source: """ + + using System; + var _ = new Func(() => null); + + """, + validator: g => + { + }) + + .AddGeneration( + source: """ + + using System; + var _ = new Func(() => args); + + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("Program.
$"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "Program: {<>c__DisplayClass0_0#1}", + "Program.<>c__DisplayClass0_0#1: {args, <
$>b__0#1}"); + + g.VerifyMethodDefNames( + "
$", "<
$>b__0_0", ".ctor", "<
$>b__0#1"); + + g.VerifyIL( + """ + { + // Code size 27 (0x1b) + .maxstack 2 + IL_0000: newobj 0x06000006 + IL_0005: stloc.1 + IL_0006: ldloc.1 + IL_0007: ldarg.0 + IL_0008: stfld 0x04000003 + IL_000d: ldloc.1 + IL_000e: ldftn 0x06000007 + IL_0014: newobj 0x0A000008 + IL_0019: stloc.2 + IL_001a: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000A + IL_0006: nop + IL_0007: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000003 + IL_0006: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_This_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + int x = 1; + + public void F() + { + _ = new Action(() => Console.WriteLine(0)); + _ = new Action(() => Console.WriteLine(1)); + } + } + """, + validator: g => + { + g.VerifyMethodBody("C.<>c.b__1_0", """ + { + // Code size 8 (0x8) + .maxstack 1 + // sequence point: Console.WriteLine(0) + IL_0000: ldc.i4.0 + IL_0001: call "void System.Console.WriteLine(int)" + IL_0006: nop + IL_0007: ret + } + """); + + g.VerifyMethodBody("C.<>c.b__1_1", """ + { + // Code size 8 (0x8) + .maxstack 1 + // sequence point: Console.WriteLine(1) + IL_0000: ldc.i4.1 + IL_0001: call "void System.Console.WriteLine(int)" + IL_0006: nop + IL_0007: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + int x = 1; + + public void F() + { + _ = new Action(() => Console.WriteLine(x)); + _ = new Action(() => Console.WriteLine(1)); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // Static lambda is reused. + // A new display class and method is generated for lambda that captures x. + g.VerifySynthesizedMembers( + "C: {b__1_0#1, <>c}", + "C.<>c: {<>9__1_1, b__1_1}"); + + g.VerifyMethodDefNames("F", "b__1_0", "b__1_1", "b__1_0#1"); + + g.VerifyIL( + """ + { + // Code size 31 (0x1f) + .maxstack 8 + IL_0000: nop + IL_0001: nop + IL_0002: ldsfld 0x04000004 + IL_0007: brtrue.s IL_001e + IL_0009: ldsfld 0x04000002 + IL_000e: ldftn 0x06000006 + IL_0014: newobj 0x0A000009 + IL_0019: stsfld 0x04000004 + IL_001e: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: call 0x0A00000B + IL_0006: nop + IL_0007: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: call 0x0A00000B + IL_000b: nop + IL_000c: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_This_LocalFunction() + { + // Rude edit since we can't convert static method to an instance method. + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + int x = 1; + + public void F() + { + void L1() => Console.WriteLine(0); + void L2() => Console.WriteLine(1); + } + } + """, + validator: g => + { + g.VerifyMethodBody("C.g__L1|1_0", """ + { + // Code size 8 (0x8) + .maxstack 1 + // sequence point: Console.WriteLine(0) + IL_0000: ldc.i4.0 + IL_0001: call "void System.Console.WriteLine(int)" + IL_0006: nop + IL_0007: ret + } + """); + + g.VerifyMethodBody("C.g__L2|1_1", """ + { + // Code size 8 (0x8) + .maxstack 1 + // sequence point: Console.WriteLine(1) + IL_0000: ldc.i4.1 + IL_0001: call "void System.Console.WriteLine(int)" + IL_0006: nop + IL_0007: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + int x = 1; + + public void F() + { + void L1() => Console.WriteLine(x); + void L2() => Console.WriteLine(1); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L1|1_0#1, g__L2|1_1}"); + + g.VerifyMethodDefNames("F", "g__L1|1_0", "g__L2|1_1", "g__L1|1_0#1"); + + g.VerifyIL( + """ + { + // Code size 4 (0x4) + .maxstack 8 + IL_0000: nop + IL_0001: nop + IL_0002: nop + IL_0003: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: call 0x0A000009 + IL_0006: nop + IL_0007: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: call 0x0A000009 + IL_000b: nop + IL_000c: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_PrimaryParameter_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C(int x) + { + public void F() + { + _ = new Action(() => Console.WriteLine(0)); + _ = new Action(() => Console.WriteLine(1)); + } + } + """, + validator: g => + { + }) + + .AddGeneration( + source: """ + using System; + class C(int x) + { + public void F() + { + _ = new Action(() => Console.WriteLine(x)); + _ = new Action(() => Console.WriteLine(2)); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // Static lambda is reused. + // A new display class and method is generated for lambda that captures x. + g.VerifySynthesizedMembers( + "C: {b__1_0#1, <>c}", + "C.<>c: {<>9__1_1, b__1_1}"); + + g.VerifyMethodDefNames("F", "b__1_0", "b__1_1", "b__1_0#1"); + + g.VerifyIL( + """ + { + // Code size 31 (0x1f) + .maxstack 8 + IL_0000: nop + IL_0001: nop + IL_0002: ldsfld 0x04000003 + IL_0007: brtrue.s IL_001e + IL_0009: ldsfld 0x04000001 + IL_000e: ldftn 0x06000006 + IL_0014: newobj 0x0A00000A + IL_0019: stsfld 0x04000003 + IL_001e: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000B + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.2 + IL_0001: call 0x0A00000C + IL_0006: nop + IL_0007: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000004 + IL_0006: call 0x0A00000C + IL_000b: nop + IL_000c: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Capture_PrimaryParameter_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C(int x) + { + public void F() + { + void L1() => Console.WriteLine(0); + void L2() => Console.WriteLine(1); + } + } + """, + validator: g => + { + }) + + .AddGeneration( + source: """ + using System; + class C(int x) + { + public void F() + { + void L1() => Console.WriteLine(x); + void L2() => Console.WriteLine(1); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L1|1_0#1, g__L2|1_1}"); + + g.VerifyMethodDefNames("F", "g__L1|1_0", "g__L2|1_1", "g__L1|1_0#1"); + + g.VerifyIL( + """ + { + // Code size 4 (0x4) + .maxstack 8 + IL_0000: nop + IL_0001: nop + IL_0002: nop + IL_0003: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: call 0x0A00000A + IL_0006: nop + IL_0007: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: call 0x0A00000A + IL_000b: nop + IL_000c: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void CeaseCapture_Local_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int y = 2; + G(() => x + y); + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + + 1 + + + + + + + + """); + + g.VerifyMethodBody("C.<>c__DisplayClass1_0.b__0", """ + { + // Code size 14 (0xe) + .maxstack 2 + // sequence point: x + y + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_0.x" + IL_0006: ldarg.0 + IL_0007: ldfld "int C.<>c__DisplayClass1_0.y" + IL_000c: add + IL_000d: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int y = 2; + G(() => x); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass1_0}", + "C.<>c__DisplayClass1_0: {x, b__0}"); + + g.VerifyMethodDefNames("F", "b__0"); + + g.VerifyIL( + """ + { + // Code size 35 (0x23) + .maxstack 2 + IL_0000: newobj 0x06000004 + IL_0005: stloc.0 + IL_0006: nop + IL_0007: ldloc.0 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000001 + IL_000e: ldc.i4.2 + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldftn 0x06000005 + IL_0017: newobj 0x0A000008 + IL_001c: call 0x06000001 + IL_0021: nop + IL_0022: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void CeaseCapture_Local_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + int y = 2; + int L() => x + y; + } + } + """, + validator: g => + { + g.VerifySynthesizedMembers(displayTypeKind: true, + [ + "struct C.<>c__DisplayClass0_0: {x, y}", + "class C: {g__L|0_0, <>c__DisplayClass0_0}" + ]); + + g.VerifyMethodBody("C.g__L|0_0", """ + { + // Code size 14 (0xe) + .maxstack 2 + // sequence point: x + y + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass0_0.x" + IL_0006: ldarg.0 + IL_0007: ldfld "int C.<>c__DisplayClass0_0.y" + IL_000c: add + IL_000d: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + int y = 2; + int L() => x; + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers(displayTypeKind: true, + [ + "struct C.<>c__DisplayClass0_0: {x}", + "class C: {g__L|0_0, <>c__DisplayClass0_0}" + ]); + + g.VerifyMethodDefNames("F", "g__L|0_0"); + + g.VerifyIL( + """ + { + // Code size 13 (0xd) + .maxstack 2 + IL_0000: nop + IL_0001: ldloca.s V_0 + IL_0003: ldc.i4.1 + IL_0004: stfld 0x04000001 + IL_0009: ldc.i4.2 + IL_000a: stloc.1 + IL_000b: nop + IL_000c: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void CeaseCapture_LastLocal_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + _ = new Action(() => Console.WriteLine(x)); + } + } + """, + validator: g => + { + }) + .AddGeneration( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + _ = new Action(() => Console.WriteLine(2)); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c}", + "C.<>c: {<>9__0_0#1, b__0_0#1}"); + + g.VerifyMethodDefNames("F", "b__0", ".cctor", ".ctor", "b__0_0#1"); + + g.VerifyIL( + """ + { + // Code size 32 (0x20) + .maxstack 2 + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: stloc.1 + IL_0003: ldsfld 0x04000003 + IL_0008: brtrue.s IL_001f + IL_000a: ldsfld 0x04000002 + IL_000f: ldftn 0x06000007 + IL_0015: newobj 0x0A000008 + IL_001a: stsfld 0x04000003 + IL_001f: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: newobj 0x06000006 + IL_0005: stsfld 0x04000002 + IL_000a: ret + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000A + IL_0006: nop + IL_0007: ret + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.2 + IL_0001: call 0x0A00000B + IL_0006: nop + IL_0007: ret + } + """); + }) + .AddGeneration( // resume capture + source: """ + using System; + class C + { + public void F() + { + int x = 1; + _ = new Action(() => Console.WriteLine(x + 3)); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass0_0#2, <>c}", + "C.<>c: {<>9__0_0#1, b__0_0#1}", + "C.<>c__DisplayClass0_0#2: {x, b__0#2}"); + + g.VerifyMethodDefNames("F", "b__0_0#1", ".ctor", "b__0#2"); + + g.VerifyIL( + """ + { + // Code size 16 (0x10) + .maxstack 2 + IL_0000: newobj 0x06000008 + IL_0005: stloc.2 + IL_0006: nop + IL_0007: ldloc.2 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000004 + IL_000e: nop + IL_000f: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x700001F5 + IL_0005: newobj 0x0A00000D + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000E + IL_0006: nop + IL_0007: ret + } + { + // Code size 15 (0xf) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000004 + IL_0006: ldc.i4.3 + IL_0007: add + IL_0008: call 0x0A00000F + IL_000d: nop + IL_000e: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void CeaseCapture_LastLocal_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F() + { + { + int x = 1; + void L() => Console.WriteLine(x);; + } + { + int x = 1; + void L() => Console.WriteLine(x);; + } + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + + + + + 0 + + + + + + + + + + """); + }) + .AddGeneration( + source: """ + using System; + class C + { + public void F() + { + { + int x = 1; + void L() => Console.WriteLine(1);; + } + { + int x = 1; + void L() => Console.WriteLine(2);; + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L|0_0#1, g__L|0_1#1}"); + + g.VerifyMethodDefNames("F", "g__L|0_0", "g__L|0_1", "g__L|0_0#1", "g__L|0_1#1"); + + g.VerifyIL( + """ + { + // Code size 14 (0xe) + .maxstack 1 + IL_0000: nop + IL_0001: nop + IL_0002: ldc.i4.1 + IL_0003: stloc.2 + IL_0004: nop + IL_0005: nop + IL_0006: nop + IL_0007: nop + IL_0008: ldc.i4.1 + IL_0009: stloc.3 + IL_000a: nop + IL_000b: nop + IL_000c: nop + IL_000d: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x700001F4 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: call 0x0A000009 + IL_0006: nop + IL_0007: ret + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.2 + IL_0001: call 0x0A000009 + IL_0006: nop + IL_0007: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void CeaseCapture_This_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + int x = 1; + + public void F() + { + _ = new Action(() => Console.WriteLine(x)); + _ = new Action(() => Console.WriteLine(1)); + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + 1 + + + + + + + + """); + + g.VerifyMethodBody("C.b__1_0", """ + { + // Code size 13 (0xd) + .maxstack 1 + // sequence point: Console.WriteLine(x) + IL_0000: ldarg.0 + IL_0001: ldfld "int C.x" + IL_0006: call "void System.Console.WriteLine(int)" + IL_000b: nop + IL_000c: ret + } + """); + + g.VerifyMethodBody("C.<>c.b__1_1", """ + { + // Code size 8 (0x8) + .maxstack 1 + // sequence point: Console.WriteLine(1) + IL_0000: ldc.i4.1 + IL_0001: call "void System.Console.WriteLine(int)" + IL_0006: nop + IL_0007: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + int x = 1; + + public void F() + { + _ = new Action(() => Console.WriteLine(0)); + _ = new Action(() => Console.WriteLine(1)); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // Static lambda is reused. + // A new display class and method is generated for lambda that captured x. + g.VerifySynthesizedMembers( + "C: {<>c}", + "C.<>c: {<>9__1_0#1, <>9__1_1, b__1_0#1, b__1_1}"); + + g.VerifyMethodDefNames("F", "b__1_0", "b__1_1", "b__1_0#1"); + + g.VerifyIL( + """ + { + // Code size 58 (0x3a) + .maxstack 8 + IL_0000: nop + IL_0001: ldsfld 0x04000004 + IL_0006: brtrue.s IL_001d + IL_0008: ldsfld 0x04000002 + IL_000d: ldftn 0x06000007 + IL_0013: newobj 0x0A000009 + IL_0018: stsfld 0x04000004 + IL_001d: ldsfld 0x04000003 + IL_0022: brtrue.s IL_0039 + IL_0024: ldsfld 0x04000002 + IL_0029: ldftn 0x06000006 + IL_002f: newobj 0x0A000009 + IL_0034: stsfld 0x04000003 + IL_0039: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: call 0x0A00000B + IL_0006: nop + IL_0007: ret + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: call 0x0A00000B + IL_0006: nop + IL_0007: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void CeaseCapture_This_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + int x = 1; + + public void F() + { + void L1() => Console.WriteLine(x); + void L2() => Console.WriteLine(1); + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + 1 + + + + + + + + """); + + g.VerifyMethodBody("C.g__L1|1_0", """ + { + // Code size 13 (0xd) + .maxstack 1 + // sequence point: Console.WriteLine(x) + IL_0000: ldarg.0 + IL_0001: ldfld "int C.x" + IL_0006: call "void System.Console.WriteLine(int)" + IL_000b: nop + IL_000c: ret + } + """); + + g.VerifyMethodBody("C.g__L2|1_1", """ + { + // Code size 8 (0x8) + .maxstack 1 + // sequence point: Console.WriteLine(1) + IL_0000: ldc.i4.1 + IL_0001: call "void System.Console.WriteLine(int)" + IL_0006: nop + IL_0007: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + int x = 1; + + public void F() + { + void L1() => Console.WriteLine(0); + void L2() => Console.WriteLine(1); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L1|1_0#1, g__L2|1_1}"); + + g.VerifyMethodDefNames("F", "g__L1|1_0", "g__L2|1_1", "g__L1|1_0#1"); + + g.VerifyIL( + """ + { + // Code size 4 (0x4) + .maxstack 8 + IL_0000: nop + IL_0001: nop + IL_0002: nop + IL_0003: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: call 0x0A000009 + IL_0006: nop + IL_0007: ret + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: call 0x0A000009 + IL_0006: nop + IL_0007: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void AddingAndRemovingClosure_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + } + } + """, + validator: g => + { + }) + .AddGeneration( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + _ = new Action(() => Console.WriteLine(x)); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // A new display class and method is generated for lambda that captures x. + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass0#1_0#1}", + "C.<>c__DisplayClass0#1_0#1: {x, b__0#1}"); + + g.VerifyMethodDefNames("F", ".ctor", "b__0#1"); + + g.VerifyIL( + """ + { + // Code size 16 (0x10) + .maxstack 2 + IL_0000: newobj 0x06000003 + IL_0005: stloc.1 + IL_0006: nop + IL_0007: ldloc.1 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000001 + IL_000e: nop + IL_000f: ret + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A000006 + IL_0006: nop + IL_0007: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: call 0x0A000007 + IL_000b: nop + IL_000c: ret + } + """); + }) + .AddGeneration( // remove closure + source: """ + using System; + class C + { + public void F() + { + int x = 1; + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass0#1_0#1}", + "C.<>c__DisplayClass0#1_0#1: {x, b__0#1}"); + + g.VerifyMethodDefNames("F", "b__0#1"); + + g.VerifyIL(""" + { + // Code size 4 (0x4) + .maxstack 1 + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: stloc.2 + IL_0003: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + """); + }) + .Verify(); + } + + [Fact] + public void AddingAndRemovingClosure_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + } + } + """, + validator: g => + { + }) + .AddGeneration( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + void L() => Console.WriteLine(x); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // A new display class and method is generated for lambda that captures x. + g.VerifySynthesizedMembers( + "C: {g__L|0#1_0#1, <>c__DisplayClass0#1_0#1}", + "C.<>c__DisplayClass0#1_0#1: {x}"); + + g.VerifyMethodDefNames("F", "g__L|0#1_0#1"); + + g.VerifyIL( + """ + { + // Code size 11 (0xb) + .maxstack 2 + IL_0000: nop + IL_0001: ldloca.s V_1 + IL_0003: ldc.i4.1 + IL_0004: stfld 0x04000001 + IL_0009: nop + IL_000a: ret + } + { + // Code size 13 (0xd) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: call 0x0A000006 + IL_000b: nop + IL_000c: ret + } + """); + }) + .AddGeneration( // remove closure + source: """ + using System; + class C + { + public void F() + { + int x = 1; + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L|0#1_0#1, <>c__DisplayClass0#1_0#1}", + "C.<>c__DisplayClass0#1_0#1: {x}"); + + g.VerifyMethodDefNames("F", "g__L|0#1_0#1"); + + g.VerifyIL(""" + { + // Code size 4 (0x4) + .maxstack 1 + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: stloc.2 + IL_0003: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A000007 + IL_000a: throw + } + """); + }) + .Verify(); + } + + [Fact] + public void ChainClosure_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + + class C + { + void G(Func f) {} + + void F() + { + { int x0 = 0; // Closure 0 + { int x1 = 0; // Closure 1 + + G(a => x0); + G(a => x1); + } + } + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + + + 1 + + + + + + + + + + """); + }) + .AddGeneration( + source: """ + using System; + + class C + { + void G(Func f) {} + + void F() + { + { int x0 = 0; // Closure 0 + { int x1 = 0; // Closure 1 -> Closure 0 + + G(a => x0); + G(a => x0 + x1); + } + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass1_0, <>c__DisplayClass1_1#1}", + "C.<>c__DisplayClass1_1#1: {x1, CS$<>8__locals1, b__1#1}", + "C.<>c__DisplayClass1_0: {x0, b__0}"); + + g.VerifyMethodDefNames("F", "b__0", "b__1", ".ctor", "b__1#1"); + + g.VerifyIL( + """ + { + // Code size 82 (0x52) + .maxstack 3 + IL_0000: nop + IL_0001: newobj 0x06000004 + IL_0006: stloc.0 + IL_0007: nop + IL_0008: ldloc.0 + IL_0009: ldc.i4.0 + IL_000a: stfld 0x04000001 + IL_000f: newobj 0x06000008 + IL_0014: stloc.2 + IL_0015: ldloc.2 + IL_0016: ldloc.0 + IL_0017: stfld 0x04000004 + IL_001c: nop + IL_001d: ldloc.2 + IL_001e: ldc.i4.0 + IL_001f: stfld 0x04000003 + IL_0024: ldarg.0 + IL_0025: ldloc.2 + IL_0026: ldfld 0x04000004 + IL_002b: ldftn 0x06000005 + IL_0031: newobj 0x0A000008 + IL_0036: call 0x06000001 + IL_003b: nop + IL_003c: ldarg.0 + IL_003d: ldloc.2 + IL_003e: ldftn 0x06000009 + IL_0044: newobj 0x0A000008 + IL_0049: call 0x06000001 + IL_004e: nop + IL_004f: nop + IL_0050: nop + IL_0051: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000A + IL_0006: nop + IL_0007: ret + } + { + // Code size 19 (0x13) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000004 + IL_0006: ldfld 0x04000001 + IL_000b: ldarg.0 + IL_000c: ldfld 0x04000003 + IL_0011: add + IL_0012: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void ChainClosure_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + + class C + { + void F() + { + { int x0 = 0; // Closure 0 + { int x1 = 0; // Closure 1 + + int L1() => x0; + int L2() => x1; + } + } + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + + + + + 0 + + + + + + + + + + """); + + g.VerifyMethodBody("C.g__L1|0_0(ref C.<>c__DisplayClass0_0)", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: x0 + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass0_0.x0" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.g__L2|0_1(ref C.<>c__DisplayClass0_1)", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: x1 + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass0_1.x1" + IL_0006: ret + } + """); + }) + .AddGeneration( + source: """ + using System; + + class C + { + void F() + { + { int x0 = 0; // Closure 0 + { int x1 = 0; // Closure 1 -> Closure 0 + + int L1() => x0; + int L2() => x0 + x1; + } + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L1|0_0, g__L2|0_1#1, <>c__DisplayClass0_0, <>c__DisplayClass0_1}", + "C.<>c__DisplayClass0_0: {x0}", + "C.<>c__DisplayClass0_1: {x1}"); + + g.VerifyMethodDefNames("F", "g__L1|0_0", "g__L2|0_1", "g__L2|0_1#1"); + + g.VerifyIL( + """ + { + // Code size 24 (0x18) + .maxstack 2 + IL_0000: nop + IL_0001: nop + IL_0002: ldloca.s V_0 + IL_0004: ldc.i4.0 + IL_0005: stfld 0x04000001 + IL_000a: nop + IL_000b: ldloca.s V_1 + IL_000d: ldc.i4.0 + IL_000e: stfld 0x04000002 + IL_0013: nop + IL_0014: nop + IL_0015: nop + IL_0016: nop + IL_0017: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000007 + IL_000a: throw + } + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ldarg.1 + IL_0007: ldfld 0x04000002 + IL_000c: add + IL_000d: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void UnchainClosure_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + + class C + { + static void G(Func f) {} + + void F() + { + { int x0 = 0; // Closure 0 + { int x1 = 0; // Closure 1 -> Closure 0 + + G(a => x0); + G(a => x0 + x1); + } + } + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + + + 1 + + + + + + + + + + """); + }) + .AddGeneration( + source: """ + using System; + + class C + { + static void G(Func f) {} + + void F() + { + { int x0 = 0; // Closure 0 + { int x1 = 0; // Closure 1 + + G(a => x0); + G(a => x1); + } + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // closure #0 is preserved, a new closure #1 is created as it has a different parent now: + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass1_0, <>c__DisplayClass1_1#1}", + "C.<>c__DisplayClass1_0: {x0, b__0}", + "C.<>c__DisplayClass1_1#1: {x1, b__1#1}"); + + g.VerifyMethodDefNames("F", "b__0", "b__1", ".ctor", "b__1#1"); + + g.VerifyIL( + """ + { + // Code size 68 (0x44) + .maxstack 2 + IL_0000: nop + IL_0001: newobj 0x06000004 + IL_0006: stloc.0 + IL_0007: nop + IL_0008: ldloc.0 + IL_0009: ldc.i4.0 + IL_000a: stfld 0x04000001 + IL_000f: newobj 0x06000008 + IL_0014: stloc.2 + IL_0015: nop + IL_0016: ldloc.2 + IL_0017: ldc.i4.0 + IL_0018: stfld 0x04000004 + IL_001d: ldloc.0 + IL_001e: ldftn 0x06000005 + IL_0024: newobj 0x0A000008 + IL_0029: call 0x06000001 + IL_002e: nop + IL_002f: ldloc.2 + IL_0030: ldftn 0x06000009 + IL_0036: newobj 0x0A000008 + IL_003b: call 0x06000001 + IL_0040: nop + IL_0041: nop + IL_0042: nop + IL_0043: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000A + IL_0006: nop + IL_0007: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000004 + IL_0006: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void UnchainClosure_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + + class C + { + void F() + { + { int x0 = 0; // Closure 0 + { int x1 = 0; // Closure 1 -> Closure 0 + + int L1() => x0; + int L2() => x0 + x1; + } + } + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + + + + + 0 + + + + + + + + + + """); + + g.VerifyMethodBody("C.g__L1|0_0(ref C.<>c__DisplayClass0_0)", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: x0 + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass0_0.x0" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.g__L2|0_1(ref C.<>c__DisplayClass0_0, ref C.<>c__DisplayClass0_1)", """ + { + // Code size 14 (0xe) + .maxstack 2 + // sequence point: x0 + x1 + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass0_0.x0" + IL_0006: ldarg.1 + IL_0007: ldfld "int C.<>c__DisplayClass0_1.x1" + IL_000c: add + IL_000d: ret + } + """); + }) + .AddGeneration( + source: """ + using System; + + class C + { + void F() + { + { int x0 = 0; // Closure 0 + { int x1 = 0; // Closure 1 + + int L1() => x0; + int L2() => x1; + } + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L1|0_0, g__L2|0_1#1, <>c__DisplayClass0_0, <>c__DisplayClass0_1}", + "C.<>c__DisplayClass0_1: {x1}", + "C.<>c__DisplayClass0_0: {x0}"); + + g.VerifyMethodDefNames("F", "g__L1|0_0", "g__L2|0_1", "g__L2|0_1#1"); + + g.VerifyIL( + """ + { + // Code size 24 (0x18) + .maxstack 2 + IL_0000: nop + IL_0001: nop + IL_0002: ldloca.s V_0 + IL_0004: ldc.i4.0 + IL_0005: stfld 0x04000001 + IL_000a: nop + IL_000b: ldloca.s V_1 + IL_000d: ldc.i4.0 + IL_000e: stfld 0x04000002 + IL_0013: nop + IL_0014: nop + IL_0015: nop + IL_0016: nop + IL_0017: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000007 + IL_000a: throw + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void ChangeClosureParent_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + + class C + { + static void G(Func f) {} + + void F() + { + { int x = 1; + { int y = 2; + { int z = 3; + G(() => x); + G(() => z + x); + } + } + } + } + } + """, + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass1_0, <>c__DisplayClass1_1}", + "C.<>c__DisplayClass1_0: {x, b__0}", + "C.<>c__DisplayClass1_1: {z, CS$<>8__locals1, b__1}"); + }) + .AddGeneration( + source: """ + using System; + + class C + { + static void G(Func f) {} + + void F() + { + { int x = 1; + { int y = 2; + { int z = 3; + G(() => x); + G(() => z + x); + G(() => z + x + y); + } + } + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // closure #0 is preserved, new closures #1 and #2 are created: + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass1_0, <>c__DisplayClass1_1#1, <>c__DisplayClass1_2#1}", + "C.<>c__DisplayClass1_0: {x, b__0}", + "C.<>c__DisplayClass1_1#1: {y, CS$<>8__locals1}", + "C.<>c__DisplayClass1_2#1: {z, CS$<>8__locals2, b__1#1, b__2#1}"); + + g.VerifyMethodDefNames( + "F", + "b__0", + "b__1", + ".ctor", + ".ctor", + "b__1#1", + "b__2#1"); + + g.VerifyIL(""" + { + // Code size 131 (0x83) + .maxstack 2 + IL_0000: nop + IL_0001: newobj 0x06000004 + IL_0006: stloc.0 + IL_0007: nop + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: stfld 0x04000001 + IL_000f: newobj 0x06000008 + IL_0014: stloc.3 + IL_0015: ldloc.3 + IL_0016: ldloc.0 + IL_0017: stfld 0x04000005 + IL_001c: nop + IL_001d: ldloc.3 + IL_001e: ldc.i4.2 + IL_001f: stfld 0x04000004 + IL_0024: newobj 0x06000009 + IL_0029: stloc.s V_4 + IL_002b: ldloc.s V_4 + IL_002d: ldloc.3 + IL_002e: stfld 0x04000007 + IL_0033: nop + IL_0034: ldloc.s V_4 + IL_0036: ldc.i4.3 + IL_0037: stfld 0x04000006 + IL_003c: ldloc.s V_4 + IL_003e: ldfld 0x04000007 + IL_0043: ldfld 0x04000005 + IL_0048: ldftn 0x06000005 + IL_004e: newobj 0x0A000008 + IL_0053: call 0x06000001 + IL_0058: nop + IL_0059: ldloc.s V_4 + IL_005b: ldftn 0x0600000A + IL_0061: newobj 0x0A000008 + IL_0066: call 0x06000001 + IL_006b: nop + IL_006c: ldloc.s V_4 + IL_006e: ldftn 0x0600000B + IL_0074: newobj 0x0A000008 + IL_0079: call 0x06000001 + IL_007e: nop + IL_007f: nop + IL_0080: nop + IL_0081: nop + IL_0082: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000A + IL_0006: nop + IL_0007: ret + } + { + // Code size 24 (0x18) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000006 + IL_0006: ldarg.0 + IL_0007: ldfld 0x04000007 + IL_000c: ldfld 0x04000005 + IL_0011: ldfld 0x04000001 + IL_0016: add + IL_0017: ret + } + { + // Code size 36 (0x24) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000006 + IL_0006: ldarg.0 + IL_0007: ldfld 0x04000007 + IL_000c: ldfld 0x04000005 + IL_0011: ldfld 0x04000001 + IL_0016: add + IL_0017: ldarg.0 + IL_0018: ldfld 0x04000007 + IL_001d: ldfld 0x04000004 + IL_0022: add + IL_0023: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void ChangeClosureParent_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + + class C + { + void F() + { + { int x = 1; + { int y = 2; + { int z = 3; + int L1() => x; + int L2() => z + x; + } + } + } + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + + + + + + 0 + + + + + + + + + + """); + + g.VerifyMethodBody("C.g__L1|0_0(ref C.<>c__DisplayClass0_0)", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: x + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass0_0.x" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.g__L2|0_1(ref C.<>c__DisplayClass0_0, ref C.<>c__DisplayClass0_1)", """ + { + // Code size 14 (0xe) + .maxstack 2 + // sequence point: z + x + IL_0000: ldarg.1 + IL_0001: ldfld "int C.<>c__DisplayClass0_1.z" + IL_0006: ldarg.0 + IL_0007: ldfld "int C.<>c__DisplayClass0_0.x" + IL_000c: add + IL_000d: ret + } + """); + }) + .AddGeneration( + source: """ + using System; + + class C + { + void F() + { + { int x = 1; + { int y = 2; + { int z = 3; + int L1() => x; + int L2() => z + x; + int L3() => z + x + y; + } + } + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // closures 0 and 1 are preserved, a new closure is created: + g.VerifySynthesizedMembers( + "C: {g__L1|0_0, g__L2|0_1, g__L3|0_2#1, <>c__DisplayClass0_0, <>c__DisplayClass0_1, <>c__DisplayClass0_1#1}", + "C.<>c__DisplayClass0_0: {x}", + "C.<>c__DisplayClass0_1: {z}", + "C.<>c__DisplayClass0_1#1: {y}"); + + g.VerifyMethodDefNames("F", "g__L1|0_0", "g__L2|0_1", "g__L3|0_2#1"); + + g.VerifyIL(""" + { + // Code size 35 (0x23) + .maxstack 2 + IL_0000: nop + IL_0001: nop + IL_0002: ldloca.s V_0 + IL_0004: ldc.i4.1 + IL_0005: stfld 0x04000001 + IL_000a: nop + IL_000b: ldloca.s V_3 + IL_000d: ldc.i4.2 + IL_000e: stfld 0x04000003 + IL_0013: nop + IL_0014: ldloca.s V_2 + IL_0016: ldc.i4.3 + IL_0017: stfld 0x04000002 + IL_001c: nop + IL_001d: nop + IL_001e: nop + IL_001f: nop + IL_0020: nop + IL_0021: nop + IL_0022: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldfld 0x04000002 + IL_0006: ldarg.0 + IL_0007: ldfld 0x04000001 + IL_000c: add + IL_000d: ret + } + { + // Code size 21 (0x15) + .maxstack 8 + IL_0000: ldarg.2 + IL_0001: ldfld 0x04000002 + IL_0006: ldarg.0 + IL_0007: ldfld 0x04000001 + IL_000c: add + IL_000d: ldarg.1 + IL_000e: ldfld 0x04000003 + IL_0013: add + IL_0014: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void ChangeLambdaParent_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { int x = 1; + { int y = 2; + G(() => x); + G(() => y); + + G(() => x + 1); + } + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + + + 1 + + + + + + + + + + + """); + + g.VerifyMethodBody("C.<>c__DisplayClass1_0.b__0", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: x + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_0.x" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.<>c__DisplayClass1_1.b__1", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: y + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_1.y" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.<>c__DisplayClass1_0.b__2", """ + { + // Code size 9 (0x9) + .maxstack 2 + // sequence point: x + 1 + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_0.x" + IL_0006: ldc.i4.1 + IL_0007: add + IL_0008: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { int x = 1; + { int y = 2; + G(() => x); + G(() => y); + + G(() => y + 1); + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // Lambda moved from closure 0 to 1: + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass1_0, <>c__DisplayClass1_1}", + "C.<>c__DisplayClass1_0: {x, b__0}", + "C.<>c__DisplayClass1_1: {y, b__1, b__2#1}"); + + g.VerifyMethodDefNames("F", "b__0", "b__2", "b__1", "b__2#1"); + + g.VerifyIL( + """ + { + // Code size 84 (0x54) + .maxstack 2 + IL_0000: newobj 0x06000004 + IL_0005: stloc.0 + IL_0006: nop + IL_0007: ldloc.0 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000001 + IL_000e: newobj 0x06000007 + IL_0013: stloc.1 + IL_0014: nop + IL_0015: ldloc.1 + IL_0016: ldc.i4.2 + IL_0017: stfld 0x04000002 + IL_001c: ldloc.0 + IL_001d: ldftn 0x06000005 + IL_0023: newobj 0x0A000008 + IL_0028: call 0x06000001 + IL_002d: nop + IL_002e: ldloc.1 + IL_002f: ldftn 0x06000008 + IL_0035: newobj 0x0A000008 + IL_003a: call 0x06000001 + IL_003f: nop + IL_0040: ldloc.1 + IL_0041: ldftn 0x06000009 + IL_0047: newobj 0x0A000008 + IL_004c: call 0x06000001 + IL_0051: nop + IL_0052: nop + IL_0053: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ret + } + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ldc.i4.1 + IL_0007: add + IL_0008: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void ChangeLambdaParent_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F() + { int x = 1; + { int y = 2; + int L1() => x; + int L2() => y; + + int L3() => x + 1; + } + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + + + + + 0 + + + + + + + + + + + """); + + g.VerifyMethodBody("C.g__L1|0_0(ref C.<>c__DisplayClass0_0)", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: x + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass0_0.x" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.g__L2|0_1(ref C.<>c__DisplayClass0_1)", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: y + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass0_1.y" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.g__L3|0_2(ref C.<>c__DisplayClass0_0)", """ + { + // Code size 9 (0x9) + .maxstack 2 + // sequence point: x + 1 + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass0_0.x" + IL_0006: ldc.i4.1 + IL_0007: add + IL_0008: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + public void F() + { int x = 1; + { int y = 2; + int L1() => x; + int L2() => y; + + int L3() => y + 1; + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // Lambda moved from closure 0 to 1: + g.VerifySynthesizedMembers( + "C: {g__L1|0_0, g__L2|0_1, g__L3|0_2#1, <>c__DisplayClass0_0, <>c__DisplayClass0_1}", + "C.<>c__DisplayClass0_0: {x}", + "C.<>c__DisplayClass0_1: {y}"); + + g.VerifyMethodDefNames("F", "g__L1|0_0", "g__L2|0_1", "g__L3|0_2", "g__L3|0_2#1"); + + g.VerifyIL( + """ + { + // Code size 23 (0x17) + .maxstack 2 + IL_0000: nop + IL_0001: ldloca.s V_0 + IL_0003: ldc.i4.1 + IL_0004: stfld 0x04000001 + IL_0009: nop + IL_000a: ldloca.s V_1 + IL_000c: ldc.i4.2 + IL_000d: stfld 0x04000002 + IL_0012: nop + IL_0013: nop + IL_0014: nop + IL_0015: nop + IL_0016: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000007 + IL_000a: throw + } + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ldc.i4.1 + IL_0007: add + IL_0008: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void ChangeLambdaParent_LambdaAndLocalFunction_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { int x = 1; + { int y = 2; + int L1() => x; + G(() => y); + + G(() => x + 1); + } + } + } + """, + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass1_0, <>c__DisplayClass1_1}", + "C.<>c__DisplayClass1_0: {x, g__L1|0, b__2}", + "C.<>c__DisplayClass1_1: {y, b__1}"); + + g.VerifyMethodBody("C.<>c__DisplayClass1_0.g__L1|0()", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: x + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_0.x" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.<>c__DisplayClass1_1.b__1()", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: y + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_1.y" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.<>c__DisplayClass1_0.b__2()", """ + { + // Code size 9 (0x9) + .maxstack 2 + // sequence point: x + 1 + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_0.x" + IL_0006: ldc.i4.1 + IL_0007: add + IL_0008: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { int x = 1; + { int y = 2; + int L1() => x; + G(() => y); + + G(() => y + 1); + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L1|1_0#1, <>c__DisplayClass1_0#1, <>c__DisplayClass1_1}", + "C.<>c__DisplayClass1_0#1: {x}", + "C.<>c__DisplayClass1_1: {y, b__1, b__2#1}"); + + g.VerifyMethodDefNames("F", "g__L1|0", "b__2", "b__1", "g__L1|1_0#1", "b__2#1"); + + g.VerifyIL( + """ + { + // Code size 62 (0x3e) + .maxstack 2 + IL_0000: nop + IL_0001: ldloca.s V_2 + IL_0003: ldc.i4.1 + IL_0004: stfld 0x04000003 + IL_0009: newobj 0x06000007 + IL_000e: stloc.1 + IL_000f: nop + IL_0010: ldloc.1 + IL_0011: ldc.i4.2 + IL_0012: stfld 0x04000002 + IL_0017: nop + IL_0018: ldloc.1 + IL_0019: ldftn 0x06000008 + IL_001f: newobj 0x0A000008 + IL_0024: call 0x06000001 + IL_0029: nop + IL_002a: ldloc.1 + IL_002b: ldftn 0x0600000A + IL_0031: newobj 0x0A000008 + IL_0036: call 0x06000001 + IL_003b: nop + IL_003c: nop + IL_003d: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x700001F4 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000003 + IL_0006: ret + } + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ldc.i4.1 + IL_0007: add + IL_0008: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void ChangeLambdaParent_LambdaAndLocalFunction_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { int x = 1; + { int y = 2; + int L1() => x; + G(() => y); + + int L3() => x + 1; + } + } + } + """, + validator: g => + { + g.VerifyCustomDebugInformation("C.F", """ + + + + + + + + + + + 1 + + + + + + + + + + + """); + + g.VerifyMethodBody("C.g__L1|1_0(ref C.<>c__DisplayClass1_0)", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: x + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_0.x" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.<>c__DisplayClass1_1.b__1()", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: y + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_1.y" + IL_0006: ret + } + """); + + g.VerifyMethodBody("C.g__L3|1_2(ref C.<>c__DisplayClass1_0)", """ + { + // Code size 9 (0x9) + .maxstack 2 + // sequence point: x + 1 + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_0.x" + IL_0006: ldc.i4.1 + IL_0007: add + IL_0008: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { int x = 1; + { int y = 2; + int L1() => x; + G(() => y); + + int L3() => y + 1; + } + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // Lambda moved from closure 0 to 1: + g.VerifySynthesizedMembers( + "C: {g__L1|1_0, <>c__DisplayClass1_0, <>c__DisplayClass1_1}", + "C.<>c__DisplayClass1_0: {x}", + "C.<>c__DisplayClass1_1: {y, b__1, g__L3|2#1}"); + + g.VerifyMethodDefNames("F", "g__L1|1_0", "g__L3|1_2", "b__1", "g__L3|2#1"); + + g.VerifyIL( + """ + { + // Code size 45 (0x2d) + .maxstack 2 + IL_0000: nop + IL_0001: ldloca.s V_0 + IL_0003: ldc.i4.1 + IL_0004: stfld 0x04000001 + IL_0009: newobj 0x06000006 + IL_000e: stloc.1 + IL_000f: nop + IL_0010: ldloc.1 + IL_0011: ldc.i4.2 + IL_0012: stfld 0x04000002 + IL_0017: nop + IL_0018: ldloc.1 + IL_0019: ldftn 0x06000007 + IL_001f: newobj 0x0A000008 + IL_0024: call 0x06000001 + IL_0029: nop + IL_002a: nop + IL_002b: nop + IL_002c: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ret + } + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ldc.i4.1 + IL_0007: add + IL_0008: ret + } + """); + }) + .Verify(); + } + + /// + /// We allow to add a capture as long as the closure tree shape remains the same. + /// The value of the captured variable might be uninitialized in the lambda. + /// We leave it up to the user to set its value as needed. + /// + [Fact] + public void UninitializedCapture_Lambda() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int y = 2; + G(() => x); + } + } + """, + validator: g => + { + g.VerifyMethodBody("C.<>c__DisplayClass1_0.b__0", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: x + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_0.x" + IL_0006: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int y = 2; + G(() => x + y); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass1_0}", + "C.<>c__DisplayClass1_0: {x, y, b__0}"); + + g.VerifyMethodDefNames("F", "b__0"); + + g.VerifyIL( + """ + { + // Code size 40 (0x28) + .maxstack 2 + IL_0000: newobj 0x06000004 + IL_0005: stloc.0 + IL_0006: nop + IL_0007: ldloc.0 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000001 + IL_000e: ldloc.0 + IL_000f: ldc.i4.2 + IL_0010: stfld 0x04000002 + IL_0015: ldloc.0 + IL_0016: ldftn 0x06000005 + IL_001c: newobj 0x0A000008 + IL_0021: call 0x06000001 + IL_0026: nop + IL_0027: ret + } + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000001 + IL_0006: ldarg.0 + IL_0007: ldfld 0x04000002 + IL_000c: add + IL_000d: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void UninitializedCapture_LocalFunction() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + int y = 2; + int L() => x; + } + } + """, + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L|0_0, <>c__DisplayClass0_0}", + "C.<>c__DisplayClass0_0: {x}"); + + g.VerifyMethodBody("C.g__L|0_0(ref C.<>c__DisplayClass0_0)", """ + { + // Code size 7 (0x7) + .maxstack 1 + // sequence point: x + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass0_0.x" + IL_0006: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + public void F() + { + int x = 1; + int y = 2; + int L() => x + y; + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers( + "C: {g__L|0_0#1, <>c__DisplayClass0_0#1}", + "C.<>c__DisplayClass0_0#1: {x, y}"); + + g.VerifyMethodDefNames("F", "g__L|0_0", "g__L|0_0#1"); + + g.VerifyIL(""" + { + // Code size 19 (0x13) + .maxstack 2 + IL_0000: nop + IL_0001: ldloca.s V_2 + IL_0003: ldc.i4.1 + IL_0004: stfld 0x04000002 + IL_0009: ldloca.s V_2 + IL_000b: ldc.i4.2 + IL_000c: stfld 0x04000003 + IL_0011: nop + IL_0012: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000007 + IL_000a: throw + } + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ldarg.0 + IL_0007: ldfld 0x04000003 + IL_000c: add + IL_000d: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void CaptureOrdering() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int y = 2; + G(() => x + y); + } + } + """, + validator: g => + { + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass1_0}", + "C.<>c__DisplayClass1_0: {x, y, b__0}"); + + g.VerifyMethodBody("C.<>c__DisplayClass1_0.b__0", """ + { + // Code size 14 (0xe) + .maxstack 2 + // sequence point: x + y + IL_0000: ldarg.0 + IL_0001: ldfld "int C.<>c__DisplayClass1_0.x" + IL_0006: ldarg.0 + IL_0007: ldfld "int C.<>c__DisplayClass1_0.y" + IL_000c: add + IL_000d: ret + } + """); + }) + + .AddGeneration( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int y = 2; + G(() => y + x); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + // Unlike local slots, the order is insignificant since the fields are referred to by name (MemberRef) + g.VerifySynthesizedMembers( + "C: {<>c__DisplayClass1_0}", + "C.<>c__DisplayClass1_0: {y, x, b__0}"); + + g.VerifyMethodDefNames("F", "b__0"); + + g.VerifyIL( + """ + { + // Code size 40 (0x28) + .maxstack 2 + IL_0000: newobj 0x06000004 + IL_0005: stloc.0 + IL_0006: nop + IL_0007: ldloc.0 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000001 + IL_000e: ldloc.0 + IL_000f: ldc.i4.2 + IL_0010: stfld 0x04000002 + IL_0015: ldloc.0 + IL_0016: ldftn 0x06000005 + IL_001c: newobj 0x0A000008 + IL_0021: call 0x06000001 + IL_0026: nop + IL_0027: ret + } + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ldarg.0 + IL_0007: ldfld 0x04000001 + IL_000c: add + IL_000d: ret + } + """); + + g.VerifyEncLogDefinitions( + [ + Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default), + Row(2, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default) + ]); + }) + .Verify(); + } + + [Fact] + public void Closure_ClassToStruct() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int L() => x; + G(() => x); + } + } + """, + validator: g => + { + g.VerifySynthesizedMembers(displayTypeKind: true, + [ + "class C: {<>c__DisplayClass1_0}", + "class C.<>c__DisplayClass1_0: {x, g__L|0, b__1}" + ]); + }) + + .AddGeneration( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int L() => x; + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers(displayTypeKind: true, + [ + "struct C.<>c__DisplayClass1_0#1: {x}", + "class C: {g__L|1_0#1, <>c__DisplayClass1_0#1}" + ]); + + g.VerifyMethodDefNames("F", "g__L|0", "b__1", "g__L|1_0#1"); + + g.VerifyIL( + """ + { + // Code size 11 (0xb) + .maxstack 2 + IL_0000: nop + IL_0001: ldloca.s V_1 + IL_0003: ldc.i4.1 + IL_0004: stfld 0x04000002 + IL_0009: nop + IL_000a: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x700001F4 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ret + } + """); + + g.VerifyEncLogDefinitions( + [ + Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default), + Row(4, TableIndex.TypeDef, EditAndContinueOperation.Default), + Row(4, TableIndex.TypeDef, EditAndContinueOperation.AddField), + Row(2, TableIndex.Field, EditAndContinueOperation.Default), + Row(2, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(6, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(2, TableIndex.TypeDef, EditAndContinueOperation.AddMethod), + Row(7, TableIndex.MethodDef, EditAndContinueOperation.Default), + Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default), + Row(6, TableIndex.CustomAttribute, EditAndContinueOperation.Default), + Row(2, TableIndex.NestedClass, EditAndContinueOperation.Default) + ]); + }) + .Verify(); + } + + [Fact] + public void Closure_ClassToStruct_DelegateConversion() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int L() => x; + G(L); + } + } + """, + validator: g => + { + g.VerifySynthesizedMembers(displayTypeKind: true, + [ + "class C: {<>c__DisplayClass1_0}", + "class C.<>c__DisplayClass1_0: {x, g__L|0}" + ]); + }) + + .AddGeneration( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int L() => x; + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers(displayTypeKind: true, + [ + "struct C.<>c__DisplayClass1_0#1: {x}", + "class C: {g__L|1_0#1, <>c__DisplayClass1_0#1}" + ]); + + g.VerifyMethodDefNames("F", "g__L|0", "g__L|1_0#1"); + + g.VerifyIL( + """ + { + // Code size 11 (0xb) + .maxstack 2 + IL_0000: nop + IL_0001: ldloca.s V_1 + IL_0003: ldc.i4.1 + IL_0004: stfld 0x04000002 + IL_0009: nop + IL_000a: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Closure_StructToClass() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int L() => x; + } + } + """, + validator: g => + { + g.VerifySynthesizedMembers(displayTypeKind: true, + [ + "struct C.<>c__DisplayClass1_0: {x}", + "class C: {g__L|1_0, <>c__DisplayClass1_0}", + ]); + }) + + .AddGeneration( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int L() => x; + G(() => x); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers(displayTypeKind: true, + [ + "class C: {<>c__DisplayClass1_0#1}", + "class C.<>c__DisplayClass1_0#1: {x, g__L|0#1, b__1#1}" + ]); + + g.VerifyMethodDefNames("F", "g__L|1_0", ".ctor", "g__L|0#1", "b__1#1"); + + g.VerifyIL( + """ + { + // Code size 34 (0x22) + .maxstack 2 + IL_0000: newobj 0x06000005 + IL_0005: stloc.1 + IL_0006: nop + IL_0007: ldloc.1 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000002 + IL_000e: nop + IL_000f: ldloc.1 + IL_0010: ldftn 0x06000007 + IL_0016: newobj 0x0A000007 + IL_001b: call 0x06000001 + IL_0020: nop + IL_0021: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A000009 + IL_0006: nop + IL_0007: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ret + } + """); + }) + .Verify(); + } + + [Fact] + public void Closure_StructToClass_DelegateConversion() + { + using var _ = new EditAndContinueTest() + .AddBaseline( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int L() => x; + } + } + """, + validator: g => + { + g.VerifySynthesizedMembers(displayTypeKind: true, + [ + "struct C.<>c__DisplayClass1_0: {x}", + "class C: {g__L|1_0, <>c__DisplayClass1_0}", + ]); + }) + + .AddGeneration( + source: """ + using System; + class C + { + static void G(Func f) {} + + public void F() + { + int x = 1; + int L() => x; + G(L); + } + } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), + ], + validator: g => + { + g.VerifySynthesizedMembers(displayTypeKind: true, + [ + "class C: {<>c__DisplayClass1_0#1}", + "class C.<>c__DisplayClass1_0#1: {x, g__L|0#1}" + ]); + + g.VerifyMethodDefNames("F", "g__L|1_0", ".ctor", "g__L|0#1"); + + g.VerifyIL( + """ + { + // Code size 34 (0x22) + .maxstack 2 + IL_0000: newobj 0x06000005 + IL_0005: stloc.1 + IL_0006: nop + IL_0007: ldloc.1 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000002 + IL_000e: nop + IL_000f: ldloc.1 + IL_0010: ldftn 0x06000006 + IL_0016: newobj 0x0A000007 + IL_001b: call 0x06000001 + IL_0020: nop + IL_0021: ret + } + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A000009 + IL_0006: nop + IL_0007: ret + } + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld 0x04000002 + IL_0006: ret + } + """); + }) + .Verify(); + } } } diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.cs index a96e05f7fef08..ee4438d480e46 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.cs @@ -135,13 +135,15 @@ internal static StatementSyntax GetNearestStatement(SyntaxNode node) return null; } +#nullable enable internal static SemanticEditDescription Edit( SemanticEditKind kind, Func symbolProvider, - Func newSymbolProvider = null, - bool preserveLocalVariables = false) - => new(kind, symbolProvider, newSymbolProvider, preserveLocalVariables); - + Func? newSymbolProvider = null, + bool preserveLocalVariables = false, + Func? rudeEdits = null) + => new(kind, symbolProvider, newSymbolProvider, rudeEdits, preserveLocalVariables); +#nullable disable internal static EditAndContinueLogEntry Row(int rowNumber, TableIndex table, EditAndContinueOperation operation) { return new EditAndContinueLogEntry(MetadataTokens.Handle(table, rowNumber), operation); diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs index f7810b6d431c7..cda7a4bd44ede 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs @@ -91,10 +91,11 @@ public C() var expectedIL = """ { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000005 + IL_000a: throw } """; @@ -152,10 +153,11 @@ class C g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000005 + IL_000a: throw } { // Code size 8 (0x8) @@ -443,7 +445,7 @@ static void Main() { } @"class C { static void Main() { } - static string F() { return string.Empty; } + static string F() { return ""abc""; } }"; var compilation0 = CreateCompilation(source0, parseOptions: TestOptions.Regular.WithNoRefSafetyRulesAttribute(), options: TestOptions.DebugExe); var compilation1 = compilation0.WithSource(source1); @@ -477,23 +479,14 @@ static void Main() { } CheckNames(readers, reader1.GetTypeDefNames()); CheckNames(readers, reader1.GetMethodDefNames(), "F"); - CheckNames(readers, reader1.GetMemberRefNames(), /*String.*/"Empty"); - CheckEncLog(reader1, - Row(2, TableIndex.AssemblyRef, EditAndContinueOperation.Default), - Row(5, TableIndex.MemberRef, EditAndContinueOperation.Default), - Row(6, TableIndex.TypeRef, EditAndContinueOperation.Default), - Row(7, TableIndex.TypeRef, EditAndContinueOperation.Default), + CheckEncLogDefinitions(reader1, Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default), Row(2, TableIndex.MethodDef, EditAndContinueOperation.Default)); // C.F - CheckEncMap(reader1, - Handle(6, TableIndex.TypeRef), - Handle(7, TableIndex.TypeRef), + CheckEncMapDefinitions(reader1, Handle(2, TableIndex.MethodDef), - Handle(5, TableIndex.MemberRef), - Handle(2, TableIndex.StandAloneSig), - Handle(2, TableIndex.AssemblyRef)); + Handle(2, TableIndex.StandAloneSig)); } [Fact] @@ -2060,10 +2053,10 @@ static unsafe void F() EncValidation.VerifyModuleMvid(1, reader0, reader1); CheckNames(readers, reader1.GetTypeDefNames(), "<>f__AnonymousDelegate0", "<>c"); - CheckNames(readers, reader1.GetMethodDefNames(), "F", ".ctor", "Invoke", ".cctor", ".ctor", "b__0#1"); + CheckNames(readers, reader1.GetMethodDefNames(), "F", ".ctor", "Invoke", ".cctor", ".ctor", "b__0#1_0#1"); diff1.VerifySynthesizedMembers( - "C.<>c: {<>9__0#1, b__0#1}", + "C.<>c: {<>9__0#1_0#1, b__0#1_0#1}", "C: {<>c}"); } @@ -2291,10 +2284,11 @@ .maxstack 8 IL_001d: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A00000A - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw } { // Code size 8 (0x8) @@ -2624,10 +2618,11 @@ .maxstack 2 IL_001b: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000009 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw } { // Code size 8 (0x8) @@ -3858,17 +3853,15 @@ class C Handle(2, TableIndex.MethodDef), }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000007 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000007 + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .AddGeneration( source: """ @@ -3978,17 +3971,15 @@ class C Handle(2, TableIndex.MethodDef), }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A000005 + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .AddGeneration( source: """ @@ -4105,17 +4096,15 @@ class C Handle(2, TableIndex.MethodDef), }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A000005 + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .AddGeneration( source: """ @@ -4156,12 +4145,12 @@ class C Handle(4, TableIndex.MethodSemantics), }); - var expectedIL = """ + g.VerifyIL(""" { // Code size 11 (0xb) .maxstack 1 IL_0000: nop - IL_0001: ldstr 0x7000000D + IL_0001: ldstr 0x70000155 IL_0006: stloc.0 IL_0007: br.s IL_0009 IL_0009: ldloc.0 @@ -4173,10 +4162,7 @@ .maxstack 8 IL_0000: nop IL_0001: ret } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } @@ -4223,17 +4209,15 @@ class C Handle(2, TableIndex.MethodDef), }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A000005 + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .AddGeneration( source: """ @@ -4273,12 +4257,12 @@ class C Handle(4, TableIndex.MethodSemantics), }); - var expectedIL = """ + g.VerifyIL(""" { // Code size 11 (0xb) .maxstack 1 IL_0000: nop - IL_0001: ldstr 0x7000000D + IL_0001: ldstr 0x70000155 IL_0006: stloc.0 IL_0007: br.s IL_0009 IL_0009: ldloc.0 @@ -4290,10 +4274,7 @@ .maxstack 8 IL_0000: nop IL_0001: ret } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } @@ -4376,10 +4357,11 @@ class C var expectedIL = """ { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000009 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw } { // Code size 7 (0x7) @@ -4449,7 +4431,7 @@ class C Handle(6, TableIndex.MethodSemantics), }); - var expectedIL = """ + g.VerifyIL(""" { // Code size 7 (0x7) .maxstack 8 @@ -4466,15 +4448,13 @@ .maxstack 8 IL_0007: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A00000C - IL_0005: throw + IL_0000: ldstr 0x70000151 + IL_0005: newobj 0x0A00000C + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } @@ -4484,7 +4464,7 @@ public void Property_Rename() { using var _ = new EditAndContinueTest() .AddBaseline( - source: $$""" + source: """ class C { string P { get; set; } @@ -4496,7 +4476,7 @@ class C g.VerifyMethodDefNames("get_P", "set_P", ".ctor"); }) .AddGeneration( - source: $$""" + source: """ class C { string Q { get; set; } @@ -4554,12 +4534,13 @@ class C Handle(4, TableIndex.MethodSemantics), }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000009 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw } { // Code size 7 (0x7) @@ -4576,10 +4557,7 @@ .maxstack 8 IL_0002: stfld 0x04000002 IL_0007: ret } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .AddGeneration( source: $$""" @@ -4629,7 +4607,7 @@ class C Handle(6, TableIndex.MethodSemantics) }); - var expectedIL = """ + g.VerifyIL(""" { // Code size 7 (0x7) .maxstack 8 @@ -4646,15 +4624,13 @@ .maxstack 8 IL_0007: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A00000C - IL_0005: throw + IL_0000: ldstr 0x70000151 + IL_0005: newobj 0x0A00000C + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } @@ -4706,17 +4682,15 @@ class C Handle(2, TableIndex.MethodDef), }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000006 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000006 + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } @@ -4778,12 +4752,13 @@ class C Handle(2, TableIndex.MethodSemantics), }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000007 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000007 + IL_000a: throw } { // Code size 7 (0x7) @@ -4795,10 +4770,7 @@ .maxstack 1 IL_0005: ldloc.0 IL_0006: ret } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .AddGeneration( source: $$""" @@ -4838,7 +4810,7 @@ class C Handle(3, TableIndex.MethodSemantics), }); - var expectedIL = """ + g.VerifyIL(""" { // Code size 7 (0x7) .maxstack 1 @@ -4850,17 +4822,14 @@ .maxstack 1 IL_0006: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000009 - IL_0005: throw + IL_0000: ldstr 0x70000151 + IL_0005: newobj 0x0A000009 + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); - }).AddGeneration( - source: $$""" + """); + }).AddGeneration(""" class C { int this[int x] { get { return 2; } } @@ -4896,7 +4865,7 @@ class C Handle(4, TableIndex.MethodSemantics) }); - var expectedIL = """ + g.VerifyIL(""" { // Code size 7 (0x7) .maxstack 1 @@ -4907,10 +4876,7 @@ .maxstack 1 IL_0005: ldloc.0 IL_0006: ret } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } @@ -5171,17 +5137,15 @@ class C Handle(2, TableIndex.MethodDef), }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A00000A - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } @@ -5265,12 +5229,13 @@ class C Handle(4, TableIndex.MethodSemantics), }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A00000C - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000C + IL_000a: throw } { // Code size 41 (0x29) @@ -5320,10 +5285,7 @@ .maxstack 3 IL_0026: bne.un.s IL_0007 IL_0028: ret } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .AddGeneration( @@ -5376,7 +5338,7 @@ class C Handle(6, TableIndex.MethodSemantics), }); - var expectedIL = """ + g.VerifyIL(""" { // Code size 41 (0x29) .maxstack 3 @@ -5426,15 +5388,13 @@ .maxstack 3 IL_0028: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000015 - IL_0005: throw + IL_0000: ldstr 0x70000151 + IL_0005: newobj 0x0A000015 + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } @@ -11554,10 +11514,11 @@ class C var expectedIL = """ { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000005 + IL_000a: throw } """; @@ -15702,10 +15663,11 @@ class N var expectedIL = """ { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000005 + IL_000a: throw } """; @@ -15796,10 +15758,11 @@ void M1() { } var expectedIL = """ { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A000005 + IL_000a: throw } """; @@ -15851,10 +15814,11 @@ class C var expectedIL = """ { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000005 + IL_000a: throw } """; @@ -15956,10 +15920,11 @@ class C var expectedIL = """ { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000006 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000006 + IL_000a: throw } """; @@ -16117,10 +16082,11 @@ void Goo() { } var expectedIL = """ { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A000005 + IL_000a: throw } """; @@ -16184,7 +16150,7 @@ public void Method_Delete_WithLambda() { using var _ = new EditAndContinueTest() .AddBaseline( - source: $$""" + source: """ using System; class C @@ -16194,7 +16160,9 @@ class C """, validator: g => { - g.VerifySynthesizedMembers(); + g.VerifySynthesizedMembers( + "C: {<>c}", + "C.<>c: {<>9__0_0, b__0_0}"); }) .AddGeneration( source: """ @@ -16204,13 +16172,14 @@ class C { } """, - edits: new[] - { + edits: + [ Edit(SemanticEditKind.Delete, symbolProvider: c => c.GetMember("C.F"), newSymbolProvider: c => c.GetMember("C")), - }, + ], validator: g => { g.VerifySynthesizedMembers(); + g.VerifyTypeDefNames(); g.VerifyMethodDefNames("F", "b__0_0"); g.VerifyTypeRefNames("Object", "MissingMethodException"); @@ -16229,10 +16198,18 @@ class C g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw + } + { + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000008 - IL_0005: throw + IL_0000: ldstr 0x7000014E + IL_0005: newobj 0x0A000008 + IL_000a: throw } """); }) @@ -16343,10 +16320,18 @@ class C g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000299 + IL_0005: newobj 0x0A00000D + IL_000a: throw + } + { + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A00000D - IL_0005: throw + IL_0000: ldstr 0x700003E2 + IL_0005: newobj 0x0A00000D + IL_000a: throw } """); }) @@ -16430,10 +16415,18 @@ class C g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A000009 + IL_000a: throw + } + { + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000009 - IL_0005: throw + IL_0000: ldstr 0x70000152 + IL_0005: newobj 0x0A000009 + IL_000a: throw } """); }) @@ -16472,7 +16465,12 @@ ref readonly S F<[A]S>([A]T a, ref readonly S b) where S : struct """, validator: g => { - g.VerifySynthesizedMembers(); + g.VerifySynthesizedMembers( + [ + .. synthesized, + "C: {<>c__0}", + "C.<>c__0: {<>9__0_0, b__0_0}" + ]); }) .AddGeneration( source: common + """ @@ -16486,15 +16484,18 @@ ref readonly S F<[A]S>([A]T a, ref readonly S b) where S : struct } } """, - edits: new[] - { + edits: + [ Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), - }, + ], validator: g => { - g.VerifySynthesizedMembers([.. synthesized, + g.VerifySynthesizedMembers( + [ + .. synthesized, "C: {<>c__0}", - "C.<>c__0: {<>9__0_0, <>9__0_1#1, b__0_0, b__0_1#1}"]); + "C.<>c__0: {<>9__0_0, <>9__0_1#1, b__0_0, b__0_1#1}" + ]); }) .AddGeneration( source: common + """ @@ -16509,10 +16510,10 @@ ref readonly S F<[A]S>([A]T a, ref readonly S b) where S : struct } } """, - edits: new[] - { + edits: + [ Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), - }, + ], validator: g => { g.VerifySynthesizedMembers([.. synthesized, @@ -16525,15 +16526,18 @@ class C { } """, - edits: _ => new[] - { + edits: + [ Edit(SemanticEditKind.Delete, c => c.GetMember("C.F"), newSymbolProvider: c => c.GetMember("C")), - }, + ], validator: g => { - g.VerifySynthesizedMembers([.. synthesized, + g.VerifySynthesizedMembers( + [ + .. synthesized, "C: {<>c__0}", - "C.<>c__0: {<>9__0_0, <>9__0_1#1, <>9__0_2#2, b__0_0, b__0_1#1, b__0_2#2}"]); + "C.<>c__0: {<>9__0_0, <>9__0_1#1, <>9__0_2#2, b__0_0, b__0_1#1, b__0_2#2}" + ]); g.VerifyTypeDefNames(); g.VerifyMethodDefNames("F", "b__0_0", "b__0_1#1", "b__0_2#2"); @@ -16550,6 +16554,7 @@ class C Row(10, TableIndex.MethodDef, EditAndContinueOperation.Default), Row(11, TableIndex.MethodDef, EditAndContinueOperation.Default) }); + g.VerifyEncMapDefinitions(new[] { Handle(5, TableIndex.MethodDef), @@ -16560,10 +16565,18 @@ class C g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x7000000D + IL_0005: newobj 0x0A000023 + IL_000a: throw + } + { + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000023 - IL_0005: throw + IL_0000: ldstr 0x70000156 + IL_0005: newobj 0x0A000023 + IL_000a: throw } """); }) @@ -16578,16 +16591,19 @@ void F<[A]S>([A]T a, S b) where S : struct } } """, - edits: new[] - { + edits: + [ Edit(SemanticEditKind.Insert, c => c.GetMember("C.F")), - }, + ], validator: g => { - g.VerifySynthesizedMembers([.. synthesized, + g.VerifySynthesizedMembers( + [ + .. synthesized, "C: {<>c__0#4, <>c__0}", "C.<>c__0#4: {<>9__0#4_0#4, b__0#4_0#4}", - "C.<>c__0: {<>9__0_0, <>9__0_1#1, <>9__0_2#2, b__0_0, b__0_1#1, b__0_2#2}"]); + "C.<>c__0: {<>9__0_0, <>9__0_1#1, <>9__0_2#2, b__0_0, b__0_1#1, b__0_2#2}" + ]); g.VerifyTypeDefNames("<>c__0#4`1"); g.VerifyMethodDefNames("F", ".cctor", ".ctor", "b__0#4_0#4"); @@ -16639,16 +16655,19 @@ class C { } """, - edits: _ => new[] - { + edits: + [ Edit(SemanticEditKind.Delete, c => c.GetMember("C.F"), newSymbolProvider: c => c.GetMember("C")), - }, + ], validator: g => { - g.VerifySynthesizedMembers([.. synthesized, + g.VerifySynthesizedMembers( + [ + .. synthesized, "C: {<>c__0#4, <>c__0}", "C.<>c__0#4: {<>9__0#4_0#4, b__0#4_0#4}", - "C.<>c__0: {<>9__0_0, <>9__0_1#1, <>9__0_2#2, b__0_0, b__0_1#1, b__0_2#2}"]); + "C.<>c__0: {<>9__0_0, <>9__0_1#1, <>9__0_2#2, b__0_0, b__0_1#1, b__0_2#2}" + ]); g.VerifyTypeDefNames(); @@ -16663,6 +16682,7 @@ class C Row(12, TableIndex.MethodDef, EditAndContinueOperation.Default), Row(15, TableIndex.MethodDef, EditAndContinueOperation.Default) }); + g.VerifyEncMapDefinitions(new[] { Handle(12, TableIndex.MethodDef), @@ -16671,10 +16691,18 @@ class C g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x700002A1 + IL_0005: newobj 0x0A00002D + IL_000a: throw + } + { + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A00002D - IL_0005: throw + IL_0000: ldstr 0x700003EA + IL_0005: newobj 0x0A00002D + IL_000a: throw } """); }) @@ -16713,7 +16741,11 @@ void F(T x, ref readonly int b) """, validator: g => { - g.VerifySynthesizedMembers(); + g.VerifySynthesizedMembers( + [ + .. synthesized, + "C: {g__L|0_0}", + ]); }) .AddGeneration( source: common + """ @@ -16728,14 +16760,17 @@ void F(T x, ref readonly int b) } } """, - edits: new[] - { + edits: + [ Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true), - }, + ], validator: g => { - g.VerifySynthesizedMembers([.. synthesized, - "C: {g__L|0_0, g__M|0_1#1}"]); + g.VerifySynthesizedMembers( + [ + .. synthesized, + "C: {g__L|0_0, g__M|0_1#1}" + ]); }) .AddGeneration( source: common + """ @@ -16743,14 +16778,17 @@ class C { } """, - edits: _ => new[] - { + edits: + [ Edit(SemanticEditKind.Delete, c => c.GetMember("C.F"), newSymbolProvider: c => c.GetMember("C")), - }, + ], validator: g => { - g.VerifySynthesizedMembers([.. synthesized, - "C: {g__L|0_0, g__M|0_1#1}"]); + g.VerifySynthesizedMembers( + [ + .. synthesized, + "C: {g__L|0_0, g__M|0_1#1}" + ]); g.VerifyTypeDefNames(); g.VerifyMethodDefNames("F", "g__L|0_0", "g__M|0_1#1"); @@ -16764,6 +16802,7 @@ class C Row(7, TableIndex.MethodDef, EditAndContinueOperation.Default), Row(8, TableIndex.MethodDef, EditAndContinueOperation.Default) }); + g.VerifyEncMapDefinitions(new[] { Handle(5, TableIndex.MethodDef), @@ -16773,10 +16812,18 @@ class C g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A00000C + IL_000a: throw + } + { + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A00000C - IL_0005: throw + IL_0000: ldstr 0x70000152 + IL_0005: newobj 0x0A00000C + IL_000a: throw } """); }) @@ -16797,15 +16844,18 @@ ref readonly T O(ref readonly T b) } } """, - edits: new[] - { + edits: + [ Edit(SemanticEditKind.Insert, c => c.GetMember("C.F")), - }, + ], validator: g => { - g.VerifySynthesizedMembers([.. synthesized, + g.VerifySynthesizedMembers( + [ + .. synthesized, "C: {g__N|0#3_1#3, <>c__DisplayClass0#3_0#3, g__L|0_0, g__M|0_1#1}", - "C.<>c__DisplayClass0#3_0#3: {x, g__O|0#3, b__2#3}"]); + "C.<>c__DisplayClass0#3_0#3: {x, g__O|0#3, b__2#3}" + ]); g.VerifyTypeDefNames("<>c__DisplayClass0#3_0#3"); g.VerifyMethodDefNames("F", "g__N|0#3_1#3", ".ctor", "g__O|0#3", "b__2#3"); @@ -16873,15 +16923,18 @@ class C { } """, - edits: _ => new[] - { + edits: + [ Edit(SemanticEditKind.Delete, c => c.GetMember("C.F"), newSymbolProvider: c => c.GetMember("C")), - }, + ], validator: g => { - g.VerifySynthesizedMembers([.. synthesized, + g.VerifySynthesizedMembers( + [ + .. synthesized, "C: {g__N|0#3_1#3, <>c__DisplayClass0#3_0#3, g__L|0_0, g__M|0_1#1}", - "C.<>c__DisplayClass0#3_0#3: {x, g__O|0#3, b__2#3}"]); + "C.<>c__DisplayClass0#3_0#3: {x, g__O|0#3, b__2#3}" + ]); g.VerifyTypeDefNames(); @@ -16891,20 +16944,28 @@ class C g.VerifyTypeRefNames("Object", "MissingMethodException"); g.VerifyMemberRefNames(".ctor"); - g.VerifyEncLogDefinitions(new[] - { + g.VerifyEncLogDefinitions( + [ Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default), Row(9, TableIndex.MethodDef, EditAndContinueOperation.Default), Row(11, TableIndex.MethodDef, EditAndContinueOperation.Default), Row(12, TableIndex.MethodDef, EditAndContinueOperation.Default) - }); + ]); g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x7000029D + IL_0005: newobj 0x0A000013 + IL_000a: throw + } + { + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000013 - IL_0005: throw + IL_0000: ldstr 0x700003E6 + IL_0005: newobj 0x0A000013 + IL_000a: throw } """); }) @@ -17018,10 +17079,11 @@ class C var expectedIL = """ { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000006 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000006 + IL_000a: throw } { // Code size 10 (0xa) @@ -17067,7 +17129,7 @@ class C Handle(1, TableIndex.Param), }); - var expectedIL = """ + g.VerifyIL(""" { // Code size 10 (0xa) .maxstack 8 @@ -17078,15 +17140,13 @@ .maxstack 8 IL_0009: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000009 - IL_0005: throw + IL_0000: ldstr 0x70000151 + IL_0005: newobj 0x0A000009 + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } @@ -17141,12 +17201,13 @@ class C Handle(2, TableIndex.StandAloneSig) }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000006 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000006 + IL_000a: throw } { // Code size 7 (0x7) @@ -17158,10 +17219,7 @@ .maxstack 1 IL_0005: ldloc.0 IL_0006: ret } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .AddGeneration( source: $$""" @@ -17195,7 +17253,7 @@ class C Handle(3, TableIndex.StandAloneSig) }); - var expectedIL = """ + g.VerifyIL(""" { // Code size 13 (0xd) .maxstack 1 @@ -17208,15 +17266,13 @@ .maxstack 1 IL_000c: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000008 - IL_0005: throw + IL_0000: ldstr 0x70000151 + IL_0005: newobj 0x0A000008 + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } @@ -17272,12 +17328,13 @@ class C Handle(3, TableIndex.Param) }); - var expectedIL = """ + g.VerifyIL(""" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000006 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000006 + IL_000a: throw } { // Code size 10 (0xa) @@ -17288,10 +17345,7 @@ .maxstack 8 IL_0008: pop IL_0009: ret } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .AddGeneration( source: $$""" @@ -17323,7 +17377,7 @@ class C Handle(1, TableIndex.Param), }); - var expectedIL = """ + g.VerifyIL(""" { // Code size 10 (0xa) .maxstack 8 @@ -17334,15 +17388,13 @@ .maxstack 8 IL_0009: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000009 - IL_0005: throw + IL_0000: ldstr 0x70000151 + IL_0005: newobj 0x0A000009 + IL_000a: throw } - """; - - // Can't verify the IL of individual methods because that requires IMethodSymbolInternal implementations - g.VerifyIL(expectedIL); + """); }) .Verify(); } diff --git a/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableArrayExtensionsTests.cs b/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableArrayExtensionsTests.cs index be6724db373c3..994564ca25cae 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableArrayExtensionsTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableArrayExtensionsTests.cs @@ -508,5 +508,28 @@ public void Casting() // Trying to cast from base to derived. "As" should return null (default) Assert.True(new C[] { new C() }.AsImmutableOrNull().As().IsDefault); } + + [Theory] + [InlineData(new int[0], new[] { 1 })] + [InlineData(new[] { 1 }, new[] { 3, 1, 1, 3, 4 })] + [InlineData(new[] { 3, 1 }, new[] { 1, 2, 2, 3, 4 })] + [InlineData(new[] { 3, 3, 3 }, new[] { 1, 2, 3, 4 })] + [InlineData(new[] { 2, 4, 1, 2 }, new[] { 1, 2, 3, 4 })] + public void IsSubsetOf_Strict(int[] array, int[] other) + { + Assert.True(array.ToImmutableArray().IsSubsetOf(other.ToImmutableArray())); + Assert.False(other.ToImmutableArray().IsSubsetOf(array.ToImmutableArray())); + } + + [Theory] + [InlineData(new int[0], new int[0])] + [InlineData(new[] { 1 }, new[] { 1 })] + [InlineData(new[] { 1, 1 }, new[] { 1, 1, 1, 1 })] + [InlineData(new[] { 1, 1, 1 }, new[] { 1, 1 })] + public void IsSubsetOf_Equal(int[] array, int[] other) + { + Assert.True(array.ToImmutableArray().IsSubsetOf(other.ToImmutableArray())); + Assert.True(other.ToImmutableArray().IsSubsetOf(array.ToImmutableArray())); + } } } diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.resx b/src/Compilers/Core/Portable/CodeAnalysisResources.resx index deff5670de1a9..44fe48cf05988 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.resx +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.resx @@ -724,6 +724,18 @@ Edit and Continue can't resume suspended iterator since the corresponding yield return statement has been deleted + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Generator diff --git a/src/Compilers/Core/Portable/CodeGen/ClosureDebugInfo.cs b/src/Compilers/Core/Portable/CodeGen/ClosureDebugInfo.cs index 2ef2bc1291aef..431e26e710f0f 100644 --- a/src/Compilers/Core/Portable/CodeGen/ClosureDebugInfo.cs +++ b/src/Compilers/Core/Portable/CodeGen/ClosureDebugInfo.cs @@ -2,43 +2,19 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Diagnostics; -using Roslyn.Utilities; -namespace Microsoft.CodeAnalysis.CodeGen -{ - [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] - internal readonly struct ClosureDebugInfo : IEquatable - { - public readonly int SyntaxOffset; - public readonly DebugId ClosureId; - - public ClosureDebugInfo(int syntaxOffset, DebugId closureId) - { - SyntaxOffset = syntaxOffset; - ClosureId = closureId; - } - - public bool Equals(ClosureDebugInfo other) - { - return SyntaxOffset == other.SyntaxOffset && - ClosureId.Equals(other.ClosureId); - } +namespace Microsoft.CodeAnalysis.CodeGen; - public override bool Equals(object? obj) - { - return obj is ClosureDebugInfo && Equals((ClosureDebugInfo)obj); - } - - public override int GetHashCode() - { - return Hash.Combine(SyntaxOffset, ClosureId.GetHashCode()); - } - - internal string GetDebuggerDisplay() - { - return $"({ClosureId} @{SyntaxOffset})"; - } - } +/// +/// Debug information maintained for each closure. +/// +/// +/// The information is emitted to PDB in Custom Debug Information record for a method containing the closure. +/// +[DebuggerDisplay("{GetDebuggerDisplay(), nq}")] +internal readonly record struct ClosureDebugInfo(int SyntaxOffset, DebugId ClosureId) +{ + internal string GetDebuggerDisplay() + => $"({ClosureId} @{SyntaxOffset})"; } diff --git a/src/Compilers/Core/Portable/CodeGen/LambdaDebugInfo.cs b/src/Compilers/Core/Portable/CodeGen/LambdaDebugInfo.cs index 5a784a9a5c525..71acb3c390399 100644 --- a/src/Compilers/Core/Portable/CodeGen/LambdaDebugInfo.cs +++ b/src/Compilers/Core/Portable/CodeGen/LambdaDebugInfo.cs @@ -2,9 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Diagnostics; -using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CodeGen { @@ -14,8 +12,7 @@ namespace Microsoft.CodeAnalysis.CodeGen /// /// The information is emitted to PDB in Custom Debug Information record for a method containing the lambda. /// - [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] - internal readonly struct LambdaDebugInfo : IEquatable + internal readonly record struct LambdaDebugInfo { /// /// The syntax offset of the syntax node declaring the lambda (lambda expression) or its body (lambda in a query). @@ -23,7 +20,7 @@ namespace Microsoft.CodeAnalysis.CodeGen public readonly int SyntaxOffset; /// - /// The ordinal of the closure frame the lambda belongs to, or + /// The ordinal of the closure frame the lambda or local function belongs to, or /// if the lambda is static, or /// if the lambda is closed over "this" pointer only. /// @@ -44,30 +41,9 @@ public LambdaDebugInfo(int syntaxOffset, DebugId lambdaId, int closureOrdinal) LambdaId = lambdaId; } - public bool Equals(LambdaDebugInfo other) - { - return SyntaxOffset == other.SyntaxOffset - && ClosureOrdinal == other.ClosureOrdinal - && LambdaId.Equals(other.LambdaId); - } - - public override bool Equals(object? obj) - { - return obj is LambdaDebugInfo && Equals((LambdaDebugInfo)obj); - } - - public override int GetHashCode() - { - return Hash.Combine(ClosureOrdinal, - Hash.Combine(SyntaxOffset, LambdaId.GetHashCode())); - } - - internal string GetDebuggerDisplay() - { - return - ClosureOrdinal == StaticClosureOrdinal ? $"({LambdaId} @{SyntaxOffset}, static)" : - ClosureOrdinal == ThisOnlyClosureOrdinal ? $"(#{LambdaId} @{SyntaxOffset}, this)" : - $"({LambdaId} @{SyntaxOffset} in {ClosureOrdinal})"; - } + public override string ToString() + => ClosureOrdinal == StaticClosureOrdinal ? $"({LambdaId} @{SyntaxOffset}, static)" : + ClosureOrdinal == ThisOnlyClosureOrdinal ? $"(#{LambdaId} @{SyntaxOffset}, this)" : + $"({LambdaId} @{SyntaxOffset} in {ClosureOrdinal})"; } } diff --git a/src/Compilers/Core/Portable/CodeGen/LambdaRuntimeRudeEditInfo.cs b/src/Compilers/Core/Portable/CodeGen/LambdaRuntimeRudeEditInfo.cs new file mode 100644 index 0000000000000..2e9e7798bc9a0 --- /dev/null +++ b/src/Compilers/Core/Portable/CodeGen/LambdaRuntimeRudeEditInfo.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.CodeAnalysis.Emit; + +namespace Microsoft.CodeAnalysis.CodeGen; + +internal readonly struct LambdaRuntimeRudeEditInfo(DebugId lambdaId, RuntimeRudeEdit rudeEdit) +{ + public DebugId LambdaId { get; } = lambdaId; + public RuntimeRudeEdit RudeEdit { get; } = rudeEdit; +} diff --git a/src/Compilers/Core/Portable/CodeGen/MethodBody.cs b/src/Compilers/Core/Portable/CodeGen/MethodBody.cs index 620d33e267862..be2d425d5d0d4 100644 --- a/src/Compilers/Core/Portable/CodeGen/MethodBody.cs +++ b/src/Compilers/Core/Portable/CodeGen/MethodBody.cs @@ -35,8 +35,9 @@ internal sealed class MethodBody : Cci.IMethodBody // Debug information emitted to Debug PDBs supporting EnC: private readonly DebugId _methodId; private readonly ImmutableArray _stateMachineHoistedLocalSlots; - private readonly ImmutableArray _lambdaDebugInfo; - private readonly ImmutableArray _closureDebugInfo; + private readonly ImmutableArray _lambdaDebugInfo; + private readonly ImmutableArray _orderedLambdaRuntimeRudeEdits; + private readonly ImmutableArray _closureDebugInfo; private readonly StateMachineStatesDebugInfo _stateMachineStatesDebugInfo; // Data used when emitting EnC delta: @@ -61,8 +62,9 @@ public MethodBody( ImmutableArray localScopes, bool hasDynamicLocalVariables, Cci.IImportScope importScopeOpt, - ImmutableArray lambdaDebugInfo, - ImmutableArray closureDebugInfo, + ImmutableArray lambdaDebugInfo, + ImmutableArray orderedLambdaRuntimeRudeEdits, + ImmutableArray closureDebugInfo, string stateMachineTypeNameOpt, ImmutableArray stateMachineHoistedLocalScopes, ImmutableArray stateMachineHoistedLocalSlots, @@ -88,6 +90,7 @@ public MethodBody( _hasDynamicLocalVariables = hasDynamicLocalVariables; _importScopeOpt = importScopeOpt; _lambdaDebugInfo = lambdaDebugInfo; + _orderedLambdaRuntimeRudeEdits = orderedLambdaRuntimeRudeEdits; _closureDebugInfo = closureDebugInfo; _stateMachineTypeNameOpt = stateMachineTypeNameOpt; _stateMachineHoistedLocalScopes = stateMachineHoistedLocalScopes; @@ -152,9 +155,14 @@ ImmutableArray Cci.IMethodBody.StateMachineHoistedLocalSlot public DebugId MethodId => _methodId; - public ImmutableArray LambdaDebugInfo => _lambdaDebugInfo; + public ImmutableArray LambdaDebugInfo => _lambdaDebugInfo; - public ImmutableArray ClosureDebugInfo => _closureDebugInfo; + /// + /// Ordered by . + /// + public ImmutableArray OrderedLambdaRuntimeRudeEdits => _orderedLambdaRuntimeRudeEdits; + + public ImmutableArray ClosureDebugInfo => _closureDebugInfo; public StateMachineStatesDebugInfo StateMachineStatesDebugInfo => _stateMachineStatesDebugInfo; diff --git a/src/Compilers/Core/Portable/CodeGen/VariableSlotAllocator.cs b/src/Compilers/Core/Portable/CodeGen/VariableSlotAllocator.cs index c7400a206f650..0b4cff26b4cad 100644 --- a/src/Compilers/Core/Portable/CodeGen/VariableSlotAllocator.cs +++ b/src/Compilers/Core/Portable/CodeGen/VariableSlotAllocator.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Reflection.Metadata; +using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Symbols; @@ -69,17 +70,33 @@ public abstract bool TryGetPreviousHoistedLocalSlotIndex( /// /// Finds a closure in the previous generation that corresponds to the specified syntax. /// + /// Syntax of the closure scope. + /// Id of the parent closure. + /// Names of variables hoisted into the closure, or default if the closure is a class. + /// Id of the closure assigned in the generation that defined the closure. + /// + /// Not-null if the previous closure is found, but is incompatible with the shape of the closure in the current source. + /// The previous closure can't be reused (a new one needs to be emitted) and IL bodies of lambdas of the previous closure are updated to throw an exception. + /// The exception message is specified in . + /// /// /// See LambdaFrame.AssertIsLambdaScopeSyntax for kinds of syntax nodes that represent closures. /// - public abstract bool TryGetPreviousClosure(SyntaxNode closureSyntax, out DebugId closureId); + public abstract bool TryGetPreviousClosure(SyntaxNode closureSyntax, DebugId? parentClosureId, ImmutableArray structCaptures, out DebugId closureId, out RuntimeRudeEdit? runtimeRudeEdit); /// /// Finds a lambda in the previous generation that corresponds to the specified syntax. - /// The is either a lambda syntax ( is false), - /// or lambda body syntax ( is true). /// - public abstract bool TryGetPreviousLambda(SyntaxNode lambdaOrLambdaBodySyntax, bool isLambdaBody, out DebugId lambdaId); + /// Syntax of the lambda or its body. + /// True if is a lambda body syntax, false if it is a lambda syntax. + /// The ordinal of the closure the lambda is emitted to. + /// Id of the lambda assigned in the generation that defined the lambda. + /// + /// Not-null if the previous lambda is found, but is incompatible with the shape of the lambda in the current source. + /// The previous lambda can't be reused (a new one needs to be emitted) and the previous lambda IL body is updated to throw an exception. + /// The exception message is specified in . + /// + public abstract bool TryGetPreviousLambda(SyntaxNode lambdaOrLambdaBodySyntax, bool isLambdaBody, int closureOrdinal, ImmutableArray structClosureIds, out DebugId lambdaId, out RuntimeRudeEdit? runtimeRudeEdit); /// /// State number to be used for next state of the state machine, diff --git a/src/Compilers/Core/Portable/Collections/ImmutableArrayExtensions.cs b/src/Compilers/Core/Portable/Collections/ImmutableArrayExtensions.cs index 00d1398278959..18393aebb6679 100644 --- a/src/Compilers/Core/Portable/Collections/ImmutableArrayExtensions.cs +++ b/src/Compilers/Core/Portable/Collections/ImmutableArrayExtensions.cs @@ -1098,5 +1098,43 @@ internal static int BinarySearch(this ImmutableSegmentedList(this ImmutableArray array, ImmutableArray other) + { + if (other.Length == 0) + { + return array.Length == 0; + } + + switch (array.Length) + { + case 0: + return true; + case 1: + return other.Contains(array[0]); + case 2: + return other.Contains(array[0]) && other.Contains(array[1]); + case 3: + return other.Contains(array[0]) && other.Contains(array[1]) && other.Contains(array[2]); + } + + var set = PooledHashSet.GetInstance(); + foreach (var item in other) + { + set.Add(item); + } + + foreach (var item in array) + { + if (!set.Contains(item)) + { + set.Free(); + return false; + } + } + + set.Free(); + return true; + } } } diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/AddedOrChangedMethodInfo.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/AddedOrChangedMethodInfo.cs index 98080deeaa1c7..80e42a45514ce 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/AddedOrChangedMethodInfo.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/AddedOrChangedMethodInfo.cs @@ -17,8 +17,8 @@ internal readonly struct AddedOrChangedMethodInfo public readonly ImmutableArray Locals; // lambdas, closures: - public readonly ImmutableArray LambdaDebugInfo; - public readonly ImmutableArray ClosureDebugInfo; + public readonly ImmutableArray LambdaDebugInfo; + public readonly ImmutableArray ClosureDebugInfo; // state machines: public readonly string? StateMachineTypeName; @@ -29,8 +29,8 @@ internal readonly struct AddedOrChangedMethodInfo public AddedOrChangedMethodInfo( DebugId methodId, ImmutableArray locals, - ImmutableArray lambdaDebugInfo, - ImmutableArray closureDebugInfo, + ImmutableArray lambdaDebugInfo, + ImmutableArray closureDebugInfo, string? stateMachineTypeName, ImmutableArray stateMachineHoistedLocalSlotsOpt, ImmutableArray stateMachineAwaiterSlotsOpt, diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs index e65d243d55746..03aebde7eba92 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs @@ -20,20 +20,33 @@ namespace Microsoft.CodeAnalysis.Emit { internal abstract class DefinitionMap { - protected readonly struct MappedMethod + private readonly struct MetadataLambdasAndClosures( + ImmutableArray<(DebugId id, IMethodSymbolInternal symbol)> lambdaSymbols, + IReadOnlyDictionary structCaptures)> closureTree) { - public readonly IMethodSymbolInternal PreviousMethod; - public readonly Func? SyntaxMap; + /// + /// Ordered by id. + /// + public ImmutableArray<(DebugId id, IMethodSymbolInternal symbol)> LambdaSymbols { get; } = lambdaSymbols; - public MappedMethod(IMethodSymbolInternal previousMethod, Func? syntaxMap) - { - PreviousMethod = previousMethod; - SyntaxMap = syntaxMap; - } + public IReadOnlyDictionary structCaptures)> ClosureTree { get; } = closureTree; + + public IMethodSymbolInternal? GetLambdaSymbol(DebugId lambdaId) + => LambdaSymbols.BinarySearch(lambdaId, static (info, id) => info.id.CompareTo(id)) is int i and >= 0 ? LambdaSymbols[i].symbol : null; + + public (DebugId? parentId, ImmutableArray) TryGetClosureInfo(DebugId closureId) + => ClosureTree.TryGetValue(closureId, out var node) ? node : default; } private readonly ImmutableDictionary _methodInstrumentations; - protected readonly IReadOnlyDictionary mappedMethods; + protected readonly IReadOnlyDictionary mappedMethods; + + /// + /// Caches for named PE types. + /// + private ImmutableDictionary _metadataLambdasAndClosures + = ImmutableDictionary.Empty; + public readonly EmitBaseline Baseline; protected DefinitionMap(IEnumerable edits, EmitBaseline baseline) @@ -49,9 +62,9 @@ protected DefinitionMap(IEnumerable edits, EmitBaseline baseline) Baseline = baseline; } - private IReadOnlyDictionary GetMappedMethods(IEnumerable edits) + private IReadOnlyDictionary GetMappedMethods(IEnumerable edits) { - var mappedMethods = new Dictionary(); + var mappedMethods = new Dictionary(); foreach (var edit in edits) { // We should always "preserve locals" of iterator and async methods since the state machine @@ -73,14 +86,16 @@ private IReadOnlyDictionary GetMappedMethod if (edit.Kind == SemanticEditKind.Update && edit.SyntaxMap != null) { - RoslynDebug.AssertNotNull(edit.NewSymbol); - RoslynDebug.AssertNotNull(edit.OldSymbol); + Debug.Assert(edit.NewSymbol != null); + Debug.Assert(edit.OldSymbol != null); - if (GetISymbolInternalOrNull(edit.NewSymbol) is IMethodSymbolInternal newMethod && - GetISymbolInternalOrNull(edit.OldSymbol) is IMethodSymbolInternal oldMethod) - { - mappedMethods.Add(newMethod, new MappedMethod(oldMethod, edit.SyntaxMap)); - } + var oldMethod = (IMethodSymbolInternal?)GetISymbolInternalOrNull(edit.OldSymbol); + var newMethod = (IMethodSymbolInternal?)GetISymbolInternalOrNull(edit.NewSymbol); + + Debug.Assert(oldMethod != null); + Debug.Assert(newMethod != null); + + mappedMethods.Add(newMethod, new EncMappedMethod(oldMethod, edit.SyntaxMap, edit.RuntimeRudeEdit)); } } @@ -212,8 +227,8 @@ protected abstract void GetStateMachineFieldMapFromMetadata( ImmutableArray previousLocals; IReadOnlyDictionary? hoistedLocalMap = null; IReadOnlyDictionary? awaiterMap = null; - IReadOnlyDictionary>? lambdaMap = null; - IReadOnlyDictionary? closureMap = null; + IReadOnlyDictionary? lambdaMap = null; + IReadOnlyDictionary? closureMap = null; IReadOnlyDictionary<(int syntaxOffset, AwaitDebugId debugId), StateMachineState>? stateMachineStateMap = null; StateMachineState? firstUnusedIncreasingStateMachineState = null; StateMachineState? firstUnusedDecreasingStateMachineState = null; @@ -224,15 +239,16 @@ protected abstract void GetStateMachineFieldMapFromMetadata( SymbolMatcher symbolMap; int methodIndex = MetadataTokens.GetRowNumber(methodHandle); - DebugId methodId; + DebugId? methodId; // Check if method has changed previously. If so, we already have a map. if (Baseline.AddedOrChangedMethods.TryGetValue(methodIndex, out var addedOrChangedMethod)) { methodId = addedOrChangedMethod.MethodId; - MakeLambdaAndClosureMaps(addedOrChangedMethod.LambdaDebugInfo, addedOrChangedMethod.ClosureDebugInfo, out lambdaMap, out closureMap); - MakeStateMachineStateMap(addedOrChangedMethod.StateMachineStates.States, out stateMachineStateMap); + lambdaMap = MakeLambdaMap(addedOrChangedMethod.LambdaDebugInfo); + closureMap = MakeClosureMap(addedOrChangedMethod.ClosureDebugInfo); + stateMachineStateMap = MakeStateMachineStateMap(addedOrChangedMethod.StateMachineStates.States); firstUnusedIncreasingStateMachineState = addedOrChangedMethod.StateMachineStates.FirstUnusedIncreasingStateMachineState; firstUnusedDecreasingStateMachineState = addedOrChangedMethod.StateMachineStates.FirstUnusedDecreasingStateMachineState; @@ -288,14 +304,20 @@ protected abstract void GetStateMachineFieldMapFromMetadata( return null; } - methodId = new DebugId(debugInfo.MethodOrdinal, 0); - - if (!debugInfo.Lambdas.IsDefaultOrEmpty) + if (debugInfo.Lambdas.IsDefaultOrEmpty) { - MakeLambdaAndClosureMaps(debugInfo.Lambdas, debugInfo.Closures, out lambdaMap, out closureMap); + // We do not have method ids for methods without lambdas. + methodId = null; + } + else + { + methodId = new DebugId(debugInfo.MethodOrdinal, 0); + + var peMethod = GetMethodSymbol(methodHandle); + MakeLambdaAndClosureMapFromMetadata(debugInfo, peMethod, methodId.Value, out lambdaMap, out closureMap); } - MakeStateMachineStateMap(debugInfo.StateMachineStates, out stateMachineStateMap); + stateMachineStateMap = MakeStateMachineStateMap(debugInfo.StateMachineStates); if (!debugInfo.StateMachineStates.IsDefaultOrEmpty) { @@ -372,8 +394,7 @@ protected abstract void GetStateMachineFieldMapFromMetadata( return new EncVariableSlotAllocator( symbolMap, - mappedMethod.SyntaxMap, - mappedMethod.PreviousMethod, + mappedMethod, methodId, previousLocals, lambdaMap, @@ -403,40 +424,70 @@ private void ReportMissingStateMachineAttribute(DiagnosticBag diagnostics, IMeth stateMachineAttributeFullName)); } - private static void MakeLambdaAndClosureMaps( - ImmutableArray lambdaDebugInfo, - ImmutableArray closureDebugInfo, - out IReadOnlyDictionary> lambdaMap, - out IReadOnlyDictionary closureMap) + private static IReadOnlyDictionary MakeLambdaMap(ImmutableArray lambdaDebugInfo) + => lambdaDebugInfo.ToImmutableSegmentedDictionary( + keySelector: static info => info.DebugInfo.SyntaxOffset, + elementSelector: static info => new EncLambdaMapValue(info.DebugInfo.LambdaId, info.DebugInfo.ClosureOrdinal, info.StructClosureIds)); + + private static IReadOnlyDictionary MakeClosureMap(ImmutableArray closureDebugInfo) + => closureDebugInfo.ToImmutableSegmentedDictionary( + keySelector: static info => info.DebugInfo.SyntaxOffset, + elementSelector: static info => new EncClosureMapValue(info.DebugInfo.ClosureId, info.ParentDebugId, info.StructCaptures)); + + private void MakeLambdaAndClosureMapFromMetadata( + EditAndContinueMethodDebugInformation debugInfo, + IMethodSymbolInternal method, + DebugId methodId, + out IReadOnlyDictionary lambdaMap, + out IReadOnlyDictionary closureMap) { - var lambdas = new Dictionary>(lambdaDebugInfo.Length); - var closures = new Dictionary(closureDebugInfo.Length); + var map = GetMetadataLambdaAndClosureMap(method.ContainingType, methodId); - for (int i = 0; i < lambdaDebugInfo.Length; i++) - { - var lambdaInfo = lambdaDebugInfo[i]; - lambdas[lambdaInfo.SyntaxOffset] = KeyValuePairUtil.Create(lambdaInfo.LambdaId, lambdaInfo.ClosureOrdinal); - } + lambdaMap = debugInfo.Lambdas.ToImmutableSegmentedDictionary( + keySelector: static info => info.SyntaxOffset, + elementSelector: info => new EncLambdaMapValue(info.LambdaId, info.ClosureOrdinal, getLambdaStructClosureIdsFromMetadata(map.GetLambdaSymbol(info.LambdaId), methodId))); - for (int i = 0; i < closureDebugInfo.Length; i++) + closureMap = debugInfo.Closures.ToImmutableSegmentedDictionary( + keySelector: static info => info.SyntaxOffset, + elementSelector: info => + { + var (parentId, structCaptures) = map.TryGetClosureInfo(info.ClosureId); + return new EncClosureMapValue(info.ClosureId, parentId, structCaptures); + }); + + ImmutableArray getLambdaStructClosureIdsFromMetadata(IMethodSymbolInternal? lambda, DebugId methodId) { - var closureInfo = closureDebugInfo[i]; - closures[closureInfo.SyntaxOffset] = closureInfo.ClosureId; - } + if (lambda == null || lambda.Parameters is []) + { + return ImmutableArray.Empty; + } - lambdaMap = lambdas; - closureMap = closures; - } + var builder = ArrayBuilder.GetInstance(lambda.Parameters.Length); + foreach (var p in lambda.Parameters) + { + var displayClassName = p.Type.Name; + if (p.RefKind == RefKind.Ref && + TryParseDisplayClassOrLambdaName(displayClassName, out int suffixIndex, out char idSeparator, out bool isDisplayClass, out bool _, out bool hasDebugIds) && + isDisplayClass && + hasDebugIds && + CommonGeneratedNames.TryParseDebugIds(displayClassName.AsSpan(suffixIndex), idSeparator, isMethodIdOptional: false, out var parsedMethodId, out var parsedEntityId) && + parsedMethodId == methodId) + { + builder.Add(parsedEntityId); + } + } - private static void MakeStateMachineStateMap( - ImmutableArray debugInfos, - out IReadOnlyDictionary<(int syntaxOffset, AwaitDebugId debugId), StateMachineState>? map) - { - map = debugInfos.IsDefault ? - null : - debugInfos.ToDictionary(entry => (entry.SyntaxOffset, entry.AwaitId), entry => entry.StateNumber); + return builder.ToImmutableAndFree(); + } } + private static IReadOnlyDictionary<(int syntaxOffset, AwaitDebugId debugId), StateMachineState>? MakeStateMachineStateMap(ImmutableArray debugInfos) + => debugInfos.IsDefault + ? null + : debugInfos.ToImmutableSegmentedDictionary( + keySelector: static entry => (entry.SyntaxOffset, entry.AwaitId), + elementSelector: static entry => entry.StateNumber); + private static void GetStateMachineFieldMapFromPreviousCompilation( ImmutableArray hoistedLocalSlots, ImmutableArray hoistedAwaiters, @@ -479,40 +530,52 @@ protected abstract bool TryParseDisplayClassOrLambdaName( out int suffixIndex, out char idSeparator, out bool isDisplayClass, + out bool isDisplayClassParentField, out bool hasDebugIds); - private IEnumerable GetSynthesizedClosureMethods( - ImmutableArray synthesizedMembers, + private MetadataLambdasAndClosures GetMetadataLambdaAndClosureMap(INamedTypeSymbolInternal peType, DebugId methodId) + => ImmutableInterlocked.GetOrAdd( + ref _metadataLambdasAndClosures, + peType, + static (type, arg) => arg.self.CreateLambdaAndClosureMap(type.GetMembers(), synthesizedMemberMap: null, arg.methodId), + (self: this, methodId)); + + private MetadataLambdasAndClosures CreateLambdaAndClosureMap( + ImmutableArray members, IReadOnlyDictionary>? synthesizedMemberMap, - DebugId methodId, - HashSet lambdaIds) + DebugId methodId) { - return recurse(synthesizedMembers, inSpecificDisplayClass: false); + var lambdasBuilder = ArrayBuilder<(DebugId id, IMethodSymbolInternal symbol)>.GetInstance(); + var closureTreeBuilder = ImmutableSegmentedDictionary.CreateBuilder structCaptures)>(); + + recurse(members, containingDisplayClassId: null); + + lambdasBuilder.Sort(static (x, y) => x.id.CompareTo(y.id)); - IEnumerable recurse(ImmutableArray synthesizedMembers, bool inSpecificDisplayClass) + return new MetadataLambdasAndClosures(lambdasBuilder.ToImmutableAndFree(), closureTreeBuilder.ToImmutable()); + + void recurse(ImmutableArray members, DebugId? containingDisplayClassId) { - foreach (var synthesizedMember in synthesizedMembers) + foreach (var member in members) { - var memberName = synthesizedMember.Name; + var memberName = member.Name; - if (TryParseDisplayClassOrLambdaName(memberName, out int suffixIndex, out char idSeparator, out bool isDisplayClass, out bool hasDebugIds)) + if (TryParseDisplayClassOrLambdaName(memberName, out int suffixIndex, out char idSeparator, out bool isDisplayClass, out bool isDisplayClassParentField, out bool hasDebugIds)) { // If we are in a display class that is specific to a method the original method id is already incorporated to the name of the display class, // so members do not have it in their name and only have the entity id. - var suffixSpan = memberName.AsSpan(suffixIndex); - DebugId parsedMethodId = default; DebugId parsedEntityId = default; if (hasDebugIds) { - if (!CommonGeneratedNames.TryParseDebugIds(suffixSpan, idSeparator, isMethodIdOptional: inSpecificDisplayClass, out parsedMethodId, out parsedEntityId)) + if (!CommonGeneratedNames.TryParseDebugIds(memberName.AsSpan(suffixIndex), idSeparator, isMethodIdOptional: containingDisplayClassId.HasValue, out parsedMethodId, out parsedEntityId)) { // name is not well-formed continue; } - if (!inSpecificDisplayClass && parsedMethodId != methodId) + if (!containingDisplayClassId.HasValue && parsedMethodId != methodId) { // synthesized member belongs to a different method continue; @@ -522,27 +585,69 @@ IEnumerable recurse(ImmutableArray synth if (isDisplayClass) { // display classes are not nested: - Debug.Assert(!inSpecificDisplayClass); + Debug.Assert(!containingDisplayClassId.HasValue); - var displayClass = (INamedTypeSymbolInternal)synthesizedMember; + var displayClass = (INamedTypeSymbolInternal)member; var displayClassMembers = (synthesizedMemberMap != null) ? synthesizedMemberMap[displayClass] : displayClass.GetMembers(); - foreach (var displayClassMember in recurse(displayClassMembers, inSpecificDisplayClass: hasDebugIds)) + if (displayClass.TypeKind == TypeKind.Struct) { - yield return displayClassMember; + Debug.Assert(hasDebugIds); + + closureTreeBuilder[parsedEntityId] = + closureTreeBuilder.GetValueOrDefault(parsedEntityId) with { structCaptures = getHoistedVariableNames(displayClassMembers) }; } + + recurse(displayClassMembers, hasDebugIds ? parsedEntityId : null); } - else + else if (isDisplayClassParentField) { - Debug.Assert(hasDebugIds); + Debug.Assert(containingDisplayClassId.HasValue); - if (lambdaIds.Contains(parsedEntityId)) + if (member is IFieldSymbolInternal field && tryParseDisplayClassDebugId(field.Type.Name, out var parentClosureDebugId)) { - yield return (IMethodSymbolInternal)synthesizedMember; + closureTreeBuilder[containingDisplayClassId.Value] = + closureTreeBuilder.GetValueOrDefault(containingDisplayClassId.Value) with { parentId = parentClosureDebugId }; } } + else + { + Debug.Assert(hasDebugIds); + lambdasBuilder.Add((parsedEntityId, (IMethodSymbolInternal)member)); + } + } + } + } + + bool tryParseDisplayClassDebugId(string displayClassName, out DebugId id) + { + if (TryParseDisplayClassOrLambdaName(displayClassName, out int suffixIndex, out char idSeparator, out bool isDisplayClass, out _, out bool hasDebugIds) && + isDisplayClass && + hasDebugIds && + CommonGeneratedNames.TryParseDebugIds(displayClassName.AsSpan(suffixIndex), idSeparator, isMethodIdOptional: false, out var parsedMethodId, out var parsedEntityId) && + parsedMethodId == methodId) + { + id = parsedEntityId; + return true; + } + + // invalid metadata + id = default; + return false; + } + + static ImmutableArray getHoistedVariableNames(ImmutableArray members) + { + var builder = ArrayBuilder.GetInstance(); + foreach (var member in members) + { + if (member is { Kind: SymbolKind.Field, IsStatic: false }) + { + builder.Add(member.Name); } } + + return builder.ToImmutableAndFree(); } } @@ -551,7 +656,7 @@ IEnumerable recurse(ImmutableArray synth /// /// Method from the previous generation. /// Lambdas generated to the current version of the method. This includes both lambdas mapped to previous ones and newly introduced lambdas. - public IEnumerable GetDeletedSynthesizedMethods(IMethodSymbolInternal oldMethod, ImmutableArray currentLambdas) + public IEnumerable<(DebugId id, IMethodSymbolInternal symbol)> GetDeletedSynthesizedMethods(IMethodSymbolInternal oldMethod, ImmutableArray currentLambdas) { var methodHandle = GetPreviousMethodHandle(oldMethod, out var peMethod); var methodRowId = MetadataTokens.GetRowNumber(methodHandle); @@ -563,10 +668,12 @@ public IEnumerable GetDeletedSynthesizedMethods(IMethodSy if (!addedOrChangedMethod.LambdaDebugInfo.IsDefaultOrEmpty && Baseline.SynthesizedMembers.TryGetValue(oldMethod.ContainingType, out var synthesizedSiblingSymbols)) { - return getDeletedSynthesizedClosureMethods(synthesizedSiblingSymbols, Baseline.SynthesizedMembers, addedOrChangedMethod.MethodId, addedOrChangedMethod.LambdaDebugInfo); + return getDeletedLambdas( + CreateLambdaAndClosureMap(synthesizedSiblingSymbols, Baseline.SynthesizedMembers, addedOrChangedMethod.MethodId), + lambdasToInclude: addedOrChangedMethod.LambdaDebugInfo); } - return SpecializedCollections.EmptyEnumerable(); + return []; } Debug.Assert(peMethod != null); @@ -578,38 +685,46 @@ public IEnumerable GetDeletedSynthesizedMethods(IMethodSy } catch (Exception e) when (e is InvalidDataException or IOException) { - return SpecializedCollections.EmptyEnumerable(); + return []; } if (provider.Lambdas.IsDefaultOrEmpty) { - return SpecializedCollections.EmptyEnumerable(); + return []; } - var debugId = new DebugId(provider.MethodOrdinal, generation: 0); - return getDeletedSynthesizedClosureMethods(peMethod.ContainingType.GetMembers(), synthesizedMemberMap: null, debugId, provider.Lambdas); + return getDeletedLambdas( + GetMetadataLambdaAndClosureMap(peMethod.ContainingType, methodId: new DebugId(provider.MethodOrdinal, generation: 0)), + metadataLambdasToInclude: provider.Lambdas); - IEnumerable getDeletedSynthesizedClosureMethods( - ImmutableArray synthesizedSiblings, - IReadOnlyDictionary>? synthesizedMemberMap, - DebugId methodId, - ImmutableArray previousLambdas) + IEnumerable<(DebugId id, IMethodSymbolInternal symbol)> getDeletedLambdas( + MetadataLambdasAndClosures map, + ImmutableArray lambdasToInclude = default, + ImmutableArray metadataLambdasToInclude = default) { var lambdaIdSet = PooledHashSet.GetInstance(); - foreach (var info in previousLambdas) + foreach (var info in lambdasToInclude.NullToEmpty()) + { + lambdaIdSet.Add(info.DebugInfo.LambdaId); + } + + foreach (var info in metadataLambdasToInclude.NullToEmpty()) { lambdaIdSet.Add(info.LambdaId); } foreach (var info in currentLambdas) { - lambdaIdSet.Remove(info.LambdaId); + lambdaIdSet.Remove(info.DebugInfo.LambdaId); } - foreach (var method in GetSynthesizedClosureMethods(synthesizedSiblings, synthesizedMemberMap, methodId, lambdaIdSet)) + foreach (var entry in map.LambdaSymbols) { - yield return method; + if (lambdaIdSet.Contains(entry.id)) + { + yield return entry; + } } lambdaIdSet.Free(); diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedMethodBody.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedMethodBody.cs index 58b8c1eef12e3..79a240adfeadc 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedMethodBody.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedMethodBody.cs @@ -2,51 +2,39 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - -using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; -using System.Text; -using Microsoft.Cci; +using System.Reflection.Metadata; using Microsoft.CodeAnalysis.CodeGen; using Microsoft.CodeAnalysis.Debugging; namespace Microsoft.CodeAnalysis.Emit.EditAndContinue { - internal sealed class DeletedMethodBody : IMethodBody + internal sealed class DeletedMethodBody(IDeletedMethodDefinition methodDef, ImmutableArray il) : Cci.IMethodBody { - private readonly IMethodDefinition _methodDef; - private readonly ImmutableArray _ilBytes; + public ImmutableArray IL { get; } = il; - public DeletedMethodBody(IMethodDefinition methodDef, EmitContext context) - { - _methodDef = methodDef; - _ilBytes = GetIL(context); - } +#nullable disable - public ImmutableArray ExceptionRegions => ImmutableArray.Empty; + public ImmutableArray ExceptionRegions => ImmutableArray.Empty; public bool AreLocalsZeroed => false; public bool HasStackalloc => false; - public ImmutableArray LocalVariables => ImmutableArray.Empty; + public ImmutableArray LocalVariables => ImmutableArray.Empty; - public IMethodDefinition MethodDefinition => _methodDef; + public Cci.IMethodDefinition MethodDefinition => methodDef; public StateMachineMoveNextBodyDebugInfo MoveNextBodyInfo => null; public ushort MaxStack => 8; - public ImmutableArray IL => _ilBytes; - - public ImmutableArray SequencePoints => ImmutableArray.Empty; + public ImmutableArray SequencePoints => ImmutableArray.Empty; public bool HasDynamicLocalVariables => false; - public ImmutableArray LocalScopes => ImmutableArray.Empty; + public ImmutableArray LocalScopes => ImmutableArray.Empty; public Cci.IImportScope ImportScope => null; @@ -58,30 +46,40 @@ public DeletedMethodBody(IMethodDefinition methodDef, EmitContext context) public ImmutableArray StateMachineHoistedLocalSlots => default; - public ImmutableArray StateMachineAwaiterSlots => default; + public ImmutableArray StateMachineAwaiterSlots => default; + + public ImmutableArray ClosureDebugInfo => ImmutableArray.Empty; - public ImmutableArray ClosureDebugInfo => ImmutableArray.Empty; + public ImmutableArray LambdaDebugInfo => ImmutableArray.Empty; - public ImmutableArray LambdaDebugInfo => ImmutableArray.Empty; + public ImmutableArray OrderedLambdaRuntimeRudeEdits => ImmutableArray.Empty; public ImmutableArray CodeCoverageSpans => ImmutableArray.Empty; public StateMachineStatesDebugInfo StateMachineStatesDebugInfo => default; - private static ImmutableArray GetIL(EmitContext context) + public bool IsPrimaryConstructor => false; + +#nullable enable + public static ImmutableArray GetIL(EmitContext context, RuntimeRudeEdit? rudeEdit, bool isLambdaOrLocalFunction) { - var missingMethodExceptionStringStringConstructor = context.Module.CommonCompilation.CommonGetWellKnownTypeMember(WellKnownMember.System_MissingMethodException__ctor); + var missingMethodExceptionStringStringConstructor = context.Module.CommonCompilation.CommonGetWellKnownTypeMember(WellKnownMember.System_MissingMethodException__ctorString); Debug.Assert(missingMethodExceptionStringStringConstructor is not null); var builder = new ILBuilder((ITokenDeferral)context.Module, null, OptimizationLevel.Debug, false); - builder.EmitOpCode(System.Reflection.Metadata.ILOpCode.Newobj, 4); + + builder.EmitStringConstant(rudeEdit.HasValue + ? string.Format(CodeAnalysisResources.EncLambdaRudeEdit, rudeEdit.Value.Message) + : isLambdaOrLocalFunction + ? CodeAnalysisResources.EncDeletedLambdaInvoked + : CodeAnalysisResources.EncDeletedMethodInvoked); + + builder.EmitOpCode(ILOpCode.Newobj, 4); builder.EmitToken(missingMethodExceptionStringStringConstructor.GetCciAdapter(), context.SyntaxNode!, context.Diagnostics); builder.EmitThrow(isRethrow: false); builder.Realize(); return builder.RealizedIL; } - - public bool IsPrimaryConstructor => false; } } diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedPEMethodDefinition.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedPEMethodDefinition.cs index ff0ccd085d99a..2e0466fa06541 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedPEMethodDefinition.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedPEMethodDefinition.cs @@ -13,16 +13,17 @@ namespace Microsoft.CodeAnalysis.Emit.EditAndContinue { - internal sealed class DeletedPEMethodDefinition : Cci.IMethodDefinition, IDeletedMethodDefinition + internal sealed class DeletedPEMethodDefinition : IDeletedMethodDefinition { private readonly IMethodSymbolInternal _oldMethod; - private DeletedMethodBody? _lazyBody; + private readonly DeletedMethodBody _body; - public DeletedPEMethodDefinition(IMethodSymbolInternal oldMethod) + public DeletedPEMethodDefinition(IMethodSymbolInternal oldMethod, ImmutableArray bodyIL) { Debug.Assert(oldMethod.MetadataToken != 0); _oldMethod = oldMethod; + _body = new DeletedMethodBody(this, bodyIL); } public bool IsEncDeleted @@ -86,7 +87,7 @@ public bool HasBody => true; public Cci.IMethodBody GetBody(EmitContext context) - => _lazyBody ??= new DeletedMethodBody(this, context); + => _body; public void Dispatch(Cci.MetadataVisitor visitor) => visitor.Visit(this); diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedSourceMethodDefinition.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedSourceMethodDefinition.cs index c9af7f50acf1e..249dcf60401bd 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedSourceMethodDefinition.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedSourceMethodDefinition.cs @@ -12,17 +12,18 @@ namespace Microsoft.CodeAnalysis.Emit.EditAndContinue { internal sealed class DeletedSourceMethodDefinition - : DeletedSourceDefinition, IMethodDefinition, IDeletedMethodDefinition + : DeletedSourceDefinition, IDeletedMethodDefinition { private readonly MethodDefinitionHandle _handle; private readonly ImmutableArray _parameters; - private DeletedMethodBody? _body; + private readonly DeletedMethodBody _body; - public DeletedSourceMethodDefinition(IMethodDefinition oldMethod, MethodDefinitionHandle handle, Dictionary typesUsedByDeletedMembers) + public DeletedSourceMethodDefinition(IMethodDefinition oldMethod, MethodDefinitionHandle handle, ImmutableArray bodyIL, Dictionary typesUsedByDeletedMembers) : base(oldMethod, typesUsedByDeletedMembers) { _handle = handle; _parameters = WrapParameters(oldMethod.Parameters); + _body = new DeletedMethodBody(this, bodyIL); } public MethodDefinitionHandle MetadataHandle @@ -108,10 +109,7 @@ public bool HasBody => true; public IMethodBody GetBody(EmitContext context) - { - _body ??= new DeletedMethodBody(this, context); - return _body; - } + => _body; public ITypeReference GetContainingType(EmitContext context) => throw ExceptionUtilities.Unreachable(); diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs index 017ecbd704410..07673f9307922 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs @@ -570,40 +570,54 @@ protected override void CreateIndicesForNonTypeMembers(ITypeDefinition typeDef) // create representations of the old deleted methods in this compilation: var newMethodDefs = ArrayBuilder.GetInstance(); + ImmutableArray? lazyDeletedMethodIL = null; + ImmutableArray? lazyDeletedLambdaIL = null; + foreach (var deletedMember in deletedMembers.NullToEmpty()) { if (deletedMember is IMethodSymbolInternal deletedMethod) { var deletedMethodHandle = _definitionMap.GetPreviousMethodHandle(deletedMethod); - var deletedMethodDef = (IMethodDefinition)deletedMethod.GetCciAdapter(); - newMethodDefs.Add(new DeletedSourceMethodDefinition(deletedMethodDef, deletedMethodHandle, _typesUsedByDeletedMembers)); - addDeletedClosureMethods(deletedMethod, currentLambdas: ImmutableArray.Empty); + lazyDeletedMethodIL ??= DeletedMethodBody.GetIL(Context, rudeEdit: null, isLambdaOrLocalFunction: false); + + newMethodDefs.Add(new DeletedSourceMethodDefinition(deletedMethodDef, deletedMethodHandle, lazyDeletedMethodIL.Value, _typesUsedByDeletedMembers)); + + addDeletedClosureMethods(deletedMethod, currentLambdas: ImmutableArray.Empty, ImmutableArray.Empty); } } foreach (var (oldMethod, newMethod) in updatedMethods.NullToEmpty()) { var newMethodDef = (IMethodDefinition)newMethod.GetCciAdapter(); - var currentLambdas = (newMethodDef.HasBody && newMethodDef.GetBody(Context) is { } body) ? body.LambdaDebugInfo : ImmutableArray.Empty; - addDeletedClosureMethods(oldMethod, currentLambdas); + var (currentLambdas, rudeEdits) = (newMethodDef.HasBody && newMethodDef.GetBody(Context) is { } body) ? + (body.LambdaDebugInfo, body.OrderedLambdaRuntimeRudeEdits) : + (ImmutableArray.Empty, ImmutableArray.Empty); + + addDeletedClosureMethods(oldMethod, currentLambdas, rudeEdits); } - void addDeletedClosureMethods(IMethodSymbolInternal oldMethod, ImmutableArray currentLambdas) + void addDeletedClosureMethods(IMethodSymbolInternal oldMethod, ImmutableArray currentLambdas, ImmutableArray orderedLambdaRuntimeRudeEdits) { - foreach (var deletedClosureMethod in _definitionMap.GetDeletedSynthesizedMethods(oldMethod, currentLambdas)) + foreach (var (lambdaId, deletedClosureMethod) in _definitionMap.GetDeletedSynthesizedMethods(oldMethod, currentLambdas)) { + var rudeEditIndex = orderedLambdaRuntimeRudeEdits.BinarySearch(lambdaId, static (rudeEdit, lambdaId) => rudeEdit.LambdaId.CompareTo(lambdaId)); + + var il = (rudeEditIndex >= 0) + ? DeletedMethodBody.GetIL(Context, orderedLambdaRuntimeRudeEdits[rudeEditIndex].RudeEdit, isLambdaOrLocalFunction: true) + : lazyDeletedLambdaIL ??= DeletedMethodBody.GetIL(Context, rudeEdit: null, isLambdaOrLocalFunction: true); + if (deletedClosureMethod.MetadataToken != 0) { - newMethodDefs.Add(new DeletedPEMethodDefinition(deletedClosureMethod)); + newMethodDefs.Add(new DeletedPEMethodDefinition(deletedClosureMethod, il)); } else { var deletedClosureMethodDef = (IMethodDefinition)deletedClosureMethod.GetCciAdapter(); var deletedClosureMethodHandle = _definitionMap.GetPreviousMethodHandle(deletedClosureMethod); - newMethodDefs.Add(new DeletedSourceMethodDefinition(deletedClosureMethodDef, deletedClosureMethodHandle, _typesUsedByDeletedMembers)); + newMethodDefs.Add(new DeletedSourceMethodDefinition(deletedClosureMethodDef, deletedClosureMethodHandle, il, _typesUsedByDeletedMembers)); } } } diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncClosureInfo.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncClosureInfo.cs new file mode 100644 index 0000000000000..1d9bb44605927 --- /dev/null +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncClosureInfo.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.CodeGen; + +namespace Microsoft.CodeAnalysis.Emit; + +internal readonly struct EncClosureInfo(ClosureDebugInfo debugInfo, DebugId? parentDebugId, ImmutableArray structCaptures) +{ + /// + /// Info to write to the PDB. + /// + public readonly ClosureDebugInfo DebugInfo = debugInfo; + + /// + /// Id of the parent closure. Only relevant when emitting EnC delta. + /// + public readonly DebugId? ParentDebugId = parentDebugId; + + /// + /// Metadata names of fields of a struct closure that store variables captured by the closure. Null for class closures. + /// Only relevant when emitting EnC delta. + /// + public readonly ImmutableArray StructCaptures = structCaptures; +} diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncClosureMapValue.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncClosureMapValue.cs new file mode 100644 index 0000000000000..f2bfe9c93aa14 --- /dev/null +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncClosureMapValue.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.CodeGen; + +namespace Microsoft.CodeAnalysis.Emit; + +internal readonly struct EncClosureMapValue(DebugId id, DebugId? parentId, ImmutableArray structCaptures) +{ + public DebugId Id { get; } = id; + public DebugId? ParentId { get; } = parentId; + public ImmutableArray StructCaptures { get; } = structCaptures; + + public bool IsStructClosure + => !StructCaptures.IsDefault; + + /// + /// True if the closure being built is compatible with the previous one. + /// + /// + /// True if + /// - The parent closure hasn't changed + /// - Both closures are struct closures or neither is. + /// - The set of variables captured by the new struct closure + /// must be a subset of previously captured variables + /// (the runtime doesn't allow adding fields to structs). + /// + public bool IsCompatibleWith(DebugId? parentClosureId, ImmutableArray structCaptures) + => ParentId == parentClosureId && + StructCaptures.IsDefault == structCaptures.IsDefault && + (structCaptures.IsDefault || structCaptures.IsSubsetOf(StructCaptures)); +} diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncLambdaInfo.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncLambdaInfo.cs new file mode 100644 index 0000000000000..d924118e4ce7c --- /dev/null +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncLambdaInfo.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.CodeGen; + +namespace Microsoft.CodeAnalysis.Emit; + +internal readonly struct EncLambdaInfo(LambdaDebugInfo debugInfo, ImmutableArray structClosureIds) +{ + public readonly LambdaDebugInfo DebugInfo = debugInfo; + public readonly ImmutableArray StructClosureIds = structClosureIds; +} diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncLambdaMapValue.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncLambdaMapValue.cs new file mode 100644 index 0000000000000..07601b122efd0 --- /dev/null +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncLambdaMapValue.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using System.Linq; +using Microsoft.CodeAnalysis.CodeGen; + +namespace Microsoft.CodeAnalysis.Emit; + +internal readonly struct EncLambdaMapValue(DebugId id, int closureOrdinal, ImmutableArray structClosureIds) +{ + public readonly DebugId Id = id; + public readonly int ClosureOrdinal = closureOrdinal; + public readonly ImmutableArray StructClosureIds = structClosureIds; + + /// + /// True if the lambda being built is compatible with the previous one. + /// + /// + /// True if + /// - The closure ordinal of the previous lambda is the same as the current one. + /// It is not necessary to check that the generation of the closure matches. + /// + /// Two closures of the same ordinal that differ in generation can only exist because the first closure was deleted (or regenerated due to a rude edit) in + /// an earlier generation and the latter closure corresponding to the same scope was added in a subsequent generation. + /// The above condition ensures that the current lambda syntax maps to an existing lambda syntax in the previous generation. + /// The closure the previous lambda is emitted to couldn't have been deleted. + /// + /// Guarantees that the containing type of the synthesized method remains unchanged. + /// + /// - The sequence of struct closures the local function captures is preserved. + /// Guarantees that the signature of the synthesized method remains unchanged. + /// + public bool IsCompatibleWith(int closureOrdinal, ImmutableArray structClosureIds) + => ClosureOrdinal == closureOrdinal && + StructClosureIds.SequenceEqual(structClosureIds); +} diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncMappedMethod.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncMappedMethod.cs new file mode 100644 index 0000000000000..a24f98eb8aee2 --- /dev/null +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncMappedMethod.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Microsoft.CodeAnalysis.Symbols; + +namespace Microsoft.CodeAnalysis.Emit; + +internal readonly struct EncMappedMethod(IMethodSymbolInternal previousMethod, Func? syntaxMap, Func? runtimeRudeEdit) +{ + public readonly IMethodSymbolInternal PreviousMethod = previousMethod; + public readonly Func? SyntaxMap = syntaxMap; + public readonly Func? RuntimeRudeEdit = runtimeRudeEdit; +} diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs index 20958f7c1beb8..6a719124dba43 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs @@ -21,9 +21,8 @@ internal sealed class EncVariableSlotAllocator : VariableSlotAllocator private readonly SymbolMatcher _symbolMap; // syntax: - private readonly Func? _syntaxMap; - private readonly IMethodSymbolInternal _previousTopLevelMethod; - private readonly DebugId _methodId; + private readonly EncMappedMethod _mappedMethod; + private readonly DebugId? _methodId; // locals: private readonly IReadOnlyDictionary _previousLocalSlots; @@ -39,20 +38,19 @@ internal sealed class EncVariableSlotAllocator : VariableSlotAllocator private readonly StateMachineState? _firstUnusedDecreasingStateMachineState; private readonly StateMachineState? _firstUnusedIncreasingStateMachineState; - // closures: - private readonly IReadOnlyDictionary>? _lambdaMap; // SyntaxOffset -> (Lambda Id, Closure Ordinal) - private readonly IReadOnlyDictionary? _closureMap; // SyntaxOffset -> Id + // closures (keyed by syntax offset): + private readonly IReadOnlyDictionary? _lambdaMap; + private readonly IReadOnlyDictionary? _closureMap; private readonly LambdaSyntaxFacts _lambdaSyntaxFacts; public EncVariableSlotAllocator( SymbolMatcher symbolMap, - Func? syntaxMap, - IMethodSymbolInternal previousTopLevelMethod, - DebugId methodId, + EncMappedMethod mappedMethod, + DebugId? methodId, ImmutableArray previousLocals, - IReadOnlyDictionary>? lambdaMap, - IReadOnlyDictionary? closureMap, + IReadOnlyDictionary? lambdaMap, + IReadOnlyDictionary? closureMap, string? stateMachineTypeName, int hoistedLocalSlotCount, IReadOnlyDictionary? hoistedLocalSlots, @@ -66,9 +64,8 @@ public EncVariableSlotAllocator( Debug.Assert(!previousLocals.IsDefault); _symbolMap = symbolMap; - _syntaxMap = syntaxMap; + _mappedMethod = mappedMethod; _previousLocals = previousLocals; - _previousTopLevelMethod = previousTopLevelMethod; _methodId = methodId; _hoistedLocalSlots = hoistedLocalSlots; _hoistedLocalSlotCount = hoistedLocalSlotCount; @@ -107,7 +104,7 @@ private int CalculateSyntaxOffsetInPreviousMethod(SyntaxNode node) // Note that syntax offset of a syntax node contained in a lambda body is calculated by the containing top-level method, // not by the lambda method. The offset is thus relative to the top-level method body start. We can thus avoid mapping // the current lambda symbol or body to the corresponding previous lambda symbol or body, which is non-trivial. - return _previousTopLevelMethod.CalculateLocalSyntaxOffset(_lambdaSyntaxFacts.GetDeclaratorPosition(node), node.SyntaxTree); + return _mappedMethod.PreviousMethod.CalculateLocalSyntaxOffset(_lambdaSyntaxFacts.GetDeclaratorPosition(node), node.SyntaxTree); } public override void AddPreviousLocals(ArrayBuilder builder) @@ -121,7 +118,7 @@ public override void AddPreviousLocals(ArrayBuilder builde private bool TryGetPreviousLocalId(SyntaxNode currentDeclarator, LocalDebugId currentId, out LocalDebugId previousId) { - if (_syntaxMap == null) + if (_mappedMethod.SyntaxMap == null) { // no syntax map // => the source of the current method is the same as the source of the previous method @@ -131,7 +128,7 @@ private bool TryGetPreviousLocalId(SyntaxNode currentDeclarator, LocalDebugId cu return true; } - SyntaxNode? previousDeclarator = _syntaxMap(currentDeclarator); + SyntaxNode? previousDeclarator = _mappedMethod.SyntaxMap(currentDeclarator); if (previousDeclarator == null) { previousId = default; @@ -253,7 +250,7 @@ private bool TryGetPreviousSyntaxOffset(SyntaxNode currentSyntax, out int previo // => the source of the current method is the same as the source of the previous method // => relative positions are the same // => ids are the same - SyntaxNode? previousSyntax = _syntaxMap?.Invoke(currentSyntax); + SyntaxNode? previousSyntax = _mappedMethod.SyntaxMap?.Invoke(currentSyntax); if (previousSyntax == null) { previousSyntaxOffset = 0; @@ -276,7 +273,7 @@ private bool TryGetPreviousLambdaSyntaxOffset(SyntaxNode lambdaOrLambdaBodySynta // => the source of the current method is the same as the source of the previous method // => relative positions are the same // => ids are the same - SyntaxNode? previousLambdaSyntax = _syntaxMap?.Invoke(currentLambdaSyntax); + SyntaxNode? previousLambdaSyntax = _mappedMethod.SyntaxMap?.Invoke(currentLambdaSyntax); if (previousLambdaSyntax == null) { previousSyntaxOffset = 0; @@ -302,30 +299,59 @@ private bool TryGetPreviousLambdaSyntaxOffset(SyntaxNode lambdaOrLambdaBodySynta return true; } - public override bool TryGetPreviousClosure(SyntaxNode scopeSyntax, out DebugId closureId) + public override bool TryGetPreviousClosure( + SyntaxNode scopeSyntax, + DebugId? parentClosureId, + ImmutableArray structCaptures, + out DebugId closureId, + out RuntimeRudeEdit? runtimeRudeEdit) { - if (_closureMap != null && - TryGetPreviousSyntaxOffset(scopeSyntax, out int syntaxOffset) && - _closureMap.TryGetValue(syntaxOffset, out closureId)) + if (_closureMap != null && TryGetPreviousSyntaxOffset(scopeSyntax, out int syntaxOffset)) { - return true; + if (_closureMap.TryGetValue(syntaxOffset, out var closureMapValue) && + closureMapValue.IsCompatibleWith(parentClosureId, structCaptures)) + { + closureId = closureMapValue.Id; + runtimeRudeEdit = _mappedMethod.RuntimeRudeEdit?.Invoke(scopeSyntax); + return true; + } + + // closure shape changed: + closureId = default; + runtimeRudeEdit = new RuntimeRudeEdit(CodeAnalysisResources.EncLambdaRudeEdit_CapturedVariables); + return false; } + // closure added: closureId = default; + runtimeRudeEdit = null; return false; } - public override bool TryGetPreviousLambda(SyntaxNode lambdaOrLambdaBodySyntax, bool isLambdaBody, out DebugId lambdaId) + public override bool TryGetPreviousLambda(SyntaxNode lambdaOrLambdaBodySyntax, bool isLambdaBody, int closureOrdinal, ImmutableArray structClosureIds, out DebugId lambdaId, out RuntimeRudeEdit? runtimeRudeEdit) { - if (_lambdaMap != null && - TryGetPreviousLambdaSyntaxOffset(lambdaOrLambdaBodySyntax, isLambdaBody, out int syntaxOffset) && - _lambdaMap.TryGetValue(syntaxOffset, out var idAndClosureOrdinal)) + Debug.Assert(closureOrdinal >= LambdaDebugInfo.MinClosureOrdinal); + + if (_lambdaMap != null && TryGetPreviousLambdaSyntaxOffset(lambdaOrLambdaBodySyntax, isLambdaBody, out int syntaxOffset)) { - lambdaId = idAndClosureOrdinal.Key; - return true; + if (_lambdaMap.TryGetValue(syntaxOffset, out var lambdaMapValue) && lambdaMapValue.IsCompatibleWith(closureOrdinal, structClosureIds)) + { + // Rude edit map contains mapping for lambdas, but not their bodies. + runtimeRudeEdit = _mappedMethod.RuntimeRudeEdit?.Invoke(isLambdaBody ? _lambdaSyntaxFacts.GetLambda(lambdaOrLambdaBodySyntax) : lambdaOrLambdaBodySyntax); + + lambdaId = lambdaMapValue.Id; + return true; + } + + // lambda closure changed: + lambdaId = default; + runtimeRudeEdit = new RuntimeRudeEdit(CodeAnalysisResources.EncLambdaRudeEdit_CapturedVariables); + return false; } + // lambda added: lambdaId = default; + runtimeRudeEdit = null; return false; } diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/IDeletedMethodDefinition.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/IDeletedMethodDefinition.cs index afa5a4b215d77..6803e8afc1e33 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/IDeletedMethodDefinition.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/IDeletedMethodDefinition.cs @@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.Emit.EditAndContinue; -internal interface IDeletedMethodDefinition +internal interface IDeletedMethodDefinition : Cci.IMethodDefinition { public MethodDefinitionHandle MetadataHandle { get; } } diff --git a/src/Compilers/Core/Portable/Emit/NoPia/CommonEmbeddedMethod.cs b/src/Compilers/Core/Portable/Emit/NoPia/CommonEmbeddedMethod.cs index 5187b13a61db6..7f25d17f66b5e 100644 --- a/src/Compilers/Core/Portable/Emit/NoPia/CommonEmbeddedMethod.cs +++ b/src/Compilers/Core/Portable/Emit/NoPia/CommonEmbeddedMethod.cs @@ -158,11 +158,14 @@ public EmptyBody(CommonEmbeddedMethod method) ImmutableArray Cci.IMethodBody.StateMachineAwaiterSlots => default(ImmutableArray); - ImmutableArray Cci.IMethodBody.ClosureDebugInfo => - default(ImmutableArray); + ImmutableArray Cci.IMethodBody.ClosureDebugInfo => + default(ImmutableArray); - ImmutableArray Cci.IMethodBody.LambdaDebugInfo => - default(ImmutableArray); + ImmutableArray Cci.IMethodBody.LambdaDebugInfo => + default(ImmutableArray); + + ImmutableArray Cci.IMethodBody.OrderedLambdaRuntimeRudeEdits => + ImmutableArray.Empty; public StateMachineStatesDebugInfo StateMachineStatesDebugInfo => default; diff --git a/src/Compilers/Core/Portable/Emit/RuntimeRudeEdit.cs b/src/Compilers/Core/Portable/Emit/RuntimeRudeEdit.cs new file mode 100644 index 0000000000000..7c8723aa0d431 --- /dev/null +++ b/src/Compilers/Core/Portable/Emit/RuntimeRudeEdit.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.Emit; + +/// +/// Describes rude edit to be reported at runtime. +/// +/// Error message. +public readonly struct RuntimeRudeEdit(string message) +{ + public string Message { get; } = message; + + internal bool IsDefault + => Message is null; +} diff --git a/src/Compilers/Core/Portable/Emit/SemanticEdit.cs b/src/Compilers/Core/Portable/Emit/SemanticEdit.cs index 0c772ce0b7e54..be2f00be20c11 100644 --- a/src/Compilers/Core/Portable/Emit/SemanticEdit.cs +++ b/src/Compilers/Core/Portable/Emit/SemanticEdit.cs @@ -46,6 +46,12 @@ namespace Microsoft.CodeAnalysis.Emit /// public Func? SyntaxMap { get; } + /// + /// Associates a syntax node in the later compilation to an error that should be + /// reported at runtime by the IL generated for the node, if any. + /// + public Func? RuntimeRudeEdit { get; } + /// /// Instrumentation update to be applied to a method. /// If not empty, and must be non-null s, and @@ -66,7 +72,7 @@ public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbo [Obsolete("Use other overload")] [EditorBrowsable(EditorBrowsableState.Never)] public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbol, Func? syntaxMap, bool preserveLocalVariables, MethodInstrumentation instrumentation) - : this(kind, oldSymbol, newSymbol, syntaxMap, MethodInstrumentation.Empty) + : this(kind, oldSymbol, newSymbol, syntaxMap, runtimeRudeEdit: null, MethodInstrumentation.Empty) { } #pragma warning restore @@ -95,7 +101,7 @@ public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbo /// /// is not a valid kind. /// - public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbol, Func? syntaxMap = null, MethodInstrumentation instrumentation = default) + public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbol, Func? syntaxMap = null, Func? runtimeRudeEdit = null, MethodInstrumentation instrumentation = default) { if (kind <= SemanticEditKind.None || kind > SemanticEditKind.Replace) { @@ -112,6 +118,12 @@ public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbo throw new ArgumentNullException(nameof(newSymbol)); } + // runtime rude edits should only be specified for methods with a syntax map: + if (runtimeRudeEdit != null && syntaxMap == null) + { + throw new ArgumentNullException(nameof(syntaxMap)); + } + if (syntaxMap != null) { if (kind != SemanticEditKind.Update) @@ -181,6 +193,7 @@ public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbo NewSymbol = newSymbol; SyntaxMap = syntaxMap; Instrumentation = instrumentation; + RuntimeRudeEdit = runtimeRudeEdit; } /// diff --git a/src/Compilers/Core/Portable/PEWriter/Members.cs b/src/Compilers/Core/Portable/PEWriter/Members.cs index a1fad2667834f..238be2f37fa65 100644 --- a/src/Compilers/Core/Portable/PEWriter/Members.cs +++ b/src/Compilers/Core/Portable/PEWriter/Members.cs @@ -484,8 +484,14 @@ ImmutableArray ExceptionRegions /// ImmutableArray StateMachineAwaiterSlots { get; } - ImmutableArray ClosureDebugInfo { get; } - ImmutableArray LambdaDebugInfo { get; } + ImmutableArray ClosureDebugInfo { get; } + ImmutableArray LambdaDebugInfo { get; } + + /// + /// Ordered by . + /// + ImmutableArray OrderedLambdaRuntimeRudeEdits { get; } + StateMachineStatesDebugInfo StateMachineStatesDebugInfo { get; } /// diff --git a/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs b/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs index 668ac656db4ce..381d10f9e0e90 100644 --- a/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs +++ b/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs @@ -470,11 +470,14 @@ private void CreateIndices() { _cancellationToken.ThrowIfCancellationRequested(); - this.CreateUserStringIndices(); this.CreateInitialAssemblyRefIndex(); this.CreateInitialFileRefIndex(); this.CreateIndicesForModule(); + // Snapshot user strings only after indexing all types and members. + // EnC method deletes discovered during indexing may contribute new strings. + this.CreateUserStringIndices(); + // Find all references and assign tokens. _referenceVisitor = this.CreateReferenceVisitor(); _referenceVisitor.Visit(module); @@ -486,13 +489,7 @@ private void CreateIndices() private void CreateUserStringIndices() { - _pseudoStringTokenToStringMap = new List(); - - foreach (string str in this.module.GetStrings()) - { - _pseudoStringTokenToStringMap.Add(str); - } - + _pseudoStringTokenToStringMap = [.. module.GetStrings()]; _pseudoStringTokenToTokenMap = new UserStringHandle[_pseudoStringTokenToStringMap.Count]; } @@ -4143,8 +4140,8 @@ internal static EditAndContinueMethodDebugInformation GetEncMethodDebugInfo(IMet return new EditAndContinueMethodDebugInformation( methodBody.MethodId.Ordinal, encLocalSlots, - methodBody.ClosureDebugInfo, - methodBody.LambdaDebugInfo, + methodBody.ClosureDebugInfo.SelectAsArray(static info => info.DebugInfo), + methodBody.LambdaDebugInfo.SelectAsArray(static info => info.DebugInfo), methodBody.StateMachineStatesDebugInfo.States); } diff --git a/src/Compilers/Core/Portable/PEWriter/RootModuleStaticConstructor.cs b/src/Compilers/Core/Portable/PEWriter/RootModuleStaticConstructor.cs index addae692be37b..e8d99093842c2 100644 --- a/src/Compilers/Core/Portable/PEWriter/RootModuleStaticConstructor.cs +++ b/src/Compilers/Core/Portable/PEWriter/RootModuleStaticConstructor.cs @@ -159,9 +159,11 @@ public RootModuleStaticConstructor(ITypeDefinition containingTypeDefinition, Imm public ImmutableArray StateMachineAwaiterSlots => ImmutableArray.Empty; - public ImmutableArray ClosureDebugInfo => ImmutableArray.Empty; + public ImmutableArray ClosureDebugInfo => ImmutableArray.Empty; - public ImmutableArray LambdaDebugInfo => ImmutableArray.Empty; + public ImmutableArray LambdaDebugInfo => ImmutableArray.Empty; + + public ImmutableArray OrderedLambdaRuntimeRudeEdits => ImmutableArray.Empty; public StateMachineStatesDebugInfo StateMachineStatesDebugInfo => default; diff --git a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt index 4a69069dee830..91020224a013c 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -21,8 +21,13 @@ Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.CompilationWithAnaly Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAllDiagnosticsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task>! Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerDiagnosticsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task>! *REMOVED*Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap = null, bool preserveLocalVariables = false, Microsoft.CodeAnalysis.Emit.MethodInstrumentation instrumentation = default(Microsoft.CodeAnalysis.Emit.MethodInstrumentation)) -> void +Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit +Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit.Message.get -> string! +Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit.RuntimeRudeEdit() -> void +Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit.RuntimeRudeEdit(string! message) -> void +Microsoft.CodeAnalysis.Emit.SemanticEdit.RuntimeRudeEdit.get -> System.Func? +Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap = null, System.Func? runtimeRudeEdit = null, Microsoft.CodeAnalysis.Emit.MethodInstrumentation instrumentation = default(Microsoft.CodeAnalysis.Emit.MethodInstrumentation)) -> void Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap, bool preserveLocalVariables, Microsoft.CodeAnalysis.Emit.MethodInstrumentation instrumentation) -> void -Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap = null, Microsoft.CodeAnalysis.Emit.MethodInstrumentation instrumentation = default(Microsoft.CodeAnalysis.Emit.MethodInstrumentation)) -> void Microsoft.CodeAnalysis.Text.SourceText.GetContentHash() -> System.Collections.Immutable.ImmutableArray static Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerExtensions.WithAnalyzers(this Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options = null) -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers! static Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerExtensions.WithAnalyzers(this Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options, System.Threading.CancellationToken cancellationToken) -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers! diff --git a/src/Compilers/Core/Portable/Symbols/IFieldSymbolInternal.cs b/src/Compilers/Core/Portable/Symbols/IFieldSymbolInternal.cs index e4cbf11df5214..4e8a867f77661 100644 --- a/src/Compilers/Core/Portable/Symbols/IFieldSymbolInternal.cs +++ b/src/Compilers/Core/Portable/Symbols/IFieldSymbolInternal.cs @@ -17,5 +17,10 @@ internal interface IFieldSymbolInternal : ISymbolInternal /// Returns true if this field was declared as "volatile". /// bool IsVolatile { get; } + + /// + /// Field type. + /// + ITypeSymbolInternal Type { get; } } } diff --git a/src/Compilers/Core/Portable/Symbols/IParameterSymbolInternal.cs b/src/Compilers/Core/Portable/Symbols/IParameterSymbolInternal.cs index f08c655187ef8..94bcd28a9bb4d 100644 --- a/src/Compilers/Core/Portable/Symbols/IParameterSymbolInternal.cs +++ b/src/Compilers/Core/Portable/Symbols/IParameterSymbolInternal.cs @@ -7,5 +7,6 @@ namespace Microsoft.CodeAnalysis.Symbols internal interface IParameterSymbolInternal : ISymbolInternal { ITypeSymbolInternal Type { get; } + RefKind RefKind { get; } } } diff --git a/src/Compilers/Core/Portable/WellKnownMember.cs b/src/Compilers/Core/Portable/WellKnownMember.cs index d9d7854893eb6..9d2a991f3ebf7 100644 --- a/src/Compilers/Core/Portable/WellKnownMember.cs +++ b/src/Compilers/Core/Portable/WellKnownMember.cs @@ -586,7 +586,7 @@ internal enum WellKnownMember System_Diagnostics_CodeAnalysis_UnscopedRefAttribute__ctor, System_NotSupportedException__ctor, - System_MissingMethodException__ctor, + System_MissingMethodException__ctorString, System_Runtime_CompilerServices_MetadataUpdateOriginalTypeAttribute__ctor, System_Collections_ICollection__Count, diff --git a/src/Compilers/Core/Portable/WellKnownMembers.cs b/src/Compilers/Core/Portable/WellKnownMembers.cs index d014305128563..3c4e3b4da8fb3 100644 --- a/src/Compilers/Core/Portable/WellKnownMembers.cs +++ b/src/Compilers/Core/Portable/WellKnownMembers.cs @@ -4054,12 +4054,13 @@ static WellKnownMembers() 0, // Method Signature (byte)SignatureTypeCode.TypeHandle, (byte)SpecialType.System_Void, - // System_MissingMethodException__ctor + // System_MissingMethodException__ctorString (byte)MemberFlags.Constructor, // Flags (byte)WellKnownType.ExtSentinel, (byte)(WellKnownType.System_MissingMethodException - WellKnownType.ExtSentinel), // DeclaringTypeId - 0, // Arity - 0, // Method Signature - (byte)SignatureTypeCode.TypeHandle, (byte)SpecialType.System_Void, + 0, // Arity + 1, // Method Signature + (byte)SignatureTypeCode.TypeHandle, (byte)SpecialType.System_Void, // Return Type + (byte)SignatureTypeCode.TypeHandle, (byte)SpecialType.System_String, // MetadataUpdateOriginalTypeAttribute__ctor (byte)MemberFlags.Constructor, // Flags diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.cs.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.cs.xlf index 4ebf247dbf293..f9e238feae644 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.cs.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.cs.xlf @@ -57,6 +57,26 @@ Funkce Upravit a pokračovat nemůže obnovit pozastavený iterátor, protože odpovídající příkaz yield return byl odstraněn. + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. Hodnota end nesmí být menší než hodnota start. start={0} end={1}. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.de.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.de.xlf index 11e496c734dba..f9baa4f2a73dd 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.de.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.de.xlf @@ -57,6 +57,26 @@ "Bearbeiten und Fortfahren" kann den angehaltenen Iterator nicht fortsetzen, da die entsprechende yield return-Anweisung gelöscht wurde + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. "Ende" darf nicht kleiner sein als "Start". start='{0}' end='{1}'. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.es.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.es.xlf index bd5b38aeb20bf..e3feaedfc67ee 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.es.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.es.xlf @@ -57,6 +57,26 @@ Editar y continuar no puede reanudar el iterador suspendido porque se ha eliminado la instrucción yield return correspondiente + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. 'fin' no debe ser menor que 'inicio'. inicio='{0}' fin='{1}'. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.fr.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.fr.xlf index c04aa6eccf74b..fa7e65ba0bb70 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.fr.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.fr.xlf @@ -57,6 +57,26 @@ Modifier et continuer ne peut pas reprendre l’itérateur suspendu, car l’instruction yield return correspondante a été supprimée + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. 'end' ne doit pas être inférieur à 'start'. start='{0}'end='{1}'. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.it.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.it.xlf index d7ba53c5b7771..86e7c09053073 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.it.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.it.xlf @@ -57,6 +57,26 @@ Modifica e Continua non sono in grado di riprendere l'enumeratore sospeso perché l'istruzione yield return corrispondente è stata eliminata + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. il valore di 'end' non deve essere minore di quello di 'start'. start='{0}' end='{1}'. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ja.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ja.xlf index ff7f8ccffa62d..0350b8a5bcb1e 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ja.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ja.xlf @@ -57,6 +57,26 @@ 対応する yield return ステートメントが削除されているため、エディット コンティニュは中断された反復子を再開できません + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. 'end' は 'start' より小さくすることはできません。start='{0}' end='{1}'。 diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ko.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ko.xlf index abaf447b33144..18a9099dd40fb 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ko.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ko.xlf @@ -57,6 +57,26 @@ 해당 yield return 문이 삭제되었으므로 편집하고 계속하기가 일시 중단된 반복기를 다시 시작할 수 없습니다. + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. 'end'는 'start'보다 작을 수 없습니다. start='{0}' end='{1}' diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pl.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pl.xlf index 7dbfae14267c7..02d01d6a6c7f8 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pl.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pl.xlf @@ -57,6 +57,26 @@ Funkcja Edytuj i kontynuuj nie może wznowić wstrzymanego iteratora, ponieważ odpowiadająca jej instrukcja yield return została usunięta + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. Wartość „end” nie może być mniejsza niż wartość „start”. start=„{0}” end=„{1}”. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pt-BR.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pt-BR.xlf index 80528b1bc4215..ea4699586e601 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pt-BR.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.pt-BR.xlf @@ -57,6 +57,26 @@ Editar e Continuar não pode retomar o iterador suspenso já que a instrução yield return correspondente foi excluída + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. 'end' não deve ser menor que 'start'. start='{0}' end='{1}'. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ru.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ru.xlf index 57833f1fa1ac8..ae1782d33cd85 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ru.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.ru.xlf @@ -57,6 +57,26 @@ Операция "Изменить и продолжить" не может возобновить приостановленный итератор, поскольку соответствующий оператор yield return удален + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. Значение "end" не должно быть меньше, чем "start". start="{0}", end="{1}". diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.tr.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.tr.xlf index c50518d307ec0..7decd30bc2390 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.tr.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.tr.xlf @@ -57,6 +57,26 @@ İlgili yield return deyimi silindiğinden Düzenle ve Devam Et, askıya alınmış yineleyiciyi sürdüremiyor + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. 'bitiş', 'başlangıç' değerinden küçük olmamalıdır. başla='{0}' bitiş='{1}'. diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hans.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hans.xlf index cb7f24ba6ba7e..9551da1d1ec76 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hans.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hans.xlf @@ -57,6 +57,26 @@ 编辑并继续无法恢复挂起的迭代器,因为相应的 yield return 语句已被删除 + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. "end" 不得小于 "start"。start="{0}" end="{1}"。 diff --git a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hant.xlf b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hant.xlf index eb4a4df7c0780..31840dc346137 100644 --- a/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hant.xlf +++ b/src/Compilers/Core/Portable/xlf/CodeAnalysisResources.zh-Hant.xlf @@ -57,6 +57,26 @@ 編輯和繼續無法繼續暫停的列舉程式,因為對應的 yield return 陳述式已刪除 + + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + Attempted to invoke a deleted lambda or local function implementation. This can happen when lambda or local function is deleted while the application is running. + + + + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + Attempted to invoke a deleted method implementation. This can happen when a method is deleted or its name or signature is changed while the application is running. + + + + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + Attempted to invoke lambda or local function with an unsupported change made while the application is running: {0} + + + + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + Attempted to invoke lambda or local function that has an unsupported change to captured variables made while the application is running + + 'end' must not be less than 'start'. start='{0}' end='{1}'. 'end' 不可小於 'start'。start='{0}' end='{1}'。 diff --git a/src/Compilers/Test/Core/MarkedSource/SourceWithMarkedNodes.MarkedSpan.cs b/src/Compilers/Test/Core/MarkedSource/SourceWithMarkedNodes.MarkedSpan.cs index 6fc3555f5a174..894a26d4ce51f 100644 --- a/src/Compilers/Test/Core/MarkedSource/SourceWithMarkedNodes.MarkedSpan.cs +++ b/src/Compilers/Test/Core/MarkedSource/SourceWithMarkedNodes.MarkedSpan.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using Microsoft.CodeAnalysis.Text; namespace Roslyn.Test.Utilities diff --git a/src/Compilers/Test/Core/MarkedSource/SourceWithMarkedNodes.cs b/src/Compilers/Test/Core/MarkedSource/SourceWithMarkedNodes.cs index 129f12c910656..4b0e9c501686d 100644 --- a/src/Compilers/Test/Core/MarkedSource/SourceWithMarkedNodes.cs +++ b/src/Compilers/Test/Core/MarkedSource/SourceWithMarkedNodes.cs @@ -27,9 +27,8 @@ internal sealed partial class SourceWithMarkedNodes /// public readonly string Input; - public readonly SyntaxTree Tree; public readonly ImmutableArray MarkedSpans; - public readonly ImmutableArray> SpansAndKindsAndIds; + public readonly SyntaxNode Root; /// /// Parses source code with markers for further processing @@ -43,12 +42,13 @@ public SourceWithMarkedNodes(string markedSource, Func parse { Source = removeTags ? RemoveTags(markedSource) : ClearTags(markedSource); Input = markedSource; - Tree = parser(Source); + Root = parser(Source).GetRoot(); MarkedSpans = ImmutableArray.CreateRange(GetSpansRecursive(markedSource, 0, getSyntaxKind)); - SpansAndKindsAndIds = ImmutableArray.CreateRange(MarkedSpans.Select(s => (s.MarkedSyntax, s.SyntaxKind, s.Id))); } + public SyntaxTree Tree => Root.SyntaxTree; + private static IEnumerable GetSpansRecursive(string markedSource, int offset, Func getSyntaxKind) { foreach (var match in s_markerPattern.Matches(markedSource).ToEnumerable()) @@ -105,43 +105,31 @@ internal static string ClearTags(string source) RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline); public ImmutableDictionary MapSyntaxNodesToMarks() - { - var root = Tree.GetRoot(); - var builder = ImmutableDictionary.CreateBuilder(); - for (int i = 0; i < SpansAndKindsAndIds.Length; i++) - { - var node = GetNode(root, SpansAndKindsAndIds[i]); - builder.Add(node, SpansAndKindsAndIds[i].Item3); - } + => MarkedSpans.ToImmutableDictionary( + keySelector: marker => GetNode(Root, marker), + elementSelector: marker => marker.Id); - return builder.ToImmutableDictionary(); - } + public ImmutableDictionary MapMarksToSyntaxNodes() + => MarkedSpans.ToImmutableDictionary( + keySelector: marker => marker.Id, + elementSelector: marker => GetNode(Root, marker)); + + public SyntaxNode GetNode(string tag, int id) + => GetNode(Root, MarkedSpans.Single(s => s.TagName == tag && s.Id == id)); - private SyntaxNode GetNode(SyntaxNode root, ValueTuple spanAndKindAndId) + private static SyntaxNode GetNode(SyntaxNode root, MarkedSpan marker) { - var node = root.FindNode(spanAndKindAndId.Item1, getInnermostNodeForTie: true); - if (spanAndKindAndId.Item2 == 0) + var node = root.FindNode(marker.MarkedSyntax, getInnermostNodeForTie: true); + if (marker.SyntaxKind == 0) { return node; } - var nodeOfKind = node.FirstAncestorOrSelf(n => n.RawKind == spanAndKindAndId.Item2); + var nodeOfKind = node.FirstAncestorOrSelf(n => n.RawKind == marker.SyntaxKind); Assert.NotNull(nodeOfKind); return nodeOfKind; } - public ImmutableDictionary MapMarksToSyntaxNodes() - { - var root = Tree.GetRoot(); - var builder = ImmutableDictionary.CreateBuilder(); - for (int i = 0; i < SpansAndKindsAndIds.Length; i++) - { - builder.Add(SpansAndKindsAndIds[i].Item3, GetNode(root, SpansAndKindsAndIds[i])); - } - - return builder.ToImmutableDictionary(); - } - public static Func GetSyntaxMap(SourceWithMarkedNodes source0, SourceWithMarkedNodes source1, List unmappedNodes = null) { var map0 = source0.MapMarksToSyntaxNodes(); diff --git a/src/Compilers/VisualBasic/Portable/Compilation/MethodCompiler.vb b/src/Compilers/VisualBasic/Portable/Compilation/MethodCompiler.vb index a41101b5ecf0a..8d42d722dc96b 100644 --- a/src/Compilers/VisualBasic/Portable/Compilation/MethodCompiler.vb +++ b/src/Compilers/VisualBasic/Portable/Compilation/MethodCompiler.vb @@ -311,8 +311,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic synthesizedEntryPoint, methodOrdinal:=DebugId.UndefinedOrdinal, block:=body, - lambdaDebugInfo:=ImmutableArray(Of LambdaDebugInfo).Empty, - closureDebugInfo:=ImmutableArray(Of ClosureDebugInfo).Empty, + lambdaDebugInfo:=ImmutableArray(Of EncLambdaInfo).Empty, + orderedLambdaRuntimeRudeEdits:=ImmutableArray(Of LambdaRuntimeRudeEditInfo).Empty, + closureDebugInfo:=ImmutableArray(Of EncClosureInfo).Empty, stateMachineStateDebugInfos:=ImmutableArray(Of StateMachineStateDebugInfo).Empty, stateMachineTypeOpt:=Nothing, variableSlotAllocatorOpt:=Nothing, @@ -881,8 +882,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic method, methodOrdinal:=DebugId.UndefinedOrdinal, block:=boundBody, - lambdaDebugInfo:=ImmutableArray(Of LambdaDebugInfo).Empty, - closureDebugInfo:=ImmutableArray(Of ClosureDebugInfo).Empty, + lambdaDebugInfo:=ImmutableArray(Of EncLambdaInfo).Empty, + orderedLambdaRuntimeRudeEdits:=ImmutableArray(Of LambdaRuntimeRudeEditInfo).Empty, + closureDebugInfo:=ImmutableArray(Of EncClosureInfo).Empty, stateMachineStateDebugInfos:=ImmutableArray(Of StateMachineStateDebugInfo).Empty, stateMachineTypeOpt:=Nothing, variableSlotAllocatorOpt:=Nothing, @@ -912,8 +914,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Private Sub CompileSynthesizedMethods(additionalTypes As ImmutableArray(Of NamedTypeSymbol)) Debug.Assert(_moduleBeingBuiltOpt IsNot Nothing) - Dim lambdaDebugInfoBuilder = ArrayBuilder(Of LambdaDebugInfo).GetInstance() - Dim closureDebugInfoBuilder = ArrayBuilder(Of ClosureDebugInfo).GetInstance() + Dim lambdaDebugInfoBuilder = ArrayBuilder(Of EncLambdaInfo).GetInstance() + Dim lambdaRuntimeRudeEditsBuilder = ArrayBuilder(Of LambdaRuntimeRudeEditInfo).GetInstance() + Dim lambdaRuntimeRudeEdits = ArrayBuilder(Of LambdaRuntimeRudeEditInfo).GetInstance() + Dim closureDebugInfoBuilder = ArrayBuilder(Of EncClosureInfo).GetInstance() Dim stateMachineStateDebugInfoBuilder = ArrayBuilder(Of StateMachineStateDebugInfo).GetInstance() Dim compilationState As New TypeCompilationState(_compilation, _moduleBeingBuiltOpt, initializeComponentOpt:=Nothing) @@ -947,6 +951,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic diagnostics:=diagnosticsThisMethod, lazyVariableSlotAllocator:=lazyVariableSlotAllocator, lambdaDebugInfoBuilder:=lambdaDebugInfoBuilder, + lambdaRuntimeRudeEditsBuilder:=lambdaRuntimeRudeEditsBuilder, closureDebugInfoBuilder:=closureDebugInfoBuilder, stateMachineStateDebugInfoBuilder:=stateMachineStateDebugInfoBuilder, delegateRelaxationIdDispenser:=delegateRelaxationIdDispenser, @@ -957,11 +962,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic If DoEmitPhase AndAlso Not diagnosticsThisMethod.HasAnyErrors Then ' Synthesized methods have no ordinal stored in custom debug information ' (only user-defined methods have ordinals). + + lambdaRuntimeRudeEdits.Sort(Function(x, y) x.LambdaId.CompareTo(y.LambdaId)) + emittedBody = GenerateMethodBody(_moduleBeingBuiltOpt, method, DebugId.UndefinedOrdinal, rewrittenBody, lambdaDebugInfoBuilder.ToImmutable(), + orderedLambdaRuntimeRudeEdits:=lambdaRuntimeRudeEdits.ToImmutable(), closureDebugInfoBuilder.ToImmutable(), stateMachineStateDebugInfoBuilder.ToImmutable(), statemachineTypeOpt, @@ -1001,6 +1010,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic lambdaDebugInfoBuilder.Free() closureDebugInfoBuilder.Free() stateMachineStateDebugInfoBuilder.Free() + lambdaRuntimeRudeEditsBuilder.Free() End Sub Private Sub CompileSynthesizedMethods(compilationState As TypeCompilationState) @@ -1019,8 +1029,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic method, methodOrdinal:=DebugId.UndefinedOrdinal, block:=methodWithBody.Body, - lambdaDebugInfo:=ImmutableArray(Of LambdaDebugInfo).Empty, - closureDebugInfo:=ImmutableArray(Of ClosureDebugInfo).Empty, + lambdaDebugInfo:=ImmutableArray(Of EncLambdaInfo).Empty, + orderedLambdaRuntimeRudeEdits:=ImmutableArray(Of LambdaRuntimeRudeEditInfo).Empty, + closureDebugInfo:=ImmutableArray(Of EncClosureInfo).Empty, stateMachineStateDebugInfos:=methodWithBody.StateMachineStatesDebugInfo, stateMachineTypeOpt:=methodWithBody.StateMachineType, variableSlotAllocatorOpt:=Nothing, @@ -1362,8 +1373,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' setter needs to rewritten as it may require lambda conversions Dim setterBody = setter.GetBoundMethodBody(compilationState, diagnostics, containingTypeBinder) - Dim lambdaDebugInfoBuilder = ArrayBuilder(Of LambdaDebugInfo).GetInstance() - Dim closureDebugInfoBuilder = ArrayBuilder(Of ClosureDebugInfo).GetInstance() + Dim lambdaDebugInfoBuilder = ArrayBuilder(Of EncLambdaInfo).GetInstance() + Dim lambdaRuntimeRudeEditsBuilder = ArrayBuilder(Of LambdaRuntimeRudeEditInfo).GetInstance() + Dim closureDebugInfoBuilder = ArrayBuilder(Of EncClosureInfo).GetInstance() Dim stateMachineStateDebugInfoBuilder = ArrayBuilder(Of StateMachineStateDebugInfo).GetInstance() Dim methodInstrumentations = _moduleBeingBuiltOpt.GetMethodBodyInstrumentations(setter) @@ -1378,6 +1390,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic diagnostics:=diagnostics, lazyVariableSlotAllocator:=Nothing, lambdaDebugInfoBuilder:=lambdaDebugInfoBuilder, + lambdaRuntimeRudeEditsBuilder:=lambdaRuntimeRudeEditsBuilder, closureDebugInfoBuilder:=closureDebugInfoBuilder, stateMachineStateDebugInfoBuilder:=stateMachineStateDebugInfoBuilder, delegateRelaxationIdDispenser:=delegateRelaxationIdDispenser, @@ -1387,10 +1400,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' There shall be no lambdas and no awaits/yields in the synthesized accessor but delegate relaxation conversions: Debug.Assert(lambdaDebugInfoBuilder.IsEmpty()) + Debug.Assert(lambdaRuntimeRudeEditsBuilder.IsEmpty()) Debug.Assert(closureDebugInfoBuilder.IsEmpty()) Debug.Assert(stateMachineStateDebugInfoBuilder.IsEmpty()) lambdaDebugInfoBuilder.Free() + lambdaRuntimeRudeEditsBuilder.Free() closureDebugInfoBuilder.Free() stateMachineStateDebugInfoBuilder.Free() @@ -1475,93 +1490,104 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim lazyVariableSlotAllocator As VariableSlotAllocator = Nothing Dim stateMachineTypeOpt As StateMachineTypeSymbol = Nothing Dim allowOmissionOfConditionalCalls = _moduleBeingBuiltOpt Is Nothing OrElse _moduleBeingBuiltOpt.AllowOmissionOfConditionalCalls - Dim lambdaDebugInfoBuilder = ArrayBuilder(Of LambdaDebugInfo).GetInstance() - Dim closureDebugInfoBuilder = ArrayBuilder(Of ClosureDebugInfo).GetInstance() + Dim lambdaDebugInfoBuilder = ArrayBuilder(Of EncLambdaInfo).GetInstance() + Dim lambdaRuntimeRudeEditsBuilder = ArrayBuilder(Of LambdaRuntimeRudeEditInfo).GetInstance() + Dim lambdaRuntimeRudeEdits = ArrayBuilder(Of LambdaRuntimeRudeEditInfo).GetInstance() + Dim closureDebugInfoBuilder = ArrayBuilder(Of EncClosureInfo).GetInstance() Dim stateMachineStateDebugInfoBuilder = ArrayBuilder(Of StateMachineStateDebugInfo).GetInstance() Dim codeCoverageSpans As ImmutableArray(Of SourceSpan) = ImmutableArray(Of SourceSpan).Empty Dim instrumentation = If(_moduleBeingBuiltOpt IsNot Nothing, _moduleBeingBuiltOpt.GetMethodBodyInstrumentations(method), Nothing) - body = Rewriter.LowerBodyOrInitializer(method, - methodOrdinal, - body, - previousSubmissionFields, - compilationState, - instrumentation, - codeCoverageSpans, - GetDebugDocumentProvider(instrumentation), - diagnostics, - lazyVariableSlotAllocator, - lambdaDebugInfoBuilder, - closureDebugInfoBuilder, - stateMachineStateDebugInfoBuilder, - delegateRelaxationIdDispenser, - stateMachineTypeOpt, - allowOmissionOfConditionalCalls, - isBodySynthesized:=False) - - ' The submission initializer has to be constructed after the body is rewritten (all previous submission references are visited): - Dim submissionInitialization = If(method.IsSubmissionConstructor, + Try + body = Rewriter.LowerBodyOrInitializer(method, + methodOrdinal, + body, + previousSubmissionFields, + compilationState, + instrumentation, + codeCoverageSpans, + GetDebugDocumentProvider(instrumentation), + diagnostics, + lazyVariableSlotAllocator, + lambdaDebugInfoBuilder, + lambdaRuntimeRudeEditsBuilder, + closureDebugInfoBuilder, + stateMachineStateDebugInfoBuilder, + delegateRelaxationIdDispenser, + stateMachineTypeOpt, + allowOmissionOfConditionalCalls, + isBodySynthesized:=False) + + ' The submission initializer has to be constructed after the body is rewritten (all previous submission references are visited): + Dim submissionInitialization = If(method.IsSubmissionConstructor, SynthesizedSubmissionConstructorSymbol.MakeSubmissionInitialization(block.Syntax, method, previousSubmissionFields, _compilation), ImmutableArray(Of BoundStatement).Empty) - Dim hasErrors = body.HasErrors OrElse diagsForCurrentMethod.HasAnyErrors OrElse (diagnostics IsNot diagsForCurrentMethod AndAlso diagnostics.HasAnyErrors) - SetGlobalErrorIfTrue(hasErrors) + Dim hasErrors = body.HasErrors OrElse diagsForCurrentMethod.HasAnyErrors OrElse (diagnostics IsNot diagsForCurrentMethod AndAlso diagnostics.HasAnyErrors) + SetGlobalErrorIfTrue(hasErrors) + + ' Actual emitting is only done if we have a module in which to emit and no errors so far. + If _moduleBeingBuiltOpt Is Nothing OrElse hasErrors Then + If diagnostics IsNot diagsForCurrentMethod Then + DirectCast(method.AssociatedSymbol, SynthesizedMyGroupCollectionPropertySymbol).RelocateDiagnostics(diagnostics.DiagnosticBag, diagsForCurrentMethod.DiagnosticBag) + diagsForCurrentMethod.AddDependencies(diagnostics) + diagnostics.Free() + End If + + Return + End If + + ' now we have everything we need to build complete submission + If method.IsScriptConstructor Then + Dim boundStatements = ArrayBuilder(Of BoundStatement).GetInstance() + Debug.Assert(constructorInitializerOpt IsNot Nothing) + boundStatements.Add(constructorInitializerOpt) + boundStatements.AddRange(submissionInitialization) + boundStatements.Add(body) + body = New BoundBlock(body.Syntax, Nothing, ImmutableArray(Of LocalSymbol).Empty, boundStatements.ToImmutableAndFree(), body.HasErrors).MakeCompilerGenerated() + End If + + If DoEmitPhase Then + ' NOTE: additional check for statement.HasErrors is needed to identify parse errors which didn't get into diagsForCurrentMethod + + lambdaRuntimeRudeEdits.Sort(Function(x, y) x.LambdaId.CompareTo(y.LambdaId)) + + Dim methodBody As MethodBody = GenerateMethodBody(_moduleBeingBuiltOpt, + method, + methodOrdinal, + body, + lambdaDebugInfoBuilder.ToImmutable(), + orderedLambdaRuntimeRudeEdits:=lambdaRuntimeRudeEdits.ToImmutable(), + closureDebugInfoBuilder.ToImmutable(), + stateMachineStateDebugInfoBuilder.ToImmutable(), + stateMachineTypeOpt, + lazyVariableSlotAllocator, + GetDebugDocumentProvider(instrumentation), + diagnostics, + emittingPdb:=_emittingPdb, + codeCoverageSpans:=codeCoverageSpans) + + _moduleBeingBuiltOpt.SetMethodBody(If(method.PartialDefinitionPart, method), methodBody) + End If - ' Actual emitting is only done if we have a module in which to emit and no errors so far. - If _moduleBeingBuiltOpt Is Nothing OrElse hasErrors Then If diagnostics IsNot diagsForCurrentMethod Then DirectCast(method.AssociatedSymbol, SynthesizedMyGroupCollectionPropertySymbol).RelocateDiagnostics(diagnostics.DiagnosticBag, diagsForCurrentMethod.DiagnosticBag) diagsForCurrentMethod.AddDependencies(diagnostics) diagnostics.Free() End If - - Return - End If - - ' now we have everything we need to build complete submission - If method.IsScriptConstructor Then - Dim boundStatements = ArrayBuilder(Of BoundStatement).GetInstance() - Debug.Assert(constructorInitializerOpt IsNot Nothing) - boundStatements.Add(constructorInitializerOpt) - boundStatements.AddRange(submissionInitialization) - boundStatements.Add(body) - body = New BoundBlock(body.Syntax, Nothing, ImmutableArray(Of LocalSymbol).Empty, boundStatements.ToImmutableAndFree(), body.HasErrors).MakeCompilerGenerated() - End If - - If DoEmitPhase Then - ' NOTE: additional check for statement.HasErrors is needed to identify parse errors which didn't get into diagsForCurrentMethod - Dim methodBody As MethodBody = GenerateMethodBody(_moduleBeingBuiltOpt, - method, - methodOrdinal, - body, - lambdaDebugInfoBuilder.ToImmutable(), - closureDebugInfoBuilder.ToImmutable(), - stateMachineStateDebugInfoBuilder.ToImmutable(), - stateMachineTypeOpt, - lazyVariableSlotAllocator, - GetDebugDocumentProvider(instrumentation), - diagnostics, - emittingPdb:=_emittingPdb, - codeCoverageSpans:=codeCoverageSpans) - - _moduleBeingBuiltOpt.SetMethodBody(If(method.PartialDefinitionPart, method), methodBody) - End If - - If diagnostics IsNot diagsForCurrentMethod Then - DirectCast(method.AssociatedSymbol, SynthesizedMyGroupCollectionPropertySymbol).RelocateDiagnostics(diagnostics.DiagnosticBag, diagsForCurrentMethod.DiagnosticBag) - diagsForCurrentMethod.AddDependencies(diagnostics) - diagnostics.Free() - End If - - lambdaDebugInfoBuilder.Free() - closureDebugInfoBuilder.Free() + Finally + lambdaDebugInfoBuilder.Free() + closureDebugInfoBuilder.Free() + lambdaRuntimeRudeEditsBuilder.Free() + End Try End Sub Friend Shared Function GenerateMethodBody(moduleBuilder As PEModuleBuilder, method As MethodSymbol, methodOrdinal As Integer, block As BoundStatement, - lambdaDebugInfo As ImmutableArray(Of LambdaDebugInfo), - closureDebugInfo As ImmutableArray(Of ClosureDebugInfo), + lambdaDebugInfo As ImmutableArray(Of EncLambdaInfo), + orderedLambdaRuntimeRudeEdits As ImmutableArray(Of LambdaRuntimeRudeEditInfo), + closureDebugInfo As ImmutableArray(Of EncClosureInfo), stateMachineStateDebugInfos As ImmutableArray(Of StateMachineStateDebugInfo), stateMachineTypeOpt As StateMachineTypeSymbol, variableSlotAllocatorOpt As VariableSlotAllocator, @@ -1680,6 +1706,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic hasDynamicLocalVariables:=False, importScopeOpt:=importScopeOpt, lambdaDebugInfo:=lambdaDebugInfo, + orderedLambdaRuntimeRudeEdits:=orderedLambdaRuntimeRudeEdits, closureDebugInfo:=closureDebugInfo, stateMachineTypeNameOpt:=stateMachineTypeOpt?.Name, ' TODO: remove or update AddedOrChangedMethodInfo stateMachineHoistedLocalScopes:=stateMachineHoistedLocalScopes, diff --git a/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicDefinitionMap.vb b/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicDefinitionMap.vb index df2f3481c2385..05450b24291de 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicDefinitionMap.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicDefinitionMap.vb @@ -75,6 +75,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit Return VisualBasicLambdaSyntaxFacts.Instance End Function + Private Shared Function IsParentDisplayClassFieldName(name As String) As Boolean + Return name.StartsWith(GeneratedNameConstants.HoistedSpecialVariablePrefix & GeneratedNameConstants.ClosureVariablePrefix, StringComparison.Ordinal) + End Function + Friend Function TryGetAnonymousTypeName(template As AnonymousTypeManager.AnonymousTypeOrDelegateTemplateSymbol, ByRef name As String, ByRef index As Integer) As Boolean Return _mapToPrevious.TryGetAnonymousTypeName(template, name, index) End Function @@ -210,22 +214,38 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit Return ImmutableArray.Create(result) End Function - Protected Overrides Function TryParseDisplayClassOrLambdaName(name As String, ByRef suffixIndex As Integer, ByRef idSeparator As Char, ByRef isDisplayClass As Boolean, ByRef hasDebugIds As Boolean) As Boolean + Protected Overrides Function TryParseDisplayClassOrLambdaName( + name As String, + ByRef suffixIndex As Integer, + ByRef idSeparator As Char, + ByRef isDisplayClass As Boolean, + ByRef isDisplayClassParentField As Boolean, + ByRef hasDebugIds As Boolean) As Boolean + idSeparator = GeneratedNameConstants.IdSeparator isDisplayClass = name.StartsWith(GeneratedNameConstants.DisplayClassPrefix, StringComparison.Ordinal) If isDisplayClass Then suffixIndex = GeneratedNameConstants.DisplayClassPrefix.Length + isDisplayClassParentField = False hasDebugIds = name.Length > suffixIndex Return True End If If name.StartsWith(GeneratedNameConstants.LambdaMethodNamePrefix, StringComparison.Ordinal) Then suffixIndex = GeneratedNameConstants.LambdaMethodNamePrefix.Length + isDisplayClassParentField = False hasDebugIds = name.Length > suffixIndex Return True End If + If IsParentDisplayClassFieldName(name) Then + suffixIndex = -1 + isDisplayClassParentField = True + hasDebugIds = False + Return True + End If + Return False End Function End Class diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaCapturedVariable.vb b/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaCapturedVariable.vb index f46b6374cbe03..96a3b2965e06d 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaCapturedVariable.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaCapturedVariable.vb @@ -7,6 +7,7 @@ Imports System.Collections.Immutable Imports System.Runtime.InteropServices Imports System.Threading Imports Microsoft.CodeAnalysis.CodeGen +Imports Microsoft.CodeAnalysis.Symbols Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax @@ -19,6 +20,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ''' Friend NotInheritable Class LambdaCapturedVariable Inherits SynthesizedFieldSymbol + Implements ISynthesizedMethodBodyImplementationSymbol Private ReadOnly _isMe As Boolean @@ -28,6 +30,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Me._isMe = isMeParameter End Sub + Public ReadOnly Property Frame As LambdaFrame + Get + Return DirectCast(_containingType, LambdaFrame) + End Get + End Property + Public Shared Function Create(frame As LambdaFrame, captured As Symbol, ByRef uniqueId As Integer) As LambdaCapturedVariable Debug.Assert(TypeOf captured Is LocalSymbol OrElse TypeOf captured Is ParameterSymbol) @@ -122,6 +130,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return Me._isMe End Get End Property + + Public ReadOnly Property ISynthesizedMethodBodyImplementationSymbol_Method As IMethodSymbolInternal Implements ISynthesizedMethodBodyImplementationSymbol.Method + Get + Return Frame.TopLevelMethod + End Get + End Property + + Public ReadOnly Property ISynthesizedMethodBodyImplementationSymbol_HasMethodBodyDependency As Boolean Implements ISynthesizedMethodBodyImplementationSymbol.HasMethodBodyDependency + Get + Return False + End Get + End Property End Class End Namespace diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaFrame.vb b/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaFrame.vb index 7c597e4c0d5f9..93314cd1171e5 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaFrame.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaFrame.vb @@ -4,6 +4,7 @@ Imports System.Collections.Immutable Imports Microsoft.CodeAnalysis.CodeGen +Imports Microsoft.CodeAnalysis.Emit Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Symbols @@ -20,18 +21,20 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Implements ISynthesizedMethodBodyImplementationSymbol Private ReadOnly _typeParameters As ImmutableArray(Of TypeParameterSymbol) - Private ReadOnly _topLevelMethod As MethodSymbol + Friend ReadOnly TopLevelMethod As MethodSymbol Private ReadOnly _sharedConstructor As MethodSymbol Private ReadOnly _singletonCache As FieldSymbol - Friend ReadOnly ClosureOrdinal As Integer 'NOTE: this does not include captured parent frame references Friend ReadOnly CapturedLocals As New ArrayBuilder(Of LambdaCapturedVariable) Private ReadOnly _constructor As SynthesizedLambdaConstructor Friend ReadOnly TypeMap As TypeSubstitution - Private ReadOnly _scopeSyntaxOpt As SyntaxNode + ' debug info: + Public ReadOnly RudeEdit As RuntimeRudeEdit? + Public ReadOnly ClosureId As DebugId + Private Shared ReadOnly s_typeSubstitutionFactory As Func(Of Symbol, TypeSubstitution) = Function(container) Dim f = TryCast(container, LambdaFrame) @@ -47,6 +50,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic scopeSyntaxOpt As SyntaxNode, methodId As DebugId, closureId As DebugId, + rudeEdit As RuntimeRudeEdit?, copyConstructor As Boolean, isStatic As Boolean, isDelegateRelaxationFrame As Boolean) @@ -75,7 +79,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Me._typeParameters = SynthesizedClonedTypeParameterSymbol.MakeTypeParameters(topLevelMethod.TypeParameters, Me, CreateTypeParameter) Me.TypeMap = TypeSubstitution.Create(topLevelMethod, topLevelMethod.TypeParameters, Me.TypeArgumentsNoUseSiteDiagnostics) - Me._topLevelMethod = topLevelMethod + Me.TopLevelMethod = topLevelMethod + Me.RudeEdit = rudeEdit + Me.ClosureId = closureId End Sub Private Shared Function MakeName(scopeSyntaxOpt As SyntaxNode, @@ -237,7 +243,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Public ReadOnly Property Method As IMethodSymbolInternal Implements ISynthesizedMethodBodyImplementationSymbol.Method Get - Return _topLevelMethod + Return TopLevelMethod End Get End Property End Class diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaRewriter.vb b/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaRewriter.vb index e0c2e8e585e7f..e4a577d7452d5 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaRewriter.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaRewriter.vb @@ -5,6 +5,7 @@ Imports System.Collections.Immutable Imports System.Runtime.InteropServices Imports Microsoft.CodeAnalysis.CodeGen +Imports Microsoft.CodeAnalysis.Emit Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax @@ -75,7 +76,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' "This" in the context of current method. Private _currentFrameThis As ParameterSymbol - Private ReadOnly _lambdaDebugInfoBuilder As ArrayBuilder(Of LambdaDebugInfo) + Private ReadOnly _lambdaDebugInfoBuilder As ArrayBuilder(Of EncLambdaInfo) + Private ReadOnly _lambdaRuntimeRudeEditsBuilder As ArrayBuilder(Of LambdaRuntimeRudeEditInfo) + Private _delegateRelaxationIdDispenser As Integer ' ID dispenser for field names of frame references. @@ -112,7 +115,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Private Sub New(analysis As Analysis, method As MethodSymbol, methodOrdinal As Integer, - lambdaDebugInfoBuilder As ArrayBuilder(Of LambdaDebugInfo), + lambdaDebugInfoBuilder As ArrayBuilder(Of EncLambdaInfo), + lambdaRuntimeRudeEditsBuilder As ArrayBuilder(Of LambdaRuntimeRudeEditInfo), delegateRelaxationIdDispenser As Integer, slotAllocatorOpt As VariableSlotAllocator, compilationState As TypeCompilationState, @@ -122,6 +126,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Me._topLevelMethod = method Me._topLevelMethodOrdinal = methodOrdinal Me._lambdaDebugInfoBuilder = lambdaDebugInfoBuilder + Me._lambdaRuntimeRudeEditsBuilder = lambdaRuntimeRudeEditsBuilder Me._delegateRelaxationIdDispenser = delegateRelaxationIdDispenser Me._currentMethod = method Me._analysis = analysis @@ -146,17 +151,21 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ''' The bound node to be rewritten ''' The containing method of the node to be rewritten ''' Index of the method symbol in its containing type member list. + ''' Information on lambdas defined in needed for debugging. + ''' EnC rude edit information on lambdas defined in . + ''' Information on closures defined in needed for debugging. ''' The caller's buffer into which we produce additional methods to be emitted by the caller ''' Set of symbols that should not be captured using a copy constructor ''' The caller's buffer into which we place any diagnostics for problems encountered Public Shared Function Rewrite(node As BoundBlock, method As MethodSymbol, methodOrdinal As Integer, - lambdaDebugInfoBuilder As ArrayBuilder(Of LambdaDebugInfo), - closureDebugInfoBuilder As ArrayBuilder(Of ClosureDebugInfo), + lambdaDebugInfoBuilder As ArrayBuilder(Of EncLambdaInfo), + lambdaRuntimeRudeEditsBuilder As ArrayBuilder(Of LambdaRuntimeRudeEditInfo), + closureDebugInfoBuilder As ArrayBuilder(Of EncClosureInfo), ByRef delegateRelaxationIdDispenser As Integer, slotAllocatorOpt As VariableSlotAllocator, - CompilationState As TypeCompilationState, + compilationState As TypeCompilationState, symbolsCapturedWithoutCopyCtor As ISet(Of Symbol), diagnostics As BindingDiagnosticBag, rewrittenNodes As HashSet(Of BoundNode)) As BoundBlock @@ -170,9 +179,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic method, methodOrdinal, lambdaDebugInfoBuilder, + lambdaRuntimeRudeEditsBuilder, delegateRelaxationIdDispenser, slotAllocatorOpt, - CompilationState, + compilationState, diagnostics) #If DEBUG Then Debug.Assert(rewrittenNodes IsNot Nothing) @@ -219,7 +229,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ''' ''' Create the frame types. ''' - Private Sub MakeFrames(closureDebugInfo As ArrayBuilder(Of ClosureDebugInfo)) + Private Sub MakeFrames(closureDebugInfo As ArrayBuilder(Of EncClosureInfo)) ' There is a simple test to determine whether to do copy-construction: ' If method contains a backward branch, then all closures should attempt copy-construction. ' In the worst case, we will redundantly check if a previous version exists which is cheap @@ -250,7 +260,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Private Function GetFrameForScope(copyConstructor As Boolean, captured As Symbol, scope As BoundNode, - closureDebugInfo As ArrayBuilder(Of ClosureDebugInfo), + closureDebugInfo As ArrayBuilder(Of EncClosureInfo), ByRef delegateRelaxationIdDispenser As Integer) As LambdaFrame Dim frame As LambdaFrame = Nothing @@ -268,6 +278,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim isDelegateRelaxationFrame = If(TryCast(captured, SynthesizedLocal)?.SynthesizedKind = SynthesizedLocalKind.DelegateRelaxationReceiver, False) Dim methodId, closureId As DebugId + Dim rudeEdit As RuntimeRudeEdit? = Nothing If isDelegateRelaxationFrame Then Dim currentGeneration = CompilationState.ModuleBuilderOpt.CurrentGenerationOrdinal @@ -276,13 +287,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic delegateRelaxationIdDispenser += 1 Else methodId = GetTopLevelMethodId() - closureId = GetClosureId(syntax, closureDebugInfo) + closureId = GetClosureId(scope, syntax, closureDebugInfo, rudeEdit) End If frame = New LambdaFrame(_topLevelMethod, syntax, methodId, closureId, + rudeEdit, copyConstructor AndAlso Not _analysis.symbolsCapturedWithoutCopyCtor.Contains(captured), isStatic:=False, isDelegateRelaxationFrame:=isDelegateRelaxationFrame) @@ -313,7 +325,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End If Dim closureId As DebugId = Nothing - _lazyStaticLambdaFrame = New LambdaFrame(_topLevelMethod, lambda.Syntax, methodId, closureId, copyConstructor:=False, isStatic:=True, isDelegateRelaxationFrame:=False) + _lazyStaticLambdaFrame = New LambdaFrame( + _topLevelMethod, + lambda.Syntax, + methodId, + closureId, + rudeEdit:=Nothing, + copyConstructor:=False, + isStatic:=True, + isDelegateRelaxationFrame:=False) ' non-generic static lambdas can share the frame If isNonGeneric Then @@ -959,23 +979,39 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return If(SlotAllocatorOpt?.MethodId, New DebugId(_topLevelMethodOrdinal, CompilationState.ModuleBuilderOpt.CurrentGenerationOrdinal)) End Function - Private Function GetClosureId(syntax As SyntaxNode, closureDebugInfo As ArrayBuilder(Of ClosureDebugInfo)) As DebugId + Private Function GetClosureId(scope As BoundNode, syntax As SyntaxNode, closureDebugInfo As ArrayBuilder(Of EncClosureInfo), ByRef rudeEdit As RuntimeRudeEdit?) As DebugId Debug.Assert(syntax IsNot Nothing) + Dim parentScope As BoundNode = Nothing + Dim parentFrame As LambdaFrame = Nothing + Dim parentClosureId As DebugId? = Nothing + + If _analysis.needsParentFrame.Contains(scope) AndAlso + _analysis.blockParent.TryGetValue(scope, parentScope) AndAlso + _frames.TryGetValue(parentScope, parentFrame) Then + + rudeEdit = parentFrame.RudeEdit + parentClosureId = parentFrame.ClosureId + End If + Dim closureId As DebugId Dim previousClosureId As DebugId - If SlotAllocatorOpt IsNot Nothing AndAlso SlotAllocatorOpt.TryGetPreviousClosure(syntax, previousClosureId) Then + + If rudeEdit Is Nothing AndAlso + SlotAllocatorOpt IsNot Nothing AndAlso + SlotAllocatorOpt.TryGetPreviousClosure(syntax, parentClosureId, structCaptures:=Nothing, previousClosureId, rudeEdit) AndAlso + rudeEdit Is Nothing Then closureId = previousClosureId Else closureId = New DebugId(closureDebugInfo.Count, CompilationState.ModuleBuilderOpt.CurrentGenerationOrdinal) End If Dim syntaxOffset As Integer = _topLevelMethod.CalculateLocalSyntaxOffset(syntax.SpanStart, syntax.SyntaxTree) - closureDebugInfo.Add(New ClosureDebugInfo(syntaxOffset, closureId)) + closureDebugInfo.Add(New EncClosureInfo(New ClosureDebugInfo(syntaxOffset, closureId), parentClosureId, structCaptures:=Nothing)) Return closureId End Function - Private Function GetLambdaId(syntax As SyntaxNode, closureKind As ClosureKind, closureOrdinal As Integer) As DebugId + Private Function GetLambdaId(syntax As SyntaxNode, closureKind As ClosureKind, closureOrdinal As Integer, closureRudeEdit As RuntimeRudeEdit?) As DebugId Debug.Assert(syntax IsNot Nothing) Dim lambdaOrLambdaBodySyntax As SyntaxNode @@ -990,7 +1026,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' EnC is not supported in this case. lambdaOrLambdaBodySyntax = syntax isLambdaBody = False - ElseIf LambdaUtilities.IsNonUserCodeQueryLambda(syntax) + ElseIf LambdaUtilities.IsNonUserCodeQueryLambda(syntax) Then lambdaOrLambdaBodySyntax = syntax isLambdaBody = False Else @@ -1004,15 +1040,23 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' determine lambda ordinal and calculate syntax offset Dim lambdaId As DebugId - Dim previousLambdaId As DebugId - If SlotAllocatorOpt IsNot Nothing AndAlso SlotAllocatorOpt.TryGetPreviousLambda(lambdaOrLambdaBodySyntax, isLambdaBody, previousLambdaId) Then + Dim previousLambdaId As DebugId = Nothing + Dim lambdaRudeEdit As RuntimeRudeEdit? = Nothing + If closureRudeEdit Is Nothing AndAlso + SlotAllocatorOpt?.TryGetPreviousLambda(lambdaOrLambdaBodySyntax, isLambdaBody, closureOrdinal, structClosureIds:=ImmutableArray(Of DebugId).Empty, previousLambdaId, lambdaRudeEdit) = True AndAlso + lambdaRudeEdit Is Nothing Then lambdaId = previousLambdaId Else lambdaId = New DebugId(_lambdaDebugInfoBuilder.Count, CompilationState.ModuleBuilderOpt.CurrentGenerationOrdinal) + + Dim rudeEdit = If(closureRudeEdit, lambdaRudeEdit) + If rudeEdit IsNot Nothing Then + _lambdaRuntimeRudeEditsBuilder.Add(New LambdaRuntimeRudeEditInfo(previousLambdaId, rudeEdit.Value)) + End If End If Dim syntaxOffset As Integer = _topLevelMethod.CalculateLocalSyntaxOffset(lambdaOrLambdaBodySyntax.SpanStart, lambdaOrLambdaBodySyntax.SyntaxTree) - _lambdaDebugInfoBuilder.Add(New LambdaDebugInfo(syntaxOffset, lambdaId, closureOrdinal)) + _lambdaDebugInfoBuilder.Add(New EncLambdaInfo(New LambdaDebugInfo(syntaxOffset, lambdaId, closureOrdinal), structClosureIds:=ImmutableArray(Of DebugId).Empty)) Return lambdaId End Function @@ -1037,19 +1081,23 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End If Dim translatedLambdaContainer As InstanceTypeSymbol + Dim containerFrame As LambdaFrame Dim lambdaScope As BoundNode = Nothing Dim closureOrdinal As Integer Dim closureKind As ClosureKind If _analysis.lambdaScopes.TryGetValue(node.LambdaSymbol, lambdaScope) Then - translatedLambdaContainer = _frames(lambdaScope) + containerFrame = _frames(lambdaScope) + translatedLambdaContainer = containerFrame closureKind = ClosureKind.General - closureOrdinal = _frames(lambdaScope).ClosureOrdinal - ElseIf _analysis.capturedVariablesByLambda(node.LambdaSymbol).Count = 0 - translatedLambdaContainer = GetStaticFrame(node, Diagnostics) + closureOrdinal = _frames(lambdaScope).ClosureId.Ordinal + ElseIf _analysis.capturedVariablesByLambda(node.LambdaSymbol).Count = 0 Then + containerFrame = GetStaticFrame(node, Diagnostics) + translatedLambdaContainer = containerFrame closureKind = ClosureKind.Static closureOrdinal = LambdaDebugInfo.StaticClosureOrdinal Else + containerFrame = Nothing translatedLambdaContainer = DirectCast(_topLevelMethod.ContainingType, InstanceTypeSymbol) closureKind = ClosureKind.ThisOnly closureOrdinal = LambdaDebugInfo.ThisOnlyClosureOrdinal @@ -1062,7 +1110,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic lambdaId = New DebugId(_delegateRelaxationIdDispenser, generation) topLevelMethodId = New DebugId(_topLevelMethodOrdinal, generation) Else - lambdaId = GetLambdaId(node.Syntax, closureKind, closureOrdinal) + lambdaId = GetLambdaId(node.Syntax, closureKind, closureOrdinal, containerFrame?.RudeEdit) topLevelMethodId = GetTopLevelMethodId() End If diff --git a/src/Compilers/VisualBasic/Portable/Lowering/Rewriter.vb b/src/Compilers/VisualBasic/Portable/Lowering/Rewriter.vb index 107774e9f2bfd..6026efc4c42d5 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/Rewriter.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/Rewriter.vb @@ -25,8 +25,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic debugDocumentProvider As DebugDocumentProvider, diagnostics As BindingDiagnosticBag, ByRef lazyVariableSlotAllocator As VariableSlotAllocator, - lambdaDebugInfoBuilder As ArrayBuilder(Of LambdaDebugInfo), - closureDebugInfoBuilder As ArrayBuilder(Of ClosureDebugInfo), + lambdaDebugInfoBuilder As ArrayBuilder(Of EncLambdaInfo), + lambdaRuntimeRudeEditsBuilder As ArrayBuilder(Of LambdaRuntimeRudeEditInfo), + closureDebugInfoBuilder As ArrayBuilder(Of EncClosureInfo), stateMachineStateDebugInfoBuilder As ArrayBuilder(Of StateMachineStateDebugInfo), ByRef delegateRelaxationIdDispenser As Integer, ByRef stateMachineTypeOpt As StateMachineTypeSymbol, @@ -93,6 +94,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic method, methodOrdinal, lambdaDebugInfoBuilder, + lambdaRuntimeRudeEditsBuilder, closureDebugInfoBuilder, delegateRelaxationIdDispenser, lazyVariableSlotAllocator, diff --git a/src/Compilers/VisualBasic/Portable/Symbols/FieldSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/FieldSymbol.vb index fc12413f5b111..7128b4874f743 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/FieldSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/FieldSymbol.vb @@ -407,6 +407,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property + Private ReadOnly Property IFieldSymbolInternal_Type As ITypeSymbolInternal Implements IFieldSymbolInternal.Type + Get + Return Me.Type + End Get + End Property + Private ReadOnly Property IFieldSymbolInternal_AssociatedSymbol As ISymbolInternal Implements IFieldSymbolInternal.AssociatedSymbol Get Return Me.AssociatedSymbol diff --git a/src/Compilers/VisualBasic/Portable/Symbols/ParameterSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/ParameterSymbol.vb index 91a202e404a2e..d91c47d96152e 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/ParameterSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/ParameterSymbol.vb @@ -295,7 +295,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property - Private ReadOnly Property IParameterSymbol_RefKind As RefKind Implements IParameterSymbol.RefKind + Private ReadOnly Property IParameterSymbol_RefKind As RefKind Implements IParameterSymbol.RefKind, IParameterSymbolInternal.RefKind Get ' TODO: Should we check if it has the attribute and return 'RefKind.Out' in ' that case? diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.vb index 849c4cd5d13ab..e4072e17c1d39 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.vb @@ -4,8 +4,10 @@ Imports System.Collections.Immutable Imports System.Reflection.Metadata.Ecma335 +Imports Microsoft.CodeAnalysis.EditAndContinue.UnitTests Imports Microsoft.CodeAnalysis.Emit Imports Microsoft.CodeAnalysis.Test.Utilities +Imports Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Roslyn.Test.Utilities @@ -982,9 +984,9 @@ End Class diff1.VerifySynthesizedMembers( "C: {_Closure$__}", - "C._Closure$__: {$I0#1, _Lambda$__0#1}") + "C._Closure$__: {$I2#1-0#1, _Lambda$__2#1-0#1}") - diff1.VerifyIL("C._Closure$__._Lambda$__0#1", " + diff1.VerifyIL("C._Closure$__._Lambda$__2#1-0#1", " { // Code size 9 (0x9) .maxstack 2 @@ -1005,9 +1007,9 @@ End Class diff2.VerifySynthesizedMembers( "C: {_Closure$__}", - "C._Closure$__: {$I0#1, _Lambda$__0#1}") + "C._Closure$__: {$I2#1-0#1, _Lambda$__2#1-0#1}") - diff2.VerifyIL("C._Closure$__._Lambda$__0#1", " + diff2.VerifyIL("C._Closure$__._Lambda$__2#1-0#1", " { // Code size 9 (0x9) .maxstack 2 @@ -2219,5 +2221,1598 @@ End Class diff2.VerifyIL("C.F", expectedIL.Replace("<>", "2")) End Sub + + + Public Sub Capture_Local() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim a1 = new Action(Sub() Console.WriteLine(0)) + Dim a2 = new Action(Sub() Console.WriteLine(1)) + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__}", + "C._Closure$__: {$I1-0, $I1-1, _Lambda$__1-0, _Lambda$__1-1}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim a1 = new Action(Sub() Console.WriteLine(x)) + Dim a2 = new Action(Sub() Console.WriteLine(1)) + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + ' Static lambda is reused. + ' A new display class and method is generated for lambda that captures x. + g.VerifySynthesizedMembers( + "C: {_Closure$__, _Closure$__1-0#1}", + "C._Closure$__: {$I1-1, _Lambda$__1-1}", + "C._Closure$__1-0#1: {_Lambda$__0#1}") + + g.VerifyMethodDefNames("F", "_Lambda$__1-0", "_Lambda$__1-1", ".ctor", "_Lambda$__0#1") + + g.VerifyIL(" +{ + // Code size 67 (0x43) + .maxstack 2 + IL_0000: nop + IL_0001: newobj 0x06000007 + IL_0006: stloc.3 + IL_0007: ldloc.3 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000004 + IL_000e: ldloc.3 + IL_000f: ldftn 0x06000008 + IL_0015: newobj 0x0A000009 + IL_001a: stloc.s V_4 + IL_001c: ldsfld 0x04000003 + IL_0021: brfalse.s IL_002a + IL_0023: ldsfld 0x04000003 + IL_0028: br.s IL_0040 + IL_002a: ldsfld 0x04000001 + IL_002f: ldftn 0x06000006 + IL_0035: newobj 0x0A000009 + IL_003a: dup + IL_003b: stsfld 0x04000003 + IL_0040: stloc.s V_5 + IL_0042: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw +} +{ + // Code size 9 (0x9) + .maxstack 8 + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: call 0x0A00000B + IL_0007: nop + IL_0008: ret +} +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000C + IL_0006: ret +} +{ + // Code size 14 (0xe) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000004 + IL_0007: call 0x0A00000B + IL_000c: nop + IL_000d: ret +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub Capture_Parameter() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Sub F(x As Integer) + Dim a1 = New Action(Sub() Console.WriteLine(0)) + Dim a2 = New Action(Sub() Console.WriteLine(1)) + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__}", + "C._Closure$__: {$I1-0, $I1-1, _Lambda$__1-0, _Lambda$__1-1}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Sub F(x As Integer) + Dim a1 = New Action(Sub() Console.WriteLine(0)) + Dim a2 = New Action(Sub() Console.WriteLine(x)) + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__, _Closure$__1-0#1}", + "C._Closure$__: {$I1-0, _Lambda$__1-0}", + "C._Closure$__1-0#1: {_Lambda$__1#1}") + + g.VerifyMethodDefNames("F", "_Lambda$__1-0", "_Lambda$__1-1", ".ctor", "_Lambda$__1#1") + + g.VerifyIL(" +{ + // Code size 66 (0x42) + .maxstack 2 + IL_0000: nop + IL_0001: newobj 0x06000007 + IL_0006: stloc.2 + IL_0007: ldloc.2 + IL_0008: ldarg.1 + IL_0009: stfld 0x04000004 + IL_000e: ldsfld 0x04000002 + IL_0013: brfalse.s IL_001c + IL_0015: ldsfld 0x04000002 + IL_001a: br.s IL_0032 + IL_001c: ldsfld 0x04000001 + IL_0021: ldftn 0x06000005 + IL_0027: newobj 0x0A000009 + IL_002c: dup + IL_002d: stsfld 0x04000002 + IL_0032: stloc.3 + IL_0033: ldloc.2 + IL_0034: ldftn 0x06000008 + IL_003a: newobj 0x0A000009 + IL_003f: stloc.s V_4 + IL_0041: ret +} +{ + // Code size 9 (0x9) + .maxstack 8 + IL_0000: nop + IL_0001: ldc.i4.0 + IL_0002: call 0x0A00000A + IL_0007: nop + IL_0008: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000B + IL_000a: throw +} +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000C + IL_0006: ret +} +{ + // Code size 14 (0xe) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000004 + IL_0007: call 0x0A00000A + IL_000c: nop + IL_000d: ret +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub Capture_This() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Dim x As Integer = 1 + + Sub F() + Dim a1 = new Action(Sub() Console.WriteLine(0)) + Dim a2 = new Action(Sub() Console.WriteLine(1)) + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__}", + "C._Closure$__: {$I2-0, $I2-1, _Lambda$__2-0, _Lambda$__2-1}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Dim x As Integer = 1 + + Sub F() + Dim a1 = new Action(Sub() Console.WriteLine(0)) + Dim a2 = new Action(Sub() Console.WriteLine(x)) + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Lambda$__2-1#1, _Closure$__}", + "C._Closure$__: {$I2-0, _Lambda$__2-0}") + + g.VerifyMethodDefNames("F", "_Lambda$__2-0", "_Lambda$__2-1", "_Lambda$__2-1#1") + + g.VerifyIL(" +{ + // Code size 52 (0x34) + .maxstack 2 + IL_0000: nop + IL_0001: ldsfld 0x04000003 + IL_0006: brfalse.s IL_000f + IL_0008: ldsfld 0x04000003 + IL_000d: br.s IL_0025 + IL_000f: ldsfld 0x04000002 + IL_0014: ldftn 0x06000005 + IL_001a: newobj 0x0A000009 + IL_001f: dup + IL_0020: stsfld 0x04000003 + IL_0025: stloc.2 + IL_0026: ldarg.0 + IL_0027: ldftn 0x06000007 + IL_002d: newobj 0x0A000009 + IL_0032: stloc.3 + IL_0033: ret +} +{ + // Code size 9 (0x9) + .maxstack 8 + IL_0000: nop + IL_0001: ldc.i4.0 + IL_0002: call 0x0A00000A + IL_0007: nop + IL_0008: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000B + IL_000a: throw +} +{ + // Code size 14 (0xe) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000001 + IL_0007: call 0x0A00000A + IL_000c: nop + IL_000d: ret +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub CeaseCapture_Local() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim y = 1 + Dim a1 = Function() x + y + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__1-0}", + "C._Closure$__1-0: {_Lambda$__0}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim y = 1 + Dim a1 = Function() x + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__1-0}", + "C._Closure$__1-0: {_Lambda$__0}") + + g.VerifyMethodDefNames("F", "_Lambda$__0") + + g.VerifyIL(" +{ + // Code size 30 (0x1e) + .maxstack 2 + IL_0000: nop + IL_0001: newobj 0x06000007 + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000001 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: ldloc.0 + IL_0011: ldftn 0x06000008 + IL_0017: newobj 0x0A000009 + IL_001c: stloc.3 + IL_001d: ret +} +{ + // Code size 12 (0xc) + .maxstack 1 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000001 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + IL_000a: ldloc.0 + IL_000b: ret +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub CeaseCapture_LastLocal() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim a1 = Function() x + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C._Closure$__1-0: {_Lambda$__0}", + "C: {_Closure$__1-0}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim a1 = Function() 1 + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__}", + "C._Closure$__: {$I1-0#1, _Lambda$__1-0#1}") + + g.VerifyMethodDefNames("F", "_Lambda$__0", ".ctor", ".cctor", "_Lambda$__1-0#1") + + g.VerifyIL(" +{ + // Code size 41 (0x29) + .maxstack 2 + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: stloc.2 + IL_0003: ldsfld 0x04000003 + IL_0008: brfalse.s IL_0011 + IL_000a: ldsfld 0x04000003 + IL_000f: br.s IL_0027 + IL_0011: ldsfld 0x04000002 + IL_0016: ldftn 0x0600000B + IL_001c: newobj 0x0A000009 + IL_0021: dup + IL_0022: stsfld 0x04000003 + IL_0027: stloc.3 + IL_0028: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw +} +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000B + IL_0006: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: newobj 0x06000009 + IL_0005: stsfld 0x04000002 + IL_000a: ret +} +{ + // Code size 7 (0x7) + .maxstack 1 + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + IL_0005: ldloc.0 + IL_0006: ret +} +") + End Sub). + AddGeneration(' resume capture + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim a1 = Function() x + 1 + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__1-0#2, _Closure$__}", + "C._Closure$__: {$I1-0#1, _Lambda$__1-0#1}", + "C._Closure$__1-0#2: {_Lambda$__0#2}") + + g.VerifyMethodDefNames("F", "_Lambda$__1-0#1", ".ctor", "_Lambda$__0#2") + + g.VerifyIL(" +{ + // Code size 32 (0x20) + .maxstack 2 + IL_0000: nop + IL_0001: newobj 0x0600000C + IL_0006: stloc.s V_4 + IL_0008: ldloc.s V_4 + IL_000a: ldc.i4.1 + IL_000b: stfld 0x04000004 + IL_0010: ldloc.s V_4 + IL_0012: ldftn 0x0600000D + IL_0018: newobj 0x0A00000D + IL_001d: stloc.s V_5 + IL_001f: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x7000014D + IL_0005: newobj 0x0A00000E + IL_000a: throw +} +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000F + IL_0006: ret +} +{ + // Code size 14 (0xe) + .maxstack 2 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000004 + IL_0007: ldc.i4.1 + IL_0008: add.ovf + IL_0009: stloc.0 + IL_000a: br.s IL_000c + IL_000c: ldloc.0 + IL_000d: ret +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub CeaseCapture_This() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Dim x As Integer = 1 + + Sub F() + Dim a1 = Function() x + Dim a2 = Function() 1 + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Lambda$__2-0, _Closure$__}", + "C._Closure$__: {$I2-1, _Lambda$__2-1}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Dim x As Integer = 1 + + Sub F() + Dim a1 = Function() 0 + Dim a2 = Function() 1 + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__}", + "C._Closure$__: {$I2-0#1, $I2-1, _Lambda$__2-0#1, _Lambda$__2-1}") + + g.VerifyMethodDefNames("F", "_Lambda$__2-0", "_Lambda$__2-1", "_Lambda$__2-0#1") + + g.VerifyIL(" +{ + // Code size 76 (0x4c) + .maxstack 2 + IL_0000: nop + IL_0001: ldsfld 0x04000004 + IL_0006: brfalse.s IL_000f + IL_0008: ldsfld 0x04000004 + IL_000d: br.s IL_0025 + IL_000f: ldsfld 0x04000002 + IL_0014: ldftn 0x0600000B + IL_001a: newobj 0x0A000009 + IL_001f: dup + IL_0020: stsfld 0x04000004 + IL_0025: stloc.2 + IL_0026: ldsfld 0x04000003 + IL_002b: brfalse.s IL_0034 + IL_002d: ldsfld 0x04000003 + IL_0032: br.s IL_004a + IL_0034: ldsfld 0x04000002 + IL_0039: ldftn 0x0600000A + IL_003f: newobj 0x0A000009 + IL_0044: dup + IL_0045: stsfld 0x04000003 + IL_004a: stloc.3 + IL_004b: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw +} +{ + // Code size 7 (0x7) + .maxstack 1 + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + IL_0005: ldloc.0 + IL_0006: ret +} +{ + // Code size 7 (0x7) + .maxstack 1 + IL_0000: nop + IL_0001: ldc.i4.0 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + IL_0005: ldloc.0 + IL_0006: ret +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub AddingAndRemovingClosure() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers() + End Sub). + AddGeneration('add closure + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim a2 = new Func(Of Integer)(Function() x) + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + ' Method F is assigned a new id in generation 1 since it doesn't have any lambda in the baseline. + g.VerifySynthesizedMembers( + "C: {_Closure$__1#1-0#1}", + "C._Closure$__1#1-0#1: {_Lambda$__0#1}") + + g.VerifyMethodDefNames("F", ".ctor", "_Lambda$__0#1") + + g.VerifyIL(" +{ + // Code size 28 (0x1c) + .maxstack 2 + IL_0000: nop + IL_0001: newobj 0x06000003 + IL_0006: stloc.1 + IL_0007: ldloc.1 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000001 + IL_000e: ldloc.1 + IL_000f: ldftn 0x06000004 + IL_0015: newobj 0x0A000006 + IL_001a: stloc.2 + IL_001b: ret +} +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A000007 + IL_0006: ret +} +{ + // Code size 12 (0xc) + .maxstack 1 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000001 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + IL_000a: ldloc.0 + IL_000b: ret +} +") + End Sub). + AddGeneration('remove closure + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__1#1-0#1}", + "C._Closure$__1#1-0#1: {_Lambda$__0#1}") + + g.VerifyMethodDefNames("F", "_Lambda$__0#1") + + g.VerifyIL(" +{ + // Code size 4 (0x4) + .maxstack 1 + IL_0000: nop + IL_0001: ldc.i4.1 + IL_0002: stloc.3 + IL_0003: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A000008 + IL_000a: throw +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub ChainClosure() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Dim x As Integer = 1 + + Sub F() ' Closure 0 + Dim x0 = 0 + + While True ' Closure 1 + Dim x1 = 1 + + Dim a1 = New Func(Of Integer)(Function() x0) + Dim a2 = New Func(Of Integer)(Function() x1) + End While + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C._Closure$__2-1: {_Lambda$__1}", + "C._Closure$__2-0: {$I0, _Lambda$__0}", + "C: {_Closure$__2-0, _Closure$__2-1}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Dim x As Integer = 1 + + Sub F() ' Closure 0 + Dim x0 = 0 + + While True ' Closure 1 -> Closure 0 + Dim x1 = 1 + + Dim a1 = New Func(Of Integer)(Function() x0) + Dim a2 = New Func(Of Integer)(Function() x0 + x1) + End While + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__2-0, _Closure$__2-1#1}", + "C._Closure$__2-1#1: {$VB$NonLocal_$VB$Closure_2, _Lambda$__1#1}", + "C._Closure$__2-0: {$I0, _Lambda$__0}") + + g.VerifyMethodDefNames("F", "_Lambda$__0", "_Lambda$__1", ".ctor", "_Lambda$__1#1") + + g.VerifyIL(" +{ + // Code size 128 (0x80) + .maxstack 3 + IL_0000: nop + IL_0001: ldloc.0 + IL_0002: newobj 0x06000003 + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.0 + IL_000a: stfld 0x04000002 + IL_000f: br.s IL_007b + IL_0011: ldloc.s V_6 + IL_0013: newobj 0x06000007 + IL_0018: stloc.s V_6 + IL_001a: ldloc.s V_6 + IL_001c: ldloc.0 + IL_001d: stfld 0x04000006 + IL_0022: ldloc.s V_6 + IL_0024: ldc.i4.1 + IL_0025: stfld 0x04000005 + IL_002a: ldloc.s V_6 + IL_002c: ldfld 0x04000006 + IL_0031: ldfld 0x04000003 + IL_0036: brfalse.s IL_0046 + IL_0038: ldloc.s V_6 + IL_003a: ldfld 0x04000006 + IL_003f: ldfld 0x04000003 + IL_0044: br.s IL_0069 + IL_0046: ldloc.s V_6 + IL_0048: ldfld 0x04000006 + IL_004d: ldloc.s V_6 + IL_004f: ldfld 0x04000006 + IL_0054: ldftn 0x06000004 + IL_005a: newobj 0x0A000008 + IL_005f: dup + IL_0060: stloc.s V_9 + IL_0062: stfld 0x04000003 + IL_0067: ldloc.s V_9 + IL_0069: stloc.s V_7 + IL_006b: ldloc.s V_6 + IL_006d: ldftn 0x06000008 + IL_0073: newobj 0x0A000008 + IL_0078: stloc.s V_8 + IL_007a: nop + IL_007b: ldc.i4.1 + IL_007c: stloc.s V_5 + IL_007e: br.s IL_0011 +} +{ + // Code size 12 (0xc) + .maxstack 1 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000002 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + IL_000a: ldloc.0 + IL_000b: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw +} +{ + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000A + IL_0006: ldarg.1 + IL_0007: brfalse.s IL_0015 + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: ldfld 0x04000005 + IL_0010: stfld 0x04000005 + IL_0015: ret +} +{ + // Code size 24 (0x18) + .maxstack 2 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000006 + IL_0007: ldfld 0x04000002 + IL_000c: ldarg.0 + IL_000d: ldfld 0x04000005 + IL_0012: add.ovf + IL_0013: stloc.0 + IL_0014: br.s IL_0016 + IL_0016: ldloc.0 + IL_0017: ret +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub UnchainClosure() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Sub F() ' Closure 0 + Dim x0 = 0 + + While True ' Closure 1 -> Closure 0 + Dim x1 = 1 + + Dim a1 = Function() x0 + Dim a2 = Function() x0 + x1 + End While + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__1-0, _Closure$__1-1}", + "C._Closure$__1-0: {$I0, _Lambda$__0}", + "C._Closure$__1-1: {$VB$NonLocal_$VB$Closure_2, _Lambda$__1}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Sub F() ' Closure 0 + Dim x0 = 0 + + While True ' Closure 1 + Dim x1 = 1 + + Dim a1 = Function() x0 + Dim a2 = Function() x1 + End While + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__1-0, _Closure$__1-1#1}", + "C._Closure$__1-0: {$I0, _Lambda$__0}", + "C._Closure$__1-1#1: {_Lambda$__1#1}") + + g.VerifyMethodDefNames("F", "_Lambda$__0", "_Lambda$__1", ".ctor", "_Lambda$__1#1") + + g.VerifyIL(" +{ + // Code size 96 (0x60) + .maxstack 3 + IL_0000: nop + IL_0001: ldloc.0 + IL_0002: newobj 0x06000007 + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.0 + IL_000a: stfld 0x04000001 + IL_000f: br.s IL_005b + IL_0011: ldloc.s V_6 + IL_0013: newobj 0x0600000B + IL_0018: stloc.s V_6 + IL_001a: ldloc.s V_6 + IL_001c: ldc.i4.1 + IL_001d: stfld 0x04000005 + IL_0022: ldloc.0 + IL_0023: ldfld 0x04000002 + IL_0028: brfalse.s IL_0032 + IL_002a: ldloc.0 + IL_002b: ldfld 0x04000002 + IL_0030: br.s IL_0049 + IL_0032: ldloc.0 + IL_0033: ldloc.0 + IL_0034: ldftn 0x06000008 + IL_003a: newobj 0x0A000009 + IL_003f: dup + IL_0040: stloc.s V_9 + IL_0042: stfld 0x04000002 + IL_0047: ldloc.s V_9 + IL_0049: stloc.s V_7 + IL_004b: ldloc.s V_6 + IL_004d: ldftn 0x0600000C + IL_0053: newobj 0x0A000009 + IL_0058: stloc.s V_8 + IL_005a: nop + IL_005b: ldc.i4.1 + IL_005c: stloc.s V_5 + IL_005e: br.s IL_0011 +} +{ + // Code size 12 (0xc) + .maxstack 1 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000001 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + IL_000a: ldloc.0 + IL_000b: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw +} +{ + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000B + IL_0006: ldarg.1 + IL_0007: brfalse.s IL_0015 + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: ldfld 0x04000005 + IL_0010: stfld 0x04000005 + IL_0015: ret +} +{ + // Code size 12 (0xc) + .maxstack 1 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000005 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + IL_000a: ldloc.0 + IL_000b: ret +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub ChangeClosureParent() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Dim x As Integer = 1 + + Sub F() ' Closure 0 + Dim x = 1 + + While True + Dim y = 2 + + While True ' Closure 1 + Dim z = 3 + + Dim a1 = Function() x + Dim a2 = Function() z + x + End While + End While + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__2-0, _Closure$__2-1}", + "C._Closure$__2-0: {$I0, _Lambda$__0}", + "C._Closure$__2-1: {$VB$NonLocal_$VB$Closure_2, _Lambda$__1}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Dim x As Integer = 1 + + Sub F() ' Closure 0 + Dim x = 1 + + While True ' Closure 1 + Dim y = 2 + + While True ' Closure 2 + Dim z = 3 + + Dim a1 = Function() x + Dim a2 = Function() z + x + Dim a3 = Function() z + x + y + End While + End While + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + ' closure #0 is preserved, new closures #1 and #2 are created: + g.VerifySynthesizedMembers( + "C: {_Closure$__2-0, _Closure$__2-1#1, _Closure$__2-2#1}", + "C._Closure$__2-0: {$I0, _Lambda$__0}", + "C._Closure$__2-1#1: {$VB$NonLocal_$VB$Closure_3, _Lambda$__1#1, _Lambda$__2#1}", + "C._Closure$__2-2#1: {$VB$NonLocal_$VB$Closure_2}") + + g.VerifyMethodDefNames("F", "_Lambda$__0", "_Lambda$__1", ".ctor", "_Lambda$__1#1", "_Lambda$__2#1", ".ctor") + + g.VerifyIL(" +{ + // Code size 208 (0xd0) + .maxstack 3 + IL_0000: nop + IL_0001: ldloc.0 + IL_0002: newobj 0x06000007 + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: stfld 0x04000002 + IL_000f: br IL_00c8 + IL_0014: ldloc.s V_8 + IL_0016: newobj 0x0600000E + IL_001b: stloc.s V_8 + IL_001d: ldloc.s V_8 + IL_001f: ldloc.0 + IL_0020: stfld 0x04000009 + IL_0025: ldloc.s V_8 + IL_0027: ldc.i4.2 + IL_0028: stfld 0x04000008 + IL_002d: br IL_00c0 + IL_0032: ldloc.s V_9 + IL_0034: newobj 0x0600000B + IL_0039: stloc.s V_9 + IL_003b: ldloc.s V_9 + IL_003d: ldloc.s V_8 + IL_003f: stfld 0x04000007 + IL_0044: ldloc.s V_9 + IL_0046: ldc.i4.3 + IL_0047: stfld 0x04000006 + IL_004c: ldloc.s V_9 + IL_004e: ldfld 0x04000007 + IL_0053: ldfld 0x04000009 + IL_0058: ldfld 0x04000003 + IL_005d: brfalse.s IL_0072 + IL_005f: ldloc.s V_9 + IL_0061: ldfld 0x04000007 + IL_0066: ldfld 0x04000009 + IL_006b: ldfld 0x04000003 + IL_0070: br.s IL_009f + IL_0072: ldloc.s V_9 + IL_0074: ldfld 0x04000007 + IL_0079: ldfld 0x04000009 + IL_007e: ldloc.s V_9 + IL_0080: ldfld 0x04000007 + IL_0085: ldfld 0x04000009 + IL_008a: ldftn 0x06000008 + IL_0090: newobj 0x0A000009 + IL_0095: dup + IL_0096: stloc.s V_13 + IL_0098: stfld 0x04000003 + IL_009d: ldloc.s V_13 + IL_009f: stloc.s V_10 + IL_00a1: ldloc.s V_9 + IL_00a3: ldftn 0x0600000C + IL_00a9: newobj 0x0A000009 + IL_00ae: stloc.s V_11 + IL_00b0: ldloc.s V_9 + IL_00b2: ldftn 0x0600000D + IL_00b8: newobj 0x0A000009 + IL_00bd: stloc.s V_12 + IL_00bf: nop + IL_00c0: ldc.i4.1 + IL_00c1: stloc.s V_6 + IL_00c3: br IL_0032 + IL_00c8: ldc.i4.1 + IL_00c9: stloc.s V_7 + IL_00cb: br IL_0014 +} +{ + // Code size 12 (0xc) + .maxstack 1 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000002 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + IL_000a: ldloc.0 + IL_000b: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw +} +{ + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000B + IL_0006: ldarg.1 + IL_0007: brfalse.s IL_0015 + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: ldfld 0x04000006 + IL_0010: stfld 0x04000006 + IL_0015: ret +} +{ + // Code size 29 (0x1d) + .maxstack 2 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000006 + IL_0007: ldarg.0 + IL_0008: ldfld 0x04000007 + IL_000d: ldfld 0x04000009 + IL_0012: ldfld 0x04000002 + IL_0017: add.ovf + IL_0018: stloc.0 + IL_0019: br.s IL_001b + IL_001b: ldloc.0 + IL_001c: ret +} +{ + // Code size 41 (0x29) + .maxstack 2 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000006 + IL_0007: ldarg.0 + IL_0008: ldfld 0x04000007 + IL_000d: ldfld 0x04000009 + IL_0012: ldfld 0x04000002 + IL_0017: add.ovf + IL_0018: ldarg.0 + IL_0019: ldfld 0x04000007 + IL_001e: ldfld 0x04000008 + IL_0023: add.ovf + IL_0024: stloc.0 + IL_0025: br.s IL_0027 + IL_0027: ldloc.0 + IL_0028: ret +} +{ + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call 0x0A00000B + IL_0006: ldarg.1 + IL_0007: brfalse.s IL_0015 + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: ldfld 0x04000008 + IL_0010: stfld 0x04000008 + IL_0015: ret +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub ChangeLambdaParent() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Sub F() ' Closure 0 + Dim x = 1 + + While True ' Closure 1 + Dim y = 2 + + Dim a1 = New Func(Of Integer)(Function() x) + Dim a2 = New Func(Of Integer)(Function() y) + Dim a3 = New Func(Of Integer)(Function() x + 1) + End While + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__1-0, _Closure$__1-1}", + "C._Closure$__1-0: {$I0, $I2, _Lambda$__0, _Lambda$__2}", + "C._Closure$__1-1: {_Lambda$__1}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Sub F() ' Closure 0 + Dim x = 1 + + While True ' Closure 1 + Dim y = 2 + + Dim a1 = New Func(Of Integer)(Function() x) + Dim a2 = New Func(Of Integer)(Function() y) + Dim a3 = New Func(Of Integer)(Function() y + 1) + End While + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__1-0, _Closure$__1-1}", + "C._Closure$__1-0: {$I0, _Lambda$__0}", + "C._Closure$__1-1: {_Lambda$__1, _Lambda$__2#1}") + + g.VerifyMethodDefNames("F", "_Lambda$__0", "_Lambda$__2", "_Lambda$__1", "_Lambda$__2#1") + + g.VerifyIL(" + { + // Code size 106 (0x6a) + .maxstack 3 + IL_0000: nop + IL_0001: ldloc.0 + IL_0002: newobj 0x06000003 + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: stfld 0x04000001 + IL_000f: br.s IL_0065 + IL_0011: ldloc.1 + IL_0012: newobj 0x06000006 + IL_0017: stloc.1 + IL_0018: ldloc.1 + IL_0019: ldc.i4.2 + IL_001a: stfld 0x04000004 + IL_001f: ldloc.0 + IL_0020: ldfld 0x04000002 + IL_0025: brfalse.s IL_002f + IL_0027: ldloc.0 + IL_0028: ldfld 0x04000002 + IL_002d: br.s IL_0046 + IL_002f: ldloc.0 + IL_0030: ldloc.0 + IL_0031: ldftn 0x06000004 + IL_0037: newobj 0x0A000008 + IL_003c: dup + IL_003d: stloc.s V_10 + IL_003f: stfld 0x04000002 + IL_0044: ldloc.s V_10 + IL_0046: stloc.s V_7 + IL_0048: ldloc.1 + IL_0049: ldftn 0x06000007 + IL_004f: newobj 0x0A000008 + IL_0054: stloc.s V_8 + IL_0056: ldloc.1 + IL_0057: ldftn 0x06000008 + IL_005d: newobj 0x0A000008 + IL_0062: stloc.s V_9 + IL_0064: nop + IL_0065: ldc.i4.1 + IL_0066: stloc.s V_6 + IL_0068: br.s IL_0011 +} +{ + // Code size 12 (0xc) + .maxstack 1 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000001 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + IL_000a: ldloc.0 + IL_000b: ret +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000009 + IL_000a: throw +} +{ + // Code size 12 (0xc) + .maxstack 1 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000004 + IL_0007: stloc.0 + IL_0008: br.s IL_000a + IL_000a: ldloc.0 + IL_000b: ret +} +{ + // Code size 14 (0xe) + .maxstack 2 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000004 + IL_0007: ldc.i4.1 + IL_0008: add.ovf + IL_0009: stloc.0 + IL_000a: br.s IL_000c + IL_000c: ldloc.0 + IL_000d: ret +}") + End Sub). + Verify() + End Using + End Sub + + ''' + ''' We allow to add a capture as long as the closure tree shape remains the same. + ''' The value of the captured variable might be uninitialized in the lambda. + ''' We leave it up to the user to set its value as needed. + ''' + + Public Sub UninitializedCapture() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim y = 1 + + Dim a1 = Function() x + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__1-0}", + "C._Closure$__1-0: {_Lambda$__0}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim y = 1 + + Dim a1 = Function() x + y + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C: {_Closure$__1-0}", + "C._Closure$__1-0: {_Lambda$__0}") + + g.VerifyMethodDefNames("F", "_Lambda$__0") + + g.VerifyIL(" +{ + // Code size 35 (0x23) + .maxstack 2 + IL_0000: nop + IL_0001: newobj 0x06000007 + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000001 + IL_000e: ldloc.0 + IL_000f: ldc.i4.1 + IL_0010: stfld 0x04000002 + IL_0015: ldloc.0 + IL_0016: ldftn 0x06000008 + IL_001c: newobj 0x0A000009 + IL_0021: stloc.3 + IL_0022: ret +} +{ + // Code size 19 (0x13) + .maxstack 2 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000001 + IL_0007: ldarg.0 + IL_0008: ldfld 0x04000002 + IL_000d: add.ovf + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + IL_0011: ldloc.0 + IL_0012: ret +} +") + End Sub). + Verify() + End Using + End Sub + + + Public Sub CaptureOrdering() + Using test = New EditAndContinueTest() + test.AddBaseline( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim y = 1 + + Dim a1 = Function() x + y + End Sub +End Class +", + validator:= + Sub(g) + g.VerifySynthesizedMembers( + "C._Closure$__1-0: {_Lambda$__0}", + "C: {_Closure$__1-0}") + End Sub). + AddGeneration( + source:=" +Imports System +Class C + Sub F() + Dim x = 1 + Dim y = 1 + + Dim a1 = Function() y + x + End Sub +End Class +", + edits:={Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + validator:= + Sub(g) + ' Unlike local slots, the order is insignificant since the fields are referred to by name (MemberRef) + + g.VerifySynthesizedMembers( + "C: {_Closure$__1-0}", + "C._Closure$__1-0: {_Lambda$__0}") + + g.VerifyMethodDefNames("F", "_Lambda$__0") + + g.VerifyIL(" +{ + // Code size 35 (0x23) + .maxstack 2 + IL_0000: nop + IL_0001: newobj 0x06000007 + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: ldc.i4.1 + IL_0009: stfld 0x04000001 + IL_000e: ldloc.0 + IL_000f: ldc.i4.1 + IL_0010: stfld 0x04000002 + IL_0015: ldloc.0 + IL_0016: ldftn 0x06000008 + IL_001c: newobj 0x0A000009 + IL_0021: stloc.2 + IL_0022: ret +} +{ + // Code size 19 (0x13) + .maxstack 2 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld 0x04000002 + IL_0007: ldarg.0 + IL_0008: ldfld 0x04000001 + IL_000d: add.ovf + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + IL_0011: ldloc.0 + IL_0012: ret +} +") + End Sub). + Verify() + End Using + End Sub End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.vb index 4d3cce16dfcad..60e0335fc194b 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.vb @@ -56,8 +56,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests kind As SemanticEditKind, symbolProvider As Func(Of Compilation, ISymbol), Optional newSymbolProvider As Func(Of Compilation, ISymbol) = Nothing, + Optional rudeEdits As Func(Of SyntaxNode, RuntimeRudeEdit?) = Nothing, Optional preserveLocalVariables As Boolean = False) As SemanticEditDescription - Return New SemanticEditDescription(kind, symbolProvider, newSymbolProvider, preserveLocalVariables) + Return New SemanticEditDescription(kind, symbolProvider, newSymbolProvider, rudeEdits, preserveLocalVariables) End Function Friend Function ToLocalInfo(local As Cci.ILocalDefinition) As ILVisualizer.LocalInfo diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb index 42d674d001463..d538ab6ee456d 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb @@ -1433,10 +1433,11 @@ End Class g.VerifyIL(" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000006 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000006 + IL_000a: throw } ") End Sub). @@ -1589,10 +1590,11 @@ End Class g.VerifyIL(" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000006 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000006 + IL_000a: throw } { // Code size 10 (0xa) @@ -1681,10 +1683,11 @@ End Class IL_000c: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000009 - IL_0005: throw + IL_0000: ldstr 0x70000151 + IL_0005: newobj 0x0A000009 + IL_000a: throw } ") End Sub). @@ -2257,10 +2260,11 @@ End Class g.VerifyIL(" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000006 - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000006 + IL_000a: throw } { // Code size 15 (0xf) @@ -2358,11 +2362,13 @@ End Class IL_000c: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000009 - IL_0005: throw -}") + IL_0000: ldstr 0x70000151 + IL_0005: newobj 0x0A000009 + IL_000a: throw +} +") End Sub). Verify() End Using @@ -2421,11 +2427,13 @@ End Class g.VerifyIL(" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw -}") + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000005 + IL_000a: throw +} +") End Sub). AddGeneration( source:=" @@ -2529,11 +2537,13 @@ End Class g.VerifyIL(" { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000005 - IL_0005: throw -}") + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000005 + IL_000a: throw +} +") End Sub). AddGeneration( source:=" @@ -5853,10 +5863,11 @@ End Class IL_0026: ret } { - // Code size 6 (0x6) + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A00000A - IL_0005: throw + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A00000A + IL_000a: throw } { // Code size 9 (0x9) @@ -5894,8 +5905,6 @@ End Class Imports System Class C - Sub F() - End Sub End Class ", edits:= @@ -5924,10 +5933,18 @@ End Class g.VerifyIL(" { - // Code size 6 (0x6) + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000005 + IL_0005: newobj 0x0A000008 + IL_000a: throw +} +{ + // Code size 11 (0xb) .maxstack 8 - IL_0000: newobj 0x0A000008 - IL_0005: throw + IL_0000: ldstr 0x7000014E + IL_0005: newobj 0x0A000008 + IL_000a: throw } ") End Sub). @@ -6048,12 +6065,20 @@ End Class g.VerifyIL(" { - // Code size 6 (0x6) - .maxstack 8 - IL_0000: newobj 0x0A00000D - IL_0005: throw + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000299 + IL_0005: newobj 0x0A00000D + IL_000a: throw } - ") +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x700003E2 + IL_0005: newobj 0x0A00000D + IL_000a: throw +} +") End Sub). Verify() End Using @@ -6102,10 +6127,8 @@ End Class Imports System Class C - Sub F() - End Sub End Class - ", +", edits:= { Edit(SemanticEditKind.Delete, Function(c) c.GetMember("C.F"), newSymbolProvider:=Function(c) c.GetMember("C")) @@ -6134,10 +6157,18 @@ End Class g.VerifyIL(" { - // Code size 6 (0x6) - .maxstack 8 - IL_0000: newobj 0x0A000009 - IL_0005: throw + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000009 + IL_0005: newobj 0x0A000009 + IL_000a: throw +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000152 + IL_0005: newobj 0x0A000009 + IL_000a: throw } ") End Sub). @@ -6245,11 +6276,19 @@ End Class }) g.VerifyIL(" + { + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x7000000D + IL_0005: newobj 0x0A000023 + IL_000a: throw +} { - // Code size 6 (0x6) - .maxstack 8 - IL_0000: newobj 0x0A000023 - IL_0005: throw + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x70000156 + IL_0005: newobj 0x0A000023 + IL_000a: throw } ") End Sub). @@ -6362,10 +6401,18 @@ End Class g.VerifyIL(" { - // Code size 6 (0x6) - .maxstack 8 - IL_0000: newobj 0x0A00002D - IL_0005: throw + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x700002A1 + IL_0005: newobj 0x0A00002D + IL_000a: throw +} +{ + // Code size 11 (0xb) + .maxstack 8 + IL_0000: ldstr 0x700003EA + IL_0005: newobj 0x0A00002D + IL_000a: throw } ") End Sub). diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs index 399b1d913b463..e502484b6db37 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs @@ -332,14 +332,14 @@ public static void Main() Assert.True(result.HasChanges); - var syntaxMap = result.SemanticEdits[0].SyntaxMap; - Assert.NotNull(syntaxMap); + var syntaxMaps = result.SemanticEdits[0].SyntaxMaps; + Assert.True(syntaxMaps.HasMap); var newStatementSpan = result.ActiveStatements[0].Span; var newStatementTextSpan = newText.Lines.GetTextSpan(newStatementSpan); var newStatementSyntax = newSyntaxRoot.FindNode(newStatementTextSpan); - var oldStatementSyntaxMapped = syntaxMap(newStatementSyntax); + var oldStatementSyntaxMapped = syntaxMaps.MatchingNodes(newStatementSyntax); Assert.Same(oldStatementSyntax, oldStatementSyntaxMapped); } diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditingTestBase.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditingTestBase.cs index eb3cb951a2e8a..7823e55c40bf4 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditingTestBase.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditingTestBase.cs @@ -20,6 +20,7 @@ using Roslyn.Utilities; using Xunit; using Microsoft.CodeAnalysis.CSharp.Shared.Extensions; +using System.Linq; namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests { @@ -101,11 +102,14 @@ public static string GetResource(string keyword) internal static RudeEditDiagnosticDescription Diagnostic(RudeEditKind rudeEditKind, string squiggle, params string[] arguments) => new(rudeEditKind, squiggle, arguments, firstLine: null); - internal static SemanticEditDescription SemanticEdit(SemanticEditKind kind, Func symbolProvider, IEnumerable>? syntaxMap, string? partialType = null) - => new(kind, symbolProvider, (partialType != null) ? c => c.GetMember(partialType) : null, syntaxMap, hasSyntaxMap: syntaxMap != null, deletedSymbolContainerProvider: null); + internal static RuntimeRudeEditDescription RuntimeRudeEdit(int marker, RudeEditKind rudeEditKind, (int displayLine, int displayColumn) position, params string[] arguments) + => new(marker, rudeEditKind, new LinePosition(position.displayLine - 1, position.displayColumn - 1), arguments); + + internal static SemanticEditDescription SemanticEdit(SemanticEditKind kind, Func symbolProvider, IEnumerable<(TextSpan, TextSpan)>? syntaxMap, IEnumerable? rudeEdits = null, string? partialType = null) + => new(kind, symbolProvider, (partialType != null) ? c => c.GetMember(partialType) : null, syntaxMap, rudeEdits, hasSyntaxMap: syntaxMap != null, deletedSymbolContainerProvider: null); internal static SemanticEditDescription SemanticEdit(SemanticEditKind kind, Func symbolProvider, string? partialType = null, bool preserveLocalVariables = false, Func? deletedSymbolContainerProvider = null) - => new(kind, symbolProvider, (partialType != null) ? c => c.GetMember(partialType) : null, syntaxMap: null, preserveLocalVariables, deletedSymbolContainerProvider); + => new(kind, symbolProvider, (partialType != null) ? c => c.GetMember(partialType) : null, syntaxMap: null, rudeEdits: null, preserveLocalVariables, deletedSymbolContainerProvider); internal static string DeletedSymbolDisplay(string kind, string displayName) => string.Format(FeaturesResources.member_kind_and_name, kind, displayName); @@ -237,7 +241,7 @@ internal static void VerifyPreserveLocalVariables(EditScript edits, var newBody = SyntaxUtilities.TryGetDeclarationBody(newDeclaration, symbol: null); Contract.ThrowIfNull(newBody); - _ = oldBody.ComputeMatch(newBody, knownMatches: null); + _ = oldBody.ComputeMap(newBody, knownMatches: null); var oldStateMachineInfo = oldBody.GetStateMachineInfo(); var newStateMachineInfo = newBody.GetStateMachineInfo(); diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/StatementEditingTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/StatementEditingTests.cs index 704aeba32a110..3eb5efdae37d8 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/StatementEditingTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/StatementEditingTests.cs @@ -13,6 +13,7 @@ using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.EditAndContinue; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; +using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Xunit; @@ -2297,7 +2298,7 @@ class C void F() { - + } } "; @@ -2317,9 +2318,9 @@ void F() "; var edits = GetTopEdits(src1, src2); - // TODO: allow creating a new leaf closure: https://github.com/dotnet/roslyn/issues/54672 - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "this")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/1291")] @@ -2360,8 +2361,9 @@ void F() "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -2397,8 +2399,9 @@ void F() "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "this")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -2453,8 +2456,9 @@ void F() "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "this")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -2488,9 +2492,9 @@ void F() "; var edits = GetTopEdits(src1, src2); - // TODO: allow creating a new leaf closure: https://github.com/dotnet/roslyn/issues/54672 - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -2541,8 +2545,9 @@ void F() "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -2719,10 +2724,10 @@ void F() G(d => x); // OK G(e => x0 + y0); // OK - G(f => x1 + y0); // error - connecting Group #1 and Group #2 - G(g => x3 + x1); // error - multi-scope (conservative) - G(h => x + y0); // error - connecting Group #0 and Group #1 - G(i => x + x3); // error - connecting Group #0 and Group #2 + G(f => x1 + y0); // runtime rude edit - connecting Group #1 and Group #2 + G(g => x3 + x1); // runtime rude edit - multi-scope (conservative) + G(h => x + y0); // runtime rude edit - connecting Group #0 and Group #1 + G(i => x + x3); // runtime rude edit - connecting Group #0 and Group #2 } } } @@ -2731,19 +2736,15 @@ void F() "; var insert = GetTopEdits(src1, src2); - insert.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "y0", CSharpFeaturesResources.lambda, "x1", "y0"), - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x3", CSharpFeaturesResources.lambda, "x1", "x3"), - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "h", CSharpFeaturesResources.lambda, "y0", "this"), - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "i", CSharpFeaturesResources.lambda, "x3", "this")); + insert.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); var delete = GetTopEdits(src2, src1); - delete.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "y0", GetResource("lambda"), "x1", "y0"), - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "x3", GetResource("lambda"), "x1", "x3"), - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "F", GetResource("lambda"), "y0", "this"), - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "F", GetResource("lambda"), "x3", "this")); + delete.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -2784,15 +2785,16 @@ void F() G(a => x0); G(a => x1); - G(a => x0 + x1); // error: connecting previously disconnected closures + G(a => x0 + x1); // runtime rude edit: connecting previously disconnected closures } } } "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x1", CSharpFeaturesResources.lambda, "x0", "x1")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -2824,14 +2826,15 @@ void F() { int x0 = 0; // Group #0 foreach (int x1 in new[] { 1 }) // Group #1 - G(a => x0, a => x1, a => x0 + x1); // error: connecting previously disconnected closures + G(a => x0, a => x1, a => x0 + x1); // runtime rude edit: connecting previously disconnected closures } } "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x1", CSharpFeaturesResources.lambda, "x0", "x1")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -2869,15 +2872,15 @@ void F() G(a => x2); G(a => x0 + x1); // ok - G(a => x0 + x2); // error: connecting previously disconnected closures + G(a => x0 + x2); // runtime rude edit: connecting previously disconnected closures } } } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x2", CSharpFeaturesResources.lambda, "x0", "x2")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -2942,16 +2945,16 @@ void F() x0 = 1; x1 = 2; G(() => x0 + x1); // ok - G(() => x0 + x2); // error + G(() => x0 + x2); // runtime rude edit break; } } } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x0", CSharpFeaturesResources.lambda, "x2", "x0")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -2963,7 +2966,7 @@ public void Lambdas_Insert_Using1() class C { static bool G(Func f) => true; - static int F(object a, object b) => 1; + static int H(object a, object b) => 1; static IDisposable D() => null; @@ -2986,7 +2989,7 @@ static void F() class C { static bool G(Func f) => true; - static int F(object a, object b) => 1; + static int H(object a, object b) => 1; static IDisposable D() => null; @@ -3000,16 +3003,16 @@ static void F() G(() => y0); G(() => x1); - G(() => F(x0, y0)); // ok - G(() => F(x0, x1)); // error + G(() => H(x0, y0)); // ok + G(() => H(x0, x1)); // runtime rude edit } } } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x1", CSharpFeaturesResources.lambda, "x0", "x1")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -3021,7 +3024,7 @@ public void Lambdas_Insert_Catch1() class C { static bool G(Func f) => true; - static int F(object a, object b) => 1; + static int H(object a, object b) => 1; static void F() { @@ -3043,7 +3046,7 @@ static void F() class C { static bool G(Func f) => true; - static int F(object a, object b) => 1; + static int H(object a, object b) => 1; static void F() { @@ -3057,15 +3060,15 @@ static void F() G(() => x1); G(() => x0); //ok - G(() => F(x0, x1)); //error + G(() => H(x0, x1)); // runtime rude edit } } } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x1", CSharpFeaturesResources.lambda, "x0", "x1")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/1504")] @@ -3109,7 +3112,7 @@ static void F() } catch (Exception x0) when (G(() => x0) && G(() => x0) && // ok - G(() => x0 != x1)) // error + G(() => x0 != x1)) // runtime rude edit { G(() => x0); // ok } @@ -3117,10 +3120,9 @@ static void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x0", CSharpFeaturesResources.lambda, "x1", "x0") - ); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -4105,7 +4107,7 @@ class C void F() { - var f = new Func(a => a + x); + var f = new Func(a => a + x); } } "; @@ -4114,18 +4116,19 @@ void F() class C { - int x; + int x = 1; void F() { - var f = new Func(a => a); + var f = new Func(a => a); } } "; var edits = GetTopEdits(src1, src2); + var syntaxMap = GetSyntaxMap(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "F", "this")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -4166,8 +4169,8 @@ void F() var edits = GetTopEdits(src1, src2); // y is no longer captured in f2 - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "a2", "y", CSharpFeaturesResources.lambda)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/51297")] @@ -4190,9 +4193,12 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int a1", "a1")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.this[]")), + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: true), + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/51297")] @@ -4220,8 +4226,12 @@ class C "Update [int this[int a] => new Func(() => { return a + 1; })();]@35 -> [int this[int a] => new Func(() => { return 2; })();]@35", "Update [=> new Func(() => { return a + 1; })()]@51 -> [=> new Func(() => { return 2; })()]@51"); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int a", "a")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.this[]")), + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: true), + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/51297")] @@ -4249,8 +4259,12 @@ class C "Update [int this[int a] => new Func(delegate { return a + 1; })();]@35 -> [int this[int a] => new Func(delegate { return 2; })();]@35", "Update [=> new Func(delegate { return a + 1; })()]@51 -> [=> new Func(delegate { return 2; })()]@51"); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int a", "a")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.this[]")), + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: true), + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -4273,9 +4287,8 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int a1", "a1")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/51297")] @@ -4304,9 +4317,14 @@ partial class C EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, [ - DocumentResults(diagnostics: [Diagnostic(RudeEditKind.NotCapturingVariable, "int a", "a")]), + DocumentResults( + semanticEdits: [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.this[]")), + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: true), + ]), DocumentResults(), - ]); + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -4330,8 +4348,14 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "get", "a1")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.this[]"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.this[]")), + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.get_Item"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.get_Item")) + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -4361,8 +4385,8 @@ void F(int a1, int a2) "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int a2", "a2")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/51297")] @@ -4385,9 +4409,8 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int a2", "a2")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -4410,9 +4433,12 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "F", "a2")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.F"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.F")) + ], + capabilities: EditAndContinueCapabilities.NewTypeDefinition | EditAndContinueCapabilities.AddMethodToExistingType); } [Fact] @@ -4436,9 +4462,12 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.ChangingCapturedVariableType, "a1", "a1", "int"), - Diagnostic(RudeEditKind.NotCapturingVariable, "F", "a2")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.F"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.F")) + ], + capabilities: EditAndContinueCapabilities.NewTypeDefinition | EditAndContinueCapabilities.AddMethodToExistingType); } [Fact] @@ -4462,9 +4491,12 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2"), - Diagnostic(RudeEditKind.DeletingCapturedVariable, "{", "a2")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.F"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.F")) + ], + capabilities: EditAndContinueCapabilities.NewTypeDefinition | EditAndContinueCapabilities.AddMethodToExistingType); } [Fact] @@ -4488,9 +4520,12 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2"), - Diagnostic(RudeEditKind.NotCapturingVariable, "F", "a2")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.F"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.F")) + ], + capabilities: EditAndContinueCapabilities.NewTypeDefinition | EditAndContinueCapabilities.AddMethodToExistingType); } [Fact] @@ -4535,10 +4570,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "a1", "a1"), - Diagnostic(RudeEditKind.NotCapturingVariable, "a3", "a3")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems?id=234448")] @@ -4569,9 +4602,8 @@ int D } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "set", "value")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_D"))); } [Fact, WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems?id=234448")] @@ -4602,9 +4634,8 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "set", "value")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"))); } [Fact, WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems?id=234448")] @@ -4635,9 +4666,8 @@ event Action D } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "add", "value")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.add_D"))); } [Fact, WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems?id=234448")] @@ -4650,7 +4680,7 @@ class C { event Action D { - add { } + add { } remove { new Action(() => { Console.Write(value); }).Invoke(); } } } @@ -4668,9 +4698,8 @@ event Action D } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "remove", "value")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.remove_D"))); } [Fact] @@ -4681,9 +4710,8 @@ public void Lambdas_Update_CeaseCapture_ConstructorInitializer_This() var src2 = "class C { C(int x) : this(() => 1) {} C(Func f) {} }"; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int x", "x")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C").InstanceConstructors.Single(m => m.Parameters is [{ Name: "x" }]), preserveLocalVariables: true)); } [Fact] @@ -4695,8 +4723,8 @@ public void Lambdas_Update_CeaseCapture_ConstructorInitializer_Base() var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int x", "x")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C..ctor"), preserveLocalVariables: true)); } [Theory] @@ -4709,8 +4737,8 @@ public void Lambdas_Update_CeaseCapture_PrimaryParameter_InPrimaryConstructor_Fi var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int x", "x")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)); } [Theory] @@ -4723,8 +4751,8 @@ public void Lambdas_Update_CeaseCapture_PrimaryParameter_InPrimaryConstructor_Se var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int y", "y")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)); } [Theory] @@ -4738,8 +4766,8 @@ public void Lambdas_Update_CeaseCapture_PrimaryParameter_InPrimaryConstructor_Ba var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int x", "x")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)); } [Fact] @@ -4750,8 +4778,8 @@ public void Lambdas_Update_CeaseCapture_PrimaryParameter_Method_First() var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "M", "x")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M"), preserveLocalVariables: true)); } [Fact] @@ -4827,8 +4855,8 @@ void F() var edits = GetTopEdits(src1, src2); // y is no longer captured in f2 - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.DeletingCapturedVariable, "{", "y").WithFirstLine("{ // error")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -4852,8 +4880,11 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.this[]")), + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: true) + ]); } [Fact] @@ -4877,8 +4908,8 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: true)); } [Fact] @@ -4901,9 +4932,14 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.this[]"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.get_Item"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.this[]")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.get_Item")), + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -4927,8 +4963,8 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"), preserveLocalVariables: true)); } [Fact] @@ -4959,9 +4995,9 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "set", "value")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -4992,9 +5028,9 @@ event Action D } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "remove", "value")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.remove_D"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -5007,7 +5043,7 @@ class C { event Action D { - add { } + add { } remove { } } } @@ -5026,8 +5062,9 @@ event Action D "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "remove", "value")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.remove_D"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -5056,9 +5093,8 @@ void F(int a1, int a2) } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5081,9 +5117,8 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5106,9 +5141,12 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.F"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.F")) + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -5141,9 +5179,12 @@ partial class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.F").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.F").PartialImplementationPart, partialType: "C") + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -5180,9 +5221,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5193,9 +5233,9 @@ public void Lambdas_Update_Capturing_ConstructorInitializer_This() var src2 = "class C { C(int x) : this(() => x) {} C(Func f) {} }"; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C").InstanceConstructors.Single(m => m.Parameters is [{ Name: "x" }]), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -5206,9 +5246,8 @@ public void Lambdas_Update_Capturing_ConstructorInitializer_Base() var src2 = "class C : B { C(int x) : base(() => x) {} } class B { public B(Func f) {} }"; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C..ctor"), preserveLocalVariables: true)); } [Theory] @@ -5220,9 +5259,9 @@ public void Lambdas_Update_Capturing_PrimaryParameter_InPrimaryConstructor_First var src2 = keyword + " C(int x, int y) { System.Func z = () => x; }"; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Theory] @@ -5234,9 +5273,9 @@ public void Lambdas_Update_Capturing_PrimaryParameter_InPrimaryConstructor_Secon var src2 = keyword + " C(int x, int y) { System.Func z = () => x + y; }"; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "y", "y")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Theory] @@ -5249,9 +5288,9 @@ public void Lambdas_Update_Capturing_PrimaryParameter_InPrimaryConstructor_BaseI var src2 = keyword + " C(int x, int y) : B(() => x);"; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C").InstanceConstructors.Single(m => m.Parameters is [_, _]), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -5261,9 +5300,8 @@ public void Lambdas_Update_Capturing_PrimaryParameter_Method_First() var src2 = "class C(int x, int y) { System.Func M() => () => x; }"; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M"), preserveLocalVariables: true)); } [Fact] @@ -5363,9 +5401,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "this")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5406,9 +5443,8 @@ partial void F() // impl } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "this").WithFirstLine("partial void F() // impl")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F").PartialImplementationPart, preserveLocalVariables: true, partialType: "C")); } [Fact] @@ -5449,8 +5485,8 @@ partial void F() // impl "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x").WithFirstLine("partial class C(int x)")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F").PartialImplementationPart, preserveLocalVariables: true, partialType: "C")); } [Fact] @@ -5486,8 +5522,8 @@ void F() "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a1", "this", CSharpFeaturesResources.lambda)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5519,9 +5555,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a1", "x", CSharpFeaturesResources.lambda)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5550,9 +5585,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5592,9 +5626,8 @@ void F() "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "x", "x", CSharpFeaturesResources.lambda).WithFirstLine("x+ // 1"), - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "x", "x", CSharpFeaturesResources.lambda).WithFirstLine("x; // 2")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5631,9 +5664,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "y", "y", CSharpFeaturesResources.lambda)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5713,9 +5745,8 @@ void F() "; var edits = GetTopEdits(src1, src2); - // TODO: better diagnostics - identify a1 that causes the capture vs. a1 that doesn't - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1").WithFirstLine("var f1 = new Func(a1 =>")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5754,9 +5785,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "x0", "x0", CSharpFeaturesResources.lambda)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5808,9 +5838,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "a", "x0", CSharpFeaturesResources.lambda)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5865,8 +5894,8 @@ void F() "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "x0", "x0", CSharpFeaturesResources.lambda)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5921,13 +5950,8 @@ void F() "; var edits = GetTopEdits(src1, src2); - // TODO: "a => x + x0" is matched with "a => y1 + x0", hence we report more errors. - // Including statement distance when matching would help. - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "a", "this", CSharpFeaturesResources.lambda).WithFirstLine("G(a => y1 + x0); // error: connecting previously disconnected closures"), - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "y1", "y1", CSharpFeaturesResources.lambda).WithFirstLine("G(a => y1 + x0); // error: connecting previously disconnected closures"), - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a", "this", CSharpFeaturesResources.lambda).WithFirstLine("G(a => x); // error: disconnecting previously connected closures"), - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "a", "y1", CSharpFeaturesResources.lambda).WithFirstLine("G(a => x); // error: disconnecting previously connected closures")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -5969,17 +5993,16 @@ void F() G(a => b => x0); // ok G(a => b => x1); // ok - G(a => b => x0 + x1); // error + G(a => b => x0 + x1); // runtime rude edit } } } } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x1", CSharpFeaturesResources.lambda, "x0", "x1"), - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x1", CSharpFeaturesResources.lambda, "x0", "x1")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -5991,10 +6014,10 @@ public void Lambdas_CapturedLocal_Rename() class C { static void F() - { + { int x = 1; Func f = () => x; - } + } }"; var src2 = @" using System; @@ -6002,16 +6025,20 @@ static void F() class C { static void F() - { + { int X = 1; Func f = () => X; - } + } }"; var edits = GetTopEdits(src1, src2); + var syntaxMap = GetSyntaxMap(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.RenamingCapturedVariable, "X", "x", "X")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), syntaxMap[0], rudeEdits: + [ + RuntimeRudeEdit(0, RudeEditKind.RenamingCapturedVariable, (8, 13), ["x", "X"]) + ])); } [Fact] @@ -6023,10 +6050,10 @@ public void Lambdas_CapturedLocal_ChangeType() class C { static void F() - { + { int x = 1; - Func f = () => x; - } + Func f = () => x; + } }"; var src2 = @" using System; @@ -6034,20 +6061,24 @@ static void F() class C { static void F() - { + { byte x = 1; - Func f = () => x; - } + Func f = () => x; + } }"; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.ChangingCapturedVariableType, "x", "x", "int")); + var syntaxMap = GetSyntaxMap(src1, src2)[0]; + edits.VerifySemantics( + SemanticEdit( + SemanticEditKind.Update, + c => c.GetMember("C.F"), + syntaxMap, + rudeEdits: [RuntimeRudeEdit(marker: 0, RudeEditKind.ChangingCapturedVariableType, (8, 14), ["x", "int"])])); } [Fact] - public void Lambdas_CapturedParameter_Rename() + public void Lambdas_CapturedParameter_Rename_BlockBody() { var src1 = @" using System; @@ -6055,8 +6086,117 @@ public void Lambdas_CapturedParameter_Rename() class C { static void F(int x) + { + Func f = () => x; + } +}"; + var src2 = @" +using System; + +class C +{ + static void F(int X) + { + Func f = () => X; + } +}"; + + var edits = GetTopEdits(src1, src2); + var syntaxMap = GetSyntaxMap(src1, src2)[0]; + + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), syntaxMap, + rudeEdits: [RuntimeRudeEdit(marker: 0, RudeEditKind.RenamingCapturedVariable, (6, 23), ["x", "X"])]), + ], + capabilities: EditAndContinueCapabilities.UpdateParameters); + } + + [Fact] + public void Lambdas_CapturedParameter_Rename_ExpressionBody() + { + var src1 = @" +using System; + +class C +{ + static void G(Func f) {} + static void F(int x) => G(() => x); +}"; + var src2 = @" +using System; + +class C +{ + static void G(Func f) {} + static void F(int X) => G(() => X); +}"; + + var edits = GetTopEdits(src1, src2); + var syntaxMap = GetSyntaxMap(src1, src2)[0]; + + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), syntaxMap, + rudeEdits: [RuntimeRudeEdit(marker: 0, RudeEditKind.RenamingCapturedVariable, (7, 23), ["x", "X"])]), + ], + capabilities: EditAndContinueCapabilities.UpdateParameters); + } + + [Fact] + public void Lambdas_CapturedParameter_Rename_Lambda_BlockBody() + { + var src1 = @" +using System; + +class C +{ + static void F() + { + Func f1 = x => + { + Func f2 = () => x; + }; + } +}"; + var src2 = @" +using System; + +class C +{ + static void F() + { + Func f1 = X => + { + Func f2 = () => X; + }; + } +}"; + + var edits = GetTopEdits(src1, src2); + var syntaxMap = GetSyntaxMap(src1, src2)[0]; + + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), syntaxMap, + rudeEdits: [RuntimeRudeEdit(marker: 2, RudeEditKind.RenamingCapturedVariable, (8, 29), ["x", "X"])]), + ], + capabilities: EditAndContinueCapabilities.UpdateParameters); + } + + [Fact] + public void Lambdas_CapturedParameter_Rename_Lambda_ExpressionBody() + { + var src1 = @" +using System; + +class C +{ + static int G(Func f) => 1; + + static void F() { - Func f = () => x; + Func f1 = x => G(() => x); } }"; var src2 = @" @@ -6064,16 +6204,92 @@ static void F(int x) class C { - static void F(int X) + static int G(Func f) => 1; + + static void F() { - Func f = () => X; + Func f1 = X => G(() => X); } }"; var edits = GetTopEdits(src1, src2); + var syntaxMap = GetSyntaxMap(src1, src2)[0]; - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.RenamingCapturedVariable, "X", "x", "X")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), syntaxMap, + rudeEdits: [RuntimeRudeEdit(marker: 2, RudeEditKind.RenamingCapturedVariable, (10, 39), ["x", "X"])]), + ], + capabilities: EditAndContinueCapabilities.UpdateParameters); + } + + [Fact] + public void Lambdas_CapturedParameter_Rename_ConstructorDeclaration() + { + var src1 = @" +using System; + +class B(Func f); + +class C +{ + C(int x, int y) : base(() => x) + { + Func g = () => y; + } +}"; + var src2 = @" +using System; + +class B(Func f); + +class C +{ + C(int X, int Y) : base(() => X) + { + Func g = () => Y; + } +}"; + + var edits = GetTopEdits(src1, src2); + var syntaxMap = GetSyntaxMap(src1, src2)[0]; + + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C..ctor"), syntaxMap, + // only the first rude edit is reported for each node: + rudeEdits: [RuntimeRudeEdit(marker: 0, RudeEditKind.RenamingCapturedVariable, (8, 16), ["x", "X"])]), + ], + capabilities: EditAndContinueCapabilities.UpdateParameters); + } + + [Fact] + public void Lambdas_CapturedParameter_Rename_PrimaryConstructorDeclaration() + { + var src1 = @" +using System; + +class B(Func f); + +class C(int x) : B(() => x); +"; + var src2 = @" +using System; + +class B(Func f); + +class C(int X) : B(() => X); +"; + + var edits = GetTopEdits(src1, src2); + var syntaxMap = GetSyntaxMap(src1, src2)[0]; + + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C..ctor"), syntaxMap, + rudeEdits: [RuntimeRudeEdit(marker: 0, RudeEditKind.RenamingCapturedVariable, (6, 18), ["x", "X"])]), + ], + capabilities: EditAndContinueCapabilities.UpdateParameters); } [Fact] @@ -6103,8 +6319,12 @@ static void F(byte x) var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.ChangingCapturedVariableType, "x", "x", "int")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.F"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.F")) + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType); } [Fact] @@ -6128,8 +6348,14 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.ChangingCapturedVariableType, "a", "a", "int")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.this[]"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.this[]")), + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.get_Item"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.get_Item")) + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType); } [Fact] @@ -6153,8 +6379,14 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.ChangingCapturedVariableType, "a", "a", "int")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.get_Item"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.get_Item")), + SemanticEdit(SemanticEditKind.Delete, c => c.GetMember("C.this[]"), deletedSymbolContainerProvider: c => c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.this[]")), + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType); } [Fact] @@ -6792,9 +7024,9 @@ void F() "; var edits = GetTopEdits(src1, src2); - // TODO: allow creating a new leaf closure: https://github.com/dotnet/roslyn/issues/54672 - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "this")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/1291"), WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -6835,8 +7067,9 @@ void F() "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -6874,9 +7107,9 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "this")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -6931,8 +7164,9 @@ int f3(int c) "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "this")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -6991,10 +7225,10 @@ void F() int f4(int a) => x; // OK int f5(int a) => x0 + y0; // OK - int f6(int a) => x1 + y0; // error - connecting Group #1 and Group #2 - int f7(int a) => x3 + x1; // error - multi-scope (conservative) - int f8(int a) => x + y0; // error - connecting Group #0 and Group #1 - int f9(int a) => x + x3; // error - connecting Group #0 and Group #2 + int f6(int a) => x1 + y0; // runtime rude edit - connecting Group #1 and Group #2 + int f7(int a) => x3 + x1; // runtime rude edit - multi-scope (conservative) + int f8(int a) => x + y0; // runtime rude edit - connecting Group #0 and Group #1 + int f9(int a) => x + x3; // runtime rude edit - connecting Group #0 and Group #2 } } } @@ -7002,20 +7236,14 @@ void F() } "; var insert = GetTopEdits(src1, src2); - - insert.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "y0", GetResource("local function"), "x1", "y0"), - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x3", GetResource("local function"), "x1", "x3"), - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "f8", GetResource("local function"), "y0", "this"), - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "f9", GetResource("local function"), "x3", "this")); + insert.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); var delete = GetTopEdits(src2, src1); - - delete.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "y0", GetResource("local function"), "x1", "y0"), - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "x3", GetResource("local function"), "x1", "x3"), - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "F", GetResource("local function"), "y0", "this"), - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "F", GetResource("local function"), "x3", "this")); + delete.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7026,6 +7254,8 @@ public void LocalFunctions_Insert_ForEach1() class C { + void G(Func f) {} + void F() { foreach (int x0 in new[] { 1 }) // Group #0 @@ -7054,15 +7284,15 @@ void F() int f0(int a) => x0; int f1(int a) => x1; - int f2(int a) => x0 + x1; // error: connecting previously disconnected closures + int f2(int a) => x0 + x1; // runtime rude edit: connecting previously disconnected closures } } } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x1", CSharpFeaturesResources.local_function, "x0", "x1")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7127,16 +7357,16 @@ void F() x0 = 1; x1 = 2; int f01() => x0 + x1; // ok - int f02() => x0 + x2; // error + int f02() => x0 + x2; // runtime rude edit break; } } } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x0", CSharpFeaturesResources.local_function, "x2", "x0")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7178,15 +7408,15 @@ static void F() int f1() => x1; int f00() => x0; //ok - int f01() => F(x0, x1); //error + int f01() => F(x0, x1); // runtime rude edit } } } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x1", CSharpFeaturesResources.local_function, "x0", "x1")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -7243,7 +7473,7 @@ void F() class C { - int x; + int x = 1; void F() { @@ -7252,9 +7482,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "F", "this")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -7693,8 +7922,8 @@ int f1(int a1) var edits = GetTopEdits(src1, src2); // y is no longer captured in f2 - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "f2", "y", CSharpFeaturesResources.local_function)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7717,9 +7946,8 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int a1", "a1")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7748,9 +7976,8 @@ void F(int a1, int a2) } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int a2", "a2")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7787,9 +8014,8 @@ int f1(int a1, int a2) } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "int a1", "a1")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7820,9 +8046,8 @@ int D } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "set", "value")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_D"))); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7853,9 +8078,8 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "set", "value")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"))); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7886,9 +8110,8 @@ event Action D } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "add", "value")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.add_D"))); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7901,7 +8124,7 @@ class C { event Action D { - add { } + add { } remove { void f() { Console.Write(value); } f(); } } } @@ -7919,9 +8142,8 @@ event Action D } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "remove", "value")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.remove_D"))); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7960,8 +8182,8 @@ int f1(int a1) "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.DeletingCapturedVariable, "{", "y")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -7985,8 +8207,8 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8010,8 +8232,8 @@ class C "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8042,9 +8264,9 @@ class C } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "set", "value")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition | EditAndContinueCapabilities.UpdateParameters); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8075,9 +8297,9 @@ event Action D } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "remove", "value")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.remove_D"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition | EditAndContinueCapabilities.UpdateParameters); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8090,7 +8312,7 @@ class C { event Action D { - add { } + add { } remove { } } } @@ -8108,9 +8330,9 @@ event Action D } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "remove", "value")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.remove_D"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition | EditAndContinueCapabilities.UpdateParameters); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8139,9 +8361,8 @@ void F(int a1, int a2) } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8178,9 +8399,8 @@ int f1(int a1, int a2) } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8213,9 +8433,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "this")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8256,9 +8475,8 @@ partial void F() // impl } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "this")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F").PartialImplementationPart, preserveLocalVariables: true, partialType: "C")); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8293,9 +8511,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "f1", "this", CSharpFeaturesResources.local_function)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8335,9 +8552,8 @@ int f1(int a1) "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "x", "x", CSharpFeaturesResources.local_function), - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "x", "x", CSharpFeaturesResources.local_function)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -8374,9 +8590,8 @@ void F() } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "y", "y", CSharpFeaturesResources.local_function)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -8455,9 +8670,8 @@ int f1(int a1) } "; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -8505,31 +8719,38 @@ public void LocalFunctions_RenameCapturedLocal() using System; using System.Diagnostics; -class Program +class C { - static void Main() - { + static void F() + { int x = 1; int f() => x; - } + } }"; var src2 = @" using System; using System.Diagnostics; -class Program +class C { - static void Main() - { + static void F() + { int X = 1; int f() => X; - } + } }"; var edits = GetTopEdits(src1, src2); + var syntaxMap = GetSyntaxMap(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.RenamingCapturedVariable, "X", "x", "X")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), syntaxMap[0], rudeEdits: + [ + RuntimeRudeEdit(0, RudeEditKind.RenamingCapturedVariable, (9, 13), ["x", "X"]) + ]) + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition); } [Fact] @@ -8539,29 +8760,36 @@ public void LocalFunctions_RenameCapturedParameter() using System; using System.Diagnostics; -class Program +class C { - static void Main(int x) - { + static void F(int x) + { int f() => x; - } + } }"; var src2 = @" using System; using System.Diagnostics; -class Program +class C { - static void Main(int X) - { + static void F(int X) + { int f() => X; - } + } }"; var edits = GetTopEdits(src1, src2); + var syntaxMap = GetSyntaxMap(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.RenamingCapturedVariable, "X", "x", "X")); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), syntaxMap[0], rudeEdits: + [ + RuntimeRudeEdit(0, RudeEditKind.RenamingCapturedVariable, (7, 23), ["x", "X"]) + ]) + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition | EditAndContinueCapabilities.UpdateParameters); } [Fact] @@ -10539,10 +10767,8 @@ where Z(() => a + 1) > 0 } }"; var edits = GetTopEdits(src1, src2); - - // TODO: better location (the variable, not the from clause) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "from b in new[] { 2 }", "b")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -10587,9 +10813,8 @@ where Z(() => a + b) > 0 } }"; var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "b", "b")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -10669,8 +10894,8 @@ where Z(() => a) > 0 } "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a", "a", CSharpFeaturesResources.select_clause)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -10709,9 +10934,9 @@ where Z(() => a) > 0 } "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a", "a", CSharpFeaturesResources.select_clause), - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a", "a", CSharpFeaturesResources.lambda)); + + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -10752,8 +10977,8 @@ where Z(() => a) > 0 } "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "select", "a", CSharpFeaturesResources.select_clause)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -10792,9 +11017,8 @@ where Z(() => a) > 0 } "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a", "a", CSharpFeaturesResources.select_clause), - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a", "a", CSharpFeaturesResources.lambda)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true)); } [Fact] @@ -12940,10 +13164,8 @@ public void TopLevelStatement_Capture_Args() var x = new Func(() => args); "; var edits = GetTopEdits(src1, src2); - - // TODO: allow creating a new leaf closure: https://github.com/dotnet/roslyn/issues/54672 - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "var x = new Func(() => args);", "args")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.
$"), preserveLocalVariables: true)); } [Fact] @@ -12960,10 +13182,8 @@ public void TopLevelStatement_CeaseCapture_Args() var x = new Func(() => null); "; var edits = GetTopEdits(src1, src2); - - // TODO: allow creating a new leaf closure: https://github.com/dotnet/roslyn/issues/54672 - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "var x = new Func(() => null);", "args")); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.
$"), preserveLocalVariables: true)); } [Fact] @@ -12990,8 +13210,8 @@ public void TopLevelStatement_CeaseCapture_Args_Closure() var edits = GetTopEdits(src1, src2); // y is no longer captured in f2 - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "a2", "args", CSharpFeaturesResources.lambda)); + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.
$"), preserveLocalVariables: true)); } [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/21499")] @@ -13018,13 +13238,14 @@ public void TopLevelStatement_InsertMultiScopeCapture() int f0(int a) => x0; int f1(int a) => x1; - int f2(int a) => x0 + x1; // error: connecting previously disconnected closures + int f2(int a) => x0 + x1; // runtime rude edit: connecting previously disconnected closures } "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x1", CSharpFeaturesResources.local_function, "x0", "x1")); + edits.VerifySemantics( + [SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.
$"), preserveLocalVariables: true)], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.NewTypeDefinition | EditAndContinueCapabilities.UpdateParameters); } #endregion diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/TopLevelEditingTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/TopLevelEditingTests.cs index 077dd9d31b85d..64af32404a9a5 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/TopLevelEditingTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/TopLevelEditingTests.cs @@ -16279,7 +16279,7 @@ partial class C ActiveStatementsDescription.Empty, new[] { - SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C").GetMember("F")), + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")), SemanticEdit(SemanticEditKind.Update, c => c.GetParameterlessConstructor("C"), syntaxMap[0]), }); } @@ -16294,8 +16294,11 @@ public void FieldInitializerUpdate_Lambdas_InsertPrimaryConstructorParameterUse( var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "y", "y")); + edits.VerifySemantics( + new[] + { + SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C").InstanceConstructors.Single(c => c.Parameters is [_, _]), preserveLocalVariables: true), + }); } [Fact] diff --git a/src/EditorFeatures/Test/EditAndContinue/RudeEditDiagnosticTests.cs b/src/EditorFeatures/Test/EditAndContinue/RudeEditDiagnosticTests.cs index 032af20015772..a1602143f2a3d 100644 --- a/src/EditorFeatures/Test/EditAndContinue/RudeEditDiagnosticTests.cs +++ b/src/EditorFeatures/Test/EditAndContinue/RudeEditDiagnosticTests.cs @@ -58,8 +58,6 @@ public void ToDiagnostic() RudeEditKind.InsertIntoStruct, RudeEditKind.InsertIntoStruct, RudeEditKind.ChangingCapturedVariableType, - RudeEditKind.AccessingCapturedVariableInLambda, - RudeEditKind.NotAccessingCapturedVariableInLambda, RudeEditKind.RenamingCapturedVariable, RudeEditKind.ChangingStateMachineShape, RudeEditKind.InternalError, @@ -70,8 +68,6 @@ public void ToDiagnostic() var arg3 = new HashSet() { - RudeEditKind.InsertLambdaWithMultiScopeCapture, - RudeEditKind.DeleteLambdaWithMultiScopeCapture, RudeEditKind.ChangingNamespace, }; diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/DeclaratorMapDescription.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/DeclaratorMapDescription.cs deleted file mode 100644 index b093e3050db37..0000000000000 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/DeclaratorMapDescription.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Collections.Immutable; -using Microsoft.CodeAnalysis.Text; -using Roslyn.Utilities; -using Xunit; - -namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests -{ - public sealed class SyntaxMapDescription - { - public readonly ImmutableArray> OldSpans; - public readonly ImmutableArray> NewSpans; - - public SyntaxMapDescription(string oldSource, string newSource) - { - OldSpans = SourceMarkers.GetNodeSpans(oldSource); - NewSpans = SourceMarkers.GetNodeSpans(newSource); - - Assert.Equal(OldSpans.Length, NewSpans.Length); - for (var i = 0; i < OldSpans.Length; i++) - { - Assert.Equal(OldSpans[i].Length, NewSpans[i].Length); - } - } - - internal IEnumerable> this[int i] - { - get - { - for (var j = 0; j < OldSpans[i].Length; j++) - { - yield return KeyValuePairUtil.Create(OldSpans[i][j], NewSpans[i][j]); - } - } - } - } -} diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs index af57c0013c831..6c895e5022425 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs @@ -364,20 +364,19 @@ SymbolKey CreateSymbolKey(SemanticEditDescription edit) actualSemanticEdit.PartialType?.Resolve(newCompilation, ignoreAssemblyKey: true).Symbol, message: $"{message}, {editKind}({expectedNewSymbol ?? expectedOldSymbol}): Partial types do not match"); + var expectedSyntaxMap = expectedSemanticEdit.GetSyntaxMap(); + // Edit is expected to have a syntax map: - var actualSyntaxMap = actualSemanticEdit.SyntaxMap; + var actualSyntaxMaps = actualSemanticEdit.SyntaxMaps; AssertEx.AreEqual( - expectedSemanticEdit.HasSyntaxMap, - actualSyntaxMap != null, + expectedSyntaxMap != null, + actualSyntaxMaps.HasMap, message: $"{message}, {editKind}({expectedNewSymbol ?? expectedOldSymbol}): Incorrect syntax map"); // If expected map is specified validate its mappings with the actual one: - var expectedSyntaxMap = expectedSemanticEdit.SyntaxMap; - if (expectedSyntaxMap != null) { - Contract.ThrowIfNull(actualSyntaxMap); - VerifySyntaxMap(oldRoot, newRoot, expectedSyntaxMap, actualSyntaxMap); + VerifySyntaxMaps(oldRoot, newRoot, expectedSyntaxMap, actualSyntaxMaps); } } } @@ -385,27 +384,37 @@ SymbolKey CreateSymbolKey(SemanticEditDescription edit) public static SyntaxNode FindNode(SyntaxNode root, TextSpan span) { var result = root.FindToken(span.Start).Parent!; - while (result.Span != span) + while (result != null) { + if (result.Span == span) + { + return result; + } + result = result.Parent!; } - return result; + throw new Exception($"Unable to find node with span {span} `{root.GetText().GetSubText(span)}` in:{Environment.NewLine}{root}"); } - private static void VerifySyntaxMap( + private static void VerifySyntaxMaps( SyntaxNode oldRoot, SyntaxNode newRoot, - IEnumerable> expectedSyntaxMap, - Func actualSyntaxMap) + IEnumerable<(TextSpan oldSpan, TextSpan newSpan, RuntimeRudeEditDescription? runtimeRudeEdit)> expectedMapping, + SyntaxMaps actualSyntaxMaps) { - foreach (var expectedSpanMapping in expectedSyntaxMap) - { - var newNode = FindNode(newRoot, expectedSpanMapping.Value); - var expectedOldNode = FindNode(oldRoot, expectedSpanMapping.Key); - var actualOldNode = actualSyntaxMap(newNode); + Contract.ThrowIfFalse(actualSyntaxMaps.HasMap); + foreach (var (oldSpan, newSpan, expectedRuntimeRudeEdit) in expectedMapping) + { + var newNode = FindNode(newRoot, newSpan); + var expectedOldNode = FindNode(oldRoot, oldSpan); + var actualOldNode = actualSyntaxMaps.MatchingNodes(newNode); Assert.Equal(expectedOldNode, actualOldNode); + + AssertEx.Equal( + expectedRuntimeRudeEdit?.GetMessage(newRoot.SyntaxTree), + actualSyntaxMaps.RuntimeRudeEdits?.Invoke(newNode)?.Message); } } @@ -466,7 +475,7 @@ private static string DisplaySpan(SyntaxTree tree, SourceFileSpan span) internal static IEnumerable> GetMethodMatches(AbstractEditAndContinueAnalyzer analyzer, Match bodyMatch) { Dictionary? lazyActiveOrMatchedLambdas = null; - var map = analyzer.GetTestAccessor().IncludeLambdaBodyMaps(BidirectionalMap.FromMatch(bodyMatch), new ArrayBuilder(), ref lazyActiveOrMatchedLambdas); + var map = analyzer.GetTestAccessor().IncludeLambdaBodyMaps(DeclarationBodyMap.FromMatch(bodyMatch), new ArrayBuilder(), ref lazyActiveOrMatchedLambdas); var result = new Dictionary(); foreach (var pair in map.Forward) diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/RuntimeRudeEditDescription.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/RuntimeRudeEditDescription.cs new file mode 100644 index 0000000000000..ba9486aad9ee6 --- /dev/null +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/RuntimeRudeEditDescription.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests; + +internal sealed class RuntimeRudeEditDescription(int markerId, RudeEditKind kind, LinePosition position, string[] arguments) +{ + public int MarkerId { get; } = markerId; + + public string GetMessage(SyntaxTree tree) + => new RudeEditDiagnostic(kind, tree.GetText().Lines.GetTextSpan(new LinePositionSpan(position, position)), syntaxKind: 0, arguments).ToDiagnostic(tree).ToString(); +} diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/SemanticEditDescription.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/SemanticEditDescription.cs index 135d9bb311306..b8c9b4d57b7e2 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/SemanticEditDescription.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/SemanticEditDescription.cs @@ -4,39 +4,46 @@ using System; using System.Collections.Generic; +using System.Linq; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Text; -namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests +namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests; + +internal sealed class SemanticEditDescription( + SemanticEditKind kind, + Func symbolProvider, + Func? partialType, + IEnumerable<(TextSpan, TextSpan)>? syntaxMap, + IEnumerable? rudeEdits, + bool hasSyntaxMap, + Func? deletedSymbolContainerProvider) { - public sealed class SemanticEditDescription - { - public readonly SemanticEditKind Kind; - public readonly Func SymbolProvider; - public readonly Func? PartialType; - public readonly Func? DeletedSymbolContainerProvider; + public readonly SemanticEditKind Kind = kind; + public readonly Func SymbolProvider = symbolProvider; + public readonly Func? PartialType = partialType; + public readonly Func? DeletedSymbolContainerProvider = deletedSymbolContainerProvider; + + /// + /// If specified the node mappings will be validated against the actual syntax map function. + /// + public IEnumerable<(TextSpan oldSpan, TextSpan newSpan, RuntimeRudeEditDescription? runtimeRudeEdit)>? GetSyntaxMap() + => HasSyntaxMap ? GetSyntaxMapWithRudeEdits(syntaxMap, rudeEdits) : null; - /// - /// If specified the node mappings will be validated against the actual syntax map function. - /// - public readonly IEnumerable>? SyntaxMap; + public readonly bool HasSyntaxMap = hasSyntaxMap; - public readonly bool HasSyntaxMap; + private static IEnumerable<(TextSpan oldSpan, TextSpan newSpan, RuntimeRudeEditDescription? runtimeRudeEdit)> GetSyntaxMapWithRudeEdits(IEnumerable<(TextSpan, TextSpan)>? syntaxMap, IEnumerable? rudeEdits) + { + if (syntaxMap == null) + { + yield break; + } - public SemanticEditDescription( - SemanticEditKind kind, - Func symbolProvider, - Func? partialType, - IEnumerable>? syntaxMap, - bool hasSyntaxMap, - Func? deletedSymbolContainerProvider) + var markerId = 0; + foreach (var (oldSpan, newSpan) in syntaxMap) { - Kind = kind; - SymbolProvider = symbolProvider; - SyntaxMap = syntaxMap; - PartialType = partialType; - HasSyntaxMap = hasSyntaxMap; - DeletedSymbolContainerProvider = deletedSymbolContainerProvider; + yield return (oldSpan, newSpan, rudeEdits?.SingleOrDefault(e => e.MarkerId == markerId)); + markerId++; } } } diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/SourceMarkers.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/SourceMarkers.cs index 141c01a39880d..c73f63ab089ca 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/SourceMarkers.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/SourceMarkers.cs @@ -40,7 +40,7 @@ internal static string[] Clear(string[] sources) private static IEnumerable<(int, int)> ParseIds(Match match) => from ids in match.Groups["Id"].Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) let parts = ids.Split('.') - select (int.Parse(parts[0]), (parts.Length > 1) ? int.Parse(parts[1]) : 0); + select (int.Parse(parts[0]), (parts.Length > 1) ? int.Parse(parts[1]) : -1); private static IEnumerable<((int major, int minor) id, TextSpan span)> GetSpans(string markedSource, string tagName) { @@ -143,10 +143,12 @@ public static ImmutableArray> GetNodeSpans(string marke foreach (var ((major, minor), span) in GetSpans(markedSource, tagName: "N")) { - EnsureSlot(result, major); - result[major] ??= new List(); - EnsureSlot(result[major], minor); - result[major][minor] = span; + var (i, j) = (minor >= 0) ? (major, minor) : (0, major); + + EnsureSlot(result, i); + result[i] ??= []; + EnsureSlot(result[i], j); + result[i][j] = span; } return result.Select(r => r.AsImmutableOrEmpty()).AsImmutableOrEmpty(); diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/SyntaxMapDescription.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/SyntaxMapDescription.cs new file mode 100644 index 0000000000000..bb82a7810b109 --- /dev/null +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/SyntaxMapDescription.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.Text; +using Xunit; + +namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests; + +public sealed class SyntaxMapDescription +{ + // Spans from markers. Indexed by major and then minor. + public readonly ImmutableArray> OldSpans; + public readonly ImmutableArray> NewSpans; + + public SyntaxMapDescription(string oldSource, string newSource) + { + OldSpans = SourceMarkers.GetNodeSpans(oldSource); + NewSpans = SourceMarkers.GetNodeSpans(newSource); + + Assert.Equal(OldSpans.Length, NewSpans.Length); + for (var i = 0; i < OldSpans.Length; i++) + { + Assert.Equal(OldSpans[i].Length, NewSpans[i].Length); + } + } + + internal ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> this[int i] + => OldSpans[i].ZipAsArray(NewSpans[i], static (oldSpan, newSpan) => (oldSpan, newSpan)); +} diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditAndContinueValidation.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditAndContinueValidation.vb index 0ad28bda6edde..ae1c82aa991c5 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditAndContinueValidation.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditAndContinueValidation.vb @@ -112,5 +112,22 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests validator.VerifySemantics(editScripts, framework, expected, capabilities) Next End Sub + + + Friend Sub VerifySemantics( + editScript As EditScript(Of SyntaxNode), + semanticEdits As SemanticEditDescription(), + capabilities As EditAndContinueCapabilities) + + VerifySemantics(editScript, ActiveStatementsDescription.Empty, semanticEdits, capabilities:=capabilities) + End Sub + + + Friend Sub VerifySemantics( + editScript As EditScript(Of SyntaxNode), + ParamArray semanticEdits As SemanticEditDescription()) + + VerifySemantics(editScript, ActiveStatementsDescription.Empty, semanticEdits) + End Sub End Module End Namespace diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditingTestBase.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditingTestBase.vb index 4122c71f03c88..6306965d19c96 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditingTestBase.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditingTestBase.vb @@ -127,9 +127,14 @@ End Namespace Return New RudeEditDiagnosticDescription(rudeEditKind, squiggle, arguments, firstLine:=Nothing) End Function + Friend Shared Function RuntimeRudeEdit(marker As Integer, rudeEditKind As RudeEditKind, position As (displayLine As Integer, displayColumn As Integer), ParamArray arguments As String()) As RuntimeRudeEditDescription + Return New RuntimeRudeEditDescription(marker, rudeEditKind, New LinePosition(position.displayLine - 1, position.displayColumn - 1), arguments) + End Function + Friend Shared Function SemanticEdit(kind As SemanticEditKind, symbolProvider As Func(Of Compilation, ISymbol), - syntaxMap As IEnumerable(Of KeyValuePair(Of TextSpan, TextSpan)), + syntaxMap As IEnumerable(Of (TextSpan, TextSpan)), + Optional rudeEdits As IEnumerable(Of RuntimeRudeEditDescription) = Nothing, Optional partialType As String = Nothing, Optional deletedSymbolContainerProvider As Func(Of Compilation, ISymbol) = Nothing) As SemanticEditDescription Return New SemanticEditDescription( @@ -137,6 +142,7 @@ End Namespace symbolProvider, If(partialType Is Nothing, Nothing, Function(c As Compilation) CType(c.GetMember(partialType), ITypeSymbol)), syntaxMap, + rudeEdits, hasSyntaxMap:=syntaxMap IsNot Nothing, deletedSymbolContainerProvider) End Function @@ -151,6 +157,7 @@ End Namespace symbolProvider, If(partialType Is Nothing, Nothing, Function(c As Compilation) CType(c.GetMember(partialType), ITypeSymbol)), syntaxMap:=Nothing, + rudeEdits:=Nothing, hasSyntaxMap:=preserveLocalVariables, deletedSymbolContainerProvider) End Function diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/StatementEditingTests.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/StatementEditingTests.vb index cdc7a10e18a49..7cd9bc259e3cc 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/StatementEditingTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/StatementEditingTests.vb @@ -1039,9 +1039,9 @@ Class C End Class" Dim edits = GetTopEdits(src1, src2) - ' TODO allow creating a new leaf closure: : https://github.com/dotnet/roslyn/issues/54672 - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "Me")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -1076,9 +1076,9 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "x", "x")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -1115,8 +1115,9 @@ End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "Me")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -1165,8 +1166,9 @@ End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "Me")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -1222,10 +1224,10 @@ Class C G(Function(a) x) ' OK G(Function(a) x0 + y0) ' OK - G(Function(a) x1 + y0) ' error - connecting Group #1 and Group #2 - G(Function(a) x3 + x1) ' error - multi-scope (conservative) - G(Function(a) x + y0) ' error - connecting Group #0 and Group #1 - G(Function(a) x + x3) ' error - connecting Group #0 and Group #2 + G(Function(a) x1 + y0) ' runtime rude edit - connecting Group #1 and Group #2 + G(Function(a) x3 + x1) ' runtime rude edit - multi-scope (conservative) + G(Function(a) x + y0) ' runtime rude edit - connecting Group #0 and Group #1 + G(Function(a) x + x3) ' runtime rude edit - connecting Group #0 and Group #2 Loop Loop Loop @@ -1233,18 +1235,14 @@ Class C End Class" Dim insert = GetTopEdits(src1, src2) - insert.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "y0", GetResource("Lambda"), "x1", "y0"), - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "x3", GetResource("Lambda"), "x1", "x3"), - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "Function(a)", GetResource("Lambda"), "y0", "Me"), - Diagnostic(RudeEditKind.InsertLambdaWithMultiScopeCapture, "Function(a)", GetResource("Lambda"), "x3", "Me")) + insert.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) Dim delete = GetTopEdits(src2, src1) - delete.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "y0", GetResource("Lambda"), "x1", "y0"), - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "x3", GetResource("Lambda"), "x1", "x3"), - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "F", GetResource("Lambda"), "y0", "Me"), - Diagnostic(RudeEditKind.DeleteLambdaWithMultiScopeCapture, "F", GetResource("Lambda"), "x3", "Me")) + delete.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -1987,7 +1985,7 @@ End Class Imports System Class C - Dim x As Integer + Dim x As Integer = 1 Sub F() Dim f = New Func(Of Integer, Integer)(Function(a) a) @@ -1995,8 +1993,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "F", "Me")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -2029,10 +2027,8 @@ End Class " Dim edits = GetTopEdits(src1, src2) - - ' TODO: better location - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "Function(a2)", "y", VBFeaturesResources.Lambda)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -2058,8 +2054,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "a1 As Integer", "a1")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.get_Item"), preserveLocalVariables:=True)}) End Sub @@ -2085,8 +2081,15 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "Get", "a1")) + + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember("C.get_Item"), deletedSymbolContainerProvider:=Function(c) c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("C.get_Item")), + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember("C.Item"), deletedSymbolContainerProvider:=Function(c) c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("C.Item")) + }, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2110,9 +2113,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "a2 As Integer", "a2"), - Diagnostic(RudeEditKind.NotCapturingVariable, "Value As Integer", "Value")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_Item"), preserveLocalVariables:=True)}) End Sub @@ -2136,9 +2138,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "a2 As Integer", "a2"), - Diagnostic(RudeEditKind.NotCapturingVariable, "Set", "Value")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_Item"), preserveLocalVariables:=True)}) End Sub @@ -2162,9 +2163,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "a2 As Integer", "a2"), - Diagnostic(RudeEditKind.NotCapturingVariable, "Set", "Value")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_Item"), preserveLocalVariables:=True)}) End Sub @@ -2188,9 +2188,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "a2 As Integer", "a2"), - Diagnostic(RudeEditKind.NotCapturingVariable, "Set", "Value")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_Item"), preserveLocalVariables:=True)}) End Sub @@ -2212,8 +2211,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "a2 As Integer", "a2")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -2235,8 +2234,12 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "F", "a2")) + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember("C.F"), deletedSymbolContainerProvider:=Function(c) c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("C.F")) + }, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2258,9 +2261,12 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.ChangingCapturedVariableType, "a1", "a1", "Integer"), - Diagnostic(RudeEditKind.NotCapturingVariable, "F", "a2")) + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember("C.F"), deletedSymbolContainerProvider:=Function(c) c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("C.F")) + }, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2283,9 +2289,12 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2"), - Diagnostic(RudeEditKind.DeletingCapturedVariable, "Sub F(a1 As Integer, a2 As Integer)", "a2")) + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember("C.F"), deletedSymbolContainerProvider:=Function(c) c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("C.F")) + }, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2308,9 +2317,12 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2"), - Diagnostic(RudeEditKind.NotCapturingVariable, "F", "a2")) + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember("C.F"), deletedSymbolContainerProvider:=Function(c) c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("C.F")) + }, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2340,9 +2352,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "a1", "a1")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -2377,7 +2388,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics(Diagnostic(RudeEditKind.NotCapturingVariable, "Set", "Value")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_D"))}) End Sub @@ -2412,7 +2424,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics(Diagnostic(RudeEditKind.NotCapturingVariable, "Set", "Value")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_D"))}) End Sub @@ -2447,7 +2460,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics(Diagnostic(RudeEditKind.NotCapturingVariable, "Value As Integer", "Value")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_D"))}) End Sub @@ -2486,7 +2500,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics(Diagnostic(RudeEditKind.NotCapturingVariable, "Value As Action", "Value")) + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.add_D"))) End Sub @@ -2525,7 +2540,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics(Diagnostic(RudeEditKind.NotCapturingVariable, "Value As Action", "Value")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.remove_D"))}) End Sub @@ -2555,8 +2571,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.DeletingCapturedVariable, "Sub F()", "y")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -2600,11 +2616,9 @@ End Class " Dim edits = GetTopEdits(src1, src2) - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a", "a"), - Diagnostic(RudeEditKind.CapturingVariable, "b", "b"), - Diagnostic(RudeEditKind.CapturingVariable, "c", "c")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2630,9 +2644,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.get_Item"), preserveLocalVariables:=True)}) End Sub @@ -2658,9 +2671,13 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2")) + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember("C.Item"), deletedSymbolContainerProvider:=Function(c) c.GetMember("C")), + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember("C.get_Item"), deletedSymbolContainerProvider:=Function(c) c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("C.Item")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("C.get_Item")) + }, capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2692,8 +2709,9 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_Item"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2728,7 +2746,9 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics(Diagnostic(RudeEditKind.CapturingVariable, "Set", "Value")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_D"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2763,7 +2783,9 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics(Diagnostic(RudeEditKind.CapturingVariable, "Set", "Value")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_D"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2798,7 +2820,9 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics(Diagnostic(RudeEditKind.CapturingVariable, "value", "value")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.set_D"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2837,7 +2861,9 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics(Diagnostic(RudeEditKind.CapturingVariable, "value", "value")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.add_D"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2876,7 +2902,9 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics(Diagnostic(RudeEditKind.CapturingVariable, "value", "value")) + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.remove_D"), preserveLocalVariables:=True)}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2898,8 +2926,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -2921,8 +2949,12 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2")) + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember("C.F"), deletedSymbolContainerProvider:=Function(c) c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("C.F")) + }, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2956,8 +2988,12 @@ Partial Public Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a2", "a2")) + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember(Of MethodSymbol)("C.F").PartialImplementationPart, deletedSymbolContainerProvider:=Function(c) c.GetMember("C"), partialType:="C"), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember(Of MethodSymbol)("C.F").PartialImplementationPart, partialType:="C") + }, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.NewTypeDefinition) End Sub @@ -2987,8 +3023,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -3014,8 +3050,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "Me")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -3051,8 +3087,8 @@ Partial Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "F", "Me").WithFirstLine("Private Sub F() ' impl")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember(Of MethodSymbol)("C.F").PartialImplementationPart, preserveLocalVariables:=True, partialType:="C")}) End Sub @@ -3080,8 +3116,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "Function(a1)", "Me", VBFeaturesResources.Lambda)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -3113,9 +3149,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "x", "x", VBFeaturesResources.Lambda).WithFirstLine("x + ' 1"), - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "x", "x", VBFeaturesResources.Lambda).WithFirstLine("x ' 2")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -3145,8 +3180,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "y", "y", VBFeaturesResources.Lambda)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -3212,8 +3247,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "a1", "a1").WithFirstLine("Function(a1)")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -3245,8 +3280,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "x0", "x0", VBFeaturesResources.Lambda)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -3297,8 +3332,8 @@ Class C End Sub End Class" Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "Function(a)", "x0", VBFeaturesResources.Lambda)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -3351,8 +3386,8 @@ Class C End Sub End Class" Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "x0", "x0", VBFeaturesResources.Lambda)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -3406,15 +3441,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - - ' TODO "Function(a) x + x0" is matched with "Function(a) y1 + x0", hence we report more errors. - ' Including statement distance when matching would help. - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "Function(a)", "Me", VBFeaturesResources.Lambda).WithFirstLine("G(Function(a) y1 + x0) ' error: connecting previously disconnected closures"), - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "y1", "y1", VBFeaturesResources.Lambda).WithFirstLine("G(Function(a) y1 + x0) ' error: connecting previously disconnected closures"), - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "Function(a)", "Me", VBFeaturesResources.Lambda).WithFirstLine("G(Function(a) x) ' error: disconnecting previously connected closures"), - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "Function(a)", "y1", VBFeaturesResources.Lambda).WithFirstLine("G(Function(a) x) ' error: disconnecting previously connected closures")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -3422,28 +3450,33 @@ End Class Dim src1 = " Imports System -Class Program - Shared Sub Main() +Class C + Shared Sub F() Dim x As Integer = 1 Dim f As Func(Of Integer) = Function() x - End Sub + End Sub End Class " Dim src2 = " Imports System -Class Program - Shared Sub Main() +Class C + Shared Sub F() Dim X As Integer = 1 Dim f As Func(Of Integer) = Function() X - End Sub + End Sub End Class " Dim edits = GetTopEdits(src1, src2) ' Note that lifted variable is a field, which can't be renamed - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.RenamingCapturedVariable, "X", "x", "X")) + Dim syntaxMap = GetSyntaxMap(src1, src2)(0) + + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), syntaxMap, rudeEdits:= + { + RuntimeRudeEdit(0, RudeEditKind.RenamingCapturedVariable, (6, 13), {"x", "X"}) + })) End Sub @@ -3451,27 +3484,32 @@ End Class Dim src1 = " Imports System -Class Program - Shared Sub Main() +Class C + Shared Sub F() Dim x As Integer = 1 Dim f As Func(Of Integer) = Function() x - End Sub + End Sub End Class " Dim src2 = " Imports System -Class Program - Shared Sub Main() +Class C + Shared Sub F() Dim y As Integer = 1 Dim f As Func(Of Integer) = Function() y - End Sub + End Sub End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.RenamingCapturedVariable, "y", "x", "y")) + Dim syntaxMap = GetSyntaxMap(src1, src2)(0) + + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), syntaxMap, rudeEdits:= + { + RuntimeRudeEdit(0, RudeEditKind.RenamingCapturedVariable, (6, 13), {"x", "y"}) + })) End Sub @@ -3479,27 +3517,33 @@ End Class Dim src1 = " Imports System -Class Program - Shared Sub Main() +Class C + Shared Sub F() Dim x As Integer = 1 - Dim f As Func(Of Integer) = Function() x - End Sub + Dim f As Func(Of Integer) = Function() x + End Sub End Class " Dim src2 = " Imports System -Class Program - Shared Sub Main() +Class C + Shared Sub F() Dim x As Byte = 1 - Dim f As Func(Of Integer) = Function() x - End Sub + Dim f As Func(Of Integer) = Function() x + End Sub End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.ChangingCapturedVariableType, "x", "x", "Integer")) + Dim syntaxMap = GetSyntaxMap(src1, src2)(0) + + edits.VerifySemantics( + SemanticEdit( + SemanticEditKind.Update, + Function(c) c.GetMember("C.F"), + syntaxMap, + rudeEdits:={RuntimeRudeEdit(marker:=0, RudeEditKind.ChangingCapturedVariableType, (6, 13), {"x", "Integer"})})) End Sub @@ -3507,35 +3551,157 @@ End Class Dim src1 = " Imports System -Class Program - Shared Sub Main(x As Integer) +Class C + Shared Sub F(x As Integer) Dim f As Func(Of Integer) = Function() x - End Sub + End Sub End Class " Dim src2 = " Imports System -Class Program - Shared Sub Main(y As Integer) +Class C + Shared Sub F(y As Integer) Dim f As Func(Of Integer) = Function() y - End Sub + End Sub End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.RenamingCapturedVariable, "y", "x", "y")) + Dim syntaxMap = GetSyntaxMap(src1, src2)(0) + + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), syntaxMap, rudeEdits:= + { + RuntimeRudeEdit(0, RudeEditKind.RenamingCapturedVariable, (5, 23), {"x", "y"}) + }) + }, + capabilities:=EditAndContinueCapabilities.UpdateParameters) End Sub - + + Public Sub Lambdas_CapturedParameter_Rename_Lambda_MultiLine() + Dim src1 = " +Imports System + +Class C + Shared Sub F(x As Integer) + Dim f1 = Function(x) + Dim f2 = Function() x + End Function + End Sub +End Class +" + Dim src2 = " +Imports System + +Class C + Shared Sub F(x As Integer) + Dim f1 = Function(y) + Dim f2 = Function() y + End Function + End Sub +End Class +" + + Dim edits = GetTopEdits(src1, src2) + Dim syntaxMap = GetSyntaxMap(src1, src2)(0) + + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), syntaxMap, rudeEdits:= + { + RuntimeRudeEdit(1, RudeEditKind.RenamingCapturedVariable, (6, 32), {"x", "y"}) + }) + }, + capabilities:=EditAndContinueCapabilities.UpdateParameters) + End Sub + + + Public Sub Lambdas_CapturedParameter_Rename_Lambda_SingleLine() + Dim src1 = " +Imports System + +Class C + Shared Function G(a As Func(Of Integer)) As Integer + Return 0 + End Function + + Shared Sub F(x As Integer) + Dim f1 = Function(x) G(Function() x) + End Sub +End Class +" + Dim src2 = " +Imports System + +Class C + Shared Function G(a As Func(Of Integer)) As Integer + Return 0 + End Function + + Shared Sub F(x As Integer) + Dim f1 = Function(y) G(Function() y) + End Sub +End Class +" + + Dim edits = GetTopEdits(src1, src2) + Dim syntaxMap = GetSyntaxMap(src1, src2)(0) + + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), syntaxMap, rudeEdits:= + { + RuntimeRudeEdit(1, RudeEditKind.RenamingCapturedVariable, (10, 32), {"x", "y"}) + }) + }, + capabilities:=EditAndContinueCapabilities.UpdateParameters) + End Sub + + + Public Sub Lambdas_CapturedParameter_Rename_ConstructorDeclaration() + Dim src1 = " +Imports System + +Class C + Sub New(x As Integer) + Dim f As Func(Of Integer) = Function() x + End Sub +End Class +" + Dim src2 = " +Imports System + +Class C + Sub New(y As Integer) + Dim f As Func(Of Integer) = Function() y + End Sub +End Class +" + + Dim edits = GetTopEdits(src1, src2) + Dim syntaxMap = GetSyntaxMap(src1, src2)(0) + + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C..ctor"), syntaxMap, rudeEdits:= + { + RuntimeRudeEdit(0, RudeEditKind.RenamingCapturedVariable, (5, 18), {"x", "y"}) + }) + }, + capabilities:=EditAndContinueCapabilities.UpdateParameters) + End Sub + + Public Sub Lambdas_CapturedParameter_ChangeType() Dim src1 = " Imports System -Class Program - Shared Sub Main(x As Integer) +Class C + Shared Sub F(x As Integer) Dim f As Func(Of Integer) = Function() x End Sub End Class @@ -3543,16 +3709,21 @@ End Class Dim src2 = " Imports System -Class Program - Shared Sub Main(x As Byte) +Class C + Shared Sub F(x As Byte) Dim f As Func(Of Integer) = Function() x End Sub End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.ChangingCapturedVariableType, "x", "x", "Integer")) + + edits.VerifySemantics( + { + SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember("C.F"), deletedSymbolContainerProvider:=Function(c) c.GetMember("C")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("C.F")) + }, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType) End Sub @@ -4742,9 +4913,8 @@ Class C End Sub End Class" Dim edits = GetTopEdits(src1, src2) - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "b In {2}", "b")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -4785,8 +4955,8 @@ Class C End Sub End Class" Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.CapturingVariable, "b", "b")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -4824,9 +4994,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a", "a", VBFeaturesResources.Select_clause)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -4866,8 +5035,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a", "a", VBFeaturesResources.Select_clause)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -4905,9 +5074,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a", "a", VBFeaturesResources.Select_clause), - Diagnostic(RudeEditKind.AccessingCapturedVariableInLambda, "a", "a", VBFeaturesResources.Lambda)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -4947,8 +5115,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "Select", "a", VBFeaturesResources.Select_clause)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub @@ -4986,9 +5154,8 @@ Class C End Class " Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "Select", "a", VBFeaturesResources.Select_clause), - Diagnostic(RudeEditKind.NotAccessingCapturedVariableInLambda, "Function()", "a", VBFeaturesResources.Lambda)) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True)}) End Sub diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/TopLevelEditingTests.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/TopLevelEditingTests.vb index 0b2f8430693a3..3eaf69d316e74 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/TopLevelEditingTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/TopLevelEditingTests.vb @@ -8809,9 +8809,8 @@ End Class " Dim edits = GetTopEdits(src1, src2) - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.NotCapturingVariable, "a As Integer", "a")) + edits.VerifySemantics( + semanticEdits:={SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.get_P"), preserveLocalVariables:=True)}) End Sub #End Region diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb index dc537aed674f2..f9247458648a8 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb @@ -501,14 +501,14 @@ End Class Dim result = Await AnalyzeDocumentAsync(oldProject, newDocument, baseActiveStatements) Assert.True(result.HasChanges) - Dim syntaxMap = result.SemanticEdits(0).SyntaxMap - Assert.NotNull(syntaxMap) + Dim syntaxMaps = result.SemanticEdits(0).SyntaxMaps + Assert.True(syntaxMaps.HasMap) Dim newStatementSpan = result.ActiveStatements(0).Span Dim newStatementTextSpan = newText.Lines.GetTextSpan(newStatementSpan) Dim newStatementSyntax = newSyntaxRoot.FindNode(newStatementTextSpan) - Dim oldStatementSyntaxMapped = syntaxMap(newStatementSyntax) + Dim oldStatementSyntaxMapped = syntaxMaps.MatchingNodes(newStatementSyntax) Assert.Same(oldStatementSyntax, oldStatementSyntaxMapped) End Using End Function diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EEAssemblyBuilder.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EEAssemblyBuilder.cs index 27ca3362bad6c..0dbe80d7b323d 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EEAssemblyBuilder.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EEAssemblyBuilder.cs @@ -161,15 +161,17 @@ public override bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentTy return false; } - public override bool TryGetPreviousClosure(SyntaxNode closureSyntax, out DebugId closureId) + public override bool TryGetPreviousClosure(SyntaxNode closureSyntax, DebugId? parentClosureId, ImmutableArray structCaptures, out DebugId closureId, out RuntimeRudeEdit? runtimeRudeEdit) { closureId = default; + runtimeRudeEdit = null; return false; } - public override bool TryGetPreviousLambda(SyntaxNode lambdaOrLambdaBodySyntax, bool isLambdaBody, out DebugId lambdaId) + public override bool TryGetPreviousLambda(SyntaxNode lambdaOrLambdaBodySyntax, bool isLambdaBody, int closureOrdinal, ImmutableArray structClosureIds, out DebugId lambdaId, out RuntimeRudeEdit? runtimeRudeEdit) { lambdaId = default; + runtimeRudeEdit = null; return false; } diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEMethodSymbol.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEMethodSymbol.cs index c0628dc363a94..37b022abd3dd3 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEMethodSymbol.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEMethodSymbol.cs @@ -648,8 +648,9 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState, if (sawLambdas || sawLocalFunctions) { - var closureDebugInfoBuilder = ArrayBuilder.GetInstance(); - var lambdaDebugInfoBuilder = ArrayBuilder.GetInstance(); + var closureDebugInfoBuilder = ArrayBuilder.GetInstance(); + var lambdaDebugInfoBuilder = ArrayBuilder.GetInstance(); + var lambdaRuntimeRudeEditsBuilder = ArrayBuilder.GetInstance(); body = ClosureConversion.Rewrite( loweredBody: body, @@ -658,9 +659,10 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState, method: this, methodOrdinal: _methodOrdinal, substitutedSourceMethod: this.SubstitutedSourceMethod.OriginalDefinition, - closureDebugInfoBuilder: closureDebugInfoBuilder, - lambdaDebugInfoBuilder: lambdaDebugInfoBuilder, - slotAllocatorOpt: null, + lambdaDebugInfoBuilder, + lambdaRuntimeRudeEditsBuilder, + closureDebugInfoBuilder, + slotAllocator: null, compilationState: compilationState, diagnostics: diagnostics, assignLocals: localsSet); @@ -668,6 +670,7 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState, // we don't need this information: closureDebugInfoBuilder.Free(); lambdaDebugInfoBuilder.Free(); + lambdaRuntimeRudeEditsBuilder.Free(); } } finally diff --git a/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/EEAssemblyBuilder.vb b/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/EEAssemblyBuilder.vb index 5db6dd6ce31a9..c407b7dc1bd4d 100644 --- a/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/EEAssemblyBuilder.vb +++ b/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/EEAssemblyBuilder.vb @@ -180,13 +180,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator Return False End Function - Public Overrides Function TryGetPreviousClosure(scopeSyntax As SyntaxNode, ByRef closureId As DebugId) As Boolean + Public Overrides Function TryGetPreviousClosure(closureSyntax As SyntaxNode, parentClosureId As DebugId?, structCaptures As ImmutableArray(Of String), ByRef closureId As DebugId, ByRef runtimeRudeEdit As RuntimeRudeEdit?) As Boolean closureId = Nothing + runtimeRudeEdit = Nothing Return False End Function - Public Overrides Function TryGetPreviousLambda(lambdaOrLambdaBodySyntax As SyntaxNode, isLambdaBody As Boolean, ByRef lambdaId As DebugId) As Boolean + Public Overrides Function TryGetPreviousLambda(lambdaOrLambdaBodySyntax As SyntaxNode, isLambdaBody As Boolean, closureOrdinal As Integer, structClosureIds As ImmutableArray(Of DebugId), ByRef lambdaId As DebugId, ByRef runtimeRudeEdit As RuntimeRudeEdit?) As Boolean lambdaId = Nothing + runtimeRudeEdit = Nothing Return False End Function diff --git a/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs b/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs index d27f69d36dcd3..59c46e3f2b092 100644 --- a/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs +++ b/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs @@ -12,6 +12,7 @@ using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Extensions; +using Microsoft.CodeAnalysis.CSharp.ExtractMethod; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Differencing; using Microsoft.CodeAnalysis.EditAndContinue; @@ -391,6 +392,22 @@ private static bool AreEquivalentIgnoringLambdaBodies(SyntaxNode left, SyntaxNod internal override bool IsClosureScope(SyntaxNode node) => LambdaUtilities.IsClosureScope(node); + internal override SyntaxNode GetCapturedParameterScope(SyntaxNode methodOrLambda) + => methodOrLambda switch + { + // lambda/local function parameter: + AnonymousFunctionExpressionSyntax lambda => lambda.Body, + // ctor parameter captured by a lambda in a ctor initializer: + ConstructorDeclarationSyntax ctor => ctor, + // block statement or arrow expression: + BaseMethodDeclarationSyntax method => method.Body ?? (SyntaxNode?)method.ExpressionBody!, + // primary constructor parameter: + ParameterListSyntax parameters => parameters.Parent!, + // top-level args: + CompilationUnitSyntax top => top, + _ => throw ExceptionUtilities.UnexpectedValue(methodOrLambda) + }; + protected override LambdaBody? FindEnclosingLambdaBody(SyntaxNode encompassingAncestor, SyntaxNode node) { var current = node; diff --git a/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/CSharpLambdaBody.cs b/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/CSharpLambdaBody.cs index 08369b381bad5..9b8377c27cd4d 100644 --- a/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/CSharpLambdaBody.cs +++ b/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/CSharpLambdaBody.cs @@ -38,6 +38,16 @@ public override ImmutableArray GetCapturedVariables(SemanticModel model public override Match? ComputeSingleRootMatch(DeclarationBody newBody, IEnumerable>? knownMatches) => CSharpEditAndContinueAnalyzer.ComputeBodyMatch(node, ((CSharpLambdaBody)newBody).Node, knownMatches); + public override DeclarationBodyMap ComputeMap(DeclarationBody newBody, IEnumerable>? knownMatches) + { + var map = base.ComputeMap(newBody, knownMatches); + + // Include the lambda body mapping if it hasn't been matched. + // This happens with the lambda body is an expression body. + // The expression body may be a closure scope and thus needs to be included in the map. + return map.Forward.ContainsKey(node) ? map : map.WithAdditionalMapping(node, ((CSharpLambdaBody)newBody).Node); + } + public override bool TryMatchActiveStatement(DeclarationBody newBody, SyntaxNode oldStatement, ref int statementPart, [NotNullWhen(true)] out SyntaxNode? newStatement) => CSharpEditAndContinueAnalyzer.TryMatchActiveStatement(Node, ((CSharpLambdaBody)newBody).Node, oldStatement, out newStatement); diff --git a/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/CopyConstructorDeclarationBody.cs b/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/CopyConstructorDeclarationBody.cs index 7e7e588150931..4033a95c08faa 100644 --- a/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/CopyConstructorDeclarationBody.cs +++ b/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/CopyConstructorDeclarationBody.cs @@ -22,6 +22,9 @@ public override bool HasExplicitInitializer public override SyntaxNode? ExplicitBody => null; + public override SyntaxNode? ParameterClosure + => null; + public override SyntaxNode? MatchRoot => null; diff --git a/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/InstanceConstructorDeclarationBody.cs b/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/InstanceConstructorDeclarationBody.cs index 92c215dbaf065..b2d0f286fb818 100644 --- a/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/InstanceConstructorDeclarationBody.cs +++ b/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/InstanceConstructorDeclarationBody.cs @@ -3,11 +3,13 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.Differencing; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue; @@ -23,6 +25,11 @@ internal abstract class InstanceConstructorDeclarationBody : MemberBody ///
public abstract SyntaxNode? ExplicitBody { get; } + /// + /// Node that represents the closure that constructor parameters captured within its body are lifted to. + /// + public abstract SyntaxNode? ParameterClosure { get; } + public sealed override SyntaxTree SyntaxTree => InitializerActiveStatement.SyntaxTree; @@ -98,4 +105,15 @@ public sealed override bool TryMatchActiveStatement(DeclarationBody newBody, Syn => MatchRoot is { } oldRoot && ((InstanceConstructorDeclarationBody)newBody).MatchRoot is { } newRoot ? SyntaxComparer.Statement.ComputeMatch(oldRoot, newRoot, knownMatches) : null; + + public override DeclarationBodyMap ComputeMap(DeclarationBody newBody, IEnumerable>? knownMatches) + { + var map = base.ComputeMap(newBody, knownMatches); + + // parameter closures are represented by the constructor or type declaration node, which may not be included in the match: + return ParameterClosure is { } parameterClosure && + ((InstanceConstructorDeclarationBody)newBody).ParameterClosure is { } newParameterClosure && + !map.Forward.ContainsKey(parameterClosure) + ? map.WithAdditionalMapping(parameterClosure, newParameterClosure) : map; + } } diff --git a/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/OrdinaryInstanceConstructorDeclarationBody.cs b/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/OrdinaryInstanceConstructorDeclarationBody.cs index 49d5e2a16ee62..f3590a16e6d8e 100644 --- a/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/OrdinaryInstanceConstructorDeclarationBody.cs +++ b/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/OrdinaryInstanceConstructorDeclarationBody.cs @@ -25,6 +25,9 @@ public sealed override SyntaxNode EncompassingAncestor public sealed override SyntaxNode? MatchRoot => constructor; + public sealed override SyntaxNode? ParameterClosure + => constructor; + public override OneOrMany RootNodes => OneOrMany.Create(constructor); } diff --git a/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/PrimaryConstructorDeclarationBody.cs b/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/PrimaryConstructorDeclarationBody.cs index 9dc6f628c8e53..a787c962a23c0 100644 --- a/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/PrimaryConstructorDeclarationBody.cs +++ b/src/Features/CSharp/Portable/EditAndContinue/DeclarationBody/PrimaryConstructorDeclarationBody.cs @@ -24,6 +24,9 @@ public sealed override SyntaxNode? ExplicitBody public sealed override OneOrMany RootNodes => OneOrMany.Create(InitializerActiveStatement); + public sealed override SyntaxNode? ParameterClosure + => typeDeclaration; + public sealed override TextSpan Envelope => InitializerActiveStatementSpan; } diff --git a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs index 345f62053e243..877d67db119c2 100644 --- a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs +++ b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs @@ -12,6 +12,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Collections; using Microsoft.CodeAnalysis.Contracts.EditAndContinue; using Microsoft.CodeAnalysis.Differencing; using Microsoft.CodeAnalysis.Emit; @@ -446,6 +447,7 @@ internal abstract void ReportOtherRudeEditsAroundActiveStatement( internal abstract bool IsLocalFunction(SyntaxNode node); internal abstract bool IsGenericLocalFunction(SyntaxNode node); internal abstract bool IsClosureScope(SyntaxNode node); + internal abstract SyntaxNode GetCapturedParameterScope(SyntaxNode declaringMethodOrLambda); internal abstract IMethodSymbol GetLambdaExpressionSymbol(SemanticModel model, SyntaxNode lambdaExpression, CancellationToken cancellationToken); internal abstract SyntaxNode? GetContainingQueryExpression(SyntaxNode node); internal abstract bool QueryClauseLambdasTypeEquivalent(SemanticModel oldModel, SyntaxNode oldNode, SemanticModel newModel, SyntaxNode newNode, CancellationToken cancellationToken); @@ -896,25 +898,25 @@ internal readonly struct LambdaInfo public readonly List? ActiveNodeIndices; // both fields are non-null for a matching lambda (lambda that exists in both old and new document): - public readonly BidirectionalMap? Match; + public readonly DeclarationBodyMap BodyMap; public readonly LambdaBody? NewBody; public LambdaInfo(List activeNodeIndices) - : this(activeNodeIndices, null, null) + : this(activeNodeIndices, DeclarationBodyMap.Empty, null) { } - private LambdaInfo(List? activeNodeIndices, BidirectionalMap? match, LambdaBody? newLambdaBody) + private LambdaInfo(List? activeNodeIndices, DeclarationBodyMap bodyMap, LambdaBody? newLambdaBody) { ActiveNodeIndices = activeNodeIndices; - Match = match; + BodyMap = bodyMap; NewBody = newLambdaBody; } public bool HasActiveStatement => ActiveNodeIndices != null; - public LambdaInfo WithMatch(BidirectionalMap match, LambdaBody newLambdaBody) + public LambdaInfo WithMatch(DeclarationBodyMap match, LambdaBody newLambdaBody) => new(ActiveNodeIndices, match, newLambdaBody); } @@ -937,7 +939,7 @@ private void AnalyzeChangedMemberBody( [Out] ImmutableArray.Builder newActiveStatements, [Out] ImmutableArray>.Builder newExceptionRegions, [Out] ArrayBuilder diagnostics, - out Func? syntaxMap, + out SyntaxMaps syntaxMaps, CancellationToken cancellationToken) { Debug.Assert(!newActiveStatementSpans.IsDefault); @@ -948,7 +950,6 @@ private void AnalyzeChangedMemberBody( var diagnosticContext = CreateDiagnosticContext(diagnostics, oldMember, newMember, newDeclaration, newModel, topMatch); - syntaxMap = null; var activeStatementIndices = oldMemberBody?.GetOverlappingActiveStatements(oldActiveStatements)?.ToArray() ?? []; if (isMemberReplaced && !activeStatementIndices.IsEmpty()) @@ -1050,13 +1051,13 @@ private void AnalyzeChangedMemberBody( var activeNodesInBody = activeNodes.Where(n => n.EnclosingLambdaBody == null).ToArray(); - var bodyMap = ComputeMatch(oldMemberBody, newMemberBody, activeNodesInBody); - var map = IncludeLambdaBodyMaps(bodyMap, activeNodes, ref lazyActiveOrMatchedLambdas); + var memberBodyMap = ComputeDeclarationBodyMap(oldMemberBody, newMemberBody, activeNodesInBody); + var aggregateBodyMap = IncludeLambdaBodyMaps(memberBodyMap, activeNodes, ref lazyActiveOrMatchedLambdas); var oldStateMachineInfo = oldMemberBody?.GetStateMachineInfo() ?? StateMachineInfo.None; var newStateMachineInfo = newMemberBody?.GetStateMachineInfo() ?? StateMachineInfo.None; - ReportStateMachineBodyUpdateRudeEdits(diagnosticContext, bodyMap, oldStateMachineInfo, newStateMachineInfo, hasActiveStatement: activeNodesInBody.Length != 0, cancellationToken); + ReportStateMachineBodyUpdateRudeEdits(diagnosticContext, memberBodyMap, oldStateMachineInfo, newStateMachineInfo, hasActiveStatement: activeNodesInBody.Length != 0, cancellationToken); ReportMemberOrLambdaBodyUpdateRudeEdits( diagnosticContext, @@ -1084,10 +1085,11 @@ private void AnalyzeChangedMemberBody( newMemberBody, newDeclaration, lazyActiveOrMatchedLambdas, - map, + aggregateBodyMap, capabilities, diagnostics, out var newBodyHasLambdas, + out var runtimeRudeEdits, cancellationToken); // We need to provide syntax map to the compiler if @@ -1101,15 +1103,17 @@ private void AnalyzeChangedMemberBody( // 4) Constructor that emits initializers is updated. // We create syntax map even if it's not necessary: if any data member initializers are active/contain lambdas. // Since initializers are usually simple the map should not be large enough to make it worth optimizing it away. - if (!activeNodes.IsEmpty() || + var matchingNodes = + (!activeNodes.IsEmpty() || newStateMachineInfo.HasSuspensionPoints || newBodyHasLambdas || IsConstructorWithMemberInitializers(newMember, cancellationToken) || oldDeclaration != null && IsDeclarationWithInitializer(oldDeclaration) || newDeclaration != null && IsDeclarationWithInitializer(newDeclaration)) - { - syntaxMap = CreateSyntaxMap(map.Reverse); - } + ? CreateSyntaxMap(aggregateBodyMap) + : null; + + syntaxMaps = new SyntaxMaps(newModel.SyntaxTree, matchingNodes, runtimeRudeEdits); foreach (var activeNode in activeNodes) { @@ -1125,12 +1129,12 @@ private void AnalyzeChangedMemberBody( newExceptionRegions[activeStatementIndex] = ImmutableArray.Empty; - BidirectionalMap? match; + DeclarationBodyMap enclosingBodyMap; DeclarationBody oldBody; DeclarationBody? newBody; if (oldEnclosingLambdaBody == null) { - match = bodyMap; + enclosingBodyMap = memberBodyMap; oldBody = oldMemberBody; newBody = newMemberBody; } @@ -1139,24 +1143,22 @@ private void AnalyzeChangedMemberBody( Debug.Assert(lazyActiveOrMatchedLambdas != null); var matchingLambdaInfo = lazyActiveOrMatchedLambdas[oldEnclosingLambdaBody]; - match = matchingLambdaInfo.Match; + enclosingBodyMap = matchingLambdaInfo.BodyMap; oldBody = oldEnclosingLambdaBody; newBody = matchingLambdaInfo.NewBody; } bool hasMatching; SyntaxNode? newStatementSyntax; - if (match != null) + if (newBody != null) { - Debug.Assert(newBody != null); - hasMatching = oldBody.TryMatchActiveStatement(newBody, oldStatementSyntax, ref statementPart, out newStatementSyntax); if (!hasMatching) { // If the body has an empty mapping then all active statements in the body must be mapped by TryMatchActiveStatement. - Debug.Assert(!match.Value.Forward.IsEmpty()); + Debug.Assert(!enclosingBodyMap.Forward.IsEmpty()); - hasMatching = match.Value.Forward.TryGetValue(oldStatementSyntax, out newStatementSyntax); + hasMatching = enclosingBodyMap.Forward.TryGetValue(oldStatementSyntax, out newStatementSyntax); } } else @@ -1171,7 +1173,6 @@ private void AnalyzeChangedMemberBody( if (hasMatching) { Debug.Assert(newStatementSyntax != null); - Debug.Assert(match != null); Debug.Assert(newBody != null); // The matching node doesn't produce sequence points. @@ -1187,19 +1188,19 @@ private void AnalyzeChangedMemberBody( // other statements around active statement: ReportOtherRudeEditsAroundActiveStatement( diagnostics, - match.Value.Reverse, + enclosingBodyMap.Reverse, oldStatementSyntax, oldBody, newStatementSyntax, newBody, isNonLeaf); } - else if (match == null) + else if (enclosingBodyMap.Forward.IsEmpty()) { Debug.Assert(oldEnclosingLambdaBody != null); Debug.Assert(lazyActiveOrMatchedLambdas != null); - newSpan = GetDeletedNodeDiagnosticSpan(oldEnclosingLambdaBody, oldMemberBody.EncompassingAncestor, bodyMap.Forward, lazyActiveOrMatchedLambdas); + newSpan = GetDeletedNodeDiagnosticSpan(oldEnclosingLambdaBody, oldMemberBody.EncompassingAncestor, memberBodyMap.Forward, lazyActiveOrMatchedLambdas); // Lambda containing the active statement can't be found in the new source. var oldLambda = oldEnclosingLambdaBody.GetLambda(); @@ -1208,14 +1209,14 @@ private void AnalyzeChangedMemberBody( } else { - newSpan = GetDeletedNodeActiveSpan(match.Value.Forward, oldStatementSyntax); + newSpan = GetDeletedNodeActiveSpan(enclosingBodyMap.Forward, oldStatementSyntax); if (isNonLeaf || isPartiallyExecuted) { // rude edit: internal active statement deleted diagnostics.Add( new RudeEditDiagnostic(isNonLeaf ? RudeEditKind.DeleteActiveStatement : RudeEditKind.PartiallyExecutedActiveStatementDelete, - GetDeletedNodeDiagnosticSpan(match.Value.Forward, oldStatementSyntax), + GetDeletedNodeDiagnosticSpan(enclosingBodyMap.Forward, oldStatementSyntax), arguments: new[] { FeaturesResources.code })); } } @@ -1223,13 +1224,11 @@ private void AnalyzeChangedMemberBody( // If there was a lambda, but we couldn't match its body to the new tree, then the lambda was // removed, so we don't need to check it for active statements. If there wasn't a lambda then // match here will be the same as bodyMatch. - if (match != null) + if (newBody != null) { - Debug.Assert(newBody != null); - // exception handling around the statement: CalculateExceptionRegionsAroundActiveStatement( - match.Value.Forward, + enclosingBodyMap.Forward, oldStatementSyntax, oldBody.EncompassingAncestor, newStatementSyntax, @@ -1280,6 +1279,8 @@ private void AnalyzeChangedMemberBody( { diagnosticContext.Report(RudeEditKind.MemberBodyInternalError, cancellationToken, arguments: new[] { newMember.Name, e.ToString() }); } + + syntaxMaps = new SyntaxMaps(newModel.SyntaxTree); } } @@ -1377,19 +1378,19 @@ private void CalculateExceptionRegionsAroundActiveStatement( /// /// Calculates a syntax map of the entire method body including all lambda bodies it contains. /// - private BidirectionalMap IncludeLambdaBodyMaps( - BidirectionalMap memberBodyMap, + private DeclarationBodyMap IncludeLambdaBodyMaps( + DeclarationBodyMap memberBodyMap, ArrayBuilder memberBodyActiveNodes, ref Dictionary? lazyActiveOrMatchedLambdas) { - ArrayBuilder<(BidirectionalMap map, SyntaxNode? oldLambda)>? lambdaBodyMatches = null; + ArrayBuilder<(DeclarationBodyMap map, SyntaxNode? oldLambda)>? lambdaBodyMaps = null; SyntaxNode? currentOldLambda = null; var currentLambdaBodyMatch = -1; - var currentBodyMatch = memberBodyMap; + var currentBodyMap = memberBodyMap; while (true) { - foreach (var (oldNode, newNode) in currentBodyMatch.Forward) + foreach (var (oldNode, newNode) in currentBodyMap.Forward) { // the node is a declaration of the current lambda (we already processed it): if (oldNode == currentOldLambda) @@ -1399,13 +1400,13 @@ private BidirectionalMap IncludeLambdaBodyMaps( if (TryGetLambdaBodies(oldNode, out var oldLambdaBody1, out var oldLambdaBody2)) { - lambdaBodyMatches ??= ArrayBuilder<(BidirectionalMap, SyntaxNode?)>.GetInstance(); - lazyActiveOrMatchedLambdas ??= new Dictionary(); + lambdaBodyMaps ??= ArrayBuilder<(DeclarationBodyMap, SyntaxNode?)>.GetInstance(); + lazyActiveOrMatchedLambdas ??= []; var newLambdaBody1 = oldLambdaBody1.TryGetPartnerLambdaBody(newNode); if (newLambdaBody1 != null) { - lambdaBodyMatches.Add((ComputeMatch(oldLambdaBody1, newLambdaBody1, memberBodyActiveNodes, lazyActiveOrMatchedLambdas), oldNode)); + lambdaBodyMaps.Add((ComputeLambdaBodyMap(oldLambdaBody1, newLambdaBody1, memberBodyActiveNodes, lazyActiveOrMatchedLambdas), oldNode)); } if (oldLambdaBody2 != null) @@ -1413,51 +1414,55 @@ private BidirectionalMap IncludeLambdaBodyMaps( var newLambdaBody2 = oldLambdaBody2.TryGetPartnerLambdaBody(newNode); if (newLambdaBody2 != null) { - lambdaBodyMatches.Add((ComputeMatch(oldLambdaBody2, newLambdaBody2, memberBodyActiveNodes, lazyActiveOrMatchedLambdas), oldNode)); + lambdaBodyMaps.Add((ComputeLambdaBodyMap(oldLambdaBody2, newLambdaBody2, memberBodyActiveNodes, lazyActiveOrMatchedLambdas), oldNode)); } } } } currentLambdaBodyMatch++; - if (lambdaBodyMatches == null || currentLambdaBodyMatch == lambdaBodyMatches.Count) + if (lambdaBodyMaps == null || currentLambdaBodyMatch == lambdaBodyMaps.Count) { break; } - (currentBodyMatch, currentOldLambda) = lambdaBodyMatches[currentLambdaBodyMatch]; + (currentBodyMap, currentOldLambda) = lambdaBodyMaps[currentLambdaBodyMatch]; } - if (lambdaBodyMatches == null) + if (lambdaBodyMaps == null) { return memberBodyMap; } var map = new Dictionary(); - var reverseMap = new Dictionary(); + var additionalReverseMap = ImmutableDictionary.CreateBuilder(); - // include all matches, including the root: + // include all matches and additional mappings, including the root: map.AddRange(memberBodyMap.Forward); - reverseMap.AddRange(memberBodyMap.Reverse); + additionalReverseMap.AddRange(memberBodyMap.AdditionalReverseMapping); - foreach (var (lambdaBodyMatch, _) in lambdaBodyMatches) + foreach (var (lambdaBodyMap, _) in lambdaBodyMaps) { - foreach (var (oldNode, newNode) in lambdaBodyMatch.Forward) + foreach (var (oldNode, newNode) in lambdaBodyMap.Forward) { if (!map.ContainsKey(oldNode)) { map[oldNode] = newNode; - reverseMap[newNode] = oldNode; } } + + additionalReverseMap.AddRange(lambdaBodyMap.AdditionalReverseMapping); } - lambdaBodyMatches?.Free(); + lambdaBodyMaps?.Free(); - return new BidirectionalMap(map, reverseMap); + return new DeclarationBodyMap( + map, + map.ToDictionary(keySelector: entry => entry.Value, elementSelector: entry => entry.Key), + additionalReverseMap.ToImmutable()); } - private static BidirectionalMap ComputeMatch( + private static DeclarationBodyMap ComputeLambdaBodyMap( LambdaBody oldLambdaBody, LambdaBody newLambdaBody, IReadOnlyList memberBodyActiveNodes, @@ -1476,7 +1481,7 @@ private static BidirectionalMap ComputeMatch( info = new LambdaInfo(); } - var lambdaBodyMatch = ComputeMatch(oldLambdaBody, newLambdaBody, activeNodesInLambdaBody); + var lambdaBodyMatch = ComputeDeclarationBodyMap(oldLambdaBody, newLambdaBody, activeNodesInLambdaBody); activeOrMatchedLambdas[oldLambdaBody] = info.WithMatch(lambdaBodyMatch, newLambdaBody); @@ -1486,14 +1491,14 @@ private static BidirectionalMap ComputeMatch( /// /// Called for a member body and for bodies of all lambdas and local functions (recursively) found in the member body. /// - private static BidirectionalMap ComputeMatch(DeclarationBody? oldBody, DeclarationBody? newBody, IEnumerable activeNodes) + private static DeclarationBodyMap ComputeDeclarationBodyMap(DeclarationBody? oldBody, DeclarationBody? newBody, IEnumerable activeNodes) => (oldBody != null && newBody != null) - ? oldBody.ComputeMatch(newBody, knownMatches: GetMatchingActiveNodes(activeNodes)) - : BidirectionalMap.Empty; + ? oldBody.ComputeMap(newBody, knownMatches: GetMatchingActiveNodes(activeNodes)) + : DeclarationBodyMap.Empty; private void ReportStateMachineBodyUpdateRudeEdits( in DiagnosticContext diagnosticContext, - BidirectionalMap match, + DeclarationBodyMap bodyMap, StateMachineInfo oldStateMachineInfo, StateMachineInfo newStateMachineInfo, bool hasActiveStatement, @@ -1508,7 +1513,7 @@ private void ReportStateMachineBodyUpdateRudeEdits( if (oldStateMachineInfo.HasSuspensionPoints) { - foreach (var (oldNode, newNode) in match.Forward) + foreach (var (oldNode, newNode) in bodyMap.Forward) { ReportStateMachineSuspensionPointRudeEdits(diagnosticContext, oldNode, newNode); } @@ -1608,9 +1613,9 @@ private TextSpan GetDeletedNodeDiagnosticSpan( return GetDeletedNodeDiagnosticSpan(forwardMap, oldLambda); } - if (lambdaInfos.TryGetValue(oldParentLambdaBody, out var lambdaInfo) && lambdaInfo.Match != null) + if (lambdaInfos.TryGetValue(oldParentLambdaBody, out var lambdaInfo) && !lambdaInfo.BodyMap.Forward.IsEmpty()) { - return GetDeletedNodeDiagnosticSpan(lambdaInfo.Match.Value.Forward, oldLambda); + return GetDeletedNodeDiagnosticSpan(lambdaInfo.BodyMap.Forward, oldLambda); } oldLambdaBody = oldParentLambdaBody; @@ -2409,7 +2414,7 @@ private sealed class MemberInitializationUpdates(INamedTypeSymbol oldType) /// Contains syntax maps for all changed data member initializers or constructor declarations (of constructors emitting initializers) /// in the currently analyzed document. The key is the new declaration of the member. ///
- public readonly Dictionary?> ChangedDeclarations = new Dictionary?>(); + public readonly Dictionary ChangedDeclarations = new(); /// /// True if a member initializer has been deleted @@ -2530,7 +2535,6 @@ private async Task> AnalyzeSemanticsAsync( var symbol = newSymbol ?? oldSymbol; Contract.ThrowIfNull(symbol); - Func? syntaxMap; SemanticEditKind editKind; var (oldDeclaration, newDeclaration) = GetSymbolDeclarationNodes(oldSymbol, newSymbol, edit.OldNode, edit.NewNode); @@ -2631,8 +2635,6 @@ private async Task> AnalyzeSemanticsAsync( Contract.ThrowIfNull(oldSymbol); Contract.ThrowIfNull(oldDeclaration); - syntaxMap = null; - // Check if the declaration has been moved from one document to another. if (newSymbol != null) { @@ -2729,7 +2731,7 @@ newSymbol is IPropertySymbol newProperty && if (IsDeclarationWithInitializer(oldDeclaration)) { - DeferConstructorEdit(oldContainingType, newContainingType, oldDeclaration, syntaxMap, oldSymbol.IsStatic, isMemberWithDeletedInitializer: true); + DeferConstructorEdit(oldContainingType, newContainingType, oldDeclaration, syntaxMaps: default, oldSymbol.IsStatic, isMemberWithDeletedInitializer: true); } // If a property or field is deleted from a record the synthesized members may change @@ -2782,8 +2784,6 @@ newSymbol is IPropertySymbol newProperty && Contract.ThrowIfNull(newSymbol); Contract.ThrowIfNull(newDeclaration); - syntaxMap = null; - editKind = SemanticEditKind.Insert; INamedTypeSymbol? oldContainingType; var newContainingType = newSymbol.ContainingType; @@ -2916,7 +2916,7 @@ newSymbol is IPropertySymbol newProperty && Contract.ThrowIfNull(newContainingType); Contract.ThrowIfNull(oldContainingType); - DeferConstructorEdit(oldContainingType, newContainingType, newDeclaration, syntaxMap, newSymbol.IsStatic, isMemberWithDeletedInitializer: false); + DeferConstructorEdit(oldContainingType, newContainingType, newDeclaration, syntaxMaps: default, newSymbol.IsStatic, isMemberWithDeletedInitializer: false); if (isConstructorWithMemberInitializers) { @@ -2936,7 +2936,6 @@ newSymbol is IPropertySymbol newProperty && Contract.ThrowIfNull(newSymbol); editKind = SemanticEditKind.Update; - syntaxMap = null; break; case EditKind.Reorder: @@ -2979,7 +2978,7 @@ void AnalyzeRecordPropertyReplacement(IPropertySymbol oldProperty, IPropertySymb // The synthesized auto-property is `T P { get; init; } = P`. // If the initializer is different from `P` the primary constructor needs to be updated. // Note: we update the constructor regardless of the initializer exact shape, but we could check for it. - DeferConstructorEdit(oldProperty.ContainingType, newProperty.ContainingType, newDeclaration: null, syntaxMap, oldProperty.IsStatic, isMemberWithDeletedInitializer: true); + DeferConstructorEdit(oldProperty.ContainingType, newProperty.ContainingType, newDeclaration: null, syntaxMaps: default, oldProperty.IsStatic, isMemberWithDeletedInitializer: true); if (customProperty.SetMethod == null) { @@ -3048,6 +3047,7 @@ void ReportDeletedMemberActiveStatementsRudeEdits() } Contract.ThrowIfFalse(editKind is SemanticEditKind.Update or SemanticEditKind.Insert); + SyntaxMaps syntaxMaps = default; if (editKind == SemanticEditKind.Update) { @@ -3095,7 +3095,7 @@ void ReportDeletedMemberActiveStatementsRudeEdits() newActiveStatements, newExceptionRegions, diagnostics, - out syntaxMap, + out syntaxMaps, cancellationToken); } } @@ -3116,12 +3116,12 @@ void ReportDeletedMemberActiveStatementsRudeEdits() if (isConstructorWithMemberInitializers || isOldDeclarationWithInitializer || isNewDeclarationWithInitializer) { - DeferConstructorEdit(oldSymbol.ContainingType, newSymbol.ContainingType, newDeclaration, syntaxMap, newSymbol.IsStatic, + DeferConstructorEdit(oldSymbol.ContainingType, newSymbol.ContainingType, newDeclaration, syntaxMaps, newSymbol.IsStatic, isMemberWithDeletedInitializer: isOldDeclarationWithInitializer && !isNewDeclarationWithInitializer); - // Syntax map will be aggregated into one created for the constructor edit. + // Syntax maps will be aggregated into ones created for the constructor edit. // It should not be set on the edit of the member with an initializer. - syntaxMap = null; + syntaxMaps = default; } if (isConstructorWithMemberInitializers) @@ -3175,7 +3175,7 @@ IFieldSymbol or semanticEdits.Add(editKind switch { - SemanticEditKind.Update => SemanticEditInfo.CreateUpdate(symbolKey, syntaxMap, syntaxMapTree: (syntaxMap != null) ? newModel.SyntaxTree : null, partialType), + SemanticEditKind.Update => SemanticEditInfo.CreateUpdate(symbolKey, syntaxMaps, partialType), SemanticEditKind.Insert => SemanticEditInfo.CreateInsert(symbolKey, partialType), SemanticEditKind.Replace => SemanticEditInfo.CreateReplace(symbolKey, partialType), _ => throw ExceptionUtilities.UnexpectedValue(editKind) @@ -3248,8 +3248,6 @@ IFieldSymbol or continue; } - Func? syntaxMap = null; - // only trivia changed: Contract.ThrowIfNull(newBody); Debug.Assert(IsConstructorWithMemberInitializers(oldSymbol, cancellationToken) == IsConstructorWithMemberInitializers(newSymbol, cancellationToken)); @@ -3261,20 +3259,20 @@ IFieldSymbol or IsStateMachineMethod(oldDeclaration) || ContainsLambda(oldBody); - syntaxMap = isActiveMember ? CreateSyntaxMapForEquivalentNodes(oldBody, newBody) : null; - var isConstructorWithMemberInitializers = IsConstructorWithMemberInitializers(newSymbol, cancellationToken); var isDeclarationWithInitializer = IsDeclarationWithInitializer(newDeclaration); + // TODO: only create syntax map if any field initializers are active/contain lambdas or this is a partial type + var syntaxMaps = isActiveMember || isConstructorWithMemberInitializers || isDeclarationWithInitializer + ? new SyntaxMaps(newTree, CreateSyntaxMapForEquivalentNodes(oldBody, newBody), runtimeRudeEdits: null) + : default; + if (isConstructorWithMemberInitializers || isDeclarationWithInitializer) { Contract.ThrowIfNull(oldContainingType); Contract.ThrowIfNull(newContainingType); - // TODO: only create syntax map if any field initializers are active/contain lambdas or this is a partial type - syntaxMap ??= CreateSyntaxMapForEquivalentNodes(oldBody, newBody); - - DeferConstructorEdit(oldContainingType, newContainingType, newDeclaration, syntaxMap, newSymbol.IsStatic, isMemberWithDeletedInitializer: false); + DeferConstructorEdit(oldContainingType, newContainingType, newDeclaration, syntaxMaps, newSymbol.IsStatic, isMemberWithDeletedInitializer: false); // Don't add a separate semantic edit. // Updates of data members with initializers and constructors that emit initializers will be aggregated and added later. @@ -3292,8 +3290,7 @@ IFieldSymbol or semanticEdits.Add(SemanticEditInfo.CreateUpdate( symbolKey, - syntaxMap, - syntaxMapTree: (syntaxMap != null) ? newTree : null, + syntaxMaps, partialType: IsPartialTypeEdit(oldSymbol, newSymbol, oldTree, newTree) ? symbolKey : null)); } } @@ -3355,7 +3352,7 @@ void DeferConstructorEdit( INamedTypeSymbol oldType, INamedTypeSymbol newType, SyntaxNode? newDeclaration, - Func? syntaxMap, + SyntaxMaps syntaxMaps, bool isStatic, bool isMemberWithDeletedInitializer) { @@ -3376,7 +3373,7 @@ void DeferConstructorEdit( if (newDeclaration != null && !constructorEdit.ChangedDeclarations.ContainsKey(newDeclaration)) { - constructorEdit.ChangedDeclarations.Add(newDeclaration, syntaxMap); + constructorEdit.ChangedDeclarations.Add(newDeclaration, syntaxMaps); } constructorEdit.HasDeletedMemberInitializer |= isMemberWithDeletedInitializer; @@ -3612,7 +3609,7 @@ void AddUpdate(ISymbol? symbol) Debug.Assert(symbol is not IMethodSymbol { IsPartialDefinition: true }); - semanticEdits.Add(SemanticEditInfo.CreateUpdate(SymbolKey.Create(symbol, cancellationToken), syntaxMap: null, syntaxMapTree: null, partialType: null)); + semanticEdits.Add(SemanticEditInfo.CreateUpdate(SymbolKey.Create(symbol, cancellationToken), syntaxMaps: default, partialType: null)); } } @@ -3705,7 +3702,7 @@ private static void AddMemberSignatureOrNameChangeEdits( // Events can't be overloaded on their type. // Update the event to associate it with the new accessors - semanticEdits.Add(SemanticEditInfo.CreateUpdate(SymbolKey.Create(oldSymbol, cancellationToken), syntaxMap: null, syntaxMapTree: null, partialType: null)); + semanticEdits.Add(SemanticEditInfo.CreateUpdate(SymbolKey.Create(oldSymbol, cancellationToken), syntaxMaps: default, partialType: null)); // Do not change raise since its signature is not impacted by the event type change. @@ -4421,7 +4418,7 @@ private static void AddDelegateMethodEdit(ArrayBuilder semanti var beginInvokeMethod = delegateType.GetMembers(methodName).FirstOrDefault(); if (beginInvokeMethod != null) { - semanticEdits.Add(SemanticEditInfo.CreateUpdate(SymbolKey.Create(beginInvokeMethod, cancellationToken), syntaxMap: null, syntaxMapTree: null, partialType: null)); + semanticEdits.Add(SemanticEditInfo.CreateUpdate(SymbolKey.Create(beginInvokeMethod, cancellationToken), syntaxMaps: default, partialType: null)); } } @@ -4696,7 +4693,7 @@ private static void AddSynthesizedRecordMethodUpdatesForPropertyChange( // We could avoid these updates if we check the details (e.g. name & type matching, etc.) var symbolKey = SymbolKey.Create(member, cancellationToken); - semanticEdits.Add(SemanticEditInfo.CreateUpdate(symbolKey, syntaxMap: null, syntaxMapTree: null, partialType: null)); + semanticEdits.Add(SemanticEditInfo.CreateUpdate(symbolKey, syntaxMaps: default, partialType: null)); } } @@ -5051,49 +5048,78 @@ private static bool HasExplicitOrSequentialLayout(INamedTypeSymbol type, Semanti return newNode => FindPartner(oldRootNodes, newRootNodes, newNode); } - private static Func CreateSyntaxMap(IReadOnlyDictionary reverseMap) - => newNode => reverseMap.TryGetValue(newNode, out var oldNode) ? oldNode : null; + private static Func CreateSyntaxMap(DeclarationBodyMap bodyMap) + { + var reverseMatch = bodyMap.Reverse; + var additionalReverse = bodyMap.AdditionalReverseMapping; - private Func? CreateAggregateSyntaxMap( + return newNode => reverseMatch.TryGetValue(newNode, out var oldNode) || additionalReverse.TryGetValue(newNode, out oldNode) ? oldNode : null; + } + + private SyntaxMaps CreateAggregateSyntaxMaps( + SyntaxTree newTree, IReadOnlyDictionary reverseTopMatches, - IReadOnlyDictionary?> changedDeclarations) + IReadOnlyDictionary changedDeclarations) { - return newNode => - { - // containing declaration - if (!TryFindMemberDeclaration(root: null, newNode, newNode.Span, out var newDeclarations)) + return new( + newTree, + matchingNodes: newNode => { - return null; - } - - foreach (var newDeclaration in newDeclarations) - { - // The node is in a field, property or constructor declaration that has been changed: - if (changedDeclarations.TryGetValue(newDeclaration, out var syntaxMap)) + // containing declaration + if (!TryFindMemberDeclaration(root: null, newNode, newNode.Span, out var newDeclarations)) { - // If syntax map is not available the declaration was either - // 1) updated but is not active - // 2) inserted - return syntaxMap?.Invoke(newNode); + return null; } - // The node is in a declaration that hasn't been changed: - if (reverseTopMatches.TryGetValue(newDeclaration, out var oldDeclaration)) + foreach (var newDeclaration in newDeclarations) { - var oldBody = TryGetDeclarationBody(oldDeclaration, symbol: null); - var newBody = TryGetDeclarationBody(newDeclaration, symbol: null); + // The node is in a field, property or constructor declaration that has been changed: + if (changedDeclarations.TryGetValue(newDeclaration, out var nodeMaps)) + { + // If syntax map is not available the declaration was either + // 1) updated but is not active + // 2) inserted + return nodeMaps.MatchingNodes?.Invoke(newNode); + } - // The declarations must have bodies since we found newNode in the newDeclaration's body - // and the new body can only differ from the old one in trivia. - Debug.Assert(oldBody != null); - Debug.Assert(newBody != null); + // The node is in a declaration that hasn't been changed: + if (reverseTopMatches.TryGetValue(newDeclaration, out var oldDeclaration)) + { + var oldBody = TryGetDeclarationBody(oldDeclaration, symbol: null); + var newBody = TryGetDeclarationBody(newDeclaration, symbol: null); + + // The declarations must have bodies since we found newNode in the newDeclaration's body + // and the new body can only differ from the old one in trivia. + Debug.Assert(oldBody != null); + Debug.Assert(newBody != null); - return FindPartner(oldBody.RootNodes, newBody.RootNodes, newNode); + return FindPartner(oldBody.RootNodes, newBody.RootNodes, newNode); + } } - } - return null; - }; + return null; + }, + runtimeRudeEdits: newNode => + { + // containing declaration + if (!TryFindMemberDeclaration(root: null, newNode, newNode.Span, out var newDeclarations)) + { + return null; + } + + foreach (var newDeclaration in newDeclarations) + { + // The node is in a field, property or constructor declaration that has been changed. + // Lambdas in unchanged initializers (or the constructor) are also unchanged and hence won't have rude edits. + // They can't be affected by changes in other initializers (or the constructor). + if (changedDeclarations.TryGetValue(newDeclaration, out var nodeMaps)) + { + return nodeMaps.RuntimeRudeEdits?.Invoke(newNode); + } + } + + return null; + }); } #region Constructors and Initializers @@ -5120,7 +5146,6 @@ private void AddConstructorEdits( var isPartialEdit = IsPartialTypeEdit(oldType, newType, oldSyntaxTree, newSyntaxTree); var typeKey = SymbolKey.Create(newType, cancellationToken); var partialType = isPartialEdit ? typeKey : (SymbolKey?)null; - var syntaxMapTree = isPartialEdit ? newSyntaxTree : null; // Create a syntax map that aggregates syntax maps of the constructor body and all initializers in this document. // Use syntax maps stored in update.ChangedDeclarations and fallback to 1:1 map for unchanged members. @@ -5131,7 +5156,7 @@ private void AddConstructorEdits( // We will create an aggregate syntax map even in cases when we don't necessarily need it, // for example if none of the edited declarations are active. It's ok to have a map that we don't need. // This is simpler than detecting whether or not some of the initializers/constructors contain active statements. - var aggregateSyntaxMap = CreateAggregateSyntaxMap(topMatch.ReverseMatches, updatesInCurrentDocument.ChangedDeclarations); + var syntaxMaps = CreateAggregateSyntaxMaps(newSyntaxTree, topMatch.ReverseMatches, updatesInCurrentDocument.ChangedDeclarations); var memberInitializerContainingLambdaReported = false; @@ -5156,8 +5181,6 @@ private void AddConstructorEdits( var newCtorKey = SymbolKey.Create(newCtor, cancellationToken); - var syntaxMapToUse = aggregateSyntaxMap; - SyntaxNode? oldDeclaration = null; SyntaxNode? newDeclaration = null; IMethodSymbol? oldCtor; @@ -5257,7 +5280,7 @@ private void AddConstructorEdits( } else { - semanticEdits.Add(new SemanticEditInfo(SemanticEditKind.Update, newCtorKey, syntaxMapToUse, syntaxMapTree, partialType, deletedSymbolContainer: null)); + semanticEdits.Add(SemanticEditInfo.CreateUpdate(newCtorKey, syntaxMaps, partialType)); } } else @@ -5377,13 +5400,15 @@ private void ReportLambdaAndClosureRudeEdits( MemberBody? newMemberBody, SyntaxNode? newDeclaration, IReadOnlyDictionary? activeOrMatchedLambdas, - BidirectionalMap map, + DeclarationBodyMap bodyMap, EditAndContinueCapabilitiesGrantor capabilities, ArrayBuilder diagnostics, out bool syntaxMapRequired, + out Func? runtimeRudeEdits, CancellationToken cancellationToken) { syntaxMapRequired = false; + runtimeRudeEdits = null; if (activeOrMatchedLambdas != null) { @@ -5398,8 +5423,7 @@ private void ReportLambdaAndClosureRudeEdits( continue; } - var lambdaBodyMatch = newLambdaInfo.Match; - Debug.Assert(lambdaBodyMatch != null); + var lambdaBodyMap = newLambdaInfo.BodyMap; Debug.Assert(oldModel != null); @@ -5417,7 +5441,7 @@ private void ReportLambdaAndClosureRudeEdits( var oldStateMachineInfo = oldLambdaBody.GetStateMachineInfo(); var newStateMachineInfo = newLambdaBody.GetStateMachineInfo(); - ReportStateMachineBodyUpdateRudeEdits(diagnosticContext, lambdaBodyMatch.Value, oldStateMachineInfo, newStateMachineInfo, newLambdaInfo.HasActiveStatement, cancellationToken); + ReportStateMachineBodyUpdateRudeEdits(diagnosticContext, lambdaBodyMap, oldStateMachineInfo, newStateMachineInfo, newLambdaInfo.HasActiveStatement, cancellationToken); // When the delta IL of the containing method is emitted lambdas declared in it are also emitted. // If the runtime does not support changing IL of the method (e.g. method containing stackalloc) @@ -5466,7 +5490,7 @@ private void ReportLambdaAndClosureRudeEdits( } ArrayBuilder? lazyNewErroneousClauses = null; - foreach (var (oldQueryClause, newQueryClause) in map.Forward) + foreach (var (oldQueryClause, newQueryClause) in bodyMap.Forward) { Debug.Assert(oldModel != null); @@ -5484,11 +5508,8 @@ orderby clause.SpanStart group clause by GetContainingQueryExpression(clause) into clausesByQuery select clausesByQuery.First()) { - diagnostics.Add(new RudeEditDiagnostic( - RudeEditKind.ChangingQueryLambdaType, - GetDiagnosticSpan(newQueryClause, EditKind.Update), - newQueryClause, - new[] { GetDisplayName(newQueryClause, EditKind.Update) })); + var diagnosticContext = CreateDiagnosticContext(diagnostics, oldSymbol: null, newSymbol: null, newQueryClause, newModel, topMatch: null); + diagnosticContext.Report(RudeEditKind.ChangingQueryLambdaType, cancellationToken); } lazyNewErroneousClauses.Free(); @@ -5567,149 +5588,47 @@ select clausesByQuery.First()) // { old capture index -> old closure scope or null for "this" } using var _3 = ArrayBuilder.GetInstance(oldInLambdaCaptures.Length, fillWithValue: null, out var oldCapturesToClosureScopes); + using var _4 = PooledDictionary.GetInstance(out var closureRudeEdits); + CalculateCapturedVariablesMaps( oldInLambdaCaptures, oldDeclaration, oldPrimaryConstructor, newInLambdaCaptures, - newMember, newDeclaration, newPrimaryConstructor, - map, + bodyMap, reverseCapturesMap, newCapturesToClosureScopes, oldCapturesToClosureScopes, - diagnostics, - out var anyCaptureErrors, + closureRudeEdits, cancellationToken); - if (anyCaptureErrors) + if (closureRudeEdits.Any()) { + var rudeEdits = closureRudeEdits.ToImmutableSegmentedDictionary( + static item => item.Key, + static item => new RuntimeRudeEdit(item.Value.ToDiagnostic(item.Key.SyntaxTree).ToString())); + + runtimeRudeEdits = node => rudeEdits.TryGetValue(node, out var message) ? message : null; return; } - // Every captured variable accessed in the new lambda has to be - // accessed in the old lambda as well and vice versa. - // - // An added lambda can only reference captured variables that - // - // This requirement ensures that: - // - Lambda methods are generated to the same frame as before, so they can be updated in-place. - // - "Parent" links between closure scopes are preserved. - - using var _11 = PooledDictionary.GetInstance(out var oldCapturesIndex); - using var _12 = PooledDictionary.GetInstance(out var newCapturesIndex); - - BuildIndex(oldCapturesIndex, oldInLambdaCaptures); + using var _5 = PooledDictionary.GetInstance(out var newCapturesIndex); BuildIndex(newCapturesIndex, newInLambdaCaptures); - if (activeOrMatchedLambdas != null) - { - var mappedLambdasHaveErrors = false; - foreach (var (oldLambdaBody, newLambdaInfo) in activeOrMatchedLambdas) - { - var newLambdaBody = newLambdaInfo.NewBody; - - // The map now contains only matched lambdas. Any unmatched ones would have contained an active statement and - // a rude edit would be reported in syntax analysis phase. - Debug.Assert(newLambdaInfo.Match != null && newLambdaBody != null); - Debug.Assert(oldModel != null); - - var accessedOldCaptures = GetAccessedCaptures(oldLambdaBody, oldModel, oldInLambdaCaptures, oldCapturesIndex, oldLiftingPrimaryConstructor); - var accessedNewCaptures = GetAccessedCaptures(newLambdaBody, newModel, newInLambdaCaptures, newCapturesIndex, newLiftingPrimaryConstructor); - - // Requirement: - // (new(ReadInside) \/ new(WrittenInside)) /\ new(Captured) == (old(ReadInside) \/ old(WrittenInside)) /\ old(Captured) - for (var newCaptureIndex = 0; newCaptureIndex < newInLambdaCaptures.Length; newCaptureIndex++) - { - var newAccessed = accessedNewCaptures[newCaptureIndex]; - var oldAccessed = accessedOldCaptures[reverseCapturesMap[newCaptureIndex]]; - - if (newAccessed != oldAccessed) - { - var newCapture = newInLambdaCaptures[newCaptureIndex]; - - var rudeEdit = newAccessed ? RudeEditKind.AccessingCapturedVariableInLambda : RudeEditKind.NotAccessingCapturedVariableInLambda; - var arguments = new[] { newCapture.Name, GetDisplayName(newLambdaBody.GetLambda()) }; - - if (newCapture.IsThis || oldAccessed) - { - // changed accessed to "this", or captured variable accessed in old lambda is not accessed in the new lambda - diagnostics.Add(new RudeEditDiagnostic(rudeEdit, GetDiagnosticSpan(newLambdaBody.GetLambda(), EditKind.Update), null, arguments)); - } - else if (newAccessed) - { - // captured variable accessed in new lambda is not accessed in the old lambda - var hasUseSites = false; - foreach (var useSite in GetVariableUseSites(newLambdaBody.GetExpressionsAndStatements(), newCapture.Symbol, newModel, cancellationToken)) - { - hasUseSites = true; - diagnostics.Add(new RudeEditDiagnostic(rudeEdit, useSite.Span, null, arguments)); - } - - Debug.Assert(hasUseSites); - } - - mappedLambdasHaveErrors = true; - } - } - } - - if (mappedLambdasHaveErrors) - { - return; - } - } - - // Removal: We don't allow removal of lambda that has captures from multiple scopes. - var oldHasLambdas = false; - foreach (var (oldLambda, oldLambdaBody1, oldLambdaBody2) in GetLambdaBodies(oldMemberBody)) { oldHasLambdas |= !IsLocalFunction(oldLambda); - - if (!map.Forward.ContainsKey(oldLambda)) - { - Debug.Assert(oldModel != null); - - ReportMultiScopeCaptures(oldLambdaBody1, oldModel, oldInLambdaCaptures, newInLambdaCaptures, oldCapturesToClosureScopes, oldCapturesIndex, oldLiftingPrimaryConstructor, reverseCapturesMap, diagnostics, isInsert: false, cancellationToken: cancellationToken); - - if (oldLambdaBody2 != null) - { - ReportMultiScopeCaptures(oldLambdaBody2, oldModel, oldInLambdaCaptures, newInLambdaCaptures, oldCapturesToClosureScopes, oldCapturesIndex, oldLiftingPrimaryConstructor, reverseCapturesMap, diagnostics, isInsert: false, cancellationToken: cancellationToken); - } - } } - // Report rude edits for lambdas added to the method. - // We already checked that no new captures are introduced or removed. - // We also need to make sure that no new parent frame links are introduced. - // - // We could implement the same analysis as the compiler does when rewriting lambdas - - // to determine what closure scopes are connected at runtime via parent link, - // and then disallow adding a lambda that connects two previously unconnected - // groups of scopes. - // - // However even if we implemented that logic here, it would be challenging to - // present the result of the analysis to the user in a short comprehensible error message. - // - // In practice, we believe the common scenarios are (in order of commonality): - // 1) adding a static lambda - // 2) adding a lambda that accesses only "this" - // 3) adding a lambda that accesses variables from the same scope - // 4) adding a lambda that accesses "this" and variables from a single scope - // 5) adding a lambda that accesses variables from different scopes that are linked - // 6) adding a lambda that accesses variables from unlinked scopes - // - // We currently allow #1, #2, and #3 and report a rude edit for the other cases. - // In future we might be able to enable more. var isInInterface = newMember.ContainingType.TypeKind == TypeKind.Interface; var isNewMemberInGenericContext = InGenericContext(newMember); foreach (var (newLambda, newLambdaBody1, newLambdaBody2) in GetLambdaBodies(newMemberBody)) { - if (!map.Reverse.ContainsKey(newLambda)) + if (!bodyMap.Reverse.ContainsKey(newLambda)) { if (!CanAddNewLambda(newLambda, newLambdaBody1, newLambdaBody2)) { @@ -5723,13 +5642,6 @@ select clausesByQuery.First()) { diagnostics.Add(new RudeEditDiagnostic(RudeEditKind.InsertLocalFunctionIntoInterfaceMethod, GetDiagnosticSpan(newLambda, EditKind.Insert), newLambda, new string[] { GetDisplayName(newLambda, EditKind.Insert) })); } - - ReportMultiScopeCaptures(newLambdaBody1, newModel, newInLambdaCaptures, newInLambdaCaptures, newCapturesToClosureScopes, newCapturesIndex, newLiftingPrimaryConstructor, reverseCapturesMap, diagnostics, isInsert: true, cancellationToken: cancellationToken); - - if (newLambdaBody2 != null) - { - ReportMultiScopeCaptures(newLambdaBody2, newModel, newInLambdaCaptures, newInLambdaCaptures, newCapturesToClosureScopes, newCapturesIndex, newLiftingPrimaryConstructor, reverseCapturesMap, diagnostics, isInsert: true, cancellationToken: cancellationToken); - } } } @@ -5822,22 +5734,30 @@ private enum VariableCaptureKind /// Represents a captured local variable or a parameter of the current member. /// Primary constructor parameters that are accessed via "this" are represented as /// . - /// - /// Equality ignores if is . /// - private readonly record struct VariableCapture(VariableCaptureKind Kind, ISymbol Symbol) + private readonly struct VariableCapture(VariableCaptureKind kind, ISymbol symbol) { + public readonly VariableCaptureKind Kind = kind; + public readonly ISymbol Symbol = symbol; + public bool IsThis => Kind == VariableCaptureKind.This; public string Name => Symbol.Name; - public bool Equals(VariableCapture other) - => Kind == other.Kind && (Kind == VariableCaptureKind.This || ReferenceEquals(Symbol, other.Symbol)); + public VariableCaptureKey Key + => VariableCaptureKey.Create(Kind, Symbol); + } - public override int GetHashCode() - => Hash.Combine((int)Kind, (Kind == VariableCaptureKind.This) ? 0 : Symbol.GetHashCode()); + /// + /// Use to look up captures by their symbol identity. + /// Captures of kind are represented by null . + /// + private readonly record struct VariableCaptureKey(VariableCaptureKind Kind, ISymbol? CapturedVariable) + { + public static VariableCaptureKey Create(VariableCaptureKind kind, ISymbol symbol) + => new(kind, kind == VariableCaptureKind.This ? null : symbol); - public static VariableCapture Create(ISymbol variable, IMethodSymbol? liftingPrimaryConstructor) - => new(GetCaptureKind(variable, liftingPrimaryConstructor), variable); + public static VariableCaptureKey Create(ISymbol variable, IMethodSymbol? liftingPrimaryConstructor) + => Create(GetCaptureKind(variable, liftingPrimaryConstructor), variable); } private static VariableCaptureKind GetCaptureKind(ISymbol variable, IMethodSymbol? liftingPrimaryConstructor) @@ -5864,8 +5784,8 @@ private void GetCapturedVariables( Debug.Assert(model != null); - PooledHashSet? inLambdaCapturesSet = null; - ArrayBuilder? inLambdaCaptures = null; + PooledDictionary? inLambdaCapturesIndex = null; + ArrayBuilder<(VariableCaptureKind kind, ISymbol symbol, ArrayBuilder capturingLambdas)>? inLambdaCaptures = null; foreach (var (lambda, lambdaBody1, lambdaBody2) in GetLambdaBodies(memberBody)) { @@ -5882,22 +5802,31 @@ void AddCaptures(LambdaBody lambdaBody) var captures = lambdaBody.GetCapturedVariables(model); if (!captures.IsEmpty) { - inLambdaCapturesSet ??= PooledHashSet.GetInstance(); - inLambdaCaptures ??= ArrayBuilder.GetInstance(); + inLambdaCapturesIndex ??= PooledDictionary.GetInstance(); + inLambdaCaptures ??= ArrayBuilder<(VariableCaptureKind, ISymbol, ArrayBuilder)>.GetInstance(); foreach (var capture in captures) { - var variableCapture = VariableCapture.Create(capture, liftingPrimaryConstructor); - if (inLambdaCapturesSet.Add(variableCapture)) + var key = VariableCaptureKey.Create(capture, liftingPrimaryConstructor); + var index = inLambdaCapturesIndex.GetOrAdd(key, inLambdaCaptures.Count); + if (index == inLambdaCaptures.Count) { - inLambdaCaptures.Add(variableCapture); + // When capturing this parameter via primary constructor parameter capture + // the capture key might be the same for multiple captured symbols. + // We need any of the captured primary parameters, use the first one. + inLambdaCaptures.Add((key.Kind, capture, ArrayBuilder.GetInstance())); } + + inLambdaCaptures[index].capturingLambdas.Add(lambdaBody); } } } } - variablesCapturedInLambdas = inLambdaCaptures.ToImmutableOrEmptyAndFree(); + variablesCapturedInLambdas = inLambdaCaptures?.SelectAsArray( + static item => new VariableCapture(item.kind, item.symbol)) ?? ImmutableArray.Empty; + + inLambdaCaptures?.Free(); // only primary constructor parameters can be captured outside of lambda bodies: if (liftingPrimaryConstructor != null && !ignorePrimaryParameterCaptures) @@ -5912,7 +5841,7 @@ void AddCaptures(LambdaBody lambdaBody) primaryParametersCapturedViaThis = ImmutableArray.Empty; } - inLambdaCapturesSet?.Free(); + inLambdaCapturesIndex?.Free(); } private void ReportPrimaryParameterCaptureRudeEdits( @@ -5966,79 +5895,11 @@ static string GetLayoutKindDisplay(IParameterSymbol parameter) => (parameter.ContainingType.TypeKind == TypeKind.Struct) ? FeaturesResources.struct_ : FeaturesResources.class_with_explicit_or_sequential_layout; } - private void ReportMultiScopeCaptures( - LambdaBody lambdaBody, - SemanticModel model, - ImmutableArray captures, - ImmutableArray newCaptures, - ArrayBuilder newCapturesToClosureScopes, - PooledDictionary capturesIndex, - IMethodSymbol? liftingPrimaryConstructor, - ArrayBuilder reverseCapturesMap, - ArrayBuilder diagnostics, - bool isInsert, - CancellationToken cancellationToken) - { - if (captures.Length == 0) - { - return; - } - - var accessedCaptures = GetAccessedCaptures(lambdaBody, model, captures, capturesIndex, liftingPrimaryConstructor); - - var firstAccessedCaptureIndex = -1; - for (var i = 0; i < captures.Length; i++) - { - var capture = captures[i]; - - if (accessedCaptures[i]) - { - if (firstAccessedCaptureIndex == -1) - { - firstAccessedCaptureIndex = i; - } - else if (newCapturesToClosureScopes[firstAccessedCaptureIndex] != newCapturesToClosureScopes[i]) - { - // the lambda accesses variables from two different scopes: - - TextSpan errorSpan; - RudeEditKind rudeEdit; - if (isInsert) - { - if (capture.IsThis) - { - errorSpan = GetDiagnosticSpan(lambdaBody.GetLambda(), EditKind.Insert); - } - else - { - errorSpan = GetVariableUseSites(lambdaBody.GetExpressionsAndStatements(), capture.Symbol, model, cancellationToken).First().Span; - } - - rudeEdit = RudeEditKind.InsertLambdaWithMultiScopeCapture; - } - else - { - errorSpan = GetSymbolLocationSpan(newCaptures[reverseCapturesMap.IndexOf(i)].Symbol, cancellationToken); - rudeEdit = RudeEditKind.DeleteLambdaWithMultiScopeCapture; - } - - diagnostics.Add(new RudeEditDiagnostic( - rudeEdit, - errorSpan, - null, - new[] { GetDisplayName(lambdaBody.GetLambda()), captures[firstAccessedCaptureIndex].Name, capture.Name })); - - break; - } - } - } - } - private static BitVector GetAccessedCaptures( LambdaBody lambdaBody, SemanticModel model, ImmutableArray captures, - PooledDictionary capturesIndex, + PooledDictionary capturesIndex, IMethodSymbol? liftingPrimaryConstructor) { var result = BitVector.Create(captures.Length); @@ -6053,7 +5914,7 @@ void MarkVariables(ImmutableArray variables) { foreach (var variable in variables) { - if (capturesIndex.TryGetValue(VariableCapture.Create(variable, liftingPrimaryConstructor), out var newCaptureIndex)) + if (capturesIndex.TryGetValue(VariableCaptureKey.Create(variable, liftingPrimaryConstructor), out var newCaptureIndex)) { result[newCaptureIndex] = true; } @@ -6064,12 +5925,11 @@ void MarkVariables(ImmutableArray variables) return result; } - private static void BuildIndex(Dictionary index, ImmutableArray array) - where TKey : notnull + private static void BuildIndex(Dictionary index, ImmutableArray array) { for (var i = 0; i < array.Length; i++) { - index.Add(array[i], i); + index.Add(array[i].Key, i); } } @@ -6188,19 +6048,15 @@ private void CalculateCapturedVariablesMaps( SyntaxNode? oldDeclaration, IMethodSymbol? oldPrimaryConstructor, ImmutableArray newCaptures, - ISymbol newMember, SyntaxNode? newDeclaration, IMethodSymbol? newPrimaryConstructor, - BidirectionalMap bodyMap, + DeclarationBodyMap bodyMap, [Out] ArrayBuilder reverseCapturesMap, // {new capture index -> old capture index} [Out] ArrayBuilder newCapturesToClosureScopes, // {new capture index -> new closure scope} [Out] ArrayBuilder oldCapturesToClosureScopes, // {old capture index -> old closure scope} - [Out] ArrayBuilder diagnostics, - out bool hasErrors, + [Out] Dictionary closureRudeEdits, CancellationToken cancellationToken) { - hasErrors = false; - BidirectionalMap? parameterMap = null; if (oldDeclaration != null && newDeclaration != null) { @@ -6223,56 +6079,19 @@ private void CalculateCapturedVariablesMaps( } } - // Validate that all variables that are/were captured in the new/old body were captured in - // the old/new one and their type and scope haven't changed. - // - // Frames are created based upon captured variables and their scopes. If the scopes haven't changed the frames won't either. - // - // In future we can relax some of these limitations. - // - If a newly captured variable's scope is already a closure then it is ok to lift this variable to the existing closure, - // unless any lambda (or the containing member) that can access the variable is active. If it was active we would need - // to copy the value of the local variable to the lifted field. - // - // Consider the following edit: - // Gen0 Gen1 - // ... ... - // { { - // int x = 1, y = 2; int x = 1, y = 2; - // F(() => x); F(() => x); - // AS-->W(y) AS-->W(y) - // F(() => y); - // } } - // ... ... - // - // - If an "uncaptured" variable's scope still defines other captured variables it is ok to cease capturing the variable, - // unless any lambda (or the containing member) that can access the variable is active. If it was active we would need - // to copy the value of the lifted field to the local variable (consider reverse edit in the example above). - // - // - While building the closure tree for the new version the compiler can recreate - // the closure tree of the previous version and then map - // closure scopes in the new version to the previous ones, keeping empty closures around. - using var _1 = PooledDictionary.GetInstance(out var oldLocalCaptures); using var _2 = PooledDictionary.GetInstance(out var oldParameterCaptures); - ISymbol? oldCapturedThisParameter = null; - ISymbol? newCapturedThisParameter = null; - var oldThisCaptureIndex = -1; - for (var oldCaptureIndex = 0; oldCaptureIndex < oldCaptures.Length; oldCaptureIndex++) { var oldCapture = oldCaptures[oldCaptureIndex]; if (oldCapture.IsThis) { - // captures are unique, so we can only have one that represents this pointer: - Debug.Assert(oldCapturedThisParameter == null); - Debug.Assert(oldThisCaptureIndex == -1); - - oldCapturedThisParameter = oldCapture.Symbol; - oldThisCaptureIndex = oldCaptureIndex; + continue; } - else if (oldCapture.Symbol is IParameterSymbol oldParameterCapture) + + if (oldCapture.Symbol is IParameterSymbol oldParameterCapture) { oldParameterCaptures.Add(GetParameterKey(oldParameterCapture, cancellationToken), oldCaptureIndex); } @@ -6289,11 +6108,6 @@ private void CalculateCapturedVariablesMaps( if (newCapture.IsThis) { - // captures are unique, so we can only have one that represents this pointer: - Debug.Assert(newCapturedThisParameter == null); - - newCapturedThisParameter = newCapture.Symbol; - reverseCapturesMap[newCaptureIndex] = oldThisCaptureIndex; continue; } @@ -6303,20 +6117,8 @@ private void CalculateCapturedVariablesMaps( if (!TryMapParameter(newParameterKey, parameterMap?.Reverse, bodyMap.Reverse, out var oldParameterKey) || !oldParameterCaptures.TryGetValue(oldParameterKey, out oldCaptureIndex)) { - // parameter doesn't exist or is not captured prior to the edit: - diagnostics.Add(new RudeEditDiagnostic( - RudeEditKind.CapturingVariable, - GetSymbolLocationSpan(newParameterCapture, cancellationToken), - node: null, - new[] { newParameterCapture.Name })); - - hasErrors = true; continue; } - - // Remove the old parameter capture so that at the end we can use this hashset - // to identify old captures that don't have a corresponding capture in the new version: - oldParameterCaptures.Remove(oldParameterKey); } else { @@ -6327,19 +6129,8 @@ private void CalculateCapturedVariablesMaps( if (!bodyMap.Reverse.TryGetValue(newCaptureSyntax, out var mappedOldSyntax) || !oldLocalCaptures.TryGetValue(mappedOldSyntax, out oldCaptureIndex)) { - diagnostics.Add(new RudeEditDiagnostic( - RudeEditKind.CapturingVariable, - GetSymbolLocationSpan(local, cancellationToken), - node: null, - new[] { local.Name })); - - hasErrors = true; continue; } - - // Remove the old capture so that at the end we can use this hashset - // to identify old captures that don't have a corresponding capture in the new version: - oldLocalCaptures.Remove(mappedOldSyntax); } reverseCapturesMap[newCaptureIndex] = oldCaptureIndex; @@ -6369,138 +6160,51 @@ private void CalculateCapturedVariablesMaps( // rename: // Note that the name has to match exactly even in VB, since we can't rename a field. - // Consider: We could allow rename by emitting some special debug info for the field. if (newSymbol.Name != oldSymbol.Name) { - diagnostics.Add(new RudeEditDiagnostic( + AddRuntimeRudeEdit(newSymbol, new RudeEditDiagnostic( RudeEditKind.RenamingCapturedVariable, GetSymbolLocationSpan(newSymbol, cancellationToken), null, - new[] { oldSymbol.Name, newSymbol.Name })); + [oldSymbol.Name, newSymbol.Name])); + + continue; + } - hasErrors = true; + // If a parameter type changes then the containing method is going to be deleted + // along with all its closures. No need to issue rude edits for the closures. + if (oldSymbol.Kind == SymbolKind.Parameter) + { continue; } - // type check var oldType = GetType(oldSymbol); var newType = GetType(newSymbol); if (!TypesEquivalent(oldType, newType, exact: false)) { - diagnostics.Add(new RudeEditDiagnostic( + AddRuntimeRudeEdit(newSymbol, new RudeEditDiagnostic( RudeEditKind.ChangingCapturedVariableType, GetSymbolLocationSpan(newSymbol, cancellationToken), node: null, - new[] { newSymbol.Name, oldType.ToDisplayString(ErrorDisplayFormat) })); + [newSymbol.Name, oldType.ToDisplayString(ErrorDisplayFormat)])); - hasErrors = true; continue; } - // scope check for local variables (parameters can't change scope): - if (oldSymbol.Kind != SymbolKind.Parameter) + var oldScope = GetCapturedVariableScope(oldSymbol, cancellationToken); + var newScope = GetCapturedVariableScope(newSymbol, cancellationToken); + if (!AreEquivalentClosureScopes(oldScope, newScope, bodyMap.Reverse)) { - var oldScope = GetCapturedLocalScope(oldSymbol, cancellationToken); - var newScope = GetCapturedLocalScope(newSymbol, cancellationToken); - if (!AreEquivalentClosureScopes(oldScope, newScope, bodyMap.Reverse)) - { - diagnostics.Add(new RudeEditDiagnostic( - RudeEditKind.ChangingCapturedVariableScope, - GetSymbolLocationSpan(newSymbol, cancellationToken), - node: null, - new[] { newSymbol.Name })); - - hasErrors = true; - continue; - } - - newCapturesToClosureScopes[newCaptureIndex] = newScope; - oldCapturesToClosureScopes[oldCaptureIndex] = oldScope; - } - } - - if (oldCapturedThisParameter is null != newCapturedThisParameter is null) - { - if (oldCapturedThisParameter == null) - { - Debug.Assert(newCapturedThisParameter != null); - - diagnostics.Add(new RudeEditDiagnostic( - RudeEditKind.CapturingVariable, - GetSymbolLocationSpan(newCapturedThisParameter, cancellationToken), - node: null, - new[] { newCapturedThisParameter.Name })); - } - else - { - diagnostics.Add(new RudeEditDiagnostic( - RudeEditKind.NotCapturingVariable, - GetSymbolLocationSpan(newMember, cancellationToken), - node: null, - new[] { oldCapturedThisParameter.Name })); - } - - hasErrors = true; - } - - // What's left in old*Captures are captured variables in the previous version - // that have no corresponding captured variables in the new version. - // Report a rude edit for all such variables. - - if (oldParameterCaptures.Count > 0) - { - // uncaptured parameters: - foreach (var ((oldParameterKind, oldParameterSyntax, oldContainingLambdaSyntax), oldCaptureIndex) in oldParameterCaptures) - { - diagnostics.Add(new RudeEditDiagnostic( - RudeEditKind.NotCapturingVariable, - oldParameterKind switch - { - ParameterKind.Explicit => - // Try to map the parameter from old to new syntax using either the member parameter map or the body map (for lambda parameters). - // If the parameter doesn't exist in the new source show the error at the containing lambda or member location. - parameterMap?.Forward.TryGetValue(oldParameterSyntax!, out var newParameterSyntax) == true ? GetDiagnosticSpan(newParameterSyntax, EditKind.Update) : - bodyMap.Forward.TryGetValue(oldParameterSyntax!, out newParameterSyntax) ? GetDiagnosticSpan(newParameterSyntax, EditKind.Update) : - oldContainingLambdaSyntax != null && bodyMap.Forward.TryGetValue(oldContainingLambdaSyntax, out var newContainingLambdaSyntax) ? GetDiagnosticSpan(newContainingLambdaSyntax, EditKind.Update) : - GetSymbolLocationSpan(newMember, cancellationToken), - _ => GetSymbolLocationSpan(newMember, cancellationToken), - }, - node: null, - new[] { oldCaptures[oldCaptureIndex].Name })); + continue; } - hasErrors = true; + newCapturesToClosureScopes[newCaptureIndex] = newScope; + oldCapturesToClosureScopes[oldCaptureIndex] = oldScope; } - if (oldLocalCaptures.Count > 0) - { - // uncaptured or deleted variables: - foreach (var entry in oldLocalCaptures) - { - var oldCaptureNode = entry.Key; - var oldCaptureIndex = entry.Value; - var name = oldCaptures[oldCaptureIndex].Name; - if (bodyMap.Forward.TryGetValue(oldCaptureNode, out var newCaptureNode)) - { - diagnostics.Add(new RudeEditDiagnostic( - RudeEditKind.NotCapturingVariable, - newCaptureNode.Span, - null, - new[] { name })); - } - else - { - diagnostics.Add(new RudeEditDiagnostic( - RudeEditKind.DeletingCapturedVariable, - GetDeletedNodeDiagnosticSpan(bodyMap.Forward, oldCaptureNode), - null, - new[] { name })); - } - } - - hasErrors = true; - } + void AddRuntimeRudeEdit(ISymbol newSymbol, RudeEditDiagnostic diagnostic) + => closureRudeEdits.TryAdd(GetCapturedVariableScope(newSymbol, cancellationToken), diagnostic); } private void ReportLambdaSignatureRudeEdits( @@ -6572,9 +6276,16 @@ private static ITypeSymbol GetType(ISymbol localOrParameter) _ => throw ExceptionUtilities.UnexpectedValue(localOrParameter.Kind), }; - private SyntaxNode GetCapturedLocalScope(ISymbol local, CancellationToken cancellationToken) + private SyntaxNode GetCapturedVariableScope(ISymbol local, CancellationToken cancellationToken) { - Debug.Assert(local.Kind is not (SymbolKind.RangeVariable or SymbolKind.Parameter)); + Debug.Assert(local.Kind is not SymbolKind.RangeVariable); + + if (local is IParameterSymbol) + { + var scope = GetCapturedParameterScope(GetSymbolDeclarationSyntax(local.ContainingSymbol, cancellationToken)); + Contract.ThrowIfFalse(IsClosureScope(scope)); + return scope; + } var node = GetSymbolDeclarationSyntax(local, cancellationToken); while (true) @@ -6993,12 +6704,12 @@ internal readonly struct TestAccessor(AbstractEditAndContinueAnalyzer abstractEd internal void ReportTopLevelSyntacticRudeEdits(ArrayBuilder diagnostics, EditScript syntacticEdits, Dictionary editMap) => _abstractEditAndContinueAnalyzer.ReportTopLevelSyntacticRudeEdits(diagnostics, syntacticEdits, editMap); - internal BidirectionalMap IncludeLambdaBodyMaps( - BidirectionalMap bodyMatch, + internal DeclarationBodyMap IncludeLambdaBodyMaps( + DeclarationBodyMap bodyMap, ArrayBuilder memberBodyActiveNodes, ref Dictionary? lazyActiveOrMatchedLambdas) { - return _abstractEditAndContinueAnalyzer.IncludeLambdaBodyMaps(bodyMatch, memberBodyActiveNodes, ref lazyActiveOrMatchedLambdas); + return _abstractEditAndContinueAnalyzer.IncludeLambdaBodyMaps(bodyMap, memberBodyActiveNodes, ref lazyActiveOrMatchedLambdas); } } diff --git a/src/Features/Core/Portable/EditAndContinue/DeclarationBody.cs b/src/Features/Core/Portable/EditAndContinue/DeclarationBody.cs index b73a56246b9ba..474631e4fe15d 100644 --- a/src/Features/Core/Portable/EditAndContinue/DeclarationBody.cs +++ b/src/Features/Core/Portable/EditAndContinue/DeclarationBody.cs @@ -65,10 +65,10 @@ public IEnumerable GetDescendantNodes(Func descend /// /// Computes a statement-level syntax tree match of this body with . /// - public virtual BidirectionalMap ComputeMatch(DeclarationBody newBody, IEnumerable>? knownMatches) + public virtual DeclarationBodyMap ComputeMap(DeclarationBody newBody, IEnumerable>? knownMatches) { var primaryMatch = ComputeSingleRootMatch(newBody, knownMatches); - return (primaryMatch != null) ? BidirectionalMap.FromMatch(primaryMatch) : BidirectionalMap.Empty; + return (primaryMatch != null) ? DeclarationBodyMap.FromMatch(primaryMatch) : DeclarationBodyMap.Empty; } /// diff --git a/src/Features/Core/Portable/EditAndContinue/DeclarationBodyMap.cs b/src/Features/Core/Portable/EditAndContinue/DeclarationBodyMap.cs new file mode 100644 index 0000000000000..a718933ce95e5 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/DeclarationBodyMap.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using Microsoft.CodeAnalysis.Differencing; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.EditAndContinue; + +internal readonly struct DeclarationBodyMap +{ + public static readonly DeclarationBodyMap Empty = new( + SpecializedCollections.EmptyReadOnlyDictionary(), + SpecializedCollections.EmptyReadOnlyDictionary(), + ImmutableDictionary.Empty); + + public IReadOnlyDictionary Forward { get; } + public IReadOnlyDictionary Reverse { get; } + + public ImmutableDictionary AdditionalReverseMapping { get; } + + public DeclarationBodyMap( + IReadOnlyDictionary forwardMatch, + IReadOnlyDictionary reverseMatch, + ImmutableDictionary additionalReverseMapping) + { + Contract.ThrowIfFalse(forwardMatch.Count == reverseMatch.Count); + + Forward = forwardMatch; + Reverse = reverseMatch; + AdditionalReverseMapping = additionalReverseMapping; + } + + public static DeclarationBodyMap FromMatch(Match match) + => new(match.Matches, match.ReverseMatches, ImmutableDictionary.Empty); + + public DeclarationBodyMap WithAdditionalMapping(SyntaxNode oldNode, SyntaxNode newNode) + => new(Forward, Reverse, AdditionalReverseMapping.Add(newNode, oldNode)); +} diff --git a/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs b/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs index e69f46e4c2a99..f3c2fcb5c62b7 100644 --- a/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs +++ b/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs @@ -103,18 +103,11 @@ void AddGeneralDiagnostic(EditAndContinueErrorCode code, string resourceName, Di AddRudeEdit(RudeEditKind.ExperimentalFeaturesEnabled, nameof(FeaturesResources.Modifying_source_with_experimental_language_features_enabled_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.AwaitStatementUpdate, nameof(FeaturesResources.Updating_a_complex_statement_containing_an_await_expression_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.ChangingAccessibility, nameof(FeaturesResources.Changing_visibility_of_0_requires_restarting_the_application)); - AddRudeEdit(RudeEditKind.CapturingVariable, nameof(FeaturesResources.Capturing_variable_0_that_hasn_t_been_captured_before_requires_restarting_the_application)); - AddRudeEdit(RudeEditKind.NotCapturingVariable, nameof(FeaturesResources.Ceasing_to_capture_variable_0_requires_restarting_the_application)); - AddRudeEdit(RudeEditKind.DeletingCapturedVariable, nameof(FeaturesResources.Deleting_captured_variable_0_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.ChangingCapturedVariableType, nameof(FeaturesResources.Changing_the_type_of_a_captured_variable_0_previously_of_type_1_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.ChangingCapturedVariableScope, nameof(FeaturesResources.Changing_the_declaration_scope_of_a_captured_variable_0_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.ChangingLambdaParameters, nameof(FeaturesResources.Changing_the_parameters_of_0_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.ChangingLambdaReturnType, nameof(FeaturesResources.Changing_the_return_type_of_0_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.ChangingQueryLambdaType, nameof(FeaturesResources.Changing_the_signature_of_0_requires_restarting_the_application_because_it_is_not_supported_by_the_runtime)); - AddRudeEdit(RudeEditKind.AccessingCapturedVariableInLambda, nameof(FeaturesResources.Accessing_captured_variable_0_that_hasn_t_been_accessed_before_in_1_requires_restarting_the_application)); - AddRudeEdit(RudeEditKind.NotAccessingCapturedVariableInLambda, nameof(FeaturesResources.Ceasing_to_access_captured_variable_0_in_1_requires_restarting_the_application)); - AddRudeEdit(RudeEditKind.InsertLambdaWithMultiScopeCapture, nameof(FeaturesResources.Adding_0_that_accesses_captured_variables_1_and_2_declared_in_different_scopes_requires_restarting_the_application)); - AddRudeEdit(RudeEditKind.DeleteLambdaWithMultiScopeCapture, nameof(FeaturesResources.Removing_0_that_accessed_captured_variables_1_and_2_declared_in_different_scopes_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.ActiveStatementUpdate, nameof(FeaturesResources.Updating_an_active_statement_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.ActiveStatementLambdaRemoved, nameof(FeaturesResources.Removing_0_that_contains_an_active_statement_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.PartiallyExecutedActiveStatementUpdate, nameof(FeaturesResources.Updating_an_active_statement_requires_restarting_the_application)); diff --git a/src/Features/Core/Portable/EditAndContinue/EditSession.cs b/src/Features/Core/Portable/EditAndContinue/EditSession.cs index 526274eb9abbc..e4ffe3939bed5 100644 --- a/src/Features/Core/Portable/EditAndContinue/EditSession.cs +++ b/src/Features/Core/Portable/EditAndContinue/EditSession.cs @@ -723,7 +723,8 @@ internal static void MergePartialEdits( edit.Kind, oldSymbol: oldSymbol, newSymbol: newSymbol, - syntaxMap: edit.SyntaxMap)); + syntaxMap: edit.SyntaxMaps.MatchingNodes, + runtimeRudeEdit: edit.SyntaxMaps.RuntimeRudeEdits)); } } @@ -738,7 +739,7 @@ internal static void MergePartialEdits( // Calculate merged syntax map for each partial type symbol: var symbolKeyComparer = SymbolKey.GetComparer(ignoreCase: false, ignoreAssemblyKeys: true); - var mergedUpdateEditSyntaxMaps = new Dictionary?>(symbolKeyComparer); + var mergedUpdateEditSyntaxMaps = new Dictionary? matchingNodes, Func? runtimeRudeEdits)>(symbolKeyComparer); var updatesByPartialType = edits .Where(edit => edit is { PartialType: not null, Kind: SemanticEditKind.Update }) @@ -746,21 +747,23 @@ internal static void MergePartialEdits( foreach (var partialTypeEdits in updatesByPartialType) { - Debug.Assert(partialTypeEdits.All(edit => edit.SyntaxMapTree is null == edit.SyntaxMap is null)); + Func? mergedMatchingNodes; + Func? mergedRuntimeRudeEdits; - Func? mergedSyntaxMap; - if (partialTypeEdits.Any(static e => e.SyntaxMap != null)) + if (partialTypeEdits.Any(static e => e.SyntaxMaps.HasMap)) { - var newTrees = partialTypeEdits.Where(edit => edit.SyntaxMapTree != null).SelectAsArray(edit => edit.SyntaxMapTree!); - var syntaxMaps = partialTypeEdits.Where(edit => edit.SyntaxMap != null).SelectAsArray(edit => edit.SyntaxMap!); - mergedSyntaxMap = node => syntaxMaps[newTrees.IndexOf(node.SyntaxTree)](node); + var newMaps = partialTypeEdits.Where(static edit => edit.SyntaxMaps.HasMap).SelectAsArray(static edit => edit.SyntaxMaps); + + mergedMatchingNodes = node => newMaps[newMaps.IndexOf(static (m, node) => m.NewTree == node.SyntaxTree, node)].MatchingNodes!(node); + mergedRuntimeRudeEdits = node => newMaps[newMaps.IndexOf(static (m, node) => m.NewTree == node.SyntaxTree, node)].RuntimeRudeEdits?.Invoke(node); } else { - mergedSyntaxMap = null; + mergedMatchingNodes = null; + mergedRuntimeRudeEdits = null; } - mergedUpdateEditSyntaxMaps.Add(partialTypeEdits.Key, mergedSyntaxMap); + mergedUpdateEditSyntaxMaps.Add(partialTypeEdits.Key, (mergedMatchingNodes, mergedRuntimeRudeEdits)); } // Deduplicate edits based on their target symbol and use merged syntax map calculated above for a given partial type. @@ -776,8 +779,8 @@ internal static void MergePartialEdits( var (oldSymbol, newSymbol) = resolvedSymbols[i]; if (visitedSymbols.Add(newSymbol ?? oldSymbol!)) { - var syntaxMap = (edit.Kind == SemanticEditKind.Update) ? mergedUpdateEditSyntaxMaps[edit.PartialType.Value] : null; - mergedEditsBuilder.Add(new SemanticEdit(edit.Kind, oldSymbol, newSymbol, syntaxMap)); + var syntaxMaps = (edit.Kind == SemanticEditKind.Update) ? mergedUpdateEditSyntaxMaps[edit.PartialType.Value] : default; + mergedEditsBuilder.Add(new SemanticEdit(edit.Kind, oldSymbol, newSymbol, syntaxMaps.matchingNodes, syntaxMaps.runtimeRudeEdits)); } } } diff --git a/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs b/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs index 5543b9a31ea6d..eb8abc1410ea5 100644 --- a/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs +++ b/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs @@ -62,17 +62,17 @@ internal enum RudeEditKind : ushort AwaitStatementUpdate = 46, ChangingAccessibility = 47, - CapturingVariable = 48, - NotCapturingVariable = 49, - DeletingCapturedVariable = 50, + // CapturingVariable = 48, + // NotCapturingVariable = 49, + // DeletingCapturedVariable = 50, ChangingCapturedVariableType = 51, ChangingCapturedVariableScope = 52, ChangingLambdaParameters = 53, ChangingLambdaReturnType = 54, - AccessingCapturedVariableInLambda = 55, - NotAccessingCapturedVariableInLambda = 56, - InsertLambdaWithMultiScopeCapture = 57, - DeleteLambdaWithMultiScopeCapture = 58, + // AccessingCapturedVariableInLambda = 55, + // NotAccessingCapturedVariableInLambda = 56, + // InsertLambdaWithMultiScopeCapture = 57, + // DeleteLambdaWithMultiScopeCapture = 58, ChangingQueryLambdaType = 59, InsertAroundActiveStatement = 60, diff --git a/src/Features/Core/Portable/EditAndContinue/SemanticEditInfo.cs b/src/Features/Core/Portable/EditAndContinue/SemanticEditInfo.cs index c760f36e5a59c..cdcc15717bbce 100644 --- a/src/Features/Core/Portable/EditAndContinue/SemanticEditInfo.cs +++ b/src/Features/Core/Portable/EditAndContinue/SemanticEditInfo.cs @@ -4,42 +4,67 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.Emit; namespace Microsoft.CodeAnalysis.EditAndContinue { + internal readonly record struct SyntaxMaps + { + /// + /// The tree the maps operate on (the new tree, since the maps are mapping from new nodes to old nodes/rude edits). + /// + public readonly SyntaxTree NewTree; + + public readonly Func? MatchingNodes; + public readonly Func? RuntimeRudeEdits; + + public SyntaxMaps( + SyntaxTree newTree, + Func? matchingNodes = null, + Func? runtimeRudeEdits = null) + { + // if we have runtime rude edit map we should also have matching node map: + Debug.Assert(runtimeRudeEdits == null || matchingNodes != null); + + NewTree = newTree; + MatchingNodes = matchingNodes; + RuntimeRudeEdits = runtimeRudeEdits; + } + + [MemberNotNullWhen(true, nameof(MatchingNodes))] + public bool HasMap => MatchingNodes != null; + } + internal readonly struct SemanticEditInfo { public SemanticEditInfo( SemanticEditKind kind, SymbolKey symbol, - Func? syntaxMap, - SyntaxTree? syntaxMapTree, + SyntaxMaps syntaxMaps, SymbolKey? partialType, SymbolKey? deletedSymbolContainer) { Debug.Assert(kind == SemanticEditKind.Delete || deletedSymbolContainer == null); - Debug.Assert(partialType == null || syntaxMap is null == syntaxMapTree is null); Kind = kind; Symbol = symbol; - SyntaxMap = syntaxMap; - SyntaxMapTree = syntaxMapTree; + SyntaxMaps = syntaxMaps; PartialType = partialType; DeletedSymbolContainer = deletedSymbolContainer; } public static SemanticEditInfo CreateInsert(SymbolKey symbol, SymbolKey? partialType) - => new(SemanticEditKind.Insert, symbol, syntaxMap: null, syntaxMapTree: null, partialType, deletedSymbolContainer: null); + => new(SemanticEditKind.Insert, symbol, syntaxMaps: default, partialType, deletedSymbolContainer: null); - public static SemanticEditInfo CreateUpdate(SymbolKey symbol, Func? syntaxMap, SyntaxTree? syntaxMapTree, SymbolKey? partialType) - => new(SemanticEditKind.Update, symbol, syntaxMap, syntaxMapTree, partialType, deletedSymbolContainer: null); + public static SemanticEditInfo CreateUpdate(SymbolKey symbol, SyntaxMaps syntaxMaps, SymbolKey? partialType) + => new(SemanticEditKind.Update, symbol, syntaxMaps, partialType, deletedSymbolContainer: null); public static SemanticEditInfo CreateReplace(SymbolKey symbol, SymbolKey? partialType) - => new(SemanticEditKind.Replace, symbol, syntaxMap: null, syntaxMapTree: null, partialType, deletedSymbolContainer: null); + => new(SemanticEditKind.Replace, symbol, syntaxMaps: default, partialType, deletedSymbolContainer: null); public static SemanticEditInfo CreateDelete(SymbolKey symbol, SymbolKey deletedSymbolContainer, SymbolKey? partialType) - => new(SemanticEditKind.Delete, symbol, syntaxMap: null, syntaxMapTree: null, partialType, deletedSymbolContainer); + => new(SemanticEditKind.Delete, symbol, syntaxMaps: default, partialType, deletedSymbolContainer); /// /// or or . @@ -67,20 +92,14 @@ public static SemanticEditInfo CreateDelete(SymbolKey symbol, SymbolKey deletedS public SymbolKey? DeletedSymbolContainer { get; } /// - /// The syntax map for nodes in the tree for this edit, which will be merged with other maps from other trees for this type. - /// - public Func? SyntaxMap { get; } - - /// - /// The tree operates on (the new tree, since the map is mapping from new nodes to old nodes). - /// Only available when is not null. + /// Syntax maps for nodes in the tree for this edit, which will be merged with other maps from other trees for this type. /// - public SyntaxTree? SyntaxMapTree { get; } + public SyntaxMaps SyntaxMaps { get; } /// /// Specified if the edit needs to be merged with other edits of the same . /// - /// If specified, the is either null or incomplete: it only provides mapping of the changed members of a single partial type declaration. + /// If specified, the is either null or incomplete: it only provides mapping of the changed members of a single partial type declaration. /// public SymbolKey? PartialType { get; } } diff --git a/src/Features/Core/Portable/EditAndContinue/Utilities/BidirectionalMap.cs b/src/Features/Core/Portable/EditAndContinue/Utilities/BidirectionalMap.cs index 9a3dee7865ca7..34d592e3a75ed 100644 --- a/src/Features/Core/Portable/EditAndContinue/Utilities/BidirectionalMap.cs +++ b/src/Features/Core/Portable/EditAndContinue/Utilities/BidirectionalMap.cs @@ -23,6 +23,22 @@ public BidirectionalMap(IReadOnlyDictionary forward, IReadOnlyDictionary With(T source, T target) + { + var forward = new Dictionary(Forward.Count + 1); + var reverse = new Dictionary(Reverse.Count + 1); + + foreach (var entry in Forward) + { + forward.Add(entry.Key, entry.Value); + reverse.Add(entry.Value, entry.Key); + } + + forward.Add(source, target); + reverse.Add(target, source); + return new(forward, reverse); + } + public BidirectionalMap With(BidirectionalMap map) { if (map.Forward.Count == 0) diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index e77b0ee4600a0..159e455f961cc 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -369,12 +369,6 @@ Changing visibility of {0} requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - - - Ceasing to capture variable '{0}' requires restarting the application. - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. @@ -387,9 +381,6 @@ Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Deleting captured variable '{0}' requires restarting the application. - Changing the type of a captured variable '{0}' previously of type '{1}' requires restarting the application. @@ -405,18 +396,6 @@ Changing the declaration scope of a captured variable '{0}' requires restarting the application. - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Adding {0} into a {1} requires restarting the application. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index 716bdc2cd96dc..60a2af02f1e87 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -40,11 +40,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Odčítání musí být posledním prvkem ve třídě znaků. This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - Přístup k zachycené proměnné {0}, ke které se v {1} nepovedlo získat přístup, vyžaduje restartování aplikace. - - Add 'DebuggerDisplay' attribute Přidat atribut DebuggerDisplay @@ -115,11 +110,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Přidání {0} vyžaduje restartování aplikace. - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Přidání {0} s přístupem k zachyceným proměnným {1} a {2} deklarovaným v jiných oborech vyžaduje restartování aplikace. - - Adding {0} with the Handles clause requires restarting the application. Přidání {0} s klauzulí Handles vyžaduje restartování aplikace. @@ -365,26 +355,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - Zachycení proměnné {0}, která se předtím nezachytila, vyžaduje restartování aplikace. - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - Ukončení přístupu k zachycené proměnné {0} v {1} vyžaduje restartování aplikace. - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. Dokončení zachytávání parametru primárního konstruktoru '{0}' '{1}' vyžaduje restartování aplikace. - - Ceasing to capture variable '{0}' requires restarting the application. - Ukončení zachytávání proměnné {0} vyžaduje restartování aplikace. - - <infer> <vyvodit> @@ -670,11 +645,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Odstranění {0} vyžaduje restartování aplikace, protože není podporováno modulem runtime. - - Deleting captured variable '{0}' requires restarting the application. - Odstranění zachycené proměnné {0} vyžaduje restartování aplikace. - - Directives from '{0}' Direktivy z {0} @@ -2565,11 +2535,6 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Odebrat nepoužívané proměnné - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Odebrání {0} s přístupem k zachyceným proměnným {1} a {2} deklarovaným v jiných oborech vyžaduje restartování aplikace. - - Removing {0} that contains an active statement requires restarting the application. Odstranění {0} s aktivním příkazem vyžaduje restartování aplikace. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index 00400731869e5..87823b31d3241 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -40,11 +40,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Eine Subtraktion muss das letzte Element in einer Zeichenklasse sein. This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - Für den Zugriff auf die erfasste Variable „{0}“, auf die in {1} noch nicht zugegriffen wurde, muss die Anwendung neu gestartet werden. - - Add 'DebuggerDisplay' attribute DebuggerDisplay-Attribut hinzufügen @@ -115,11 +110,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Hinzufügen von {0} erfordert einen Neustart der Anwendung. - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Das Hinzufügen von {0}, welche Zugriff auf die erfassten Variablen „{1}“ und „{2}“ hat, die in unterschiedlichen Bereichen deklariert sind, erfordert einen Neustart der Anwendung. - - Adding {0} with the Handles clause requires restarting the application. Das Hinzufügen von {0} mit der der Handles-Klausel erfordert einen Neustart der Anwendung. @@ -365,26 +355,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - Das Erfassen der zuvor noch nicht erfassten Variablen „{0}“ erfordert einen Neustart der Anwendung. - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - Das Beenden des Zugriffs auf die erfasste Variable „{0}“ in {1} erfordert einen Neustart der Anwendung. - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. Das Erfassen des primären Konstruktorparameters '{0}' von '{1}' erfordert einen Neustart der Anwendung. - - Ceasing to capture variable '{0}' requires restarting the application. - Das Beenden der Erfassung der Variablen „{0}“ erfordert einen Neustart der Anwendung. - - <infer> <ableiten> @@ -670,11 +645,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Löschen von {0} erfordert einen Neustart der Anwendung, da es von der Laufzeit nicht unterstützt wird. - - Deleting captured variable '{0}' requires restarting the application. - Das Löschen der erfassten Variable „{0}“ erfordert einen Neustart der Anwendung. - - Directives from '{0}' Richtlinien von '{0}' @@ -2565,11 +2535,6 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Nicht verwendete Variablen entfernen - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Das Entfernen von {0}, welche auf die erfassten Variablen „{1}“ und „{2}“ zugegriffen hat, die in unterschiedlichen Bereichen deklariert sind, erfordert einen Neustart der Anwendung. - - Removing {0} that contains an active statement requires restarting the application. Das Entfernen von {0}, die eine aktive Anweisung enthält, erfordert einen Neustart der Anwendung. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 834e1a21f3ec9..0076529a49d7f 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -40,11 +40,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Una sustracción debe ser el último elemento de una clase de caracteres This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - Para acceder a la variable capturada "{0}" a la que no se ha accedido antes en {1} se requiere reiniciar la aplicación. - - Add 'DebuggerDisplay' attribute Agregar atributo de "DebuggerDisplay" @@ -115,11 +110,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para agregar {0} se requiere reiniciar la aplicación. - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Para agregar {0} que tiene acceso a las variables capturadas "{1}" y "{2}" declaradas en distintos ámbitos es necesario reiniciar la aplicación. - - Adding {0} with the Handles clause requires restarting the application. Para agregar {0} con la cláusula Handles es necesario reiniciar la aplicación. @@ -365,26 +355,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - Para capturar la variable "{0}" que no ha sido capturada antes, se requiere reiniciar la aplicación. - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - Para dejar de acceder a la variable capturada "{0}" en {1} es necesario reiniciar la aplicación. - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. Dejar de capturar el parámetro de constructor principal '{0}' de '{1}' requiere reiniciar la aplicación. - - Ceasing to capture variable '{0}' requires restarting the application. - Para dejar de capturar la variable "{0}" es necesario reiniciar la aplicación. - - <infer> <inferir> @@ -670,11 +645,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para eliminar {0} se requiere reiniciar la aplicación porque no es compatible con el tiempo de ejecución. - - Deleting captured variable '{0}' requires restarting the application. - Para eliminar la variable capturada "{0}" se requiere reiniciar la aplicación. - - Directives from '{0}' Directivas de '{0}' @@ -2565,11 +2535,6 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Quitar variables no utilizadas - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Para quitar {0} que accedió a las variables capturadas "{1}" y "{2}" declaradas en distintos ámbitos, se requiere reiniciar la aplicación. - - Removing {0} that contains an active statement requires restarting the application. Para quitar {0} que contiene una instrucción de acción es necesario reiniciar la aplicación. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index 071d0efe9ab0e..17ff8b643e046 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -40,11 +40,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Une soustraction doit être le dernier élément dans une classe de caractères This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - L’accès à la variable capturée « {0} » qui n’a pas été accessible auparavant dans {1} nécessite le redémarrage de l’application. - - Add 'DebuggerDisplay' attribute Ajouter l'attribut 'DebuggerDisplay' @@ -115,11 +110,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai L’ajout de {0} requiert le redémarrage de l’application. - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - L’ajout de {0} ayant accédé aux variables capturées « {1} » et « {2} » déclarées dans différentes étendues requiert le redémarrage de l’application. - - Adding {0} with the Handles clause requires restarting the application. L’ajout de {0} avec la clause Handles requiert le redémarrage de l’application. @@ -365,26 +355,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - La capture de la variable « {0} » qui n’a pas été capturée avant requiert le redémarrage de l’application. - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - L'arrêt de l'accès à la variable capturée « {0} » dans {1} requiert le redémarrage de l’application. - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. L’annulation de la capture du paramètre de constructeur principal '{0}' de '{1}' nécessite le redémarrage de l’application. - - Ceasing to capture variable '{0}' requires restarting the application. - L’arrêt de la capture de la variable « {0} » requiert le redémarrage de l’application. - - <infer> <déduire> @@ -670,11 +645,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai La suppression de {0} requiert le redémarrage de l’application, car elle n’est pas prise en charge par le Runtime. - - Deleting captured variable '{0}' requires restarting the application. - La suppression de la variable capturée « {0} » requiert le redémarrage de l’application. - - Directives from '{0}' Directives de '{0}' @@ -2565,11 +2535,6 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Supprimer les variables inutilisées - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - La suppression des {0} ayant accédé aux variables capturées « {1} » et « {2} » déclarées dans différentes étendues nécessite le redémarrage de l’application. - - Removing {0} that contains an active statement requires restarting the application. La suppression de {0} qui contient une instruction active requiert le redémarrage de l’application. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index f3e68e764bbd7..d868c8e779606 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -40,11 +40,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa L'ultimo elemento di una classe di caratteri deve essere una sottrazione This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - Se si accede alla variabile catturata '{0}' a cui non è stato ancora eseguito l'accesso in {1}, è necessario riavviare l'applicazione. - - Add 'DebuggerDisplay' attribute Aggiungi l'attributo 'DebuggerDisplay' @@ -115,11 +110,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si aggiunge {0}, è necessario riavviare l'applicazione. - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Se si aggiunge {0} che accede alle variabili catturate '{1}' e {2}' dichiarate in ambiti diversi, è necessario riavviare l'applicazione. - - Adding {0} with the Handles clause requires restarting the application. Se si aggiunge {0} con la clausola Handles, è necessario riavviare l'applicazione. @@ -365,26 +355,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - Se si acquisisce la variabile '{0}' che non è stata acquisita prima, è necessario riavviare l'applicazione. - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - Se si interrompe l'accesso alla variabile catturata '{0}' in {1}, è necessario riavviare l'applicazione. - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. Per non acquisire il parametro del costruttore primario '{0}' di '{1}' è necessario riavviare l'applicazione. - - Ceasing to capture variable '{0}' requires restarting the application. - Se si interrompe l'acquisizione della variabile '{0}', è necessario riavviare l'applicazione. - - <infer> <deduci> @@ -670,11 +645,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si elimina {0}, è necessario riavviare l'applicazione perché l'operazione non è supportata dal runtime. - - Deleting captured variable '{0}' requires restarting the application. - Se si elimina la variabile catturata '{0}', è necessario riavviare l'applicazione. - - Directives from '{0}' Direttive da '{0}' @@ -2565,11 +2535,6 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Rimuovi le variabili non usate - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Se si rimuove {0} che ha effettuato l'accesso alle variabili catturate '{1}' e {2}' dichiarate in ambiti diversi, è necessario riavviare l'applicazione. - - Removing {0} that contains an active statement requires restarting the application. Se si rimuove {0} che contiene un'istruzione attiva, è necessario riavviare l'applicazione. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index bec6ba407a574..585d26af3b4ad 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -40,11 +40,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 減算は、文字クラスの最後の要素でなければなりません This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - {1} でアクセスしたことがないキャプチャされた変数 '{0}' にアクセスするには、アプリケーションを再起動する必要があります。 - - Add 'DebuggerDisplay' attribute 'DebuggerDisplay' 属性の追加 @@ -115,11 +110,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0} を追加するには、アプリケーションを再起動する必要があります。 - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - 異なるスコープで宣言された、キャプチャした変数 '{0}' と '{1}' にアクセスする {2} を追加するには、アプリケーションを再起動する必要があります。 - - Adding {0} with the Handles clause requires restarting the application. Handles 句 に {0} を追加するには、アプリケーションを再起動する必要があります。 @@ -365,26 +355,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - 以前にキャプチャされていない変数 '{0}' をキャプチャするには、アプリケーションを再起動する必要があります。 - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - {1} にあるキャプチャした変数 '{0}' へのアクセスを中止するには、アプリケーションを再起動する必要があります。 - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. '{1}' のプライマリ コンストラクター パラメーター '{0}' をキャプチャするには、アプリケーションを再起動する必要があります。 - - Ceasing to capture variable '{0}' requires restarting the application. - 変数 '{0}' のキャプチャを中止するには、アプリケーションを再起動する必要があります。 - - <infer> <推測する> @@ -670,11 +645,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ランタイムでサポートされていないため、{0} を削除するには、アプリケーションを再起動する必要があります。 - - Deleting captured variable '{0}' requires restarting the application. - キャプチャした変数 '{0}' を削除するには、アプリケーションを再起動する必要があります。 - - Directives from '{0}' '{0}' からのディレクティブ @@ -2565,11 +2535,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 未使用の変数を削除する - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - 異なるスコープで宣言された、キャプチャされた変数 '{1}' と '{2}' にアクセスした {0} を削除するには、アプリケーションを再起動する必要があります。 - - Removing {0} that contains an active statement requires restarting the application. アクティブ ステートメントを含む {0} を削除するには、アプリケーションを再起動する必要があります。 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index d8cd4a460a0ca..ac6089d88190e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -40,11 +40,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 빼기는 문자 클래스의 마지막 요소여야 합니다. This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - {1}에서 이전에 액세스하지 않은 캡처된 변수 '{0}'에 액세스하려면 애플리케이션을 다시 시작해야 합니다. - - Add 'DebuggerDisplay' attribute 'DebuggerDisplay' 특성을 추가합니다. @@ -115,11 +110,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma {0}을(를) 추가하려면 애플리케이션을 다시 시작해야 합니다. - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - 다른 범위에서 선언된 캡처된 변수 '{1}' 및 '{2}'에 액세스하는 {0}을 추가하려면 응용 프로그램을 다시 시작해야 합니다. - - Adding {0} with the Handles clause requires restarting the application. Handles 절과 함께 {0}을(를) 추가하려면 응용 프로그램을 다시 시작해야 합니다. @@ -365,26 +355,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - 이전에 캡처되지 않은 '{0}' 변수를 캡처하려면 응용 프로그램을 다시 시작해야 합니다. - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - {1}에서 캡처된 변수 '{0}'에 대한 액세스를 중지하려면 응용 프로그램을 다시 시작해야 합니다. - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. '{1}' 기본 생성자 매개 변수 '{0}' 캡처하려면 애플리케이션을 다시 시작해야 합니다. - - Ceasing to capture variable '{0}' requires restarting the application. - 변수 '{0}' 캡처를 중지하려면 응용 프로그램을 다시 시작해야 합니다. - - <infer> <유추> @@ -670,11 +645,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 런타임에서 지원하지 않기 때문에 {0}을(를) 삭제하려면 응용 프로그램을 다시 시작해야 합니다. - - Deleting captured variable '{0}' requires restarting the application. - 캡처된 변수 '{0}'을(를) 삭제하려면 응용 프로그램을 다시 시작해야 합니다. - - Directives from '{0}' '{0}'의 지시문 @@ -2565,11 +2535,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 사용하지 않는 변수 제거 - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - 다른 범위에서 선언된 캡처된 변수 '{1}' 및 '{2}'에 액세스한 {0}을(를) 제거하려면 애플리케이션을 다시 시작해야 합니다. - - Removing {0} that contains an active statement requires restarting the application. 활성 문이 포함된 {0}을(를) 제거하려면 응용 프로그램을 다시 시작해야 합니다. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index cbd46f342d6f6..d653c327d357c 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -40,11 +40,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Odejmowanie musi być ostatnim elementem w klasie znaków This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - Uzyskanie dostępu do przechwyconej zmiennej elementu „{0}”, do którego nie uzyskano dostępu wcześniej w {1}, wymaga ponownego uruchomienia aplikacji. - - Add 'DebuggerDisplay' attribute Dodaj atrybut "DebuggerDisplay" @@ -115,11 +110,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Dodanie elementu {0} wymaga ponownego uruchomienia aplikacji. - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Dodawanie elementu {0}, który uzyskuje dostęp do przechwyconych zmiennych „{1}" i „{2}" zadeklarowanych w różnych zakresach, wymaga ponownego uruchomienia aplikacji. - - Adding {0} with the Handles clause requires restarting the application. Dodawanie elementu {0} za pomocą klauzuli procedur Handles wymaga ponownego uruchomienia aplikacji. @@ -365,26 +355,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - Przechwytywanie zmiennej "{0}", która nie została przechwycona wcześniej, wymaga ponownego uruchomienia aplikacji. - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - Zaprzestanie dostępu do przechwyconej zmiennej "{0}" w {1} wymaga ponownego uruchomienia aplikacji. - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. Próba przechwycenia podstawowego parametru konstruktora '{0}' '{1}' wymaga ponownego uruchomienia aplikacji. - - Ceasing to capture variable '{0}' requires restarting the application. - Zaprzestanie przechwytywania zmiennej "{0}" wymaga ponownego uruchomienia aplikacji. - - <infer> <wnioskuj> @@ -670,11 +645,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Usunięcie {0} wymaga ponownego uruchomienia aplikacji, ponieważ nie jest to obsługiwane przez środowisko uruchomieniowe. - - Deleting captured variable '{0}' requires restarting the application. - Usuwanie przechwyconej zmiennej "{0}" wymaga ponownego uruchomienia aplikacji. - - Directives from '{0}' Dyrektywy z „{0}” @@ -2565,11 +2535,6 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Usuń nieużywane zmienne - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Usunięcie elementu {0}, który uzyskał dostęp do przechwyconych zmiennych „{1}" i „{2}" deklarowanych w różnych zakresach, wymaga ponownego uruchomienia aplikacji. - - Removing {0} that contains an active statement requires restarting the application. Usuwanie elementu {0}, który zawiera aktywną instrukcję, wymaga ponownego uruchomienia aplikacji. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index d2a80e9fbe815..cc2e7ecaa2cb1 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -40,11 +40,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Uma subtração deve ser o último elemento em uma classe de caracteres This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - O acesso à variável capturada '{0}' que não foi acessada antes em {1} requer o reinício do aplicativo. - - Add 'DebuggerDisplay' attribute Adicionar atributo 'DebuggerDisplay' @@ -115,11 +110,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Adicionar {0} requer reiniciar o aplicativo. - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Adicionar {0} que acessa as variáveis capturadas '{1}' e '{2}' declaradas em escopos diferentes requer a reinicialização do aplicativo. - - Adding {0} with the Handles clause requires restarting the application. Adicionar {0} com a cláusula Handles requer a reinicialização do aplicativo. @@ -365,26 +355,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - Capturar a variável '{0}' que não foi capturada antes requer a reinicialização do aplicativo. - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - Deixar de acessar a variável capturada '{0}' em {1} requer a reinicialização do aplicativo. - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. - - Ceasing to capture variable '{0}' requires restarting the application. - Deixar de capturar a variável '{0}' requer a reinicialização do aplicativo. - - <infer> <inferir> @@ -670,11 +645,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess A exclusão do {0} requer a reinicialização do aplicativo porque não é compatível com o tempo de execução. - - Deleting captured variable '{0}' requires restarting the application. - Excluir a variável capturada '{0}' requer a reinicialização do aplicativo. - - Directives from '{0}' Diretrizes de '{0}' @@ -2565,11 +2535,6 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Remover variáveis não utilizadas - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - A remoção de {0} que acessou as variáveis ​​capturadas '{1}' e '{2}' declaradas em escopos diferentes requer o reinício do aplicativo. - - Removing {0} that contains an active statement requires restarting the application. Remover {0} que contém uma instrução ativa requer a reinicialização do aplicativo. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index eacccead4271c..d88fa16c1de00 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -40,11 +40,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Вычитание должно быть последним элементом в классе символов This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - Для доступа к зафиксированной переменной "{0}", к которой ранее не было доступа в {1}, требуется перезапустить приложение. - - Add 'DebuggerDisplay' attribute Добавить атрибут "DebuggerDisplay" @@ -115,11 +110,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для добавления {0} требуется перезапустить приложение. - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Для добавления {0} с доступом к зафиксированным переменным "{1}" и "{2}", которые объявлены в разных областях, требуется перезапустить приложение. - - Adding {0} with the Handles clause requires restarting the application. Для добавления {0} с предложением Handles требуется перезапустить приложение. @@ -365,26 +355,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - Для фиксации переменной "{0}", которая ранее не была зафиксированной, требуется перезапустить приложение. - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - Для прекращения доступа к зафиксированной переменной "{0}" в {1} требуется перезапустить приложение. - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. Для записи параметра первичного конструктора '{0}' '{1}' требуется перезапуск приложения. - - Ceasing to capture variable '{0}' requires restarting the application. - Для прекращения фиксации переменной "{0}" требуется перезапустить приложение. - - <infer> <вывести> @@ -670,11 +645,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для удаления {0} требуется перезапустить приложение, поскольку удаление не поддерживается средой выполнения. - - Deleting captured variable '{0}' requires restarting the application. - Для удаления зафиксированной переменной "{0}" требуется перезапустить приложение. - - Directives from '{0}' Директивы из "{0}" @@ -2565,11 +2535,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Удалить неиспользуемые переменные - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Для удаления {0} с доступом к зафиксированным переменным "{1}" и "{2}", которые объявлены в разных областях, требуется перезапустить приложение. - - Removing {0} that contains an active statement requires restarting the application. Для удаления {0} с активным оператором требуется перезапустить приложение. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index 94ff36ee36b11..4248b1c5b2157 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -40,11 +40,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Bir çıkarma bir karakter sınıfı içinde son öğe olması gerekir This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - {1} öğesinde daha önce erişilmeyen yakalanan '{0}' değişkenine erişilmesi, uygulamanın yeniden başlatılmasını gerektirir. - - Add 'DebuggerDisplay' attribute 'DebuggerDisplay' özniteliği ekle @@ -115,11 +110,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be {0} öğesinin eklenmesi, uygulamanın yeniden başlatılmasını gerektirir. - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Farklı kapsamlarda tanımlanan yakalanmış '{1}' ve '{2}' değişkenlerine erişen {0} öğesini eklemek, uygulamanın yeniden başlatılmasını gerektirir. - - Adding {0} with the Handles clause requires restarting the application. Handles yan tümcesi ile {0} eklemek, uygulamanın yeniden başlatılmasını gerektirir. @@ -365,26 +355,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - Önceden yakalanmamış olan '{0}' değişkenini yakalamak, uygulamanın yeniden başlatılmasını gerektiriyor. - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - {1}‘ de yakalanan '{0}' değişkenine erişimin kesilmesi uygulamanın yeniden başlatılmasını gerektirir. - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. Birincil oluşturucu parametresinin yakalaması '{0}' '{1}' için uygulamanın yeniden başlatılması gerekir. - - Ceasing to capture variable '{0}' requires restarting the application. - '{0}' değişkeninin yakalanmasının kesilmesi, uygulamanın yeniden başlatılmasını gerektirir. - - <infer> <çıkarsa> @@ -670,11 +645,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be {0} öğesini silmek, çalışma zamanı tarafından desteklenmediğinden uygulamanın yeniden başlatılmasını gerektirir. - - Deleting captured variable '{0}' requires restarting the application. - Yakalanan '{0}' değişkenini silmek, uygulamanın yeniden başlatılmasını gerektirir. - - Directives from '{0}' '{0}' yönergeleri @@ -2565,11 +2535,6 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Kullanılmayan değişkenleri kaldır - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - Farklı kapsamlarda bildirilen '{1}' ve '{2}' değişkenlerine erişen {0} öğesinin kaldırılması, uygulamanın yeniden başlatılmasını gerektirir. - - Removing {0} that contains an active statement requires restarting the application. Etkin bir deyim içeren {0} öğesinin kaldırılması, uygulamanın yeniden başlatılmasını gerektirir. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index afd10f249bf0a..4264062228ec5 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -40,11 +40,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 负号必须是字符类中的最后一个元素 This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - 访问已捕获变量“{0}”(以前未在 {1} 中访问过)需要重启应用程序。 - - Add 'DebuggerDisplay' attribute 添加 "DebuggerDisplay" 属性 @@ -115,11 +110,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 添加 {0} 要求重启应用程序。 - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - 添加访问已在不同范围内声明的捕获的变量“{1}”和“{2}”的 {0} 需要重新启动应用程序。 - - Adding {0} with the Handles clause requires restarting the application. 使用 Handles 子句添加 {0} 需要重新启动应用程序。 @@ -365,26 +355,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - 捕获之前尚未捕获到的变量“{0}”需要重新启动应用程序。 - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - 中止访问 {1} 中捕获的变量“{0}”需要重新启动应用程序。 - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. 若要捕获主构造函数参数 '{0}' '{1}' 需要重新启动应用程序。 - - Ceasing to capture variable '{0}' requires restarting the application. - 取消捕获变量“{0}”需要重新启动应用程序。 - - <infer> <推断> @@ -670,11 +645,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 删除 {0} 需要重新启动应用程序,因为不受运行时支持。 - - Deleting captured variable '{0}' requires restarting the application. - 删除捕获的变量“{0}”需要重新启动应用程序。 - - Directives from '{0}' 来自'{0}'的指令 @@ -2565,11 +2535,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 删除未使用的变量 - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - 删除已访问在不同作用域中声明的已捕获变量“{1}”和“{2}”的 {0} 需要重启应用程序。 - - Removing {0} that contains an active statement requires restarting the application. 删除包含活动语句的 {0} 需要重新启动应用程序。 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index 1aeb090f85b7d..45d38358073ee 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -40,11 +40,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 減法必須是字元類別中的最後一個元素 This is an error message shown to the user when they write an invalid Regular Expression. Example: [a-[b]-c] - - Accessing captured variable '{0}' that hasn't been accessed before in {1} requires restarting the application. - 存取在 {1} 中尚未存取的擷取到的變數 '{0}' 需要重新啟動應用程式。 - - Add 'DebuggerDisplay' attribute 新增 'DebuggerDisplay' 屬性 @@ -115,11 +110,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 新增 {0} 需要重新啟動應用程式。 - - Adding {0} that accesses captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - 新增在不同的範圍中宣告存取擷取到的變數 '{1}' 和 '{2}' 的 {0},需要重新啟動應用程式。 - - Adding {0} with the Handles clause requires restarting the application. 新增 {0} 的 Handles 子句需要重新啟動應用程式。 @@ -365,26 +355,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Capturing primary constructor parameter '{0}' that hasn't been capture before requires restarting the application. - - Capturing variable '{0}' that hasn't been captured before requires restarting the application. - 擷取之前尚未擷取的變數 '{0}' 需要重新啟動應用程式。 - - - - Ceasing to access captured variable '{0}' in {1} requires restarting the application. - 停止在 {1} 中存取擷取到的變數 '{0}' 需要重新啟動應用程式。 - - Ceasing to capture primary constructor parameter '{0}' of '{1}' requires restarting the application. 需要重新開機應用程式,才能擷取 '{1}' 的主要建構函式參數 '{0}'。 - - Ceasing to capture variable '{0}' requires restarting the application. - 停止擷取變數 '{0}' 需要重新啟動應用程式。 - - <infer> <推斷> @@ -670,11 +645,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 刪除 {0} 需要重新啟動應用程式,因為執行階段不支援它。 - - Deleting captured variable '{0}' requires restarting the application. - 刪除擷取到的變數 '{0}' 需要重新啟動應用程式。 - - Directives from '{0}' 來自 '{0}' 的指示詞 @@ -2565,11 +2535,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 移除未使用的變數 - - Removing {0} that accessed captured variables '{1}' and '{2}' declared in different scopes requires restarting the application. - 移除已存取擷取到的變數 '{1}' 和 '{2}' 的 {0},需要重新啟動應用程式。 - - Removing {0} that contains an active statement requires restarting the application. 移除包含作用中陳述式的 {0} 需要重新啟動應用程式。 diff --git a/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb b/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb index e062593b234ec..28556a2f30284 100644 --- a/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb +++ b/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb @@ -187,6 +187,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue Return LambdaUtilities.IsClosureScope(node) End Function + Friend Overrides Function GetCapturedParameterScope(methodOrLambda As SyntaxNode) As SyntaxNode + Return methodOrLambda + End Function + Protected Overrides Function FindEnclosingLambdaBody(encompassingAncestor As SyntaxNode, node As SyntaxNode) As LambdaBody While node IsNot encompassingAncestor And node IsNot Nothing Dim body As SyntaxNode = Nothing diff --git a/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.GenerationVerifier.cs b/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.GenerationVerifier.cs index be39361a87d06..8a683dba6ef19 100644 --- a/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.GenerationVerifier.cs +++ b/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.GenerationVerifier.cs @@ -10,6 +10,7 @@ using System.Reflection.Metadata; using System.Reflection.Metadata.Ecma335; using Microsoft.CodeAnalysis.Emit; +using Microsoft.CodeAnalysis.Symbols; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; @@ -19,165 +20,179 @@ namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests internal partial class EditAndContinueTest : IDisposable { - internal sealed class GenerationVerifier + internal sealed class GenerationVerifier(int ordinal, GenerationInfo generationInfo, ImmutableArray readers) { - private readonly int _ordinal; - private readonly MetadataReader _metadataReader; - private readonly ImmutableArray _readers; - private readonly GenerationInfo _generationInfo; + public readonly List Exceptions = []; - public GenerationVerifier(int ordinal, GenerationInfo generationInfo, ImmutableArray readers) - { - _ordinal = ordinal; - _metadataReader = generationInfo.MetadataReader; - _readers = readers; - _generationInfo = generationInfo; - } + private MetadataReader MetadataReader + => generationInfo.MetadataReader; private string GetAssertMessage(string message) { - var ordinalDescription = _ordinal == 0 ? "initial baseline" : $"generation {_ordinal}"; + var ordinalDescription = ordinal == 0 ? "initial baseline" : $"generation {ordinal}"; return $"Failure in {ordinalDescription}: {message}"; } - internal void VerifyTypeDefNames(params string[] expected) + private void Verify(Action action) { - var actual = _readers.GetStrings(_metadataReader.GetTypeDefNames()); - AssertEx.Equal(expected, actual, message: GetAssertMessage("TypeDefs don't match")); + try + { + action(); + } + catch (Exception e) + { + Exceptions.Add(e); + } } + internal void VerifyTypeDefNames(params string[] expected) + => Verify(() => AssertEntityNamesEqual("TypeDefs", expected, MetadataReader.GetTypeDefNames())); + internal void VerifyMethodDefNames(params string[] expected) - { - var actual = _readers.GetStrings(_metadataReader.GetMethodDefNames()); - AssertEx.Equal(expected, actual, message: GetAssertMessage("MethodDefs don't match")); - } + => Verify(() => AssertEntityNamesEqual("MethodDefs", expected, MetadataReader.GetMethodDefNames())); internal void VerifyTypeRefNames(params string[] expected) - { - var actual = _readers.GetStrings(_metadataReader.GetTypeRefNames()); - AssertEx.Equal(expected, actual, message: GetAssertMessage("TypeRefs don't match")); - } + => Verify(() => AssertEntityNamesEqual("TypeRefs", expected, MetadataReader.GetTypeRefNames())); internal void VerifyMemberRefNames(params string[] expected) - { - var actual = _readers.GetStrings(_metadataReader.GetMemberRefNames()); - AssertEx.Equal(expected, actual, message: GetAssertMessage("MemberRefs don't match")); - } + => Verify(() => AssertEntityNamesEqual("MemberRefs", expected, MetadataReader.GetMemberRefNames())); internal void VerifyFieldDefNames(params string[] expected) - { - var actual = _readers.GetStrings(_metadataReader.GetFieldDefNames()); - AssertEx.Equal(expected, actual, message: GetAssertMessage("FieldDefs don't match")); - } + => Verify(() => AssertEntityNamesEqual("FieldDefs", expected, MetadataReader.GetFieldDefNames())); internal void VerifyPropertyDefNames(params string[] expected) - { - var actual = _readers.GetStrings(_metadataReader.GetPropertyDefNames()); - AssertEx.Equal(expected, actual, message: GetAssertMessage("PropertyDefs don't match")); - } + => Verify(() => AssertEntityNamesEqual("PropertyDefs", expected, MetadataReader.GetPropertyDefNames())); + + private void AssertEntityNamesEqual(string entityKinds, string[] expected, StringHandle[] actual) + => AssertEx.Equal(expected, readers.GetStrings(actual), message: GetAssertMessage($"{entityKinds} don't match"), itemSeparator: ", ", itemInspector: s => $"\"{s}\""); internal void VerifyDeletedMembers(params string[] expected) - { - var actual = _generationInfo.Baseline.DeletedMembers.Select(e => e.Key.ToString() + ": {" + string.Join(", ", e.Value.Select(v => v.Name)) + "}"); - AssertEx.SetEqual(expected, actual, itemSeparator: ",\r\n", itemInspector: s => $"\"{s}\""); - } + => Verify(() => + { + var actual = generationInfo.Baseline.DeletedMembers.Select(e => e.Key.ToString() + ": {" + string.Join(", ", e.Value.Select(v => v.Name)) + "}"); + AssertEx.SetEqual(expected, actual, itemSeparator: ",\r\n", itemInspector: s => $"\"{s}\""); + }); internal void VerifyTableSize(TableIndex table, int expected) - { - AssertEx.AreEqual(expected, _metadataReader.GetTableRowCount(table), message: GetAssertMessage($"{table} table size doesnt't match")); - } + => Verify(() => + { + AssertEx.AreEqual(expected, MetadataReader.GetTableRowCount(table), message: GetAssertMessage($"{table} table size doesnt't match")); + }); internal void VerifyEncLog(IEnumerable? expected = null) - { - AssertEx.Equal( - expected ?? Array.Empty(), - _metadataReader.GetEditAndContinueLogEntries(), itemInspector: EncLogRowToString, message: GetAssertMessage("EncLog doesn't match")); - } + => Verify(() => + { + AssertEx.Equal( + expected ?? Array.Empty(), + MetadataReader.GetEditAndContinueLogEntries(), itemInspector: EncLogRowToString, message: GetAssertMessage("EncLog doesn't match")); + }); internal void VerifyEncMap(IEnumerable? expected = null) - { - AssertEx.Equal( - expected ?? Array.Empty(), - _metadataReader.GetEditAndContinueMapEntries(), itemInspector: EncMapRowToString, message: GetAssertMessage("EncMap doesn't match")); - } + => Verify(() => + { + AssertEx.Equal( + expected ?? Array.Empty(), + MetadataReader.GetEditAndContinueMapEntries(), itemInspector: EncMapRowToString, message: GetAssertMessage("EncMap doesn't match")); + }); internal void VerifyEncLogDefinitions(IEnumerable? expected = null) - { - AssertEx.Equal( - expected ?? Array.Empty(), - _metadataReader.GetEditAndContinueLogEntries().Where(e => IsDefinition(e.Handle.Kind)), itemInspector: EncLogRowToString, message: GetAssertMessage("EncLog definitions don't match")); - } + => Verify(() => + { + AssertEx.Equal( + expected ?? Array.Empty(), + MetadataReader.GetEditAndContinueLogEntries().Where(e => IsDefinition(e.Handle.Kind)), itemInspector: EncLogRowToString, message: GetAssertMessage("EncLog definitions don't match")); + }); internal void VerifyEncMapDefinitions(IEnumerable? expected = null) - { - AssertEx.Equal( - expected ?? Array.Empty(), - _metadataReader.GetEditAndContinueMapEntries().Where(e => IsDefinition(e.Kind)), itemInspector: EncMapRowToString, message: GetAssertMessage("EncMap definitions don't match")); - } + => Verify(() => + { + AssertEx.Equal( + expected ?? Array.Empty(), + MetadataReader.GetEditAndContinueMapEntries().Where(e => IsDefinition(e.Kind)), itemInspector: EncMapRowToString, message: GetAssertMessage("EncMap definitions don't match")); + }); internal void VerifyCustomAttributes(IEnumerable? expected = null) - { - AssertEx.Equal( - expected ?? Array.Empty(), - _metadataReader.GetCustomAttributeRows(), itemInspector: AttributeRowToString); - } + => Verify(() => + { + AssertEx.Equal( + expected ?? Array.Empty(), + MetadataReader.GetCustomAttributeRows(), itemInspector: AttributeRowToString); + }); + + private IReadOnlyDictionary> GetSynthesizedMembers() + => (generationInfo.CompilationVerifier != null) + ? generationInfo.CompilationVerifier.TestData.Module!.GetAllSynthesizedMembers() + : generationInfo.Baseline.SynthesizedMembers; public void VerifySynthesizedMembers(params string[] expected) - { - var actual = _generationInfo.Baseline.SynthesizedMembers - .Select(e => e.Key.ToString() + ": {" + string.Join(", ", e.Value.Select(v => v.Name)) + "}"); + => VerifySynthesizedMembers(displayTypeKind: false, expected); - AssertEx.SetEqual(expected, actual, itemSeparator: ",\r\n", itemInspector: s => $"\"{s}\""); - } + public void VerifySynthesizedMembers(bool displayTypeKind, params string[] expected) + => Verify(() => + { + var actual = GetSynthesizedMembers().Select(e => + $"{(displayTypeKind && e.Key is INamedTypeSymbolInternal type ? (type.TypeKind == TypeKind.Struct ? "struct " : "class ") : "")}{e.Key}: " + + $"{{{string.Join(", ", e.Value.Select(v => v.Name))}}}"); + + AssertEx.SetEqual(expected, actual, itemSeparator: ",\r\n", itemInspector: s => $"\"{s}\""); + }); public void VerifySynthesizedFields(string typeName, params string[] expectedSynthesizedTypesAndMemberCounts) - { - var actual = _generationInfo.Baseline.SynthesizedMembers - .Single(e => e.Key.ToString() == typeName).Value.Where(s => s.Kind == SymbolKind.Field) - .Select(s => (IFieldSymbol)s.GetISymbol()).Select(f => f.Name + ": " + f.Type); + => Verify(() => + { + var actual = GetSynthesizedMembers() + .Single(e => e.Key.ToString() == typeName).Value.Where(s => s.Kind == SymbolKind.Field) + .Select(s => (IFieldSymbol)s.GetISymbol()).Select(f => f.Name + ": " + f.Type); - AssertEx.SetEqual(expectedSynthesizedTypesAndMemberCounts, actual, itemSeparator: "\r\n"); - } + AssertEx.SetEqual(expectedSynthesizedTypesAndMemberCounts, actual, itemSeparator: "\r\n"); + }); public void VerifyUpdatedMethodNames(params string[] expectedMethodNames) - { - Debug.Assert(_generationInfo.CompilationDifference != null); - CheckNames(_readers, _generationInfo.CompilationDifference.EmitResult.UpdatedMethods, expectedMethodNames); - } + => Verify(() => + { + Debug.Assert(generationInfo.CompilationDifference != null); + CheckNames(readers, generationInfo.CompilationDifference.EmitResult.UpdatedMethods, expectedMethodNames); + }); public void VerifyChangedTypeNames(params string[] expectedTypeNames) - { - Debug.Assert(_generationInfo.CompilationDifference != null); - CheckNames(_readers, _generationInfo.CompilationDifference.EmitResult.ChangedTypes, expectedTypeNames); - } + => Verify(() => + { + Debug.Assert(generationInfo.CompilationDifference != null); + CheckNames(readers, generationInfo.CompilationDifference.EmitResult.ChangedTypes, expectedTypeNames); + }); internal void VerifyMethodBody(string qualifiedMemberName, string expectedILWithSequencePoints) - => _generationInfo.CompilationVerifier!.VerifyMethodBody(qualifiedMemberName, expectedILWithSequencePoints); + => Verify(() => generationInfo.CompilationVerifier!.VerifyMethodBody(qualifiedMemberName, expectedILWithSequencePoints)); internal void VerifyPdb(IEnumerable methodTokens, string expectedPdb) - => _generationInfo.CompilationDifference!.VerifyPdb(methodTokens, expectedPdb); + => Verify(() => generationInfo.CompilationDifference!.VerifyPdb(methodTokens, expectedPdb, expectedIsRawXml: true)); internal void VerifyPdb(string qualifiedMemberName, string expectedPdb, PdbValidationOptions options = default) - => _generationInfo.CompilationVerifier!.VerifyPdb(qualifiedMemberName, expectedPdb, options: options); + => Verify(() => generationInfo.CompilationVerifier!.VerifyPdb(qualifiedMemberName, expectedPdb, options: options, expectedIsRawXml: true)); + + internal void VerifyCustomDebugInformation(string qualifiedMemberName, string expectedPdb) + => VerifyPdb(qualifiedMemberName, expectedPdb, PdbValidationOptions.ExcludeDocuments | PdbValidationOptions.ExcludeSequencePoints | PdbValidationOptions.ExcludeScopes); internal void VerifyIL(string expectedIL) - { - Debug.Assert(_generationInfo.CompilationDifference != null); - _generationInfo.CompilationDifference.VerifyIL(expectedIL); - } + => Verify(() => + { + Debug.Assert(generationInfo.CompilationDifference != null); + generationInfo.CompilationDifference.VerifyIL(expectedIL); + }); internal void VerifyIL(string qualifiedMemberName, string expectedIL) - { - if (_generationInfo.CompilationVerifier != null) + => Verify(() => { - _generationInfo.CompilationVerifier.VerifyIL(qualifiedMemberName, expectedIL); - } - else - { - Debug.Assert(_generationInfo.CompilationDifference != null); - _generationInfo.CompilationDifference.VerifyIL(qualifiedMemberName, expectedIL); - } - } + if (generationInfo.CompilationVerifier != null) + { + generationInfo.CompilationVerifier.VerifyIL(qualifiedMemberName, expectedIL); + } + else + { + Debug.Assert(generationInfo.CompilationDifference != null); + generationInfo.CompilationDifference.VerifyIL(qualifiedMemberName, expectedIL); + } + }); } } } diff --git a/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.cs b/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.cs index 22c649e801f54..b7a240af8f861 100644 --- a/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.cs +++ b/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.cs @@ -9,9 +9,11 @@ using System.Linq; using System.Reflection.Metadata; using System.Runtime.InteropServices; +using System.Text; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; +using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests @@ -105,6 +107,8 @@ internal TSelf Verify() var readers = new List(); int index = 0; + var exceptions = new List>(); + foreach (var generation in _generations) { if (readers.Count > 0) @@ -116,12 +120,40 @@ internal TSelf Verify() var verifier = new GenerationVerifier(index, generation, readers.ToImmutableArray()); generation.Verifier(verifier); + exceptions.Add(verifier.Exceptions.ToImmutableArray()); + index++; } + var assertMessage = GetAggregateMessage(exceptions); + Assert.True(assertMessage == "", assertMessage); + return This; } + private static string GetAggregateMessage(IReadOnlyList> exceptions) + { + var builder = new StringBuilder(); + for (int generation = 0; generation < exceptions.Count; generation++) + { + if (exceptions[generation].Any()) + { + builder.AppendLine($"-------------------------------------"); + builder.AppendLine($" Generation #{generation} failures"); + builder.AppendLine($"-------------------------------------"); + + foreach (var exception in exceptions[generation]) + { + builder.AppendLine(exception.Message); + builder.AppendLine(); + builder.AppendLine(exception.StackTrace); + } + } + } + + return builder.ToString(); + } + private ImmutableArray GetSemanticEdits( SemanticEditDescription[] edits, Compilation oldCompilation, @@ -153,7 +185,7 @@ private ImmutableArray GetSemanticEdits( syntaxMap = null; } - return new SemanticEdit(e.Kind, oldSymbol, newSymbol, syntaxMap); + return new SemanticEdit(e.Kind, oldSymbol, newSymbol, syntaxMap, e.RudeEdits); })); } diff --git a/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTestUtilities.cs b/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTestUtilities.cs index bdc442ff14bf1..a1df0ee1beab5 100644 --- a/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTestUtilities.cs +++ b/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTestUtilities.cs @@ -3,9 +3,9 @@ // See the LICENSE file in the project root for more information. using System; -using System.IO; using System.Collections.Generic; using System.Collections.Immutable; +using System.IO; using System.Linq; using System.Reflection.Metadata; using System.Reflection.Metadata.Ecma335; diff --git a/src/Test/PdbUtilities/EditAndContinue/SemanticEditDescription.cs b/src/Test/PdbUtilities/EditAndContinue/SemanticEditDescription.cs index c8fbb77b10c8f..eb77f4444bb2a 100644 --- a/src/Test/PdbUtilities/EditAndContinue/SemanticEditDescription.cs +++ b/src/Test/PdbUtilities/EditAndContinue/SemanticEditDescription.cs @@ -11,10 +11,12 @@ internal sealed class SemanticEditDescription( SemanticEditKind kind, Func symbolProvider, Func? newSymbolProvider = null, + Func? rudeEdits = null, bool preserveLocalVariables = false) { public readonly SemanticEditKind Kind = kind; public readonly Func SymbolProvider = symbolProvider; public readonly Func NewSymbolProvider = newSymbolProvider ?? symbolProvider; + public readonly Func? RudeEdits = rudeEdits; public readonly bool PreserveLocalVariables = preserveLocalVariables; } diff --git a/src/Test/PdbUtilities/Reader/PdbValidation.cs b/src/Test/PdbUtilities/Reader/PdbValidation.cs index 356e3fe11cd5d..0f61d3a0c25e8 100644 --- a/src/Test/PdbUtilities/Reader/PdbValidation.cs +++ b/src/Test/PdbUtilities/Reader/PdbValidation.cs @@ -54,10 +54,11 @@ public static CompilationVerifier VerifyPdb( IMethodSymbol debugEntryPoint = null, DebugInformationFormat format = 0, PdbValidationOptions options = PdbValidationOptions.Default, + bool expectedIsRawXml = false, [CallerLineNumber] int expectedValueSourceLine = 0, [CallerFilePath] string expectedValueSourcePath = null) { - verifier.Compilation.VerifyPdb(expectedPdb, embeddedTexts, debugEntryPoint, format, options, expectedValueSourceLine, expectedValueSourcePath); + verifier.Compilation.VerifyPdb(expectedPdb, embeddedTexts, debugEntryPoint, format, options, expectedIsRawXml, expectedValueSourceLine, expectedValueSourcePath); return verifier; } @@ -69,10 +70,11 @@ public static CompilationVerifier VerifyPdb( IMethodSymbol debugEntryPoint = null, DebugInformationFormat format = 0, PdbValidationOptions options = PdbValidationOptions.Default, + bool expectedIsRawXml = false, [CallerLineNumber] int expectedValueSourceLine = 0, [CallerFilePath] string expectedValueSourcePath = null) { - verifier.Compilation.VerifyPdb(qualifiedMethodName, expectedPdb, embeddedTexts, debugEntryPoint, format, options, expectedValueSourceLine, expectedValueSourcePath); + verifier.Compilation.VerifyPdb(qualifiedMethodName, expectedPdb, embeddedTexts, debugEntryPoint, format, options, expectedIsRawXml, expectedValueSourceLine, expectedValueSourcePath); return verifier; } @@ -106,10 +108,11 @@ public static void VerifyPdb( IEnumerable methodTokens, string expectedPdb, DebugInformationFormat format = DebugInformationFormat.Pdb, + bool expectedIsRawXml = false, [CallerLineNumber] int expectedValueSourceLine = 0, [CallerFilePath] string expectedValueSourcePath = null) { - VerifyPdb(diff, methodTokens, expectedPdb, format, expectedValueSourceLine, expectedValueSourcePath, expectedIsXmlLiteral: false); + VerifyPdb(diff, methodTokens, expectedPdb, format, expectedValueSourceLine, expectedValueSourcePath, expectedIsRawXml); } public static void VerifyPdb( @@ -120,7 +123,7 @@ public static void VerifyPdb( [CallerLineNumber] int expectedValueSourceLine = 0, [CallerFilePath] string expectedValueSourcePath = null) { - VerifyPdb(diff, methodTokens, expectedPdb.ToString(), format, expectedValueSourceLine, expectedValueSourcePath, expectedIsXmlLiteral: true); + VerifyPdb(diff, methodTokens, expectedPdb.ToString(), format, expectedValueSourceLine, expectedValueSourcePath, expectedIsRawXml: true); } private static void VerifyPdb( @@ -130,7 +133,7 @@ private static void VerifyPdb( DebugInformationFormat format, int expectedValueSourceLine, string expectedValueSourcePath, - bool expectedIsXmlLiteral) + bool expectedIsRawXml) { Assert.NotEqual(default(DebugInformationFormat), format); Assert.NotEqual(DebugInformationFormat.Embedded, format); @@ -146,7 +149,7 @@ private static void VerifyPdb( $"PDB format: {format}{Environment.NewLine}", expectedValueSourcePath, expectedValueSourceLine, - escapeQuotes: !expectedIsXmlLiteral); + escapeQuotes: !expectedIsRawXml); } public static void VerifyPdb( @@ -156,10 +159,11 @@ public static void VerifyPdb( IMethodSymbol debugEntryPoint = null, DebugInformationFormat format = 0, PdbValidationOptions options = PdbValidationOptions.Default, + bool expectedIsRawXml = false, [CallerLineNumber] int expectedValueSourceLine = 0, [CallerFilePath] string expectedValueSourcePath = null) { - VerifyPdb(compilation, qualifiedMethodName: null, expectedPdb, embeddedTexts, debugEntryPoint, format, options, expectedValueSourceLine, expectedValueSourcePath); + VerifyPdb(compilation, qualifiedMethodName: null, expectedPdb, embeddedTexts, debugEntryPoint, format, options, expectedIsRawXml, expectedValueSourceLine, expectedValueSourcePath); } public static void VerifyPdb( @@ -170,6 +174,7 @@ public static void VerifyPdb( IMethodSymbol debugEntryPoint = null, DebugInformationFormat format = 0, PdbValidationOptions options = PdbValidationOptions.Default, + bool expectedIsRawXml = false, [CallerLineNumber] int expectedValueSourceLine = 0, [CallerFilePath] string expectedValueSourcePath = null) { @@ -183,7 +188,7 @@ public static void VerifyPdb( options, expectedValueSourceLine, expectedValueSourcePath, - expectedIsXmlLiteral: false); + expectedIsRawXml); } public static void VerifyPdb( @@ -220,7 +225,7 @@ public static void VerifyPdb( options, expectedValueSourceLine, expectedValueSourcePath, - expectedIsXmlLiteral: true); + expectedIsRawXml: true); } private static void VerifyPdbImpl( @@ -233,7 +238,7 @@ private static void VerifyPdbImpl( PdbValidationOptions options, int expectedValueSourceLine, string expectedValueSourcePath, - bool expectedIsXmlLiteral) + bool expectedIsRawXml) { Assert.NotEqual(DebugInformationFormat.Embedded, format); @@ -258,11 +263,11 @@ void Verify(bool isPortable, bool testOtherFormat) var pdbStream = new MemoryStream(); EmitWithPdb(peStream, pdbStream, compilation, debugEntryPoint, embeddedTexts, isPortable); - VerifyPdbMatchesExpectedXml(peStream, pdbStream, qualifiedMethodName, pdbToXmlOptions, expectedPdb, expectedValueSourceLine, expectedValueSourcePath, expectedIsXmlLiteral, isPortable); + VerifyPdbMatchesExpectedXml(peStream, pdbStream, qualifiedMethodName, pdbToXmlOptions, expectedPdb, expectedValueSourceLine, expectedValueSourcePath, expectedIsRawXml, isPortable); if (testConversion && testOtherFormat) { - VerifyConvertedPdbMatchesExpectedXml(peStream, pdbStream, qualifiedMethodName, expectedPdb, pdbToXmlOptions, expectedIsXmlLiteral, isPortable); + VerifyConvertedPdbMatchesExpectedXml(peStream, pdbStream, qualifiedMethodName, expectedPdb, pdbToXmlOptions, expectedIsRawXml, isPortable); } } } @@ -286,7 +291,7 @@ public static void VerifyPdb( expectedPdb.ToString(), expectedValueSourceLine, expectedValueSourcePath, - expectedIsXmlLiteral: false, + expectedIsRawXml: false, isPortable); } @@ -298,7 +303,7 @@ private static void VerifyPdbMatchesExpectedXml( string expectedPdb, int expectedValueSourceLine, string expectedValueSourcePath, - bool expectedIsXmlLiteral, + bool expectedIsRawXml, bool isPortable) { peStream.Position = 0; @@ -312,7 +317,7 @@ private static void VerifyPdbMatchesExpectedXml( $"PDB format: {(isPortable ? "Portable" : "Windows")}{Environment.NewLine}", expectedValueSourcePath, expectedValueSourceLine, - escapeQuotes: !expectedIsXmlLiteral); + escapeQuotes: !expectedIsRawXml); } private static void VerifyConvertedPdbMatchesExpectedXml( @@ -321,7 +326,7 @@ private static void VerifyConvertedPdbMatchesExpectedXml( string qualifiedMethodName, string expectedPdb, PdbToXmlOptions pdbToXmlOptions, - bool expectedIsXmlLiteral, + bool expectedIsRawXml, bool originalIsPortable) { var pdbStreamConverted = new MemoryStream(); @@ -353,7 +358,7 @@ private static void VerifyConvertedPdbMatchesExpectedXml( $"PDB format: {(originalIsPortable ? "Windows" : "Portable")} converted from {(originalIsPortable ? "Portable" : "Windows")}{Environment.NewLine}", expectedValueSourcePath: null, expectedValueSourceLine: 0, - escapeQuotes: !expectedIsXmlLiteral); + escapeQuotes: !expectedIsRawXml); } private static string AdjustForConversionArtifacts(string pdb) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs index 879b628a01346..cb23ad6707cf8 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs @@ -65,9 +65,6 @@ public static bool TryRemoveFirst(this IList list, Func(this IList list, Func predicate) { - Contract.ThrowIfNull(list); - Contract.ThrowIfNull(predicate); - for (var i = 0; i < list.Count; i++) { if (predicate(list[i])) @@ -79,6 +76,19 @@ public static int IndexOf(this IList list, Func predicate) return -1; } + public static int IndexOf(this IList list, Func predicate, TArg arg) + { + for (var i = 0; i < list.Count; i++) + { + if (predicate(list[i], arg)) + { + return i; + } + } + + return -1; + } + public static void AddRangeWhere(this List list, List collection, Func predicate) { foreach (var element in collection) From 3ed29fed2de537fb06dccd854b1c343b7d01b3de Mon Sep 17 00:00:00 2001 From: Julien Couvreur Date: Thu, 7 Dec 2023 14:04:45 -0800 Subject: [PATCH 054/141] Set order of precedence for obsoletion attribute family (#71043) --- .../Attributes/AttributeTests_Experimental.cs | 4 +- .../AttributeTests_WellKnownAttributes.cs | 42 +-- .../Semantics/ExperimentalAttributeTests.cs | 246 +++++++++++++++++- .../Core/Portable/MetadataReader/PEModule.cs | 21 ++ .../CommonEventEarlyWellKnownAttributeData.cs | 3 + .../CommonFieldEarlyWellKnownAttributeData.cs | 3 + ...CommonMethodEarlyWellKnownAttributeData.cs | 3 + ...mmonPropertyEarlyWellKnownAttributeData.cs | 3 + .../CommonTypeEarlyWellKnownAttributeData.cs | 4 + .../Test/Emit/Attributes/AttributeTests.vb | 124 ++++++++- 10 files changed, 422 insertions(+), 31 deletions(-) diff --git a/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Experimental.cs b/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Experimental.cs index 577023b43bf93..65bdf83eb6509 100644 --- a/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Experimental.cs +++ b/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Experimental.cs @@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests { public class AttributeTests_WindowsExperimental : CSharpTestBase { - private const string DeprecatedAttributeSource = + internal const string DeprecatedAttributeSource = @"using System; namespace Windows.Foundation.Metadata { @@ -30,7 +30,7 @@ public enum DeprecationType } }"; - private const string ExperimentalAttributeSource = + internal const string ExperimentalAttributeSource = @"using System; namespace Windows.Foundation.Metadata { diff --git a/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_WellKnownAttributes.cs b/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_WellKnownAttributes.cs index b4a8c677c4dd1..0716a3f6ca919 100644 --- a/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_WellKnownAttributes.cs +++ b/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_WellKnownAttributes.cs @@ -9871,36 +9871,46 @@ public event System.Action E1 } /// - /// Report warning or error based on last attribute. + /// Report warning or error based on first attribute. /// [WorkItem(18755, "https://github.com/dotnet/roslyn/issues/18755")] - [Fact] - public void TestMultipleDeprecatedAttributes() + [Theory, CombinatorialData] + public void TestMultipleDeprecatedAttributes(bool inSource) { - var source = + var libSrc = @"using Windows.Foundation.Metadata; -class C +public class C { [Deprecated(""Removed"", DeprecationType.Remove, 0)] [Deprecated(""Deprecated"", DeprecationType.Deprecate, 0)] - static void F() { } + public static void F() { } [Deprecated(""Deprecated"", DeprecationType.Deprecate, 0)] [Deprecated(""Removed"", DeprecationType.Remove, 0)] - static void G() { } + public static void G() { } +}"; + + var src = @" +class D +{ static void Main() { - F(); - G(); + C.F(); + C.G(); } }"; - var compilation = CreateEmptyCompilation(source, WinRtRefs, TestOptions.ReleaseDll); + var compilation = inSource + ? CreateEmptyCompilation(new[] { (libSrc, "libSrc"), (src, "src") }, WinRtRefs, TestOptions.ReleaseDll) + : CreateEmptyCompilation((src, "src"), + references: WinRtRefs.Append(CreateEmptyCompilation(new[] { libSrc }, WinRtRefs, TestOptions.ReleaseDll).EmitToImageReference()).ToArray(), + TestOptions.ReleaseDll); + compilation.VerifyDiagnostics( - // (12,9): warning CS0618: 'C.F()' is obsolete: 'Deprecated' - // F(); - Diagnostic(ErrorCode.WRN_DeprecatedSymbolStr, "F()").WithArguments("C.F()", "Deprecated").WithLocation(12, 9), - // (13,9): error CS0619: 'C.G()' is obsolete: 'Removed' - // G(); - Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "G()").WithArguments("C.G()", "Removed").WithLocation(13, 9)); + // (6,9): error CS0619: 'C.F()' is obsolete: 'Removed' + // C.F(); + Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "C.F()").WithArguments("C.F()", "Removed").WithLocation(6, 9), + // (7,9): warning CS0618: 'C.G()' is obsolete: 'Deprecated' + // C.G(); + Diagnostic(ErrorCode.WRN_DeprecatedSymbolStr, "C.G()").WithArguments("C.G()", "Deprecated").WithLocation(7, 9)); } private const string DeprecatedAttributeSourceTH1 = diff --git a/src/Compilers/CSharp/Test/Emit2/Semantics/ExperimentalAttributeTests.cs b/src/Compilers/CSharp/Test/Emit2/Semantics/ExperimentalAttributeTests.cs index a2653bcb507ed..f137057d96a58 100644 --- a/src/Compilers/CSharp/Test/Emit2/Semantics/ExperimentalAttributeTests.cs +++ b/src/Compilers/CSharp/Test/Emit2/Semantics/ExperimentalAttributeTests.cs @@ -2262,21 +2262,243 @@ void M(C c) ? CreateCompilation(new[] { src, libSrc, experimentalAttributeSrc }) : CreateCompilation(src, references: new[] { CreateCompilation(new[] { libSrc, experimentalAttributeSrc }).EmitToImageReference() }); - if (inSource) + comp.VerifyDiagnostics( + // (3,12): error CS0619: 'C' is obsolete: 'error' + // void M(C c) + Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "C").WithArguments("C", "error").WithLocation(3, 12) + ); + } + + [Theory, CombinatorialData] + public void WithObsolete_ReverseOrder(bool inSource) + { + var libSrc = """ +[System.Diagnostics.CodeAnalysis.Experimental("DiagID1")] +[System.Obsolete("error", true)] +public class C +{ +} +"""; + + var src = """ +class D +{ + void M(C c) + { + } +} +"""; + + var comp = inSource + ? CreateCompilation(new[] { src, libSrc, experimentalAttributeSrc }) + : CreateCompilation(src, references: new[] { CreateCompilation(new[] { libSrc, experimentalAttributeSrc }).EmitToImageReference() }); + + comp.VerifyDiagnostics( + // (3,12): error CS0619: 'C' is obsolete: 'error' + // void M(C c) + Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "C").WithArguments("C", "error").WithLocation(3, 12) + ); + } + + public enum ObsoleteKind + { + Deprecated, + Obsolete, + WindowsExperimental, + Experimental + } + + [Theory, CombinatorialData] + public void PriorityOrder(ObsoleteKind one, ObsoleteKind other, bool inSource) + { + if (one == other) return; + + var oneAttr = getAttribute(one); + var otherAttr = getAttribute(other); + + var libSrc = $$""" +{{oneAttr}} +{{otherAttr}} +public class C { } +"""; + + var src = """ +class D +{ + void M(C c) { } +} +"""; + var libsSrc = new CSharpTestSource[] { libSrc, experimentalAttributeSrc, + AttributeTests_WindowsExperimental.DeprecatedAttributeSource, + AttributeTests_WindowsExperimental.ExperimentalAttributeSource }; + + var comp = inSource + ? CreateCompilation(libsSrc.Append(src).ToArray()) + : CreateCompilation(src, references: new[] { CreateCompilation(libsSrc).EmitToImageReference() }); + + comp.VerifyDiagnostics(getExpectedDiagnostic(getImportantObsoleteKind(one, other))); + return; + + static ObsoleteKind getImportantObsoleteKind(ObsoleteKind one, ObsoleteKind other) { - comp.VerifyDiagnostics( - // 0.cs(3,12): error DiagID1: 'C' is for evaluation purposes only and is subject to change or removal in future updates. - // void M(C c) - Diagnostic("DiagID1", "C").WithArguments("C").WithLocation(3, 12).WithWarningAsError(true) - ); + return one < other ? one : other; } - else + + static DiagnosticDescription getExpectedDiagnostic(ObsoleteKind kind) { - comp.VerifyDiagnostics( - // (3,12): error CS0619: 'C' is obsolete: 'error' - // void M(C c) - Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "C").WithArguments("C", "error").WithLocation(3, 12) - ); + return kind switch + { + ObsoleteKind.Deprecated => + // (3,12): warning CS0618: 'C' is obsolete: 'DEPRECATED' + // void M(C c) { } + Diagnostic(ErrorCode.WRN_DeprecatedSymbolStr, "C").WithArguments("C", "DEPRECATED").WithLocation(3, 12), + + ObsoleteKind.Obsolete => + // (3,12): error CS0619: 'C' is obsolete: 'OBSOLETE' + // void M(C c) { } + Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "C").WithArguments("C", "OBSOLETE").WithLocation(3, 12), + + ObsoleteKind.WindowsExperimental => + // (3,12): warning CS8305: 'C' is for evaluation purposes only and is subject to change or removal in future updates. + // void M(C c) { } + Diagnostic(ErrorCode.WRN_WindowsExperimental, "C").WithArguments("C").WithLocation(3, 12), + + // ObsoleteKind.Experimental comes last and always loses + _ => throw new NotSupportedException() + }; } + + static string getAttribute(ObsoleteKind kind) => kind switch + { + ObsoleteKind.Deprecated => """[Windows.Foundation.Metadata.Deprecated("DEPRECATED", Windows.Foundation.Metadata.DeprecationType.Deprecate, 0)]""", + ObsoleteKind.Obsolete => """[System.Obsolete("OBSOLETE", true)]""", + ObsoleteKind.WindowsExperimental => "[Windows.Foundation.Metadata.Experimental]", + ObsoleteKind.Experimental => """[System.Diagnostics.CodeAnalysis.Experimental("DiagID1")]""", + _ => throw new NotSupportedException() + }; + } + + [Theory, CombinatorialData] + public void PriorityOrder_OnEvent(bool inSource, bool reversed) + { + var oneAttr = """[System.Obsolete("OBSOLETE", true)]"""; + var otherAttr = """[System.Diagnostics.CodeAnalysis.Experimental("DiagID1")]"""; + + var libSrc = $$""" +public class C +{ + {{(reversed ? otherAttr : oneAttr)}} + {{(reversed ? oneAttr : otherAttr)}} + public static event System.Action Event; + + static void M() + { + Event(); + } +} +"""; + + var src = """ +C.Event += () => { }; +"""; + + var comp = inSource + ? CreateCompilation(new[] { src, libSrc, experimentalAttributeSrc }) + : CreateCompilation(src, references: new[] { CreateCompilation(new[] { libSrc, experimentalAttributeSrc }).EmitToImageReference() }); + + comp.VerifyDiagnostics( + // (1,1): error CS0619: 'C.Event' is obsolete: 'OBSOLETE' + // C.Event += () => { }; + Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "C.Event").WithArguments("C.Event", "OBSOLETE").WithLocation(1, 1) + ); + } + + [Theory, CombinatorialData] + public void PriorityOrder_OnField(bool inSource, bool reversed) + { + var oneAttr = """[System.Obsolete("OBSOLETE", true)]"""; + var otherAttr = """[System.Diagnostics.CodeAnalysis.Experimental("DiagID1")]"""; + + var libSrc = $$""" +public class C +{ + {{(reversed ? otherAttr : oneAttr)}} + {{(reversed ? oneAttr : otherAttr)}} + public static int field = 0; +} +"""; + + var src = """ +_ = C.field; +"""; + var comp = inSource + ? CreateCompilation(new[] { src, libSrc, experimentalAttributeSrc }) + : CreateCompilation(src, references: new[] { CreateCompilation(new[] { libSrc, experimentalAttributeSrc }).EmitToImageReference() }); + + comp.VerifyDiagnostics( + // (1,5): error CS0619: 'C.field' is obsolete: 'OBSOLETE' + // _ = C.field; + Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "C.field").WithArguments("C.field", "OBSOLETE").WithLocation(1, 5) + ); + } + + [Theory, CombinatorialData] + public void PriorityOrder_OnMethod(bool inSource, bool reversed) + { + var oneAttr = """[System.Obsolete("OBSOLETE", true)]"""; + var otherAttr = """[System.Diagnostics.CodeAnalysis.Experimental("DiagID1")]"""; + + var libSrc = $$""" +public class C +{ + {{(reversed ? otherAttr : oneAttr)}} + {{(reversed ? oneAttr : otherAttr)}} + public static void M() { } +} +"""; + + var src = """ +C.M(); +"""; + + var comp = inSource + ? CreateCompilation(new[] { src, libSrc, experimentalAttributeSrc }) + : CreateCompilation(src, references: new[] { CreateCompilation(new[] { libSrc, experimentalAttributeSrc }).EmitToImageReference() }); + + comp.VerifyDiagnostics( + // (1,1): error CS0619: 'C.M()' is obsolete: 'OBSOLETE' + // C.M(); + Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "C.M()").WithArguments("C.M()", "OBSOLETE").WithLocation(1, 1) + ); + } + + [Theory, CombinatorialData] + public void PriorityOrder_OnProperty(bool inSource, bool reversed) + { + var oneAttr = """[System.Obsolete("OBSOLETE", true)]"""; + var otherAttr = """[System.Diagnostics.CodeAnalysis.Experimental("DiagID1")]"""; + + var libSrc = $$""" +public class C +{ + {{(reversed ? otherAttr : oneAttr)}} + {{(reversed ? oneAttr : otherAttr)}} + public static int P => 0; +} +"""; + + var src = """ +_ = C.P; +"""; + + var comp = inSource + ? CreateCompilation(new[] { src, libSrc, experimentalAttributeSrc }) + : CreateCompilation(src, references: new[] { CreateCompilation(new[] { libSrc, experimentalAttributeSrc }).EmitToImageReference() }); + + comp.VerifyDiagnostics( + // (1,5): error CS0619: 'C.P' is obsolete: 'OBSOLETE' + // _ = C.P; + Diagnostic(ErrorCode.ERR_DeprecatedSymbolStr, "C.P").WithArguments("C.P", "OBSOLETE").WithLocation(1, 5) + ); } } diff --git a/src/Compilers/Core/Portable/MetadataReader/PEModule.cs b/src/Compilers/Core/Portable/MetadataReader/PEModule.cs index 0f15cac757b93..53b2550d215f7 100644 --- a/src/Compilers/Core/Portable/MetadataReader/PEModule.cs +++ b/src/Compilers/Core/Portable/MetadataReader/PEModule.cs @@ -1192,6 +1192,7 @@ internal bool HasRequiresLocationAttribute(EntityHandle token) internal const string ByRefLikeMarker = "Types with embedded references are not supported in this version of your compiler."; internal const string RequiredMembersMarker = "Constructors of types with required members are not supported in this version of your compiler."; + /// Should be kept in sync with internal ObsoleteAttributeData TryGetDeprecatedOrExperimentalOrObsoleteAttribute( EntityHandle token, IAttributeNamedArgumentDecoder decoder, @@ -1238,6 +1239,26 @@ internal ObsoleteAttributeData TryGetDeprecatedOrExperimentalOrObsoleteAttribute } #nullable enable + /// + /// Indicates whether the first attribute should be prioritized over the second one. + /// Same order of priority as + /// + /// + internal static bool IsMoreImportantObsoleteKind(ObsoleteAttributeKind firstKind, ObsoleteAttributeKind secondKind) + { + return getPriority(firstKind) <= getPriority(secondKind); + + static int getPriority(ObsoleteAttributeKind kind) => kind switch + { + ObsoleteAttributeKind.Deprecated => 0, + ObsoleteAttributeKind.Obsolete => 1, + ObsoleteAttributeKind.WindowsExperimental => 2, + ObsoleteAttributeKind.Experimental => 3, + ObsoleteAttributeKind.Uninitialized => 4, + _ => throw ExceptionUtilities.UnexpectedValue(kind) + }; + } + internal ObsoleteAttributeData? TryDecodeExperimentalAttributeData(EntityHandle handle, IAttributeNamedArgumentDecoder decoder) { var info = FindTargetAttribute(handle, AttributeDescription.ExperimentalAttribute); diff --git a/src/Compilers/Core/Portable/Symbols/Attributes/CommonEventEarlyWellKnownAttributeData.cs b/src/Compilers/Core/Portable/Symbols/Attributes/CommonEventEarlyWellKnownAttributeData.cs index 0b0e90d41a2d6..0968f5728b0d7 100644 --- a/src/Compilers/Core/Portable/Symbols/Attributes/CommonEventEarlyWellKnownAttributeData.cs +++ b/src/Compilers/Core/Portable/Symbols/Attributes/CommonEventEarlyWellKnownAttributeData.cs @@ -32,6 +32,9 @@ public ObsoleteAttributeData ObsoleteAttributeData Debug.Assert(value != null); Debug.Assert(!value.IsUninitialized); + if (PEModule.IsMoreImportantObsoleteKind(_obsoleteAttributeData.Kind, value.Kind)) + return; + _obsoleteAttributeData = value; SetDataStored(); } diff --git a/src/Compilers/Core/Portable/Symbols/Attributes/CommonFieldEarlyWellKnownAttributeData.cs b/src/Compilers/Core/Portable/Symbols/Attributes/CommonFieldEarlyWellKnownAttributeData.cs index e323085554c2d..9d49aad79d700 100644 --- a/src/Compilers/Core/Portable/Symbols/Attributes/CommonFieldEarlyWellKnownAttributeData.cs +++ b/src/Compilers/Core/Portable/Symbols/Attributes/CommonFieldEarlyWellKnownAttributeData.cs @@ -32,6 +32,9 @@ public ObsoleteAttributeData ObsoleteAttributeData Debug.Assert(value != null); Debug.Assert(!value.IsUninitialized); + if (PEModule.IsMoreImportantObsoleteKind(_obsoleteAttributeData.Kind, value.Kind)) + return; + _obsoleteAttributeData = value; SetDataStored(); } diff --git a/src/Compilers/Core/Portable/Symbols/Attributes/CommonMethodEarlyWellKnownAttributeData.cs b/src/Compilers/Core/Portable/Symbols/Attributes/CommonMethodEarlyWellKnownAttributeData.cs index d41640ca4e082..08868f0bd94ad 100644 --- a/src/Compilers/Core/Portable/Symbols/Attributes/CommonMethodEarlyWellKnownAttributeData.cs +++ b/src/Compilers/Core/Portable/Symbols/Attributes/CommonMethodEarlyWellKnownAttributeData.cs @@ -47,6 +47,9 @@ public ObsoleteAttributeData? ObsoleteAttributeData Debug.Assert(value != null); Debug.Assert(!value.IsUninitialized); + if (PEModule.IsMoreImportantObsoleteKind(_obsoleteAttributeData.Kind, value.Kind)) + return; + _obsoleteAttributeData = value; SetDataStored(); } diff --git a/src/Compilers/Core/Portable/Symbols/Attributes/CommonPropertyEarlyWellKnownAttributeData.cs b/src/Compilers/Core/Portable/Symbols/Attributes/CommonPropertyEarlyWellKnownAttributeData.cs index 2d73eedbdf2c3..523ba1225f2e7 100644 --- a/src/Compilers/Core/Portable/Symbols/Attributes/CommonPropertyEarlyWellKnownAttributeData.cs +++ b/src/Compilers/Core/Portable/Symbols/Attributes/CommonPropertyEarlyWellKnownAttributeData.cs @@ -29,6 +29,9 @@ public ObsoleteAttributeData ObsoleteAttributeData Debug.Assert(value != null); Debug.Assert(!value.IsUninitialized); + if (PEModule.IsMoreImportantObsoleteKind(_obsoleteAttributeData.Kind, value.Kind)) + return; + _obsoleteAttributeData = value; SetDataStored(); } diff --git a/src/Compilers/Core/Portable/Symbols/Attributes/CommonTypeEarlyWellKnownAttributeData.cs b/src/Compilers/Core/Portable/Symbols/Attributes/CommonTypeEarlyWellKnownAttributeData.cs index 392f5bdade81e..744b39f2fa672 100644 --- a/src/Compilers/Core/Portable/Symbols/Attributes/CommonTypeEarlyWellKnownAttributeData.cs +++ b/src/Compilers/Core/Portable/Symbols/Attributes/CommonTypeEarlyWellKnownAttributeData.cs @@ -86,8 +86,12 @@ public ObsoleteAttributeData ObsoleteAttributeData Debug.Assert(value != null); Debug.Assert(!value.IsUninitialized); + if (PEModule.IsMoreImportantObsoleteKind(_obsoleteAttributeData.Kind, value.Kind)) + return; + _obsoleteAttributeData = value; SetDataStored(); + return; } } #endregion diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests.vb index 665ff2489859d..b71cb2f002ede 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests.vb @@ -5243,7 +5243,37 @@ End Class comp.AssertTheseDiagnostics( ) + End Sub + + + Public Sub ExperimentalWithDiagnosticsId_WithObsolete_ReverseOrder() + Dim attrComp = CreateCSharpCompilation(experimentalAttributeCSharpSrc) + + Dim src = + + + +Class C +End Class + +Class D + Sub M(c As C) + End Sub +End Class +]]> + + + + Dim comp = CreateCompilation(src, references:={attrComp.EmitToImageReference()}) + + comp.AssertTheseDiagnostics( +) @@ -5284,6 +5314,98 @@ BC30668: 'C' is obsolete: 'error'. End Sub + + Public Sub ExperimentalWithDiagnosticsId_WithDeprecated() + Dim attrComp = CreateCSharpCompilation(experimentalAttributeCSharpSrc) + + Dim src = + + + Public NotInheritable Class DeprecatedAttribute + Inherits Attribute + Public Sub New(message As String, type As DeprecationType, version As UInteger) + End Sub + End Class + Public Enum DeprecationType + Deprecate + Remove + End Enum +End Namespace + + + +Class C +End Class + +Class D + Sub M(c As C) + End Sub +End Class +]]> + + + + Dim comp = CreateCompilation(src, references:={attrComp.EmitToImageReference()}) + + comp.AssertTheseDiagnostics( +) + End Sub + + + Public Sub ExperimentalWithDiagnosticsId_WithDeprecated_ReverseOrder() + Dim attrComp = CreateCSharpCompilation(experimentalAttributeCSharpSrc) + + Dim src = + + + Public NotInheritable Class DeprecatedAttribute + Inherits Attribute + Public Sub New(message As String, type As DeprecationType, version As UInteger) + End Sub + End Class + Public Enum DeprecationType + Deprecate + Remove + End Enum +End Namespace + + + +Class C +End Class + +Class D + Sub M(c As C) + End Sub +End Class +]]> + + + + Dim comp = CreateCompilation(src, references:={attrComp.EmitToImageReference()}) + + comp.AssertTheseDiagnostics( +) + End Sub + Public Sub ExperimentalWithDiagnosticsIdAndUrlFormat() Dim attrComp = CreateCSharpCompilation(experimentalAttributeCSharpSrc) From 413c4ec3ef9389d4a71eaf7863793973220719ee Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Wed, 29 Nov 2023 15:51:36 -0800 Subject: [PATCH 055/141] Ensure we publish symbols for the BuildHost Fixes https://github.com/dotnet/roslyn/issues/70987 --- ...t.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Workspaces/Core/MSBuild.BuildHost/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj b/src/Workspaces/Core/MSBuild.BuildHost/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj index 4d4c727d19162..2683f6c3df27b 100644 --- a/src/Workspaces/Core/MSBuild.BuildHost/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj +++ b/src/Workspaces/Core/MSBuild.BuildHost/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj @@ -9,6 +9,17 @@ false false + + true + + AnyCPU From ffa547714f801482ac51ec98a6fbed72ec490825 Mon Sep 17 00:00:00 2001 From: Julien Couvreur Date: Thu, 7 Dec 2023 19:00:53 -0800 Subject: [PATCH 056/141] Add QuickInfo for collection expression brackets (#71161) --- .../QuickInfo/SemanticQuickInfoSourceTests.cs | 34 +++++++++++++++++++ .../VisualBasicSemanticQuickInfoProvider.vb | 1 + .../Services/SyntaxFacts/CSharpSyntaxFacts.cs | 6 ++++ 3 files changed, 41 insertions(+) diff --git a/src/EditorFeatures/CSharpTest/QuickInfo/SemanticQuickInfoSourceTests.cs b/src/EditorFeatures/CSharpTest/QuickInfo/SemanticQuickInfoSourceTests.cs index 5728015feea7f..addf6d2326462 100644 --- a/src/EditorFeatures/CSharpTest/QuickInfo/SemanticQuickInfoSourceTests.cs +++ b/src/EditorFeatures/CSharpTest/QuickInfo/SemanticQuickInfoSourceTests.cs @@ -8768,5 +8768,39 @@ public async Task TestUsingAliasToType5_A() await TestAsync(source, MainDescription($"int*")); } + + [Fact] + public async Task TestCollectionExpression_Start() + { + var source = +"int[] x = $$[1, 2]"; + await TestAsync(source, + MainDescription($"int[]")); + } + + [Fact] + public async Task TestCollectionExpression_Middle() + { + var source = +"int[] x = [1 $$, 2]"; + await TestAsync(source); + } + + [Fact] + public async Task TestCollectionExpression_End() + { + var source = +"int[] x = [1, 2]$$"; + await TestAsync(source, + MainDescription($"int[]")); + } + + [Fact] + public async Task TestCollectionExpression_Start_Typeless() + { + var source = +"var x = $$[1, 2]"; + await TestAsync(source); + } } } diff --git a/src/Features/VisualBasic/Portable/QuickInfo/VisualBasicSemanticQuickInfoProvider.vb b/src/Features/VisualBasic/Portable/QuickInfo/VisualBasicSemanticQuickInfoProvider.vb index 25719a98f6989..77f2abd72d4b7 100644 --- a/src/Features/VisualBasic/Portable/QuickInfo/VisualBasicSemanticQuickInfoProvider.vb +++ b/src/Features/VisualBasic/Portable/QuickInfo/VisualBasicSemanticQuickInfoProvider.vb @@ -4,6 +4,7 @@ Imports System.Collections.Immutable Imports System.Composition +Imports System.Diagnostics.CodeAnalysis Imports System.Runtime.InteropServices Imports System.Threading Imports Microsoft.CodeAnalysis diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs index 049ffcad317e1..896f1f81276de 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs @@ -529,6 +529,12 @@ public bool IsBindableToken(SyntaxToken token) return true; } + if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CloseBracketToken + && token.Parent.IsKind(SyntaxKind.CollectionExpression)) + { + return true; + } + return false; } From b6369666e0545a680384b96322cae3138ca9eb4f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 7 Dec 2023 21:37:59 -0800 Subject: [PATCH 057/141] Fix nameof references in use-primary-constructor --- ...arpUsePrimaryConstructorCodeFixProvider.cs | 18 +- .../UsePrimaryConstructorTests.cs | 161 ++++++++++++++++++ 2 files changed, 174 insertions(+), 5 deletions(-) diff --git a/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs index 77b2fb4068e46..f8c2259c7d8b8 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs @@ -240,19 +240,27 @@ ParameterListSyntax UpdateReferencesToNestedMembers(ParameterListSyntax paramete { // Don't have to update if the member is already qualified. - if (nameSyntax.Parent is not QualifiedNameSyntax qualifiedNameSyntax || qualifiedNameSyntax.Right != nameSyntax) + if (nameSyntax.Parent is not QualifiedNameSyntax qualifiedNameSyntax || + qualifiedNameSyntax.Right != nameSyntax) { - var symbol = semanticModel.GetSymbolInfo(nameSyntax, cancellationToken).GetAnySymbol(); + // Qualified names occur in things like the `type` portion of the parameter + // reference to a nested type in an unqualified fashion. Have to qualify this. + var symbol = semanticModel.GetSymbolInfo(nameSyntax, cancellationToken).GetAnySymbol(); if (symbol is INamedTypeSymbol { ContainingType: { } containingType }) return QualifiedName(containingType.GenerateNameSyntax(), currentNameSyntax); } - if (nameSyntax.Parent is not MemberAccessExpressionSyntax memberAccessExpression || memberAccessExpression.Name != nameSyntax) + if (nameSyntax.Parent is not MemberAccessExpressionSyntax memberAccessExpression || + memberAccessExpression.Name != nameSyntax) { + // Member access expressions occur in things like the default initializer, or attribute + // arguments of the parameter. + var symbol = semanticModel.GetSymbolInfo(nameSyntax, cancellationToken).GetAnySymbol(); - if (symbol is IFieldSymbol { ContainingType: not null } && - namedType.Equals(symbol.ContainingType.OriginalDefinition)) + if (symbol is IMethodSymbol or IPropertySymbol or IEventSymbol or IFieldSymbol && + symbol is { ContainingType.OriginalDefinition: { } containingType } && + namedType.Equals(containingType)) { // reference to a member field an unqualified fashion. Have to qualify this. return MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, namedType.GenerateNameSyntax(), currentNameSyntax); diff --git a/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs b/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs index 2f8471a17c785..6e3ab840ba3a5 100644 --- a/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs +++ b/src/Analyzers/CSharp/Tests/UsePrimaryConstructor/UsePrimaryConstructorTests.cs @@ -6,6 +6,7 @@ using Microsoft.CodeAnalysis.CSharp.UsePrimaryConstructor; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; +using Microsoft.CodeAnalysis.Testing; using Roslyn.Test.Utilities; using Xunit; @@ -3838,4 +3839,164 @@ public class Test(object x) LanguageVersion = LanguageVersion.CSharp12, }.RunAsync(); } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71167")] + public async Task TestMemberReferenceInAttribute1() + { + await new VerifyCS.Test + { + TestCode = """ + using System.Diagnostics.CodeAnalysis; + + public class Goo + { + public string Name { get; } + + public [|Goo|]([NotNullIfNotNull(nameof(Name))] string name) + { + Name= name; + } + } + """, + FixedCode = """ + using System.Diagnostics.CodeAnalysis; + + public class Goo([NotNullIfNotNull(nameof(Goo.Name))] string name) + { + public string Name { get; } = name; + } + """, + LanguageVersion = LanguageVersion.CSharp12, + ReferenceAssemblies = ReferenceAssemblies.Net.Net80, + }.RunAsync(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71167")] + public async Task TestMemberReferenceInAttribute2() + { + await new VerifyCS.Test + { + TestCode = """ + using System; + + public class MyAttribute(string s) : Attribute + { + } + + public class Goo + { + public string Name { get; } + + public [|Goo|]([My(nameof(Nested))] string name) + { + Name = name; + } + + public class Nested { } + } + """, + FixedCode = """ + using System; + + public class MyAttribute(string s) : Attribute + { + } + + public class Goo([My(nameof(Goo.Nested))] string name) + { + public string Name { get; } = name; + + public class Nested { } + } + """, + LanguageVersion = LanguageVersion.CSharp12, + ReferenceAssemblies = ReferenceAssemblies.Net.Net80, + }.RunAsync(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71167")] + public async Task TestMemberReferenceInAttribute3() + { + await new VerifyCS.Test + { + TestCode = """ + using System; + + public class MyAttribute(string s) : Attribute + { + } + + public class Goo + { + public string Name { get; } + + public [|Goo|]([My(nameof(E))] string name) + { + Name = name; + } + + public event Action E; + } + """, + FixedCode = """ + using System; + + public class MyAttribute(string s) : Attribute + { + } + + public class Goo([My(nameof(Goo.E))] string name) + { + public string Name { get; } = name; + + public event Action E; + } + """, + LanguageVersion = LanguageVersion.CSharp12, + ReferenceAssemblies = ReferenceAssemblies.Net.Net80, + }.RunAsync(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71167")] + public async Task TestMemberReferenceInAttribute4() + { + await new VerifyCS.Test + { + TestCode = """ + using System; + + public class MyAttribute(string s) : Attribute + { + } + + public class Goo + { + public string Name { get; } + + public [|Goo|]([My(nameof(M))] string name) + { + Name = name; + } + + public void M() { } + } + """, + FixedCode = """ + using System; + + public class MyAttribute(string s) : Attribute + { + } + + public class Goo([My(nameof(Goo.M))] string name) + { + public string Name { get; } = name; + + public void M() { } + } + """, + LanguageVersion = LanguageVersion.CSharp12, + ReferenceAssemblies = ReferenceAssemblies.Net.Net80, + }.RunAsync(); + } } From 8243ed5cae6395367d129540d5dc351bcf5bd843 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 7 Dec 2023 21:45:45 -0800 Subject: [PATCH 058/141] Simplify --- ...arpUsePrimaryConstructorCodeFixProvider.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs index f8c2259c7d8b8..16b24d8de2a75 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider.cs @@ -241,18 +241,18 @@ ParameterListSyntax UpdateReferencesToNestedMembers(ParameterListSyntax paramete // Don't have to update if the member is already qualified. if (nameSyntax.Parent is not QualifiedNameSyntax qualifiedNameSyntax || - qualifiedNameSyntax.Right != nameSyntax) + qualifiedNameSyntax.Left == nameSyntax) { // Qualified names occur in things like the `type` portion of the parameter // reference to a nested type in an unqualified fashion. Have to qualify this. var symbol = semanticModel.GetSymbolInfo(nameSyntax, cancellationToken).GetAnySymbol(); if (symbol is INamedTypeSymbol { ContainingType: { } containingType }) - return QualifiedName(containingType.GenerateNameSyntax(), currentNameSyntax); + return CreateDottedName(nameSyntax, currentNameSyntax, containingType); } if (nameSyntax.Parent is not MemberAccessExpressionSyntax memberAccessExpression || - memberAccessExpression.Name != nameSyntax) + memberAccessExpression.Expression == nameSyntax) { // Member access expressions occur in things like the default initializer, or attribute // arguments of the parameter. @@ -263,12 +263,23 @@ ParameterListSyntax UpdateReferencesToNestedMembers(ParameterListSyntax paramete namedType.Equals(containingType)) { // reference to a member field an unqualified fashion. Have to qualify this. - return MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, namedType.GenerateNameSyntax(), currentNameSyntax); + return CreateDottedName(nameSyntax, currentNameSyntax, containingType); } } return currentNameSyntax; }); + + SyntaxNode CreateDottedName( + SimpleNameSyntax originalName, + SimpleNameSyntax currentName, + INamedTypeSymbol containingType) + { + var containingTypeSyntax = containingType.GenerateNameSyntax(); + return SyntaxFacts.IsInTypeOnlyContext(originalName) + ? QualifiedName(containingTypeSyntax, currentName) + : MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, containingTypeSyntax, currentName); + } } static TListSyntax RemoveElementIndentation( From 96b7bb2d85175c526bc25b53ebc859af0704896e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 14:42:03 +0000 Subject: [PATCH 059/141] Update dependencies from https://github.com/dotnet/arcade build 20231207.2 (#71170) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 12 ++++++------ global.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b33675e07c3f0..2177209cfbc7e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -27,14 +27,14 @@ - + https://github.com/dotnet/arcade - 71149d1f281ab5e066d1f524f4862152683f5144 + 3faeb9817f465151aa4bbcdb315f0a6170206760 - + https://github.com/dotnet/arcade - 71149d1f281ab5e066d1f524f4862152683f5144 + 3faeb9817f465151aa4bbcdb315f0a6170206760 https://github.com/dotnet/symreader @@ -49,9 +49,9 @@ https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - 71149d1f281ab5e066d1f524f4862152683f5144 + 3faeb9817f465151aa4bbcdb315f0a6170206760 https://github.com/dotnet/roslyn-analyzers diff --git a/global.json b/global.json index 1d00cc6c95d3c..c771a891c9b08 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "xcopy-msbuild": "17.8.1-2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23606.1", - "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23606.1" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23607.2", + "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23607.2" } } From d8423e01a421cc41cc50966695835603a20638b4 Mon Sep 17 00:00:00 2001 From: joegoldman674 <147369450+joegoldman2@users.noreply.github.com> Date: Fri, 8 Dec 2023 18:24:48 +0200 Subject: [PATCH 060/141] Ensure the editorconfig for code-style analysis ("IDExxxx") rules is included --- src/CodeStyle/Tools/Program.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/CodeStyle/Tools/Program.cs b/src/CodeStyle/Tools/Program.cs index 2d18ae145c3c8..aa9b658682416 100644 --- a/src/CodeStyle/Tools/Program.cs +++ b/src/CodeStyle/Tools/Program.cs @@ -258,9 +258,8 @@ and an implied numerical option (such as '4') --> <_GlobalAnalyzerConfigFile_MicrosoftCodeAnalysis{language}CodeStyle Condition="'$(_GlobalAnalyzerConfigFileName_MicrosoftCodeAnalysis{language}CodeStyle)' != ''">$(_GlobalAnalyzerConfigDir_MicrosoftCodeAnalysis{language}CodeStyle)\$(_GlobalAnalyzerConfigFileName_MicrosoftCodeAnalysis{language}CodeStyle) - - + + From 3d4eb8f62fa5f02cd517e1649b3bee8ef2f27f27 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 09:39:34 -0800 Subject: [PATCH 061/141] Add test --- .../UseCollectionExpressionForArrayTests.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForArrayTests.cs b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForArrayTests.cs index b7ffab9dbf147..59817dad68720 100644 --- a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForArrayTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForArrayTests.cs @@ -4331,4 +4331,44 @@ void M() ReferenceAssemblies = ReferenceAssemblies.Net.Net80, }.RunAsync(); } + + [Fact] + public async Task TestFixAllImplicitArray1() + { + await new VerifyCS.Test + { + TestCode = $$""" + class C + { + void M(bool b) + { + object falsePositive = new[] { [|[|new|][]|] { 1 }, [|[|new|][]|] { 1 } }; + } + } + """, + // Fixing just validates each fix in order, iteratively. After the first item is fixed, the second can't be. + FixedCode = $$""" + class C + { + void M(bool b) + { + object falsePositive = new[] { [1], new[] { 1 } }; + } + } + """, + // Batch fixing runs the fixer against all diagnostics at once. That fixer goes from innermost (lowest) to + // highest. So we end up fixing the second. After that one is fixed, the first can't be. + BatchFixedCode = $$""" + class C + { + void M(bool b) + { + object falsePositive = new[] { new[] { 1 }, [1] }; + } + } + """, + LanguageVersion = LanguageVersion.CSharp12, + ReferenceAssemblies = ReferenceAssemblies.Net.Net80, + }.RunAsync(); + } } From 9d9e0874b2fc564ae4f1a2cf77f68513c8be15d2 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 10:37:13 -0800 Subject: [PATCH 062/141] REvert --- .../UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs b/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs index 1013b0a22bcf4..fe9687a962054 100644 --- a/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs +++ b/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs @@ -138,7 +138,7 @@ private async Task ProcessResultAsync(CodeFixContext context, Diagnost var resolution = await filteredLocations.ResolveConflictsAsync( fieldSymbol, propertySymbol.Name, - nonConflictSymbolKeys: default,// nonConflictSymbolKeys: ImmutableArray.Create(propertySymbol.GetSymbolKey(cancellationToken)), + nonConflictSymbolKeys: ImmutableArray.Create(propertySymbol.GetSymbolKey(cancellationToken)), context.Options, cancellationToken).ConfigureAwait(false); Contract.ThrowIfFalse(resolution.IsSuccessful); From 2eb261e903a02c9e8b1d3c53a93f838ec2a46baa Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 11:15:02 -0800 Subject: [PATCH 063/141] Reduce size of source constructor symbol --- .../Symbols/Source/SourceConstructorSymbol.cs | 33 ++++++++++--------- .../Source/SourceMemberMethodSymbol.cs | 30 ++++++++++++----- .../Source/SourceOrdinaryMethodSymbol.cs | 3 +- 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceConstructorSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceConstructorSymbol.cs index a04074d048199..512755dd22f60 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceConstructorSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceConstructorSymbol.cs @@ -12,8 +12,6 @@ namespace Microsoft.CodeAnalysis.CSharp.Symbols { internal sealed class SourceConstructorSymbol : SourceConstructorSymbolBase { - private readonly bool _hasThisInitializer; - public static SourceConstructorSymbol CreateConstructorSymbol( SourceMemberContainerTypeSymbol containingType, ConstructorDeclarationSyntax syntax, @@ -32,10 +30,9 @@ private SourceConstructorSymbol( bool isNullableAnalysisEnabled, BindingDiagnosticBag diagnostics) : base(containingType, location, syntax, SyntaxFacts.HasYieldOperations(syntax), - MakeModifiersAndFlags(containingType, syntax, methodKind, isNullableAnalysisEnabled, location, diagnostics, out bool modifierErrors, out bool report_ERR_StaticConstructorWithAccessModifiers)) + MakeModifiersAndFlags( + containingType, syntax, methodKind, isNullableAnalysisEnabled, syntax.Initializer?.Kind() == SyntaxKind.ThisConstructorInitializer, location, diagnostics, out bool modifierErrors, out bool report_ERR_StaticConstructorWithAccessModifiers)) { - _hasThisInitializer = syntax.Initializer?.Kind() == SyntaxKind.ThisConstructorInitializer; - this.CheckUnsafeModifier(DeclarationModifiers, diagnostics); if (report_ERR_StaticConstructorWithAccessModifiers) @@ -81,14 +78,22 @@ private SourceConstructorSymbol( } private static (DeclarationModifiers, Flags) MakeModifiersAndFlags( - NamedTypeSymbol containingType, ConstructorDeclarationSyntax syntax, MethodKind methodKind, bool isNullableAnalysisEnabled, Location location, BindingDiagnosticBag diagnostics, - out bool modifierErrors, out bool report_ERR_StaticConstructorWithAccessModifiers) + NamedTypeSymbol containingType, + ConstructorDeclarationSyntax syntax, + MethodKind methodKind, + bool isNullableAnalysisEnabled, + bool hasThisInitializer, + Location location, + BindingDiagnosticBag diagnostics, + out bool modifierErrors, + out bool report_ERR_StaticConstructorWithAccessModifiers) { DeclarationModifiers declarationModifiers = MakeModifiers(containingType, syntax, methodKind, syntax.HasAnyBody(), location, diagnostics, out modifierErrors, out report_ERR_StaticConstructorWithAccessModifiers); Flags flags = MakeFlags( - methodKind, RefKind.None, declarationModifiers, returnsVoid: true, returnsVoidIsSet: true, - isExpressionBodied: syntax.IsExpressionBodied(), isExtensionMethod: false, isVarArg: syntax.IsVarArg(), - isNullableAnalysisEnabled: isNullableAnalysisEnabled, isExplicitInterfaceImplementation: false); + methodKind, RefKind.None, declarationModifiers, returnsVoid: true, returnsVoidIsSet: true, + isExpressionBodied: syntax.IsExpressionBodied(), isExtensionMethod: false, isVarArg: syntax.IsVarArg(), + isNullableAnalysisEnabled: isNullableAnalysisEnabled, isExplicitInterfaceImplementation: false, + hasThisInitializer: hasThisInitializer); return (declarationModifiers, flags); } @@ -179,11 +184,9 @@ internal override OneOrMany> GetAttributeDeclara } internal override bool IsNullableAnalysisEnabled() - { - return _hasThisInitializer ? - flags.IsNullableAnalysisEnabled : - ((SourceMemberContainerTypeSymbol)ContainingType).IsNullableEnabledForConstructorsAndInitializers(IsStatic); - } + => flags.HasThisInitializer + ? flags.IsNullableAnalysisEnabled + : ((SourceMemberContainerTypeSymbol)ContainingType).IsNullableEnabledForConstructorsAndInitializers(IsStatic); protected override bool AllowRefOrOut { diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs index db59bf480d456..ec7a97ee994b9 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs @@ -24,7 +24,7 @@ protected struct Flags { // We currently pack everything into a 32 bit int with the following layout: // - // | |a|b|e|n|vvv|yy|s|r|q|z|kkk|wwwww| + // | |t|a|b|e|n|vvv|yy|s|r|q|z|kkk|wwwww| // // w = method kind. 5 bits. // k = ref kind. 3 bits. @@ -37,7 +37,8 @@ protected struct Flags // n = IsNullableAnalysisEnabled. 1 bit. // e = IsExpressionBody. 1 bit. // b = HasAnyBody. 1 bit. - // a = IsVararg. 1 bit + // a = IsVararg. 1 bit. + // t = HasThisInitializer. 1 bit. private int _flags; private const int MethodKindOffset = 0; @@ -77,8 +78,11 @@ protected struct Flags private const int HasAnyBodySize = 1; private const int IsVarargOffset = HasAnyBodyOffset + HasAnyBodySize; -#pragma warning disable IDE0051 // Remove unused private members private const int IsVarargSize = 1; + + private const int HasThisInitializerOffset = IsVarargOffset + IsVarargSize; +#pragma warning disable IDE0051 // Remove unused private members + private const int HasThisInitializerSize = 1; #pragma warning restore IDE0051 // Remove unused private members private const int HasAnyBodyBit = 1 << HasAnyBodyOffset; @@ -88,6 +92,7 @@ protected struct Flags private const int IsMetadataVirtualBit = 1 << IsMetadataVirtualIgnoringInterfaceChangesOffset; private const int IsMetadataVirtualLockedBit = 1 << IsMetadataVirtualLockedOffset; private const int IsVarargBit = 1 << IsVarargOffset; + private const int HasThisInitializerBit = 1 << HasThisInitializerOffset; private const int ReturnsVoidBit = 1 << ReturnsVoidOffset; private const int ReturnsVoidIsSetBit = 1 << ReturnsVoidOffset + 1; @@ -153,6 +158,9 @@ public bool IsVararg get { return (_flags & IsVarargBit) != 0; } } + public readonly bool HasThisInitializer + => (_flags & HasThisInitializerBit) != 0; + #if DEBUG static Flags() { @@ -179,7 +187,8 @@ public Flags( bool isExtensionMethod, bool isNullableAnalysisEnabled, bool isVararg, - bool isExplicitInterfaceImplementation) + bool isExplicitInterfaceImplementation, + bool hasThisInitializer) { Debug.Assert(!returnsVoid || returnsVoidIsSet); @@ -194,6 +203,7 @@ public Flags( int isVarargInt = isVararg ? IsVarargBit : 0; int isMetadataVirtualIgnoringInterfaceImplementationChangesInt = isMetadataVirtual ? IsMetadataVirtualIgnoringInterfaceChangesBit : 0; int isMetadataVirtualInt = isMetadataVirtual ? IsMetadataVirtualBit : 0; + int hasThisInitializerInt = hasThisInitializer ? HasThisInitializerBit : 0; _flags = methodKindInt | refKindInt @@ -204,6 +214,7 @@ public Flags( | isVarargInt | isMetadataVirtualIgnoringInterfaceImplementationChangesInt | isMetadataVirtualInt + | hasThisInitializerInt | (returnsVoid ? ReturnsVoidBit : 0) | (returnsVoidIsSet ? ReturnsVoidIsSetBit : 0); } @@ -218,7 +229,8 @@ public Flags( bool isExtensionMethod, bool isNullableAnalysisEnabled, bool isVararg, - bool isExplicitInterfaceImplementation) + bool isExplicitInterfaceImplementation, + bool hasThisInitializer) : this(methodKind, refKind, declarationModifiers, @@ -229,7 +241,8 @@ public Flags( isExtensionMethod: isExtensionMethod, isNullableAnalysisEnabled: isNullableAnalysisEnabled, isVararg: isVararg, - isExplicitInterfaceImplementation: isExplicitInterfaceImplementation) + isExplicitInterfaceImplementation: isExplicitInterfaceImplementation, + hasThisInitializer: hasThisInitializer) { } @@ -387,9 +400,10 @@ protected static Flags MakeFlags( bool isExtensionMethod, bool isNullableAnalysisEnabled, bool isVarArg, - bool isExplicitInterfaceImplementation) + bool isExplicitInterfaceImplementation, + bool hasThisInitializer = false) { - return new Flags(methodKind, refKind, declarationModifiers, returnsVoid, returnsVoidIsSet, isExpressionBodied, isExtensionMethod, isNullableAnalysisEnabled, isVarArg, isExplicitInterfaceImplementation); + return new Flags(methodKind, refKind, declarationModifiers, returnsVoid, returnsVoidIsSet, isExpressionBodied, isExtensionMethod, isNullableAnalysisEnabled, isVarArg, isExplicitInterfaceImplementation, hasThisInitializer); } protected void SetReturnsVoid(bool returnsVoid) diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs index 1c60a7da730ad..e22f227b299f6 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs @@ -101,7 +101,8 @@ private static (DeclarationModifiers, Flags) MakeModifiersAndFlags( firstParam.Modifiers.Any(SyntaxKind.ThisKeyword), isNullableAnalysisEnabled: isNullableAnalysisEnabled, isVararg: syntax.IsVarArg(), - isExplicitInterfaceImplementation: methodKind == MethodKind.ExplicitInterfaceImplementation); + isExplicitInterfaceImplementation: methodKind == MethodKind.ExplicitInterfaceImplementation, + hasThisInitializer: false); return (declarationModifiers, flags); } From d7f1d6ba388d28f1565b41bf05885e7f51633e3d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 11:54:29 -0800 Subject: [PATCH 064/141] Remove navigation helpers based on line+offset --- .../InteractiveDocumentNavigationService.cs | 6 - .../IDocumentNavigationServiceExtensions.cs | 121 ++-- .../GoToDefinition/GoToDefinitionTestsBase.vb | 1 - .../NavigableSymbols/NavigableSymbolsTest.vb | 1 - .../MockDocumentNavigationService.vb | 17 - .../MockDocumentNavigationServiceProvider.vb | 19 - .../DefaultDocumentNavigationService.cs | 29 +- .../Navigation/IDocumentNavigationService.cs | 71 +- .../FSharpDocumentNavigationService.cs | 131 ++-- .../IFSharpDocumentNavigationService.cs | 56 +- .../VisualStudioDocumentNavigationService.cs | 665 ++++++++---------- 11 files changed, 505 insertions(+), 612 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/Interactive/InteractiveDocumentNavigationService.cs b/src/EditorFeatures/Core.Wpf/Interactive/InteractiveDocumentNavigationService.cs index 9a42308102d0f..9be4ace4787ea 100644 --- a/src/EditorFeatures/Core.Wpf/Interactive/InteractiveDocumentNavigationService.cs +++ b/src/EditorFeatures/Core.Wpf/Interactive/InteractiveDocumentNavigationService.cs @@ -28,9 +28,6 @@ public InteractiveDocumentNavigationService(IThreadingContext threadingContext) public Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) => SpecializedTasks.True; - public Task CanNavigateToLineAndOffsetAsync(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) - => SpecializedTasks.False; - public Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) => SpecializedTasks.False; @@ -86,9 +83,6 @@ public Task CanNavigateToPositionAsync(Workspace workspace, DocumentId doc }); } - public Task GetLocationForLineAndOffsetAsync(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) - => SpecializedTasks.Null(); - public Task GetLocationForPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) => SpecializedTasks.Null(); } diff --git a/src/EditorFeatures/Core/Navigation/IDocumentNavigationServiceExtensions.cs b/src/EditorFeatures/Core/Navigation/IDocumentNavigationServiceExtensions.cs index 7700e1484778f..f4bfbfec622dd 100644 --- a/src/EditorFeatures/Core/Navigation/IDocumentNavigationServiceExtensions.cs +++ b/src/EditorFeatures/Core/Navigation/IDocumentNavigationServiceExtensions.cs @@ -6,68 +6,87 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Text; +using Microsoft.CodeAnalysis.Shared.Extensions; -namespace Microsoft.CodeAnalysis.Navigation +namespace Microsoft.CodeAnalysis.Navigation; + +internal static class INavigableLocationExtensions { - internal static class INavigableLocationExtensions + public static async Task TryNavigateToAsync( + this INavigableLocation? location, IThreadingContext threadingContext, NavigationOptions options, CancellationToken cancellationToken) + { + if (location == null) + return false; + + // This switch is currently unnecessary. Howevver, it helps support a future where location.NavigateTo becomes + // async and must be on the UI thread. + await threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + return await location.NavigateToAsync(options, cancellationToken).ConfigureAwait(false); + } +} + +internal static class IDocumentNavigationServiceExtensions +{ + public static async Task TryNavigateToSpanAsync( + this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, NavigationOptions options, bool allowInvalidSpan, CancellationToken cancellationToken) + { + var location = await service.GetLocationForSpanAsync(workspace, documentId, textSpan, allowInvalidSpan, cancellationToken).ConfigureAwait(false); + return await location.TryNavigateToAsync(threadingContext, options, cancellationToken).ConfigureAwait(false); + } + + public static async Task TryNavigateToSpanAsync( + this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, NavigationOptions options, CancellationToken cancellationToken) { - public static async Task TryNavigateToAsync( - this INavigableLocation? location, IThreadingContext threadingContext, NavigationOptions options, CancellationToken cancellationToken) - { - if (location == null) - return false; + var location = await service.GetLocationForSpanAsync(workspace, documentId, textSpan, cancellationToken).ConfigureAwait(false); + return await location.TryNavigateToAsync(threadingContext, options, cancellationToken).ConfigureAwait(false); + } + + public static async Task TryNavigateToSpanAsync( + this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) + { + var location = await service.GetLocationForSpanAsync(workspace, documentId, textSpan, cancellationToken).ConfigureAwait(false); + return await location.TryNavigateToAsync(threadingContext, NavigationOptions.Default, cancellationToken).ConfigureAwait(false); + } - // This switch is currently unnecessary. Howevver, it helps support a future where location.NavigateTo becomes - // async and must be on the UI thread. - await threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - return await location.NavigateToAsync(options, cancellationToken).ConfigureAwait(false); - } + public static async Task TryNavigateToPositionAsync( + this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, int position, int virtualSpace, NavigationOptions options, CancellationToken cancellationToken) + { + var location = await service.GetLocationForPositionAsync(workspace, documentId, position, virtualSpace, cancellationToken).ConfigureAwait(false); + return await location.TryNavigateToAsync(threadingContext, options, cancellationToken).ConfigureAwait(false); + } + + public static async Task TryNavigateToPositionAsync( + this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, int position, CancellationToken cancellationToken) + { + var location = await service.GetLocationForPositionAsync( + workspace, documentId, position, cancellationToken).ConfigureAwait(false); + return await location.TryNavigateToAsync(threadingContext, NavigationOptions.Default, cancellationToken).ConfigureAwait(false); } - internal static class IDocumentNavigationServiceExtensions + public static async Task TryNavigateToLineAndOffsetAsync( + this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, int lineNumber, int offset, NavigationOptions options, CancellationToken cancellationToken) { - public static async Task TryNavigateToSpanAsync( - this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, NavigationOptions options, bool allowInvalidSpan, CancellationToken cancellationToken) - { - var location = await service.GetLocationForSpanAsync(workspace, documentId, textSpan, allowInvalidSpan, cancellationToken).ConfigureAwait(false); - return await location.TryNavigateToAsync(threadingContext, options, cancellationToken).ConfigureAwait(false); - } + // Navigation should not change the context of linked files and Shared Projects. + documentId = workspace.GetDocumentIdInCurrentContext(documentId); - public static async Task TryNavigateToSpanAsync( - this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, NavigationOptions options, CancellationToken cancellationToken) - { - var location = await service.GetLocationForSpanAsync(workspace, documentId, textSpan, cancellationToken).ConfigureAwait(false); - return await location.TryNavigateToAsync(threadingContext, options, cancellationToken).ConfigureAwait(false); - } + var document = workspace.CurrentSolution.GetDocument(documentId); + if (document is null) + return false; - public static async Task TryNavigateToSpanAsync( - this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) - { - var location = await service.GetLocationForSpanAsync(workspace, documentId, textSpan, cancellationToken).ConfigureAwait(false); - return await location.TryNavigateToAsync(threadingContext, NavigationOptions.Default, cancellationToken).ConfigureAwait(false); - } + // DocumentId+Line+Column come from sources that are not snapshot based. In other words, the data may + // correspond to some point in time in the past. As such, we have to try to clamp it against the current + // view of the document text. + var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); - public static async Task TryNavigateToPositionAsync( - this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, int position, int virtualSpace, NavigationOptions options, CancellationToken cancellationToken) - { - var location = await service.GetLocationForPositionAsync(workspace, documentId, position, virtualSpace, cancellationToken).ConfigureAwait(false); - return await location.TryNavigateToAsync(threadingContext, options, cancellationToken).ConfigureAwait(false); - } + var linePosition = new LinePosition(lineNumber, offset); + var linePositionSpan = new LinePositionSpan(linePosition, linePosition); + var clampedSpan = linePositionSpan.GetClampedTextSpan(text); - public static async Task TryNavigateToPositionAsync( - this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, int position, CancellationToken cancellationToken) - { - var location = await service.GetLocationForPositionAsync( - workspace, documentId, position, cancellationToken).ConfigureAwait(false); - return await location.TryNavigateToAsync(threadingContext, NavigationOptions.Default, cancellationToken).ConfigureAwait(false); - } + // This operation is fundamentally racey. Between getting the clamped span and navigating the document may + // have changed. So allow for invalid spans here. + var location = await service.GetLocationForSpanAsync( + workspace, documentId, clampedSpan, allowInvalidSpan: true, cancellationToken).ConfigureAwait(false); - public static async Task TryNavigateToLineAndOffsetAsync( - this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, int lineNumber, int offset, NavigationOptions options, CancellationToken cancellationToken) - { - var location = await service.GetLocationForLineAndOffsetAsync( - workspace, documentId, lineNumber, offset, cancellationToken).ConfigureAwait(false); - return await location.TryNavigateToAsync(threadingContext, options, cancellationToken).ConfigureAwait(false); - } + return location != null && await location.TryNavigateToAsync(threadingContext, options, cancellationToken).ConfigureAwait(false); } } diff --git a/src/EditorFeatures/Test2/GoToDefinition/GoToDefinitionTestsBase.vb b/src/EditorFeatures/Test2/GoToDefinition/GoToDefinitionTestsBase.vb index d865c02c09c55..7988a88d444ed 100644 --- a/src/EditorFeatures/Test2/GoToDefinition/GoToDefinitionTestsBase.vb +++ b/src/EditorFeatures/Test2/GoToDefinition/GoToDefinitionTestsBase.vb @@ -89,7 +89,6 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.GoToDefinition ' The INavigableItemsPresenter should not have been called Assert.False(presenterCalled) Else - Assert.False(mockDocumentNavigationService._triedNavigationToLineAndOffset) Assert.True(presenterCalled) Dim actualLocations As New List(Of FilePathAndSpan) diff --git a/src/EditorFeatures/Test2/NavigableSymbols/NavigableSymbolsTest.vb b/src/EditorFeatures/Test2/NavigableSymbols/NavigableSymbolsTest.vb index da6faee1fd49a..6d225750d98ed 100644 --- a/src/EditorFeatures/Test2/NavigableSymbols/NavigableSymbolsTest.vb +++ b/src/EditorFeatures/Test2/NavigableSymbols/NavigableSymbolsTest.vb @@ -135,7 +135,6 @@ End Class" Await listenerProvider.GetWaiter(FeatureAttribute.NavigableSymbols).ExpeditedWaitAsync() Dim navigationService = DirectCast(workspace.Services.GetService(Of IDocumentNavigationService)(), MockDocumentNavigationServiceProvider.MockDocumentNavigationService) - Assert.Equal(True, navigationService.TryNavigateToLineAndOffsetReturnValue) Assert.Equal(True, navigationService.TryNavigateToPositionReturnValue) Assert.Equal(True, navigationService.TryNavigateToSpanReturnValue) diff --git a/src/EditorFeatures/TestUtilities2/Utilities/GoToHelpers/MockDocumentNavigationService.vb b/src/EditorFeatures/TestUtilities2/Utilities/GoToHelpers/MockDocumentNavigationService.vb index 98810315a2512..382c7703e7250 100644 --- a/src/EditorFeatures/TestUtilities2/Utilities/GoToHelpers/MockDocumentNavigationService.vb +++ b/src/EditorFeatures/TestUtilities2/Utilities/GoToHelpers/MockDocumentNavigationService.vb @@ -12,11 +12,9 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Utilities.GoToHelpers Friend Class MockDocumentNavigationService Implements IDocumentNavigationService - Public _canNavigateToLineAndOffset As Boolean = True Public _canNavigateToPosition As Boolean = True Public _canNavigateToSpan As Boolean = True - Public _triedNavigationToLineAndOffset As Boolean Public _triedNavigationToPosition As Boolean Public _triedNavigationToSpan As Boolean @@ -27,10 +25,6 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Utilities.GoToHelpers Public _position As Integer = -1 Public _positionVirtualSpace As Integer = -1 - Public Function CanNavigateToLineAndOffsetAsync(workspace As Workspace, documentId As DocumentId, lineNumber As Integer, offset As Integer, cancellationToken As CancellationToken) As Task(Of Boolean) Implements IDocumentNavigationService.CanNavigateToLineAndOffsetAsync - Return If(_canNavigateToLineAndOffset, SpecializedTasks.True, SpecializedTasks.False) - End Function - Public Function CanNavigateToPositionAsync(workspace As Workspace, documentId As DocumentId, position As Integer, virtualSpace As Integer, cancellationToken As CancellationToken) As Task(Of Boolean) Implements IDocumentNavigationService.CanNavigateToPositionAsync Return If(_canNavigateToPosition, SpecializedTasks.True, SpecializedTasks.False) End Function @@ -39,17 +33,6 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Utilities.GoToHelpers Return If(_canNavigateToSpan, SpecializedTasks.True, SpecializedTasks.False) End Function - Public Function GetLocationForLineAndOffsetAsync(workspace As Workspace, documentId As DocumentId, lineNumber As Integer, offset As Integer, cancellationToken As CancellationToken) As Task(Of INavigableLocation) Implements IDocumentNavigationService.GetLocationForLineAndOffsetAsync - Return Task.FromResult(Of INavigableLocation)(New NavigableLocation( - Function(o, c) - _triedNavigationToLineAndOffset = True - _documentId = documentId - _line = lineNumber - _offset = offset - Return SpecializedTasks.True - End Function)) - End Function - Public Function GetLocationForPositionAsync(workspace As Workspace, documentId As DocumentId, position As Integer, virtualSpace As Integer, cancellationToken As CancellationToken) As Task(Of INavigableLocation) Implements IDocumentNavigationService.GetLocationForPositionAsync Return Task.FromResult(Of INavigableLocation)(New NavigableLocation( Function(o, c) diff --git a/src/EditorFeatures/TestUtilities2/Utilities/MockDocumentNavigationServiceProvider.vb b/src/EditorFeatures/TestUtilities2/Utilities/MockDocumentNavigationServiceProvider.vb index 923f5b009272a..03e2a65135287 100644 --- a/src/EditorFeatures/TestUtilities2/Utilities/MockDocumentNavigationServiceProvider.vb +++ b/src/EditorFeatures/TestUtilities2/Utilities/MockDocumentNavigationServiceProvider.vb @@ -33,26 +33,15 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Utilities Public ProvidedDocumentId As DocumentId Public ProvidedTextSpan As TextSpan - Public ProvidedLineNumber As Integer - Public ProvidedOffset As Integer Public ProvidedPosition As Integer Public ProvidedVirtualSpace As Integer - Public CanNavigateToLineAndOffsetReturnValue As Boolean = True Public CanNavigateToPositionReturnValue As Boolean = True Public CanNavigateToSpanReturnValue As Boolean = True - Public TryNavigateToLineAndOffsetReturnValue As Boolean = True Public TryNavigateToPositionReturnValue As Boolean = True Public TryNavigateToSpanReturnValue As Boolean = True - Public Function CanNavigateToLineAndOffsetAsync(workspace As Workspace, documentId As DocumentId, lineNumber As Integer, offset As Integer, cancellationToken As CancellationToken) As Task(Of Boolean) Implements IDocumentNavigationService.CanNavigateToLineAndOffsetAsync - Me.ProvidedDocumentId = documentId - Me.ProvidedLineNumber = lineNumber - - Return If(CanNavigateToLineAndOffsetReturnValue, SpecializedTasks.True, SpecializedTasks.False) - End Function - Public Function CanNavigateToPosition(workspace As Workspace, documentId As DocumentId, position As Integer, virtualSpace As Integer, cancellationToken As CancellationToken) As Task(Of Boolean) Implements IDocumentNavigationService.CanNavigateToPositionAsync Me.ProvidedDocumentId = documentId Me.ProvidedPosition = position @@ -68,14 +57,6 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Utilities Return If(CanNavigateToSpanReturnValue, SpecializedTasks.True, SpecializedTasks.False) End Function - Public Function GetLocationForLineAndOffsetAsync(workspace As Workspace, documentId As DocumentId, lineNumber As Integer, offset As Integer, cancellationToken As CancellationToken) As Task(Of INavigableLocation) Implements IDocumentNavigationService.GetLocationForLineAndOffsetAsync - Me.ProvidedDocumentId = documentId - Me.ProvidedLineNumber = lineNumber - Me.ProvidedOffset = offset - - Return NavigableLocation.TestAccessor.Create(TryNavigateToLineAndOffsetReturnValue) - End Function - Public Function GetLocationForPositionAsync(workspace As Workspace, documentId As DocumentId, position As Integer, virtualSpace As Integer, cancellationToken As CancellationToken) As Task(Of INavigableLocation) Implements IDocumentNavigationService.GetLocationForPositionAsync Me.ProvidedDocumentId = documentId Me.ProvidedPosition = position diff --git a/src/Features/Core/Portable/Navigation/DefaultDocumentNavigationService.cs b/src/Features/Core/Portable/Navigation/DefaultDocumentNavigationService.cs index bef434fed1ef5..dd6c5fc18a8c0 100644 --- a/src/Features/Core/Portable/Navigation/DefaultDocumentNavigationService.cs +++ b/src/Features/Core/Portable/Navigation/DefaultDocumentNavigationService.cs @@ -7,26 +7,19 @@ using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; -namespace Microsoft.CodeAnalysis.Navigation -{ - internal sealed class DefaultDocumentNavigationService : IDocumentNavigationService - { - public Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) - => SpecializedTasks.False; - - public Task CanNavigateToLineAndOffsetAsync(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) - => SpecializedTasks.False; +namespace Microsoft.CodeAnalysis.Navigation; - public Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) - => SpecializedTasks.False; +internal sealed class DefaultDocumentNavigationService : IDocumentNavigationService +{ + public Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) + => SpecializedTasks.False; - public Task GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) - => SpecializedTasks.Null(); + public Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) + => SpecializedTasks.False; - public Task GetLocationForLineAndOffsetAsync(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) - => SpecializedTasks.Null(); + public Task GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) + => SpecializedTasks.Null(); - public Task GetLocationForPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) - => SpecializedTasks.Null(); - } + public Task GetLocationForPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) + => SpecializedTasks.Null(); } diff --git a/src/Features/Core/Portable/Navigation/IDocumentNavigationService.cs b/src/Features/Core/Portable/Navigation/IDocumentNavigationService.cs index 9ca5479b00ee6..461eb0af0dbca 100644 --- a/src/Features/Core/Portable/Navigation/IDocumentNavigationService.cs +++ b/src/Features/Core/Portable/Navigation/IDocumentNavigationService.cs @@ -2,49 +2,42 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; -namespace Microsoft.CodeAnalysis.Navigation +namespace Microsoft.CodeAnalysis.Navigation; + +internal interface IDocumentNavigationService : IWorkspaceService +{ + /// + /// Determines whether it is possible to navigate to the given position in the specified document. + /// + /// Legal to call from any thread. + Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken); + + /// + /// Determines whether it is possible to navigate to the given virtual position in the specified document. + /// + /// Legal to call from any thread. + Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken); + + Task GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken); + Task GetLocationForPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken); +} + +internal static class IDocumentNavigationServiceExtensions { - internal interface IDocumentNavigationService : IWorkspaceService - { - /// - /// Determines whether it is possible to navigate to the given position in the specified document. - /// - /// Legal to call from any thread. - Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken); - - /// - /// Determines whether it is possible to navigate to the given line/offset in the specified document. - /// - Task CanNavigateToLineAndOffsetAsync(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken); - - /// - /// Determines whether it is possible to navigate to the given virtual position in the specified document. - /// - Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken); - - Task GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken); - Task GetLocationForPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken); - Task GetLocationForLineAndOffsetAsync(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken); - } - - internal static class IDocumentNavigationServiceExtensions - { - public static Task CanNavigateToSpanAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) - => service.CanNavigateToSpanAsync(workspace, documentId, textSpan, allowInvalidSpan: false, cancellationToken); - - public static Task CanNavigateToPositionAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, int position, CancellationToken cancellationToken) - => service.CanNavigateToPositionAsync(workspace, documentId, position, virtualSpace: 0, cancellationToken); - - public static Task GetLocationForSpanAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) - => service.GetLocationForSpanAsync(workspace, documentId, textSpan, allowInvalidSpan: false, cancellationToken); - - public static Task GetLocationForPositionAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, int position, CancellationToken cancellationToken) - => service.GetLocationForPositionAsync(workspace, documentId, position, virtualSpace: 0, cancellationToken); - } + public static Task CanNavigateToSpanAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) + => service.CanNavigateToSpanAsync(workspace, documentId, textSpan, allowInvalidSpan: false, cancellationToken); + + public static Task CanNavigateToPositionAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, int position, CancellationToken cancellationToken) + => service.CanNavigateToPositionAsync(workspace, documentId, position, virtualSpace: 0, cancellationToken); + + public static Task GetLocationForSpanAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) + => service.GetLocationForSpanAsync(workspace, documentId, textSpan, allowInvalidSpan: false, cancellationToken); + + public static Task GetLocationForPositionAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, int position, CancellationToken cancellationToken) + => service.GetLocationForPositionAsync(workspace, documentId, position, virtualSpace: 0, cancellationToken); } diff --git a/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs b/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs index 260271486089b..3317650a1a72f 100644 --- a/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs +++ b/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs @@ -13,88 +13,77 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; -namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation -{ - [ExportWorkspaceService(typeof(IFSharpDocumentNavigationService)), Shared] - internal class FSharpDocumentNavigationService : IFSharpDocumentNavigationService - { - private readonly IThreadingContext _threadingContext; +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation; - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public FSharpDocumentNavigationService( - IThreadingContext threadingContext) - { - _threadingContext = threadingContext; - } - - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan) - => CanNavigateToSpan(workspace, documentId, textSpan, CancellationToken.None); +[ExportWorkspaceService(typeof(IFSharpDocumentNavigationService)), Shared] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal class FSharpDocumentNavigationService(IThreadingContext threadingContext) + : IFSharpDocumentNavigationService +{ + [Obsolete("Call overload that takes a CancellationToken", error: false)] + public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan) + => CanNavigateToSpan(workspace, documentId, textSpan, CancellationToken.None); - public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) - { - var service = workspace.Services.GetService(); - return _threadingContext.JoinableTaskFactory.Run(() => - service.CanNavigateToSpanAsync(workspace, documentId, textSpan, cancellationToken)); - } + public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) + { + var service = workspace.Services.GetService(); + return threadingContext.JoinableTaskFactory.Run(() => + service.CanNavigateToSpanAsync(workspace, documentId, textSpan, cancellationToken)); + } - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset) - => CanNavigateToLineAndOffset(workspace, documentId, lineNumber, offset, CancellationToken.None); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + public bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset) + => CanNavigateToLineAndOffset(workspace, documentId, lineNumber, offset, CancellationToken.None); - public bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) - { - var service = workspace.Services.GetService(); - return _threadingContext.JoinableTaskFactory.Run(() => - service.CanNavigateToLineAndOffsetAsync(workspace, documentId, lineNumber, offset, cancellationToken)); - } + [Obsolete("Call overloads that take a span or position", error: false)] + public bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) + => false; - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace) - => CanNavigateToPosition(workspace, documentId, position, virtualSpace, CancellationToken.None); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + public bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace) + => CanNavigateToPosition(workspace, documentId, position, virtualSpace, CancellationToken.None); - public bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) - { - var service = workspace.Services.GetService(); - return _threadingContext.JoinableTaskFactory.Run(() => - service.CanNavigateToPositionAsync(workspace, documentId, position, virtualSpace, cancellationToken)); - } + public bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) + { + var service = workspace.Services.GetService(); + return threadingContext.JoinableTaskFactory.Run(() => + service.CanNavigateToPositionAsync(workspace, documentId, position, virtualSpace, cancellationToken)); + } - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options) - => TryNavigateToSpan(workspace, documentId, textSpan, CancellationToken.None); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options) + => TryNavigateToSpan(workspace, documentId, textSpan, CancellationToken.None); - public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) - { - var service = workspace.Services.GetService(); - return _threadingContext.JoinableTaskFactory.Run(() => - service.TryNavigateToSpanAsync( - _threadingContext, workspace, documentId, textSpan, NavigationOptions.Default with { PreferProvisionalTab = true }, cancellationToken)); - } + public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) + { + var service = workspace.Services.GetService(); + return threadingContext.JoinableTaskFactory.Run(() => + service.TryNavigateToSpanAsync( + threadingContext, workspace, documentId, textSpan, NavigationOptions.Default with { PreferProvisionalTab = true }, cancellationToken)); + } - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, OptionSet options) - => TryNavigateToLineAndOffset(workspace, documentId, lineNumber, offset, CancellationToken.None); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + public bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, OptionSet options) + => TryNavigateToLineAndOffset(workspace, documentId, lineNumber, offset, CancellationToken.None); - public bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) - { - var service = workspace.Services.GetService(); - return _threadingContext.JoinableTaskFactory.Run(() => - service.TryNavigateToPositionAsync( - _threadingContext, workspace, documentId, lineNumber, offset, NavigationOptions.Default with { PreferProvisionalTab = true }, cancellationToken)); - } + public bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) + { + var service = workspace.Services.GetService(); + return threadingContext.JoinableTaskFactory.Run(() => + service.TryNavigateToPositionAsync( + threadingContext, workspace, documentId, lineNumber, offset, NavigationOptions.Default with { PreferProvisionalTab = true }, cancellationToken)); + } - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, OptionSet options) - => TryNavigateToPosition(workspace, documentId, position, virtualSpace, CancellationToken.None); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + public bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, OptionSet options) + => TryNavigateToPosition(workspace, documentId, position, virtualSpace, CancellationToken.None); - public bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) - { - var service = workspace.Services.GetService(); - return _threadingContext.JoinableTaskFactory.Run(() => - service.TryNavigateToPositionAsync( - _threadingContext, workspace, documentId, position, virtualSpace, NavigationOptions.Default with { PreferProvisionalTab = true }, cancellationToken)); - } + public bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) + { + var service = workspace.Services.GetService(); + return threadingContext.JoinableTaskFactory.Run(() => + service.TryNavigateToPositionAsync( + threadingContext, workspace, documentId, position, virtualSpace, NavigationOptions.Default with { PreferProvisionalTab = true }, cancellationToken)); } } diff --git a/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs b/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs index 7d282d0de9cda..b56c4904e7f40 100644 --- a/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs +++ b/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs @@ -11,37 +11,37 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; -namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation; + +internal interface IFSharpDocumentNavigationService : IWorkspaceService { - internal interface IFSharpDocumentNavigationService : IWorkspaceService - { - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan); - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset); #pragma warning disable RS0060 // API with optional parameter(s) should have the most parameters amongst its public overloads - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0); - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options = null); - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, OptionSet options = null); - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0, OptionSet options = null); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options = null); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, OptionSet options = null); + [Obsolete("Call overload that takes a CancellationToken", error: false)] + bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0, OptionSet options = null); #pragma warning restore RS0060 // API with optional parameter(s) should have the most parameters amongst its public overloads - /// - bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); - /// - bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken); - /// - bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken); + [Obsolete("Call overloads that take a span or position", error: false)] + bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken); + [Obsolete("Call overloads that take a span or position", error: false)] + bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken); + + /// + bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); + /// + bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken); - /// - bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); - /// - bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken); - /// - bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken); - } + /// + bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); + /// + bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken); } diff --git a/src/VisualStudio/Core/Def/Workspace/VisualStudioDocumentNavigationService.cs b/src/VisualStudio/Core/Def/Workspace/VisualStudioDocumentNavigationService.cs index 047510b797f0c..5606175c7fc97 100644 --- a/src/VisualStudio/Core/Def/Workspace/VisualStudioDocumentNavigationService.cs +++ b/src/VisualStudio/Core/Def/Workspace/VisualStudioDocumentNavigationService.cs @@ -29,83 +29,111 @@ using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; using VsTextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan; -namespace Microsoft.VisualStudio.LanguageServices.Implementation +namespace Microsoft.VisualStudio.LanguageServices.Implementation; + +[ExportWorkspaceService(typeof(IDocumentNavigationService), ServiceLayer.Host), Shared] +[Export(typeof(VisualStudioDocumentNavigationService))] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class VisualStudioDocumentNavigationService( + IThreadingContext threadingContext, + SVsServiceProvider serviceProvider, + IVsEditorAdaptersFactoryService editorAdaptersFactoryService, + // lazy to avoid circularities + Lazy sourceGeneratedFileManager) + : ForegroundThreadAffinitizedObject(threadingContext), IDocumentNavigationService { - using Workspace = Microsoft.CodeAnalysis.Workspace; + private readonly IServiceProvider _serviceProvider = serviceProvider; + private readonly IVsEditorAdaptersFactoryService _editorAdaptersFactoryService = editorAdaptersFactoryService; + private readonly IVsRunningDocumentTable4 _runningDocumentTable = (IVsRunningDocumentTable4)serviceProvider.GetService(typeof(SVsRunningDocumentTable)); + private readonly IThreadingContext _threadingContext = threadingContext; + private readonly Lazy _sourceGeneratedFileManager = sourceGeneratedFileManager; - [ExportWorkspaceService(typeof(IDocumentNavigationService), ServiceLayer.Host), Shared] - [Export(typeof(VisualStudioDocumentNavigationService))] - internal sealed class VisualStudioDocumentNavigationService : ForegroundThreadAffinitizedObject, IDocumentNavigationService + public async Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) { - private readonly IServiceProvider _serviceProvider; - private readonly IVsEditorAdaptersFactoryService _editorAdaptersFactoryService; - private readonly IVsRunningDocumentTable4 _runningDocumentTable; - private readonly IThreadingContext _threadingContext; - private readonly Lazy _sourceGeneratedFileManager; - - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public VisualStudioDocumentNavigationService( - IThreadingContext threadingContext, - SVsServiceProvider serviceProvider, - IVsEditorAdaptersFactoryService editorAdaptersFactoryService, - Lazy sourceGeneratedFileManager /* lazy to avoid circularities */) - : base(threadingContext) - { - _serviceProvider = serviceProvider; - _editorAdaptersFactoryService = editorAdaptersFactoryService; - _runningDocumentTable = (IVsRunningDocumentTable4)serviceProvider.GetService(typeof(SVsRunningDocumentTable)); - _threadingContext = threadingContext; - _sourceGeneratedFileManager = sourceGeneratedFileManager; - } + // Navigation should not change the context of linked files and Shared Projects. + documentId = workspace.GetDocumentIdInCurrentContext(documentId); - public async Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) - { - // Navigation should not change the context of linked files and Shared Projects. - documentId = workspace.GetDocumentIdInCurrentContext(documentId); + if (!IsSecondaryBuffer(documentId)) + return true; - if (!IsSecondaryBuffer(documentId)) - return true; + var document = workspace.CurrentSolution.GetRequiredDocument(documentId); + var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); - var document = workspace.CurrentSolution.GetRequiredDocument(documentId); - var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); + var vsTextSpan = GetVsTextSpan(text, textSpan, allowInvalidSpan); + return await CanMapFromSecondaryBufferToPrimaryBufferAsync( + documentId, vsTextSpan, cancellationToken).ConfigureAwait(false); + } - var vsTextSpan = GetVsTextSpan(text, textSpan, allowInvalidSpan); - return await CanMapFromSecondaryBufferToPrimaryBufferAsync( - documentId, vsTextSpan, cancellationToken).ConfigureAwait(false); - } + public async Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) + { + // Navigation should not change the context of linked files and Shared Projects. + documentId = workspace.GetDocumentIdInCurrentContext(documentId); - public async Task CanNavigateToLineAndOffsetAsync(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) - { - // Navigation should not change the context of linked files and Shared Projects. - documentId = workspace.GetDocumentIdInCurrentContext(documentId); + if (!IsSecondaryBuffer(documentId)) + return true; - if (!IsSecondaryBuffer(documentId)) + var document = workspace.CurrentSolution.GetRequiredDocument(documentId); + var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); + + var boundedPosition = GetPositionWithinDocumentBounds(position, text.Length); + if (boundedPosition != position) + { + try + { + throw new ArgumentOutOfRangeException(); + } + catch (ArgumentOutOfRangeException e) when (FatalError.ReportAndCatch(e)) { - return true; } - var document = workspace.CurrentSolution.GetRequiredDocument(documentId); - var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); - var vsTextSpan = text.GetVsTextSpanForLineOffset(lineNumber, offset); - - return await CanMapFromSecondaryBufferToPrimaryBufferAsync( - documentId, vsTextSpan, cancellationToken).ConfigureAwait(false); + return false; } - public async Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) - { - // Navigation should not change the context of linked files and Shared Projects. - documentId = workspace.GetDocumentIdInCurrentContext(documentId); + var vsTextSpan = text.GetVsTextSpanForPosition(position, virtualSpace); - if (!IsSecondaryBuffer(documentId)) - { - return true; - } + return await CanMapFromSecondaryBufferToPrimaryBufferAsync( + documentId, vsTextSpan, cancellationToken).ConfigureAwait(false); + } + + public async Task GetLocationForSpanAsync( + Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) + { + if (!await this.CanNavigateToSpanAsync(workspace, documentId, textSpan, allowInvalidSpan, cancellationToken).ConfigureAwait(false)) + return null; + + return await GetNavigableLocationAsync(workspace, + documentId, + _ => Task.FromResult(textSpan), + text => GetVsTextSpan(text, textSpan, allowInvalidSpan), + cancellationToken).ConfigureAwait(false); + } + + public async Task GetLocationForPositionAsync( + Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) + { + if (!await this.CanNavigateToPositionAsync(workspace, documentId, position, virtualSpace, cancellationToken).ConfigureAwait(false)) + return null; + + return await GetNavigableLocationAsync(workspace, + documentId, + document => GetTextSpanFromPositionAsync(document, position, virtualSpace, cancellationToken), + text => GetVsTextSpan(text, position, virtualSpace), + cancellationToken).ConfigureAwait(false); - var document = workspace.CurrentSolution.GetRequiredDocument(documentId); + static async Task GetTextSpanFromPositionAsync(Document document, int position, int virtualSpace, CancellationToken cancellationToken) + { var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); + text.GetLineAndOffset(position, out var lineNumber, out var offset); + + offset += virtualSpace; + var linePosition = new LinePosition(lineNumber, offset); + return text.Lines.GetTextSpan(new LinePositionSpan(linePosition, linePosition)); + } + + static VsTextSpan GetVsTextSpan(SourceText text, int position, int virtualSpace) + { var boundedPosition = GetPositionWithinDocumentBounds(position, text.Length); if (boundedPosition != position) { @@ -116,368 +144,283 @@ public async Task CanNavigateToPositionAsync(Workspace workspace, Document catch (ArgumentOutOfRangeException e) when (FatalError.ReportAndCatch(e)) { } - - return false; } - var vsTextSpan = text.GetVsTextSpanForPosition(position, virtualSpace); - - return await CanMapFromSecondaryBufferToPrimaryBufferAsync( - documentId, vsTextSpan, cancellationToken).ConfigureAwait(false); + return text.GetVsTextSpanForPosition(boundedPosition, virtualSpace); } + } - public async Task GetLocationForSpanAsync( - Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) - { - if (!await this.CanNavigateToSpanAsync(workspace, documentId, textSpan, allowInvalidSpan, cancellationToken).ConfigureAwait(false)) - return null; - - return await GetNavigableLocationAsync(workspace, - documentId, - _ => Task.FromResult(textSpan), - text => GetVsTextSpan(text, textSpan, allowInvalidSpan), - cancellationToken).ConfigureAwait(false); - } + private async Task GetNavigableLocationAsync( + Workspace workspace, + DocumentId documentId, + Func> getTextSpanForMappingAsync, + Func getVsTextSpan, + CancellationToken cancellationToken) + { + var callback = await GetNavigationCallbackAsync( + workspace, documentId, getTextSpanForMappingAsync, getVsTextSpan, cancellationToken).ConfigureAwait(true); + if (callback == null) + return null; - public async Task GetLocationForLineAndOffsetAsync( - Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) + return new NavigableLocation(async (options, cancellationToken) => { - if (!await this.CanNavigateToLineAndOffsetAsync(workspace, documentId, lineNumber, offset, cancellationToken).ConfigureAwait(false)) - return null; - - return await GetNavigableLocationAsync(workspace, - documentId, - document => GetTextSpanFromLineAndOffsetAsync(document, lineNumber, offset, cancellationToken), - text => GetVsTextSpan(text, lineNumber, offset), - cancellationToken).ConfigureAwait(false); - - static async Task GetTextSpanFromLineAndOffsetAsync(Document document, int lineNumber, int offset, CancellationToken cancellationToken) + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + using (OpenNewDocumentStateScope(options)) { - var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); - - var linePosition = new LinePosition(lineNumber, offset); - return text.Lines.GetTextSpan(new LinePositionSpan(linePosition, linePosition)); + // Ensure we come back to the UI Thread after navigating so we close the state scope. + return await callback(cancellationToken).ConfigureAwait(true); } + }); + } - static VsTextSpan GetVsTextSpan(SourceText text, int lineNumber, int offset) - { - return text.GetVsTextSpanForLineOffset(lineNumber, offset); - } - } + private async Task>?> GetNavigationCallbackAsync( + Workspace workspace, + DocumentId documentId, + Func> getTextSpanForMappingAsync, + Func getVsTextSpan, + CancellationToken cancellationToken) + { + // Navigation should not change the context of linked files and Shared Projects. + documentId = workspace.GetDocumentIdInCurrentContext(documentId); - public async Task GetLocationForPositionAsync( - Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) + var solution = workspace.CurrentSolution; + var document = solution.GetDocument(documentId); + if (document == null) { - if (!await this.CanNavigateToPositionAsync(workspace, documentId, position, virtualSpace, cancellationToken).ConfigureAwait(false)) - return null; - - return await GetNavigableLocationAsync(workspace, - documentId, - document => GetTextSpanFromPositionAsync(document, position, virtualSpace, cancellationToken), - text => GetVsTextSpan(text, position, virtualSpace), - cancellationToken).ConfigureAwait(false); - - static async Task GetTextSpanFromPositionAsync(Document document, int position, int virtualSpace, CancellationToken cancellationToken) + var project = solution.GetProject(documentId.ProjectId); + if (project is null) { - var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); - text.GetLineAndOffset(position, out var lineNumber, out var offset); + // This is a source generated document shown in Solution Explorer, but is no longer valid since + // the configuration and/or platform changed since the last generation completed. + return null; + } - offset += virtualSpace; + var generatedDocument = await project.GetSourceGeneratedDocumentAsync(documentId, cancellationToken).ConfigureAwait(false); + if (generatedDocument == null) + return null; - var linePosition = new LinePosition(lineNumber, offset); - return text.Lines.GetTextSpan(new LinePositionSpan(linePosition, linePosition)); - } + return _sourceGeneratedFileManager.Value.GetNavigationCallback( + generatedDocument, + await getTextSpanForMappingAsync(generatedDocument).ConfigureAwait(false)); + } - static VsTextSpan GetVsTextSpan(SourceText text, int position, int virtualSpace) + // Before attempting to open the document, check if the location maps to a different file that should be opened instead. + var spanMappingService = document.Services.GetService(); + if (spanMappingService != null) + { + var mappedSpan = await GetMappedSpanAsync( + spanMappingService, + document, + await getTextSpanForMappingAsync(document).ConfigureAwait(false), + cancellationToken).ConfigureAwait(false); + if (mappedSpan.HasValue) { - var boundedPosition = GetPositionWithinDocumentBounds(position, text.Length); - if (boundedPosition != position) + // Check if the mapped file matches one already in the workspace. + // If so use the workspace APIs to navigate to it. Otherwise use VS APIs to navigate to the file path. + var documentIdsForFilePath = solution.GetDocumentIdsWithFilePath(mappedSpan.Value.FilePath); + if (!documentIdsForFilePath.IsEmpty) { - try - { - throw new ArgumentOutOfRangeException(); - } - catch (ArgumentOutOfRangeException e) when (FatalError.ReportAndCatch(e)) - { - } + // If the mapped file maps to the same document that was passed in, then re-use the documentId to preserve context. + // Otherwise, just pick one of the ids to use for navigation. + var documentIdToNavigate = documentIdsForFilePath.Contains(documentId) ? documentId : documentIdsForFilePath.First(); + return GetNavigationCallback(documentIdToNavigate, workspace, getVsTextSpan); } - return text.GetVsTextSpanForPosition(boundedPosition, virtualSpace); + return await GetNavigableLocationForMappedFileAsync( + workspace, document, mappedSpan.Value, cancellationToken).ConfigureAwait(false); } } - private async Task GetNavigableLocationAsync( - Workspace workspace, - DocumentId documentId, - Func> getTextSpanForMappingAsync, - Func getVsTextSpan, - CancellationToken cancellationToken) + return GetNavigationCallback(documentId, workspace, getVsTextSpan); + } + + private Func>? GetNavigationCallback( + DocumentId documentId, + Workspace workspace, + Func getVsTextSpan) + { + return async cancellationToken => { - var callback = await GetNavigationCallbackAsync( - workspace, documentId, getTextSpanForMappingAsync, getVsTextSpan, cancellationToken).ConfigureAwait(true); - if (callback == null) - return null; + // Always open the document again, even if the document is already open in the + // workspace. If a document is already open in a preview tab and it is opened again + // in a permanent tab, this allows the document to transition to the new state. - return new NavigableLocation(async (options, cancellationToken) => - { - await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - using (OpenNewDocumentStateScope(options)) - { - // Ensure we come back to the UI Thread after navigating so we close the state scope. - return await callback(cancellationToken).ConfigureAwait(true); - } - }); - } + if (workspace.CanOpenDocuments) + await OpenDocumentAsync(_threadingContext, workspace, documentId, cancellationToken).ConfigureAwait(false); - private async Task>?> GetNavigationCallbackAsync( - Workspace workspace, - DocumentId documentId, - Func> getTextSpanForMappingAsync, - Func getVsTextSpan, - CancellationToken cancellationToken) - { - // Navigation should not change the context of linked files and Shared Projects. - documentId = workspace.GetDocumentIdInCurrentContext(documentId); + if (!workspace.IsDocumentOpen(documentId)) + return false; - var solution = workspace.CurrentSolution; - var document = solution.GetDocument(documentId); + // Now that we've opened the document reacquire the corresponding Document in the current solution. + var document = workspace.CurrentSolution.GetDocument(documentId); if (document == null) - { - var project = solution.GetProject(documentId.ProjectId); - if (project is null) - { - // This is a source generated document shown in Solution Explorer, but is no longer valid since - // the configuration and/or platform changed since the last generation completed. - return null; - } - - var generatedDocument = await project.GetSourceGeneratedDocumentAsync(documentId, cancellationToken).ConfigureAwait(false); - if (generatedDocument == null) - return null; + return false; - return _sourceGeneratedFileManager.Value.GetNavigationCallback( - generatedDocument, - await getTextSpanForMappingAsync(generatedDocument).ConfigureAwait(false)); - } + // Reacquire the SourceText for it as well. This will be a practically free as this just wraps + // the open text buffer. So it's ok to do this in the navigation step. + var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); - // Before attempting to open the document, check if the location maps to a different file that should be opened instead. - var spanMappingService = document.Services.GetService(); - if (spanMappingService != null) + // Map the given span to the right location in the buffer. If we're in a projection scenario, ensure + // the span reflects that. + var vsTextSpan = getVsTextSpan(text); + if (IsSecondaryBuffer(documentId)) { - var mappedSpan = await GetMappedSpanAsync( - spanMappingService, - document, - await getTextSpanForMappingAsync(document).ConfigureAwait(false), - cancellationToken).ConfigureAwait(false); - if (mappedSpan.HasValue) - { - // Check if the mapped file matches one already in the workspace. - // If so use the workspace APIs to navigate to it. Otherwise use VS APIs to navigate to the file path. - var documentIdsForFilePath = solution.GetDocumentIdsWithFilePath(mappedSpan.Value.FilePath); - if (!documentIdsForFilePath.IsEmpty) - { - // If the mapped file maps to the same document that was passed in, then re-use the documentId to preserve context. - // Otherwise, just pick one of the ids to use for navigation. - var documentIdToNavigate = documentIdsForFilePath.Contains(documentId) ? documentId : documentIdsForFilePath.First(); - return GetNavigationCallback(documentIdToNavigate, workspace, getVsTextSpan); - } - - return await GetNavigableLocationForMappedFileAsync( - workspace, document, mappedSpan.Value, cancellationToken).ConfigureAwait(false); - } + var mapped = await vsTextSpan.MapSpanFromSecondaryBufferToPrimaryBufferAsync( + _threadingContext, documentId, cancellationToken).ConfigureAwait(false); + if (mapped == null) + return false; + + vsTextSpan = mapped.Value; } - return GetNavigationCallback(documentId, workspace, getVsTextSpan); - } + return await NavigateToTextBufferAsync( + text.Container.GetTextBuffer(), vsTextSpan, cancellationToken).ConfigureAwait(false); + }; - private Func>? GetNavigationCallback( - DocumentId documentId, - Workspace workspace, - Func getVsTextSpan) + async static Task OpenDocumentAsync( + IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, CancellationToken cancellationToken) { - return async cancellationToken => - { - // Always open the document again, even if the document is already open in the - // workspace. If a document is already open in a preview tab and it is opened again - // in a permanent tab, this allows the document to transition to the new state. - - if (workspace.CanOpenDocuments) - await OpenDocumentAsync(_threadingContext, workspace, documentId, cancellationToken).ConfigureAwait(false); + // OpenDocument must be called on the UI thread. + await threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + workspace.OpenDocument(documentId); + } + } - if (!workspace.IsDocumentOpen(documentId)) - return false; + private async Task>?> GetNavigableLocationForMappedFileAsync( + Workspace workspace, Document generatedDocument, MappedSpanResult mappedSpanResult, CancellationToken cancellationToken) + { + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + var vsWorkspace = (VisualStudioWorkspaceImpl)workspace; + // TODO - Move to IOpenDocumentService - https://github.com/dotnet/roslyn/issues/45954 + // Pass the original result's project context so that if the mapped file has the same context available, we navigate + // to the mapped file with a consistent project context. + vsWorkspace.OpenDocumentFromPath(mappedSpanResult.FilePath, generatedDocument.Project.Id); + if (!_runningDocumentTable.TryGetBufferFromMoniker(_editorAdaptersFactoryService, mappedSpanResult.FilePath, out var textBuffer)) + return null; - // Now that we've opened the document reacquire the corresponding Document in the current solution. - var document = workspace.CurrentSolution.GetDocument(documentId); - if (document == null) - return false; + var vsTextSpan = new VsTextSpan + { + iStartIndex = mappedSpanResult.LinePositionSpan.Start.Character, + iStartLine = mappedSpanResult.LinePositionSpan.Start.Line, + iEndIndex = mappedSpanResult.LinePositionSpan.End.Character, + iEndLine = mappedSpanResult.LinePositionSpan.End.Line + }; - // Reacquire the SourceText for it as well. This will be a practically free as this just wraps - // the open text buffer. So it's ok to do this in the navigation step. - var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); + return cancellationToken => NavigateToTextBufferAsync(textBuffer, vsTextSpan, cancellationToken); + } - // Map the given span to the right location in the buffer. If we're in a projection scenario, ensure - // the span reflects that. - var vsTextSpan = getVsTextSpan(text); - if (IsSecondaryBuffer(documentId)) - { - var mapped = await vsTextSpan.MapSpanFromSecondaryBufferToPrimaryBufferAsync( - _threadingContext, documentId, cancellationToken).ConfigureAwait(false); - if (mapped == null) - return false; + private static async Task GetMappedSpanAsync( + ISpanMappingService spanMappingService, Document generatedDocument, TextSpan textSpan, CancellationToken cancellationToken) + { + var results = await spanMappingService.MapSpansAsync( + generatedDocument, SpecializedCollections.SingletonEnumerable(textSpan), cancellationToken).ConfigureAwait(false); - vsTextSpan = mapped.Value; - } + if (!results.IsDefaultOrEmpty) + { + return results.First(); + } - return await NavigateToTextBufferAsync( - text.Container.GetTextBuffer(), vsTextSpan, cancellationToken).ConfigureAwait(false); - }; + return null; + } - async static Task OpenDocumentAsync( - IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, CancellationToken cancellationToken) + /// + /// It is unclear why, but we are sometimes asked to navigate to a position that is not + /// inside the bounds of the associated . This method returns a + /// position that is guaranteed to be inside the bounds. If the + /// returned position is different from the given position, then the worst observable + /// behavior is either no navigation or navigation to the end of the document. See the + /// following bugs for more details: + /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=112211 + /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=136895 + /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=224318 + /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=235409 + /// + private static int GetPositionWithinDocumentBounds(int position, int documentLength) + => Math.Min(documentLength, Math.Max(position, 0)); + + private static VsTextSpan GetVsTextSpan(SourceText text, TextSpan textSpan, bool allowInvalidSpan) + { + var boundedTextSpan = GetSpanWithinDocumentBounds(textSpan, text.Length); + if (boundedTextSpan != textSpan && !allowInvalidSpan) + { + try { - // OpenDocument must be called on the UI thread. - await threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - workspace.OpenDocument(documentId); + throw new ArgumentOutOfRangeException(); } - } - - private async Task>?> GetNavigableLocationForMappedFileAsync( - Workspace workspace, Document generatedDocument, MappedSpanResult mappedSpanResult, CancellationToken cancellationToken) - { - await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - var vsWorkspace = (VisualStudioWorkspaceImpl)workspace; - // TODO - Move to IOpenDocumentService - https://github.com/dotnet/roslyn/issues/45954 - // Pass the original result's project context so that if the mapped file has the same context available, we navigate - // to the mapped file with a consistent project context. - vsWorkspace.OpenDocumentFromPath(mappedSpanResult.FilePath, generatedDocument.Project.Id); - if (!_runningDocumentTable.TryGetBufferFromMoniker(_editorAdaptersFactoryService, mappedSpanResult.FilePath, out var textBuffer)) - return null; - - var vsTextSpan = new VsTextSpan + catch (ArgumentOutOfRangeException e) when (FatalError.ReportAndCatch(e)) { - iStartIndex = mappedSpanResult.LinePositionSpan.Start.Character, - iStartLine = mappedSpanResult.LinePositionSpan.Start.Line, - iEndIndex = mappedSpanResult.LinePositionSpan.End.Character, - iEndLine = mappedSpanResult.LinePositionSpan.End.Line - }; - - return cancellationToken => NavigateToTextBufferAsync(textBuffer, vsTextSpan, cancellationToken); + } } - private static async Task GetMappedSpanAsync( - ISpanMappingService spanMappingService, Document generatedDocument, TextSpan textSpan, CancellationToken cancellationToken) - { - var results = await spanMappingService.MapSpansAsync( - generatedDocument, SpecializedCollections.SingletonEnumerable(textSpan), cancellationToken).ConfigureAwait(false); + return text.GetVsTextSpanForSpan(boundedTextSpan); + } - if (!results.IsDefaultOrEmpty) + /// + /// It is unclear why, but we are sometimes asked to navigate to a + /// that is not inside the bounds of the associated . This method + /// returns a span that is guaranteed to be inside the bounds. If + /// the returned span is different from the given span, then the worst observable behavior + /// is either no navigation or navigation to the end of the document. + /// See https://github.com/dotnet/roslyn/issues/7660 for more details. + /// + private static TextSpan GetSpanWithinDocumentBounds(TextSpan span, int documentLength) + => TextSpan.FromBounds(GetPositionWithinDocumentBounds(span.Start, documentLength), GetPositionWithinDocumentBounds(span.End, documentLength)); + + public async Task NavigateToTextBufferAsync( + ITextBuffer textBuffer, VsTextSpan vsTextSpan, CancellationToken cancellationToken) + { + Contract.ThrowIfNull(textBuffer); + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + using (Logger.LogBlock(FunctionId.NavigationService_VSDocumentNavigationService_NavigateTo, cancellationToken)) + { + var vsTextBuffer = _editorAdaptersFactoryService.GetBufferAdapter(textBuffer); + if (vsTextBuffer == null) { - return results.First(); + Debug.Fail("Could not get IVsTextBuffer for document!"); + return false; } - return null; - } - - /// - /// It is unclear why, but we are sometimes asked to navigate to a position that is not - /// inside the bounds of the associated . This method returns a - /// position that is guaranteed to be inside the bounds. If the - /// returned position is different from the given position, then the worst observable - /// behavior is either no navigation or navigation to the end of the document. See the - /// following bugs for more details: - /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=112211 - /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=136895 - /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=224318 - /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=235409 - /// - private static int GetPositionWithinDocumentBounds(int position, int documentLength) - => Math.Min(documentLength, Math.Max(position, 0)); - - private static VsTextSpan GetVsTextSpan(SourceText text, TextSpan textSpan, bool allowInvalidSpan) - { - var boundedTextSpan = GetSpanWithinDocumentBounds(textSpan, text.Length); - if (boundedTextSpan != textSpan && !allowInvalidSpan) + var textManager = (IVsTextManager2)_serviceProvider.GetService(typeof(SVsTextManager)); + if (textManager == null) { - try - { - throw new ArgumentOutOfRangeException(); - } - catch (ArgumentOutOfRangeException e) when (FatalError.ReportAndCatch(e)) - { - } + Debug.Fail("Could not get IVsTextManager service!"); + return false; } - return text.GetVsTextSpanForSpan(boundedTextSpan); + return ErrorHandler.Succeeded( + textManager.NavigateToLineAndColumn2( + vsTextBuffer, + VSConstants.LOGVIEWID.TextView_guid, + vsTextSpan.iStartLine, + vsTextSpan.iStartIndex, + vsTextSpan.iEndLine, + vsTextSpan.iEndIndex, + (uint)_VIEWFRAMETYPE.vftCodeWindow)); } + } - /// - /// It is unclear why, but we are sometimes asked to navigate to a - /// that is not inside the bounds of the associated . This method - /// returns a span that is guaranteed to be inside the bounds. If - /// the returned span is different from the given span, then the worst observable behavior - /// is either no navigation or navigation to the end of the document. - /// See https://github.com/dotnet/roslyn/issues/7660 for more details. - /// - private static TextSpan GetSpanWithinDocumentBounds(TextSpan span, int documentLength) - => TextSpan.FromBounds(GetPositionWithinDocumentBounds(span.Start, documentLength), GetPositionWithinDocumentBounds(span.End, documentLength)); - - public async Task NavigateToTextBufferAsync( - ITextBuffer textBuffer, VsTextSpan vsTextSpan, CancellationToken cancellationToken) - { - Contract.ThrowIfNull(textBuffer); - await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - using (Logger.LogBlock(FunctionId.NavigationService_VSDocumentNavigationService_NavigateTo, cancellationToken)) - { - var vsTextBuffer = _editorAdaptersFactoryService.GetBufferAdapter(textBuffer); - if (vsTextBuffer == null) - { - Debug.Fail("Could not get IVsTextBuffer for document!"); - return false; - } - - var textManager = (IVsTextManager2)_serviceProvider.GetService(typeof(SVsTextManager)); - if (textManager == null) - { - Debug.Fail("Could not get IVsTextManager service!"); - return false; - } + private static bool IsSecondaryBuffer(DocumentId documentId) + => ContainedDocument.TryGetContainedDocument(documentId) != null; - return ErrorHandler.Succeeded( - textManager.NavigateToLineAndColumn2( - vsTextBuffer, - VSConstants.LOGVIEWID.TextView_guid, - vsTextSpan.iStartLine, - vsTextSpan.iStartIndex, - vsTextSpan.iEndLine, - vsTextSpan.iEndIndex, - (uint)_VIEWFRAMETYPE.vftCodeWindow)); - } - } + private async Task CanMapFromSecondaryBufferToPrimaryBufferAsync( + DocumentId documentId, VsTextSpan spanInSecondaryBuffer, CancellationToken cancellationToken) + { + var mapped = await spanInSecondaryBuffer.MapSpanFromSecondaryBufferToPrimaryBufferAsync( + _threadingContext, documentId, cancellationToken).ConfigureAwait(false); + return mapped != null; + } - private static bool IsSecondaryBuffer(DocumentId documentId) - => ContainedDocument.TryGetContainedDocument(documentId) != null; + private static IDisposable OpenNewDocumentStateScope(NavigationOptions options) + { + var state = options.PreferProvisionalTab + ? __VSNEWDOCUMENTSTATE.NDS_Provisional + : __VSNEWDOCUMENTSTATE.NDS_Permanent; - private async Task CanMapFromSecondaryBufferToPrimaryBufferAsync( - DocumentId documentId, VsTextSpan spanInSecondaryBuffer, CancellationToken cancellationToken) + if (!options.ActivateTab) { - var mapped = await spanInSecondaryBuffer.MapSpanFromSecondaryBufferToPrimaryBufferAsync( - _threadingContext, documentId, cancellationToken).ConfigureAwait(false); - return mapped != null; + state |= __VSNEWDOCUMENTSTATE.NDS_NoActivate; } - private static IDisposable OpenNewDocumentStateScope(NavigationOptions options) - { - var state = options.PreferProvisionalTab - ? __VSNEWDOCUMENTSTATE.NDS_Provisional - : __VSNEWDOCUMENTSTATE.NDS_Permanent; - - if (!options.ActivateTab) - { - state |= __VSNEWDOCUMENTSTATE.NDS_NoActivate; - } - - return new NewDocumentStateScope(state, VSConstants.NewDocumentStateReason.Navigation); - } + return new NewDocumentStateScope(state, VSConstants.NewDocumentStateReason.Navigation); } } From 8fcc871a21a24d025793bbdd41927b492bd28b50 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 12:05:16 -0800 Subject: [PATCH 065/141] Cleanup --- .../Portable/Syntax/CompilationUnitSyntax.cs | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs b/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs index d976271890f3d..e3bc236f58330 100644 --- a/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs +++ b/src/Compilers/CSharp/Portable/Syntax/CompilationUnitSyntax.cs @@ -69,41 +69,5 @@ private bool HasFirstTokenDirective(Func predicate) return false; } - - //internal Syntax.InternalSyntax.DirectiveStack GetConditionalDirectivesStack() - //{ - // IEnumerable directives = this.GetDirectives(filter: IsActiveConditionalDirective); - // var directiveStack = Syntax.InternalSyntax.DirectiveStack.Empty; - // foreach (DirectiveTriviaSyntax directive in directives) - // { - // var internalDirective = (Syntax.InternalSyntax.DirectiveTriviaSyntax)directive.Green; - // directiveStack = internalDirective.ApplyDirectives(directiveStack); - // } - // return directiveStack; - //} - - //internal bool HasLoadDirectives - // // #r and #load directives are always on the first token of the compilation unit. - // => HasFirstTokenDirective(static n => n is LoadDirectiveTriviaSyntax); - - //private bool HasFirstTokenDirective(Func predicate) - //{ - // if (this.ContainsDirectives) - // { - // var firstToken = this.GetFirstToken(includeZeroWidth: true); - // if (firstToken.ContainsDirectives) - // { - // foreach (var trivia in firstToken.LeadingTrivia) - // { - // if (trivia.GetStructure() is { } structure && - // predicate(structure)) - // { - // return true; - // } - // } - // } - // } - - // return false; } } From 0926729443a2570852d7c5ea04e63ea42ebed188 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 12:08:32 -0800 Subject: [PATCH 066/141] Simplify check --- src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs b/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs index 04c5e797a4131..f008468b4ecfa 100644 --- a/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs +++ b/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs @@ -849,9 +849,10 @@ internal IList GetDirectives(Func? fil private static void GetDirectives(in SyntaxNodeOrToken node, Func? filter, ref List? directives) where TDirective : SyntaxNode { - if (node._token != null && node.AsToken() is var token && token.ContainsDirectives) + if (node._token != null) { - GetDirectives(token.LeadingTrivia, filter, ref directives); + if (node._token.ContainsDirectives) + GetDirectives(node.AsToken().LeadingTrivia, filter, ref directives); } else if (node._nodeOrParent != null) { From 1e1059874d8904489329604c7d20b1d7385026bb Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 12:11:33 -0800 Subject: [PATCH 067/141] inline --- .../Core/Portable/Syntax/SyntaxNodeOrToken.cs | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs b/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs index f008468b4ecfa..cc576953dab5b 100644 --- a/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs +++ b/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs @@ -852,7 +852,10 @@ private static void GetDirectives(in SyntaxNodeOrToken node, Func(SyntaxNode node, Func node.ContainsDirectives, descendIntoTrivia: true)) { - _ = GetDirectivesInTrivia(trivia, filter, ref directives); + GetDirectivesInTrivia(trivia, filter, ref directives); } } - private static bool GetDirectivesInTrivia(in SyntaxTrivia trivia, Func? filter, ref List? directives) + private static void GetDirectivesInTrivia(in SyntaxTrivia trivia, Func? filter, ref List? directives) where TDirective : SyntaxNode { if (trivia.IsDirective) @@ -877,28 +880,9 @@ private static bool GetDirectivesInTrivia(in SyntaxTrivia trivia, Fu if (trivia.GetStructure() is TDirective directive && filter?.Invoke(directive) != false) { - if (directives == null) - { - directives = new List(); - } - + directives ??= []; directives.Add(directive); } - - return true; - } - return false; - } - - private static void GetDirectives(in SyntaxTriviaList trivia, Func? filter, ref List? directives) - where TDirective : SyntaxNode - { - foreach (var tr in trivia) - { - if (!GetDirectivesInTrivia(tr, filter, ref directives) && tr.GetStructure() is SyntaxNode node) - { - GetDirectives(node, filter, ref directives); - } } } From f1e7f0e4b6f95a26db254aab835e802a7b54e942 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 12:14:28 -0800 Subject: [PATCH 068/141] simplify --- .../Core/Portable/Syntax/SyntaxNodeOrToken.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs b/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs index cc576953dab5b..f629a92eea77d 100644 --- a/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs +++ b/src/Compilers/Core/Portable/Syntax/SyntaxNodeOrToken.cs @@ -841,26 +841,28 @@ public static implicit operator SyntaxNodeOrToken(SyntaxNode? node) internal IList GetDirectives(Func? filter = null) where TDirective : SyntaxNode { - List? directives = null; - GetDirectives(this, filter, ref directives); - return directives ?? SpecializedCollections.EmptyList(); + GetDirectives(this, filter, out var directives); + return directives; } - private static void GetDirectives(in SyntaxNodeOrToken node, Func? filter, ref List? directives) + private static void GetDirectives(in SyntaxNodeOrToken node, Func? filter, out IList directives) where TDirective : SyntaxNode { + List? buffer = null; if (node._token != null) { if (node._token.ContainsDirectives) { foreach (var trivia in node.AsToken().LeadingTrivia) - GetDirectivesInTrivia(trivia, filter, ref directives); + GetDirectivesInTrivia(trivia, filter, ref buffer); } } else if (node._nodeOrParent != null) { - GetDirectives(node._nodeOrParent, filter, ref directives); + GetDirectives(node._nodeOrParent, filter, ref buffer); } + + directives = buffer ?? SpecializedCollections.EmptyList(); } private static void GetDirectives(SyntaxNode node, Func? filter, ref List? directives) From 9a3916e9dab9ee07c8f44236fb40d3a70f3baf52 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 12:42:01 -0800 Subject: [PATCH 069/141] Remove dead code from unit testing codepaths --- ...estingIncrementalAnalyzerImplementation.cs | 19 -- .../API/NewUnitTestingIncrementalAnalyzer.cs | 66 ----- ...wUnitTestingIncrementalAnalyzerProvider.cs | 3 - .../UnitTestingInvocationReasons_Constants.cs | 63 ----- .../UnitTestingPredefinedInvocationReasons.cs | 11 - ...UnitTestingLegacySolutionEventsListener.cs | 16 -- ...actUnitTestingDocumentDifferenceService.cs | 123 --------- ...faultUnitTestingDocumentTrackingService.cs | 4 - ...ingIncrementalAnalyzerProviderAttribute.cs | 14 - .../IUnitTestingDocumentTrackingService.cs | 4 - .../IUnitTestingIncrementalAnalyzer.cs | 40 --- ...IUnitTestingIncrementalAnalyzerProvider.cs | 6 +- ...stingSolutionCrawlerRegistrationService.cs | 4 - .../IUnitTestingWorkCoordinator.cs | 4 - ...tingIncrementalAnalyzerProviderMetadata.cs | 18 -- .../UnitTestingSolutionCrawlerLogger.cs | 16 +- ...stingSolutionCrawlerRegistrationService.cs | 68 +---- ...or.AbstractUnitTestingPriorityProcessor.cs | 7 - ...r.UnitTestingAsyncDocumentWorkItemQueue.cs | 25 +- ...or.UnitTestingAsyncProjectWorkItemQueue.cs | 11 +- ...ordinator.UnitTestingAsyncWorkItemQueue.cs | 42 +-- ...inator.UnitTestingHighPriorityProcessor.cs | 242 ------------------ ...UnitTestingIncrementalAnalyzerProcessor.cs | 198 +------------- ...dinator.UnitTestingLowPriorityProcessor.cs | 38 +-- ...ator.UnitTestingNormalPriorityProcessor.cs | 147 +---------- ...tingWorkCoordinator.UnitTestingWorkItem.cs | 14 - .../UnitTestingWorkCoordinator.cs | 152 +---------- ...ILegacySolutionEventsAggregationService.cs | 18 -- .../ILegacySolutionEventsListener.cs | 5 - 29 files changed, 22 insertions(+), 1356 deletions(-) delete mode 100644 src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/INewUnitTestingIncrementalAnalyzerImplementation.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/INewUnitTestingIncrementalAnalyzerImplementation.cs index 49aab6152f97a..4c5585aa377fc 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/INewUnitTestingIncrementalAnalyzerImplementation.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/INewUnitTestingIncrementalAnalyzerImplementation.cs @@ -10,32 +10,13 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api { internal interface INewUnitTestingIncrementalAnalyzerImplementation { -#if false // Not used in unit testing crawling - // Task NewSolutionSnapshotAsync(Solution solution, CancellationToken cancellationToken); - // Task DocumentOpenAsync(Document document, CancellationToken cancellationToken); - // Task DocumentCloseAsync(Document document, CancellationToken cancellationToken); - // Task DocumentResetAsync(Document document, CancellationToken cancellationToken); - // void RemoveProject(ProjectId projectId); - - // [Obsolete] - // bool NeedsReanalysisOnOptionChanged(object sender, UnitTestingOptionChangedEventArgsWrapper e); - - Task AnalyzeSyntaxAsync(Document document, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); -#endif - Task AnalyzeDocumentAsync( Document document, -#if false // Not used in unit testing crawling - SyntaxNode bodyOpt, -#endif UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); Task AnalyzeProjectAsync( Project project, -#if false // Not used in unit testing crawling - bool semanticsChanged, -#endif UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs index 7a86185343dc9..706894366e811 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzer.cs @@ -18,96 +18,30 @@ private sealed class NewUnitTestingIncrementalAnalyzer(INewUnitTestingIncrementa public Task AnalyzeDocumentAsync( Document document, -#if false // Not used in unit testing crawling - SyntaxNode bodyOpt, -#endif UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) { return _implementation.AnalyzeDocumentAsync( document, -#if false // Not used in unit testing crawling - bodyOpt, -#endif reasons, cancellationToken); } public Task AnalyzeProjectAsync( Project project, -#if false // Not used in unit testing crawling - bool semanticsChanged, -#endif UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) { return _implementation.AnalyzeProjectAsync( project, -#if false // Not used in unit testing crawling - semanticsChanged, -#endif reasons, cancellationToken); } -#if false // Not used in unit testing crawling - public Task AnalyzeSyntaxAsync(Document document, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) - => Task.CompletedTask; - - public Task DocumentCloseAsync(Document document, CancellationToken cancellationToken) - => Task.CompletedTask; - - public Task DocumentOpenAsync(Document document, CancellationToken cancellationToken) - => Task.CompletedTask; - - public Task DocumentResetAsync(Document document, CancellationToken cancellationToken) - => Task.CompletedTask; - - public Task ActiveDocumentSwitchedAsync(TextDocument document, CancellationToken cancellationToken) - => Task.CompletedTask; - - public Task NewSolutionSnapshotAsync(Solution solution, CancellationToken cancellationToken) - => Task.CompletedTask; -#endif - public Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken) { _implementation.RemoveDocument(documentId); return Task.CompletedTask; } - -#if false // Not used in unit testing crawling - public Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellationToken) - => Task.CompletedTask; - - public Task NonSourceDocumentOpenAsync(TextDocument textDocument, CancellationToken cancellationToken) - => Task.CompletedTask; - - public Task NonSourceDocumentCloseAsync(TextDocument textDocument, CancellationToken cancellationToken) - => Task.CompletedTask; - - public Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationToken cancellationToken) - => Task.CompletedTask; - - public Task AnalyzeNonSourceDocumentAsync(TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) - => Task.CompletedTask; - - public void LogAnalyzerCountSummary() - { - } - - /// - /// Order all incremental analyzers below DiagnosticIncrementalAnalyzer - /// - public int Priority => 1; - - // Unit testing incremental analyzer only supports full solution analysis scope. - // In future, we should add a separate option to allow users to configure background analysis scope for unit testing. - public static BackgroundAnalysisScope GetBackgroundAnalysisScope(OptionSet _) => BackgroundAnalysisScope.FullSolution; - - public void Shutdown() - { - } -#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs index da51d3ecdebfc..0684e55d240bb 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs @@ -53,9 +53,6 @@ public void Reanalyze() var metadata = new UnitTestingIncrementalAnalyzerProviderMetadata( analyzerName, -#if false // Not used in unit testing crawling - highPriorityForActiveFile: false, -#endif new[] { workspaceKind }); solutionCrawlerRegistrationService.AddAnalyzerProvider(analyzerProvider, metadata); diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingInvocationReasons_Constants.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingInvocationReasons_Constants.cs index 6718ce34671db..f6e9b9f4000f8 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingInvocationReasons_Constants.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingInvocationReasons_Constants.cs @@ -13,85 +13,30 @@ internal readonly partial struct UnitTestingInvocationReasons public static readonly UnitTestingInvocationReasons DocumentAdded = new( ImmutableHashSet.Create( -#if false // Not used in unit testing crawling - UnitTestingPredefinedInvocationReasons.DocumentAdded, - UnitTestingPredefinedInvocationReasons.SyntaxChanged, -#endif UnitTestingPredefinedInvocationReasons.SemanticChanged)); public static readonly UnitTestingInvocationReasons DocumentRemoved = new( ImmutableHashSet.Create( -#if false // Not used in unit testing crawling - UnitTestingPredefinedInvocationReasons.DocumentRemoved, - UnitTestingPredefinedInvocationReasons.SyntaxChanged, -#endif UnitTestingPredefinedInvocationReasons.SemanticChanged, UnitTestingPredefinedInvocationReasons.HighPriority)); -#if false // Not used in unit testing crawling - public static readonly UnitTestingInvocationReasons ProjectParseOptionChanged = - new( - ImmutableHashSet.Create( - UnitTestingPredefinedInvocationReasons.ProjectParseOptionsChanged, - UnitTestingPredefinedInvocationReasons.SyntaxChanged, - UnitTestingPredefinedInvocationReasons.SemanticChanged)); -#endif - public static readonly UnitTestingInvocationReasons ProjectConfigurationChanged = new( ImmutableHashSet.Create( UnitTestingPredefinedInvocationReasons.ProjectConfigurationChanged, -#if false // Not used in unit testing crawling - UnitTestingPredefinedInvocationReasons.SyntaxChanged, -#endif UnitTestingPredefinedInvocationReasons.SemanticChanged)); -#if false - public static readonly UnitTestingInvocationReasons SolutionRemoved = - new( - ImmutableHashSet.Create( - UnitTestingPredefinedInvocationReasons.SolutionRemoved, - UnitTestingPredefinedInvocationReasons.DocumentRemoved)); -#endif - -#if false // Not used in unit testing crawling - public static readonly UnitTestingInvocationReasons DocumentOpened = - new( - ImmutableHashSet.Create( - UnitTestingPredefinedInvocationReasons.DocumentOpened, - UnitTestingPredefinedInvocationReasons.HighPriority)); - - public static readonly UnitTestingInvocationReasons DocumentClosed = - new( - ImmutableHashSet.Create( - UnitTestingPredefinedInvocationReasons.DocumentClosed, - UnitTestingPredefinedInvocationReasons.HighPriority)); -#endif - public static readonly UnitTestingInvocationReasons DocumentChanged = new( ImmutableHashSet.Create( -#if false // Not used in unit testing crawling - UnitTestingPredefinedInvocationReasons.SyntaxChanged, -#endif UnitTestingPredefinedInvocationReasons.SemanticChanged)); public static readonly UnitTestingInvocationReasons AdditionalDocumentChanged = new( ImmutableHashSet.Create( -#if false // Not used in unit testing crawling - UnitTestingPredefinedInvocationReasons.SyntaxChanged, -#endif UnitTestingPredefinedInvocationReasons.SemanticChanged)); -#if false // Not used in unit testing crawling - public static readonly UnitTestingInvocationReasons SyntaxChanged = - new( - ImmutableHashSet.Create( - UnitTestingPredefinedInvocationReasons.SyntaxChanged)); -#endif - public static readonly UnitTestingInvocationReasons SemanticChanged = new( ImmutableHashSet.Create( @@ -99,13 +44,5 @@ internal readonly partial struct UnitTestingInvocationReasons public static readonly UnitTestingInvocationReasons Reanalyze = new(UnitTestingPredefinedInvocationReasons.Reanalyze); - -#if false // Not used in unit testing crawling - public static readonly UnitTestingInvocationReasons ReanalyzeHighPriority = - Reanalyze.With(UnitTestingPredefinedInvocationReasons.HighPriority); - - public static readonly UnitTestingInvocationReasons ActiveDocumentSwitched = - new(UnitTestingPredefinedInvocationReasons.ActiveDocumentSwitched); -#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingPredefinedInvocationReasons.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingPredefinedInvocationReasons.cs index 113863a424eaa..5586f438a999f 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingPredefinedInvocationReasons.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingPredefinedInvocationReasons.cs @@ -11,16 +11,5 @@ internal static class UnitTestingPredefinedInvocationReasons public const string ProjectConfigurationChanged = nameof(ProjectConfigurationChanged); public const string HighPriority = nameof(HighPriority); - -#if false // Not used in unit testing crawling - public const string DocumentAdded = nameof(DocumentAdded); - public const string DocumentRemoved = nameof(DocumentRemoved); - public const string DocumentOpened = nameof(DocumentOpened); - public const string DocumentClosed = nameof(DocumentClosed); - public const string ActiveDocumentSwitched = nameof(ActiveDocumentSwitched); - public const string ProjectParseOptionsChanged = nameof(ProjectParseOptionsChanged); - public const string SolutionRemoved = nameof(SolutionRemoved); - public const string SyntaxChanged = nameof(SyntaxChanged); -#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/LegacySolutionEvents/UnitTestingLegacySolutionEventsListener.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/LegacySolutionEvents/UnitTestingLegacySolutionEventsListener.cs index 5cdaa0a1f0657..a12e93d9ab5ab 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/LegacySolutionEvents/UnitTestingLegacySolutionEventsListener.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/LegacySolutionEvents/UnitTestingLegacySolutionEventsListener.cs @@ -51,21 +51,5 @@ public ValueTask OnWorkspaceChangedAsync(WorkspaceChangeEventArgs args, Cancella coordinator?.OnWorkspaceChanged(args); return ValueTaskFactory.CompletedTask; } - -#if false // Not used in unit testing crawling - public ValueTask OnTextDocumentOpenedAsync(TextDocumentEventArgs args, CancellationToken cancellationToken) - { - var coordinator = GetCoordinator(args.Document.Project.Solution); - coordinator?.OnTextDocumentOpened(args); - return ValueTaskFactory.CompletedTask; - } - - public ValueTask OnTextDocumentClosedAsync(TextDocumentEventArgs args, CancellationToken cancellationToken) - { - var coordinator = GetCoordinator(args.Document.Project.Solution); - coordinator?.OnTextDocumentClosed(args); - return ValueTaskFactory.CompletedTask; - } -#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/AbstractUnitTestingDocumentDifferenceService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/AbstractUnitTestingDocumentDifferenceService.cs index b33f3f4cc0041..87d7a2c5b152d 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/AbstractUnitTestingDocumentDifferenceService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/AbstractUnitTestingDocumentDifferenceService.cs @@ -49,50 +49,6 @@ internal abstract class AbstractUnitTestingDocumentDifferenceService : IUnitTest return null; } -#if false // Not used in unit testing crawling - var incrementalParsingCandidate = range.NewLength != newText.Length; - // see whether we can get it without explicit parsing - if (!oldDocument.TryGetSyntaxRoot(out var oldRoot) || - !newDocument.TryGetSyntaxRoot(out var newRoot)) - { - if (!incrementalParsingCandidate) - { - // no cheap way to determine top level changes. assumes top level has changed - return new UnitTestingDocumentDifferenceResult(UnitTestingInvocationReasons.DocumentChanged); - } - - // explicitly parse them - oldRoot = await oldDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); - newRoot = await newDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); - - Contract.ThrowIfNull(oldRoot); - Contract.ThrowIfNull(newRoot); - } - - // at this point, we must have these version already calculated - if (!oldDocument.TryGetTopLevelChangeTextVersion(out var oldTopLevelChangeVersion) || - !newDocument.TryGetTopLevelChangeTextVersion(out var newTopLevelChangeVersion)) - { - throw ExceptionUtilities.Unreachable; - } - - // quicker common case - if (incrementalParsingCandidate) - { - if (oldTopLevelChangeVersion.Equals(newTopLevelChangeVersion)) - { - return new UnitTestingDocumentDifferenceResult(UnitTestingInvocationReasons.SyntaxChanged, GetChangedMember(syntaxFactsService, oldRoot, newRoot, range)); - } - - return new UnitTestingDocumentDifferenceResult(UnitTestingInvocationReasons.DocumentChanged, GetBestGuessChangedMember(syntaxFactsService, oldRoot, newRoot, range)); - } - - if (oldTopLevelChangeVersion.Equals(newTopLevelChangeVersion)) - { - return new UnitTestingDocumentDifferenceResult(UnitTestingInvocationReasons.SyntaxChanged); - } -#endif - return new UnitTestingDocumentDifferenceResult(UnitTestingInvocationReasons.DocumentChanged); } catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken)) @@ -100,84 +56,5 @@ internal abstract class AbstractUnitTestingDocumentDifferenceService : IUnitTest throw ExceptionUtilities.Unreachable(); } } - -#if false // Not used in unit testing crawling - private static SyntaxNode? GetChangedMember( - ISyntaxFactsService syntaxFactsService, SyntaxNode oldRoot, SyntaxNode newRoot, TextChangeRange range) - { - // if either old or new tree contains skipped text, re-analyze whole document - if (oldRoot.ContainsSkippedText || newRoot.ContainsSkippedText) - { - return null; - } - - var oldMember = syntaxFactsService.GetContainingMemberDeclaration(oldRoot, range.Span.Start); - var newMember = syntaxFactsService.GetContainingMemberDeclaration(newRoot, range.Span.Start); - - // reached the top (compilation unit) - if (oldMember == null || newMember == null) - { - return null; - } - - // member doesn't contain the change - if (!syntaxFactsService.ContainsInMemberBody(oldMember, range.Span)) - { - return null; - } - - // member signature has changed - if (!oldMember.IsEquivalentTo(newMember, topLevel: true)) - { - return null; - } - - // looks like inside of the body has changed - return newMember; - } - - private static SyntaxNode? GetBestGuessChangedMember( - ISyntaxFactsService syntaxFactsService, SyntaxNode oldRoot, SyntaxNode newRoot, TextChangeRange range) - { - // if either old or new tree contains skipped text, re-analyze whole document - if (oldRoot.ContainsSkippedText || newRoot.ContainsSkippedText) - { - return null; - } - - // there was top level changes, so we can't use equivalent to see whether two members are same. - // so, we use some simple text based heuristic to find a member that has changed. - // - // if we have a differ that do diff on member level or a way to track member between incremental parsing, then - // that would be preferable. but currently we don't have such thing. - - // get top level elements at the position where change has happened - var oldMember = syntaxFactsService.GetContainingMemberDeclaration(oldRoot, range.Span.Start); - var newMember = syntaxFactsService.GetContainingMemberDeclaration(newRoot, range.Span.Start); - - // reached the top (compilation unit) - if (oldMember == null || newMember == null) - { - return null; - } - - // if old member was empty, just use new member - if (oldMember.Span.IsEmpty) - { - return newMember; - } - - // looks like change doesn't belong to existing member - if (!oldMember.Span.Contains(range.Span)) - { - return null; - } - - // change happened inside of the old member, check whether new member seems just delta of that change - var lengthDelta = range.NewLength - range.Span.Length; - - return (oldMember.Span.Length + lengthDelta) == newMember.Span.Length ? newMember : null; - } -#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/DefaultUnitTestingDocumentTrackingService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/DefaultUnitTestingDocumentTrackingService.cs index e7b7f738b493c..7831dd3c385fd 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/DefaultUnitTestingDocumentTrackingService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/DefaultUnitTestingDocumentTrackingService.cs @@ -21,10 +21,6 @@ public DefaultUnitTestingDocumentTrackingService() public bool SupportsDocumentTracking => false; -#if false // Not used in unit testing crawling - public event EventHandler ActiveDocumentChanged { add { } remove { } } -#endif - public event EventHandler NonRoslynBufferTextChanged { add { } remove { } } public ImmutableArray GetVisibleDocuments() diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs index 4c2e88a2fa20c..df3e07472ff69 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/ExportUnitTestingIncrementalAnalyzerProviderAttribute.cs @@ -13,9 +13,6 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler [AttributeUsage(AttributeTargets.Class)] internal class ExportUnitTestingIncrementalAnalyzerProviderAttribute : ExportAttribute { -#if false // Not used in unit testing crawling - public bool HighPriorityForActiveFile { get; } -#endif public string Name { get; } public string[] WorkspaceKinds { get; } @@ -24,17 +21,6 @@ public ExportUnitTestingIncrementalAnalyzerProviderAttribute(string name, string { this.WorkspaceKinds = workspaceKinds; this.Name = name ?? throw new ArgumentNullException(nameof(name)); -#if false // Not used in unit testing crawling - this.HighPriorityForActiveFile = false; -#endif } - -#if false // Not used in unit testing crawling - public ExportUnitTestingIncrementalAnalyzerProviderAttribute(bool highPriorityForActiveFile, string name, string[] workspaceKinds) - : this(name, workspaceKinds) - { - this.HighPriorityForActiveFile = highPriorityForActiveFile; - } -#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingDocumentTrackingService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingDocumentTrackingService.cs index c26e672d992d7..84280407ece2c 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingDocumentTrackingService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingDocumentTrackingService.cs @@ -23,10 +23,6 @@ internal interface IUnitTestingDocumentTrackingService : IWorkspaceService /// ImmutableArray GetVisibleDocuments(); -#if false // Not used in unit testing crawling - event EventHandler ActiveDocumentChanged; -#endif - /// /// Raised when a text buffer that's not part of a workspace is changed. /// diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs index 54c645ab7c0da..f3d424ccce1be 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzer.cs @@ -12,56 +12,16 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler { internal interface IUnitTestingIncrementalAnalyzer { -#if false // Not used in unit testing crawling - Task NewSolutionSnapshotAsync(Solution solution, CancellationToken cancellationToken); - - Task DocumentOpenAsync(Document document, CancellationToken cancellationToken); - Task DocumentCloseAsync(Document document, CancellationToken cancellationToken); - - Task ActiveDocumentSwitchedAsync(TextDocument document, CancellationToken cancellationToken); - - /// - /// Resets all the document state cached by the analyzer. - /// - Task DocumentResetAsync(Document document, CancellationToken cancellationToken); - - Task AnalyzeSyntaxAsync(Document document, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); -#endif - Task AnalyzeDocumentAsync( Document document, -#if false // Not used in unit testing crawling - SyntaxNode bodyOpt, -#endif UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); Task AnalyzeProjectAsync( Project project, -#if false // Not used in unit testing crawling - bool semanticsChanged, -#endif UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken); - -#if false // Not used in unit testing crawling - Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellationToken); - - Task NonSourceDocumentOpenAsync(TextDocument textDocument, CancellationToken cancellationToken); - Task NonSourceDocumentCloseAsync(TextDocument textDocument, CancellationToken cancellationToken); - - /// - /// Resets all the document state cached by the analyzer. - /// - Task NonSourceDocumentResetAsync(TextDocument textDocument, CancellationToken cancellationToken); - - Task AnalyzeNonSourceDocumentAsync(TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken); - - void LogAnalyzerCountSummary(); - int Priority { get; } - void Shutdown(); -#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzerProvider.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzerProvider.cs index 5cddd91b6b4aa..fc0f28316513d 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzerProvider.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingIncrementalAnalyzerProvider.cs @@ -6,10 +6,6 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler { internal interface IUnitTestingIncrementalAnalyzerProvider { - IUnitTestingIncrementalAnalyzer? CreateIncrementalAnalyzer( -#if false // Not used in unit testing crawling - Workspace workspace -#endif - ); + IUnitTestingIncrementalAnalyzer? CreateIncrementalAnalyzer(); } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingSolutionCrawlerRegistrationService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingSolutionCrawlerRegistrationService.cs index 4e70c57fea007..22096d7b851c3 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingSolutionCrawlerRegistrationService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingSolutionCrawlerRegistrationService.cs @@ -13,10 +13,6 @@ internal interface IUnitTestingSolutionCrawlerRegistrationService : IWorkspaceSe { IUnitTestingWorkCoordinator Register(Solution solution); -#if false // Not used in unit testing crawling - void Unregister(Workspace workspace, bool blockingShutdown = false); -#endif - void AddAnalyzerProvider(IUnitTestingIncrementalAnalyzerProvider provider, UnitTestingIncrementalAnalyzerProviderMetadata metadata); bool HasRegisteredAnalyzerProviders { get; } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingWorkCoordinator.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingWorkCoordinator.cs index 0cf05fb8afec4..f3086d4e62d5d 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingWorkCoordinator.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingWorkCoordinator.cs @@ -7,9 +7,5 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler internal interface IUnitTestingWorkCoordinator { void OnWorkspaceChanged(WorkspaceChangeEventArgs args); -#if false // Not used in unit testing crawling - void OnTextDocumentOpened(TextDocumentEventArgs args); - void OnTextDocumentClosed(TextDocumentEventArgs args); -#endif } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerProviderMetadata.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerProviderMetadata.cs index 24bdb9e560d8c..b2691d9c0bc8c 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerProviderMetadata.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingIncrementalAnalyzerProviderMetadata.cs @@ -12,31 +12,19 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler { internal class UnitTestingIncrementalAnalyzerProviderMetadata : WorkspaceKindMetadata { -#if false // Not used in unit testing crawling - public bool HighPriorityForActiveFile { get; } -#endif public string Name { get; } public UnitTestingIncrementalAnalyzerProviderMetadata(IDictionary data) : base(data) { -#if false // Not used in unit testing crawling - this.HighPriorityForActiveFile = (bool)data.GetValueOrDefault("HighPriorityForActiveFile"); -#endif this.Name = (string)data.GetValueOrDefault("Name"); } public UnitTestingIncrementalAnalyzerProviderMetadata( string name, -#if false // Not used in unit testing crawling - bool highPriorityForActiveFile, -#endif params string[] workspaceKinds) : base(workspaceKinds) { -#if false // Not used in unit testing crawling - this.HighPriorityForActiveFile = highPriorityForActiveFile; -#endif this.Name = name; } @@ -44,9 +32,6 @@ public override bool Equals(object obj) { return obj is UnitTestingIncrementalAnalyzerProviderMetadata metadata && base.Equals(obj) -#if false // Not used in unit testing crawling - && HighPriorityForActiveFile == metadata.HighPriorityForActiveFile -#endif && Name == metadata.Name; } @@ -54,9 +39,6 @@ public override int GetHashCode() { var hashCode = 1997033996; hashCode = hashCode * -1521134295 + base.GetHashCode(); -#if false // Not used in unit testing crawling - hashCode = hashCode * -1521134295 + HighPriorityForActiveFile.GetHashCode(); -#endif hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Name); return hashCode; } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs index d007833cb7b2c..bf682e4f7f563 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs @@ -65,20 +65,13 @@ public static void LogReanalyze( int correlationId, IUnitTestingIncrementalAnalyzer analyzer, int documentCount, - string languages -#if false // Not used in unit testing crawling - , bool highPriority -#endif - ) + string languages) { Logger.Log(FunctionId.WorkCoordinatorRegistrationService_Reanalyze, KeyValueLogMessage.Create(m => { m[Id] = correlationId; m[Analyzer] = analyzer.ToString(); m[DocumentCount] = documentCount; -#if false // Not used in unit testing crawling - m[HighPriority] = highPriority; -#endif m[Languages] = languages; })); } @@ -224,13 +217,6 @@ public static void LogIncrementalAnalyzerProcessorStatistics(int correlationId, result.WriteTelemetryPropertiesTo(m, prefix: propertyName); } })); - -#if false // Not used in unit testing crawling - foreach (var analyzer in analyzers) - { - analyzer.LogAnalyzerCountSummary(); - } -#endif } private static int GetSolutionHash(Solution solution) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs index 8bd43be900434..5ff0bfba29467 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs @@ -70,9 +70,6 @@ public IUnitTestingWorkCoordinator Register(Solution solution) coordinator = new UnitTestingWorkCoordinator( _listener, GetAnalyzerProviders(workspaceKind), -#if false // Not used in unit testing crawling - initializeLazily: true, -#endif new UnitTestingRegistration(this, correlationId, workspaceKind, solutionServices, _progressReporter)); _documentWorkCoordinatorMap.Add((workspaceKind, solutionServices), coordinator); @@ -83,27 +80,6 @@ public IUnitTestingWorkCoordinator Register(Solution solution) return coordinator; } -#if false // Not used in unit testing crawling - public void Unregister(Workspace workspace, bool blockingShutdown = false) - { - UnitTestingWorkCoordinator? coordinator; - - lock (_gate) - { - if (!_documentWorkCoordinatorMap.TryGetValue(workspace, out coordinator)) - { - // already unregistered - return; - } - - _documentWorkCoordinatorMap.Remove(workspace); - coordinator.Shutdown(blockingShutdown); - } - - UnitTestingSolutionCrawlerLogger.LogUnregistration(coordinator.CorrelationId); - } -#endif - public bool HasRegisteredAnalyzerProviders { get @@ -143,11 +119,7 @@ public void AddAnalyzerProvider(IUnitTestingIncrementalAnalyzerProvider provider var analyzer = lazyProvider.Value.CreateIncrementalAnalyzer(); if (analyzer != null) { - coordinator.AddAnalyzer(analyzer -#if false // Not used in unit testing crawling - , metadata.HighPriorityForActiveFile -#endif - ); + coordinator.AddAnalyzer(analyzer); } } } @@ -171,19 +143,11 @@ public void Reanalyze(string? workspaceKind, SolutionServices services, IUnitTes if (projectIds == null && documentIds == null) { var solution = coordinator.Registration.GetSolutionToAnalyze(); - coordinator.Reanalyze(analyzer, new UnitTestingReanalyzeScope(solution.Id) -#if false // Not used in unit testing crawling - , highPriority -#endif - ); + coordinator.Reanalyze(analyzer, new UnitTestingReanalyzeScope(solution.Id)); return; } - coordinator.Reanalyze(analyzer, new UnitTestingReanalyzeScope(projectIds, documentIds) -#if false // Not used in unit testing crawling - , highPriority -#endif - ); + coordinator.Reanalyze(analyzer, new UnitTestingReanalyzeScope(projectIds, documentIds)); } } @@ -291,32 +255,6 @@ internal TestAccessor(UnitTestingSolutionCrawlerRegistrationService solutionCraw internal ref ImmutableDictionary>> AnalyzerProviders => ref _solutionCrawlerRegistrationService._analyzerProviders; - -#if false // Not used in unit testing crawling - internal bool TryGetWorkCoordinator(Workspace workspace, [NotNullWhen(true)] out UnitTestingWorkCoordinator? coordinator) - { - lock (_solutionCrawlerRegistrationService._gate) - { - return _solutionCrawlerRegistrationService._documentWorkCoordinatorMap.TryGetValue(workspace, out coordinator); - } - } - - internal void WaitUntilCompletion(Workspace workspace, ImmutableArray workers) - { - if (TryGetWorkCoordinator(workspace, out var coordinator)) - { - coordinator.GetTestAccessor().WaitUntilCompletion(workers); - } - } - - internal void WaitUntilCompletion(Workspace workspace) - { - if (TryGetWorkCoordinator(workspace, out var coordinator)) - { - coordinator.GetTestAccessor().WaitUntilCompletion(); - } - } -#endif } internal sealed class UnitTestingRegistration( diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs index 77026bb721491..decdeca4c80bb 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs @@ -123,13 +123,6 @@ public override void Shutdown() base.Shutdown(); Processor._documentTracker.NonRoslynBufferTextChanged -= OnNonRoslynBufferTextChanged; - -#if false // Not used in unit testing crawling - foreach (var analyzer in Analyzers) - { - analyzer.Shutdown(); - } -#endif } private void OnNonRoslynBufferTextChanged(object? sender, EventArgs e) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncDocumentWorkItemQueue.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncDocumentWorkItemQueue.cs index bb8277e7b1d0b..743ae28636686 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncDocumentWorkItemQueue.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncDocumentWorkItemQueue.cs @@ -42,10 +42,6 @@ protected override bool TryTake_NoLock(DocumentId key, out UnitTestingWorkItem w protected override bool TryTakeAnyWork_NoLock( ProjectId? preferableProjectId, -#if false // Not used in unit testing crawling - ProjectDependencyGraph dependencyGraph, - IDiagnosticAnalyzerService? service, -#endif out UnitTestingWorkItem workItem) { // there must be at least one item in the map when this is called unless host is shutting down. @@ -55,12 +51,7 @@ protected override bool TryTakeAnyWork_NoLock( return false; } - var documentId = GetBestDocumentId_NoLock(preferableProjectId -#if false // Not used in unit testing crawling - , dependencyGraph - , service -#endif - ); + var documentId = GetBestDocumentId_NoLock(preferableProjectId); if (TryTake_NoLock(documentId, out workItem)) { return true; @@ -70,21 +61,11 @@ protected override bool TryTakeAnyWork_NoLock( } private DocumentId GetBestDocumentId_NoLock( - ProjectId? preferableProjectId -#if false // Not used in unit testing crawling - , ProjectDependencyGraph dependencyGraph - , IDiagnosticAnalyzerService? analyzerService -#endif - ) + ProjectId? preferableProjectId) { var projectId = GetBestProjectId_NoLock( _documentWorkQueue, - preferableProjectId -#if false // Not used in unit testing crawling - , dependencyGraph - , analyzerService -#endif - ); + preferableProjectId); var documentMap = _documentWorkQueue[projectId]; diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncProjectWorkItemQueue.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncProjectWorkItemQueue.cs index 87a3972aaaa3d..77f3935ef31b1 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncProjectWorkItemQueue.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncProjectWorkItemQueue.cs @@ -44,10 +44,6 @@ protected override bool TryTake_NoLock(ProjectId key, out UnitTestingWorkItem wo protected override bool TryTakeAnyWork_NoLock( ProjectId? preferableProjectId, -#if false // Not used in unit testing crawling - ProjectDependencyGraph dependencyGraph, - IDiagnosticAnalyzerService? analyzerService, -#endif out UnitTestingWorkItem workItem) { // there must be at least one item in the map when this is called unless host is shutting down. @@ -58,12 +54,7 @@ protected override bool TryTakeAnyWork_NoLock( } var projectId = GetBestProjectId_NoLock( - _projectWorkQueue, preferableProjectId -#if false // Not used in unit testing crawling - , dependencyGraph - , analyzerService -#endif - ); + _projectWorkQueue, preferableProjectId); if (TryTake_NoLock(projectId, out workItem)) { return true; diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncWorkItemQueue.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncWorkItemQueue.cs index 128e967d7e74a..0cdbc0fc20584 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncWorkItemQueue.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingAsyncWorkItemQueue.cs @@ -39,10 +39,6 @@ private abstract class UnitTestingAsyncWorkItemQueue(UnitTestingSolutionCr protected abstract bool TryTakeAnyWork_NoLock( ProjectId? preferableProjectId, -#if false // Not used in unit testing crawling - ProjectDependencyGraph dependencyGraph, - IDiagnosticAnalyzerService? service, -#endif out UnitTestingWorkItem workItem); public int WorkItemCount @@ -211,10 +207,6 @@ public bool TryTake(TKey key, out UnitTestingWorkItem workInfo, out Cancellation public bool TryTakeAnyWork( ProjectId? preferableProjectId, -#if false // Not used in unit testing crawling - ProjectDependencyGraph dependencyGraph, - IDiagnosticAnalyzerService? analyzerService, -#endif out UnitTestingWorkItem workItem, out CancellationToken cancellationToken) { @@ -222,10 +214,6 @@ public bool TryTakeAnyWork( { // there must be at least one item in the map when this is called unless host is shutting down. if (TryTakeAnyWork_NoLock(preferableProjectId, -#if false // Not used in unit testing crawling - dependencyGraph, - analyzerService, -#endif out workItem)) { cancellationToken = GetNewCancellationToken_NoLock(workItem.Key); @@ -252,12 +240,7 @@ protected CancellationToken GetNewCancellationToken_NoLock(object key) protected static ProjectId GetBestProjectId_NoLock( Dictionary workQueue, - ProjectId? projectId -#if false // Not used in unit testing crawling - , ProjectDependencyGraph dependencyGraph - , IDiagnosticAnalyzerService? analyzerService -#endif - ) + ProjectId? projectId) { if (projectId != null) { @@ -265,30 +248,7 @@ protected static ProjectId GetBestProjectId_NoLock( { return projectId; } - -#if false // Not used in unit testing crawling - // prefer project that directly depends on the given project and has diagnostics as next project to - // process - foreach (var dependingProjectId in dependencyGraph.GetProjectsThatDirectlyDependOnThisProject(projectId)) - { - if (workQueue.ContainsKey(dependingProjectId) && analyzerService?.ContainsDiagnostics(Workspace, dependingProjectId) == true) - { - return dependingProjectId; - } - } -#endif - } - -#if false // Not used in unit testing crawling - // prefer a project that has diagnostics as next project to process. - foreach (var pendingProjectId in workQueue.Keys) - { - if (analyzerService?.ContainsDiagnostics(Workspace, pendingProjectId) == true) - { - return pendingProjectId; - } } -#endif // explicitly iterate so that we can use struct enumerator foreach (var pair in workQueue) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs deleted file mode 100644 index 06fe38ee8aa55..0000000000000 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingHighPriorityProcessor.cs +++ /dev/null @@ -1,242 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Immutable; -using System.Diagnostics; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.ErrorReporting; -using Microsoft.CodeAnalysis.Internal.Log; -using Microsoft.CodeAnalysis.Shared.TestHooks; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler -{ - internal sealed partial class UnitTestingSolutionCrawlerRegistrationService - { - internal sealed partial class UnitTestingWorkCoordinator - { - private sealed partial class UnitTestingIncrementalAnalyzerProcessor - { -#if false // Not used in unit testing crawling - private sealed class UnitTestingHighPriorityProcessor : UnitTestingIdleProcessor - { - private readonly UnitTestingIncrementalAnalyzerProcessor _processor; - private readonly UnitTestingAsyncDocumentWorkItemQueue _workItemQueue; - private readonly object _gate = new(); - - private Lazy> _lazyAnalyzers; - - // whether this processor is running or not - private Task _running; - - public UnitTestingHighPriorityProcessor( - IAsynchronousOperationListener listener, - UnitTestingIncrementalAnalyzerProcessor processor, - Lazy> lazyAnalyzers, - TimeSpan backOffTimeSpan, - CancellationToken shutdownToken) - : base(listener, backOffTimeSpan, shutdownToken) - { - _processor = processor; - _lazyAnalyzers = lazyAnalyzers; - - _running = Task.CompletedTask; - _workItemQueue = new UnitTestingAsyncDocumentWorkItemQueue(processor._registration.ProgressReporter); - - Start(); - } - - protected override void OnPaused() - { - } - - public ImmutableArray Analyzers - { - get - { - lock (_gate) - { - return _lazyAnalyzers.Value; - } - } - } - - public Task Running => _running; - - public int WorkItemCount => _workItemQueue.WorkItemCount; - public bool HasAnyWork => _workItemQueue.HasAnyWork; - - public void AddAnalyzer(IUnitTestingIncrementalAnalyzer analyzer) - { - lock (_gate) - { - var analyzers = _lazyAnalyzers.Value; - _lazyAnalyzers = new Lazy>(() => analyzers.Add(analyzer)); - } - } - - public void Enqueue(UnitTestingWorkItem item) - { - Contract.ThrowIfFalse(item.DocumentId != null, "can only enqueue a document work item"); - - // Don't enqueue item if we don't have any high priority analyzers - if (Analyzers.IsEmpty) - { - return; - } - - // we only put workitem in high priority queue if there is a text change. - // this is to prevent things like opening a file, changing in other files keep enqueuing - // expensive high priority work. - if (!item.InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.SyntaxChanged)) - { - return; - } - - if (!_processor._documentTracker.SupportsDocumentTracking - && _processor._registration.WorkspaceKind is WorkspaceKind.RemoteWorkspace) - { - Debug.Fail($"Unexpected use of '{nameof(ExportUnitTestingIncrementalAnalyzerProviderAttribute.HighPriorityForActiveFile)}' in workspace kind '{_processor._registration.WorkspaceKind}' that cannot support active file tracking."); - } - - // check whether given item is for active document, otherwise, nothing to do here - if (_processor._documentTracker.TryGetActiveDocument() != item.DocumentId) - { - return; - } - - // we need to clone due to waiter - EnqueueActiveFileItem(item.WithAsyncToken(Listener.BeginAsyncOperation("ActiveFile"))); - } - - private void EnqueueActiveFileItem(UnitTestingWorkItem item) - { - Contract.ThrowIfNull(item.DocumentId); - - UpdateLastAccessTime(); - var added = _workItemQueue.AddOrReplace(item); - - Logger.Log(FunctionId.WorkCoordinator_ActiveFileEnqueue, s_enqueueLogger, Environment.TickCount, item.DocumentId, !added); - UnitTestingSolutionCrawlerLogger.LogActiveFileEnqueue(_processor._logAggregator); - } - - protected override Task WaitAsync(CancellationToken cancellationToken) - => _workItemQueue.WaitAsync(cancellationToken); - - protected override async Task ExecuteAsync() - { - Debug.Assert(!Analyzers.IsEmpty); - - if (CancellationToken.IsCancellationRequested) - { - return; - } - - var source = new TaskCompletionSource(); - try - { - // mark it as running - _running = source.Task; - // okay, there must be at least one item in the map - // see whether we have work item for the document - Contract.ThrowIfFalse(GetNextWorkItem(out var workItem, out var documentCancellation)); - - var solution = _processor._registration.GetSolutionToAnalyze(); - - // okay now we have work to do - await ProcessDocumentAsync(solution, Analyzers, workItem, documentCancellation).ConfigureAwait(false); - } - catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e)) - { - throw ExceptionUtilities.Unreachable; - } - finally - { - // mark it as done running - source.SetResult(null); - } - } - - private bool GetNextWorkItem(out UnitTestingWorkItem workItem, out CancellationToken cancellationToken) - { - // GetNextWorkItem since it can't fail. we still return bool to confirm that this never fail. - var documentId = _processor._documentTracker.TryGetActiveDocument(); - if (documentId != null) - { - if (_workItemQueue.TryTake(documentId, out workItem, out cancellationToken)) - { - return true; - } - } - - return _workItemQueue.TryTakeAnyWork( - preferableProjectId: null, -#if false // Not used in unit testing crawling - dependencyGraph: _processor.DependencyGraph, - analyzerService: _processor.DiagnosticAnalyzerService, -#endif - workItem: out workItem, - cancellationToken: out cancellationToken); - } - - private async Task ProcessDocumentAsync(Solution solution, ImmutableArray analyzers, UnitTestingWorkItem workItem, CancellationToken cancellationToken) - { - Contract.ThrowIfNull(workItem.DocumentId); - - if (CancellationToken.IsCancellationRequested) - { - return; - } - - var processedEverything = false; - var documentId = workItem.DocumentId; - - try - { - using (Logger.LogBlock(FunctionId.WorkCoordinator_ProcessDocumentAsync, w => w.ToString(), workItem, cancellationToken)) - { - var document = solution.GetDocument(documentId); - if (document != null) - { - await _processor.ProcessDocumentAnalyzersAsync(document, analyzers, workItem, cancellationToken).ConfigureAwait(false); - } - - if (!cancellationToken.IsCancellationRequested) - { - processedEverything = true; - } - } - } - catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken)) - { - throw ExceptionUtilities.Unreachable; - } - finally - { - // we got cancelled in the middle of processing the document. - // let's make sure newly enqueued work item has all the flag needed. - // Avoid retry attempts after cancellation is requested, since work will not be processed - // after that point. - if (!processedEverything && !CancellationToken.IsCancellationRequested) - { - _workItemQueue.AddOrReplace(workItem.Retry(Listener.BeginAsyncOperation("ReenqueueWorkItem"))); - } - - UnitTestingSolutionCrawlerLogger.LogProcessActiveFileDocument(_processor._logAggregator, documentId.Id, processedEverything); - - // remove one that is finished running - _workItemQueue.MarkWorkItemDoneFor(workItem.DocumentId); - } - } - - public void Shutdown() - => _workItemQueue.Dispose(); - } -#endif - } - } - } -} diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs index b114b5046af8f..9b67fb3ccc9a5 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs @@ -35,17 +35,9 @@ private partial class UnitTestingIncrementalAnalyzerProcessor private readonly IAsynchronousOperationListener _listener; private readonly IUnitTestingDocumentTrackingService _documentTracker; -#if false // Not used in unit testing crawling - private readonly UnitTestingHighPriorityProcessor _highPriorityProcessor; -#endif private readonly UnitTestingNormalPriorityProcessor _normalPriorityProcessor; private readonly UnitTestingLowPriorityProcessor _lowPriorityProcessor; -#if false // Not used in unit testing crawling - // NOTE: IDiagnosticAnalyzerService can be null in test environment. - private readonly Lazy _lazyDiagnosticAnalyzerService; -#endif - /// /// The keys in this are either a string or a (string, Guid) tuple. See /// for what is writing this out. @@ -55,9 +47,6 @@ private partial class UnitTestingIncrementalAnalyzerProcessor public UnitTestingIncrementalAnalyzerProcessor( IAsynchronousOperationListener listener, IEnumerable> analyzerProviders, -#if false // Not used in unit testing crawling - bool initializeLazily, -#endif UnitTestingRegistration registration, TimeSpan highBackOffTimeSpan, TimeSpan normalBackOffTimeSpan, @@ -67,48 +56,20 @@ public UnitTestingIncrementalAnalyzerProcessor( _listener = listener; _registration = registration; -#if false // Not used in unit testing crawling - _lazyDiagnosticAnalyzerService = new Lazy(() => GetDiagnosticAnalyzerService(analyzerProviders)); -#endif - var analyzersGetter = new UnitTestingAnalyzersGetter(analyzerProviders); // create analyzers lazily. -#if false // Not used in unit testing crawling - var lazyActiveFileAnalyzers = new Lazy>(() => GetIncrementalAnalyzers(_registration, analyzersGetter, onlyHighPriorityAnalyzer: true)); -#endif var lazyAllAnalyzers = new Lazy>(() => GetIncrementalAnalyzers(_registration, analyzersGetter, onlyHighPriorityAnalyzer: false)); -#if false // Not used in unit testing crawling - if (!initializeLazily) - { - // realize all analyzer right away - _ = lazyActiveFileAnalyzers.Value; - _ = lazyAllAnalyzers.Value; - } -#endif - // event and worker queues _documentTracker = _registration.Services.GetRequiredService(); var globalNotificationService = _registration.Services.ExportProvider.GetExports().FirstOrDefault()?.Value; -#if false // Not used in unit testing crawling - _highPriorityProcessor = new UnitTestingHighPriorityProcessor(listener, this, lazyActiveFileAnalyzers, highBackOffTimeSpan, shutdownToken); -#endif _normalPriorityProcessor = new UnitTestingNormalPriorityProcessor(listener, this, lazyAllAnalyzers, globalNotificationService, normalBackOffTimeSpan, shutdownToken); _lowPriorityProcessor = new UnitTestingLowPriorityProcessor(listener, this, lazyAllAnalyzers, globalNotificationService, lowBackOffTimeSpan, shutdownToken); } -#if false // Not used in unit testing crawling - private static IDiagnosticAnalyzerService? GetDiagnosticAnalyzerService(IEnumerable> analyzerProviders) - { - // alternatively, we could just MEF import IDiagnosticAnalyzerService directly - // this can be null in test env. - return (IDiagnosticAnalyzerService?)analyzerProviders.Where(p => p.Value is IDiagnosticAnalyzerService).SingleOrDefault()?.Value; - } -#endif - private static ImmutableArray GetIncrementalAnalyzers(UnitTestingRegistration registration, UnitTestingAnalyzersGetter analyzersGetter, bool onlyHighPriorityAnalyzer) { var orderedAnalyzers = analyzersGetter.GetOrderedAnalyzers(registration.WorkspaceKind, registration.Services, onlyHighPriorityAnalyzer); @@ -121,9 +82,6 @@ public void Enqueue(UnitTestingWorkItem item) { Contract.ThrowIfNull(item.DocumentId); -#if false // Not used in unit testing crawling - _highPriorityProcessor.Enqueue(item); -#endif _normalPriorityProcessor.Enqueue(item); _lowPriorityProcessor.Enqueue(item); @@ -131,66 +89,36 @@ public void Enqueue(UnitTestingWorkItem item) } public void AddAnalyzer( - IUnitTestingIncrementalAnalyzer analyzer -#if false // Not used in unit testing crawling - , bool highPriorityForActiveFile -#endif - ) + IUnitTestingIncrementalAnalyzer analyzer) { -#if false // Not used in unit testing crawling - if (highPriorityForActiveFile) - { - _highPriorityProcessor.AddAnalyzer(analyzer); - } -#endif - _normalPriorityProcessor.AddAnalyzer(analyzer); _lowPriorityProcessor.AddAnalyzer(analyzer); } public void Shutdown() { -#if false // Not used in unit testing crawling - _highPriorityProcessor.Shutdown(); -#endif _normalPriorityProcessor.Shutdown(); _lowPriorityProcessor.Shutdown(); } public ImmutableArray Analyzers => _normalPriorityProcessor.Analyzers; -#if false // Not used in unit testing crawling - private ProjectDependencyGraph DependencyGraph => _registration.GetSolutionToAnalyze().GetProjectDependencyGraph(); - private IDiagnosticAnalyzerService? DiagnosticAnalyzerService => _lazyDiagnosticAnalyzerService?.Value; -#endif - public Task AsyncProcessorTask { get { return Task.WhenAll( -#if false // Not used in unit testing crawling - _highPriorityProcessor.AsyncProcessorTask, -#endif _normalPriorityProcessor.AsyncProcessorTask, _lowPriorityProcessor.AsyncProcessorTask); } } -#if false // Not used in unit testing crawling - private IEnumerable GetOpenDocumentIds() - => _registration.Workspace.GetOpenDocumentIds(); -#endif - private void ResetLogAggregator() => _logAggregator = new CountLogAggregator(); private void ReportPendingWorkItemCount() { var pendingItemCount = -#if false // Not used in unit testing crawling - _highPriorityProcessor.WorkItemCount + -#endif _normalPriorityProcessor.WorkItemCount + _lowPriorityProcessor.WorkItemCount; _registration.ProgressReporter.UpdatePendingItemCount(pendingItemCount); } @@ -198,42 +126,19 @@ private void ReportPendingWorkItemCount() private async Task ProcessDocumentAnalyzersAsync( TextDocument textDocument, ImmutableArray analyzers, UnitTestingWorkItem workItem, CancellationToken cancellationToken) { -#if false // Not used in unit testing crawling - // process special active document switched request, if any. - if (ProcessActiveDocumentSwitched(analyzers, workItem, textDocument, cancellationToken)) - { - return; - } -#endif - // process all analyzers for each categories in this order - syntax, body, document var reasons = workItem.InvocationReasons; -#if false // Not used in unit testing crawling - if (workItem.MustRefresh || reasons.Contains(UnitTestingPredefinedInvocationReasons.SyntaxChanged)) - { - await RunAnalyzersAsync(analyzers, textDocument, workItem, (analyzer, document, cancellationToken) => - AnalyzeSyntaxAsync(analyzer, document, reasons, cancellationToken), cancellationToken).ConfigureAwait(false); - } -#endif - if (textDocument is not Document document) { // Semantic analysis is not supported for non-source documents. return; } - if ( -#if false // Not used in unit testing crawling - workItem.MustRefresh || -#endif - reasons.Contains(UnitTestingPredefinedInvocationReasons.SemanticChanged)) + if (reasons.Contains(UnitTestingPredefinedInvocationReasons.SemanticChanged)) { await RunAnalyzersAsync(analyzers, document, workItem, (analyzer, document, cancellationToken) => analyzer.AnalyzeDocumentAsync(document, -#if false // Not used in unit testing crawling - bodyOpt: null, -#endif reasons, cancellationToken), cancellationToken).ConfigureAwait(false); } @@ -244,42 +149,6 @@ await RunAnalyzersAsync(analyzers, document, workItem, (analyzer, document, canc } return; - -#if false // Not used in unit testing crawling - static async Task AnalyzeSyntaxAsync(IUnitTestingIncrementalAnalyzer analyzer, TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) - { - if (textDocument is Document document) - { - await analyzer.AnalyzeSyntaxAsync(document, reasons, cancellationToken).ConfigureAwait(false); - } - else - { - await analyzer.AnalyzeNonSourceDocumentAsync(textDocument, reasons, cancellationToken).ConfigureAwait(false); - } - } -#endif - -#if false // Not used in unit testing crawling - bool ProcessActiveDocumentSwitched(ImmutableArray analyzers, UnitTestingWorkItem workItem, TextDocument document, CancellationToken cancellationToken) - { - try - { - if (!workItem.InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.ActiveDocumentSwitched)) - { - return false; - } - - await RunAnalyzersAsync(analyzers, document, workItem, (analyzer, document, cancellationToken) => - analyzer.ActiveDocumentSwitchedAsync(document, cancellationToken), cancellationToken).ConfigureAwait(false); - - return true; - } - catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken)) - { - throw ExceptionUtilities.Unreachable; - } - } -#endif } private async Task RunAnalyzersAsync( @@ -329,35 +198,15 @@ private async Task RunBodyAnalyzersAsync(ImmutableArray analyzer.AnalyzeDocumentAsync( document, -#if false // Not used in unit testing crawling - null, -#endif reasons, cancellationToken), cancellationToken).ConfigureAwait(false); return; } -#if false // Not used in unit testing crawling - // check whether we know what body has changed. currently, this is an optimization toward typing case. if there are more than one body changes - // it will be considered as semantic change and whole document analyzer will take care of that case. - var activeMember = GetMemberNode(syntaxFactsService, root, workItem.ActiveMember); - if (activeMember == null) - { - // no active member means, change is out side of a method body, but it didn't affect semantics (such as change in comment) - // in that case, we update whole document (just this document) so that we can have updated locations. - await RunAnalyzersAsync(analyzers, document, workItem, (analyzer, document, cancellationToken) => - analyzer.AnalyzeDocumentAsync(document, null, reasons, cancellationToken), cancellationToken).ConfigureAwait(false); - return; - } -#endif - // re-run just the body await RunAnalyzersAsync(analyzers, document, workItem, (analyzer, document, cancellationToken) => analyzer.AnalyzeDocumentAsync( document, -#if false // Not used in unit testing crawling - activeMember, -#endif reasons, cancellationToken), cancellationToken).ConfigureAwait(false); } @@ -400,23 +249,6 @@ static bool ReportWithoutCrashUnlessAllCanceledAndPropagate(AggregateException a } } -#if false // Not used in unit testing crawling - private static SyntaxNode? GetMemberNode(ISyntaxFactsService service, SyntaxNode? root, SyntaxPath? memberPath) - { - if (root == null || memberPath == null) - { - return null; - } - - if (!memberPath.TryResolve(root, out SyntaxNode? memberNode)) - { - return null; - } - - return service.IsMethodLevelMember(memberNode) ? memberNode : null; - } -#endif - private static string EnqueueLogger(int tick, object documentOrProjectId, bool replaced) { if (documentOrProjectId is DocumentId documentId) @@ -459,13 +291,7 @@ internal void WaitUntilCompletion() private class UnitTestingAnalyzersGetter(IEnumerable> analyzerProviders) { private readonly List> _analyzerProviders = analyzerProviders.ToList(); - private readonly Dictionary<(string workspaceKind, SolutionServices services), ImmutableArray< -#if false // Not used in unit testing crawling - (IUnitTestingIncrementalAnalyzer analyzer, bool highPriorityForActiveFile) -#else - IUnitTestingIncrementalAnalyzer -#endif - >> _analyzerMap = new(); + private readonly Dictionary<(string workspaceKind, SolutionServices services), ImmutableArray> _analyzerMap = new(); public ImmutableArray GetOrderedAnalyzers(string workspaceKind, SolutionServices services, bool onlyHighPriorityAnalyzer) { @@ -473,38 +299,20 @@ public ImmutableArray GetOrderedAnalyzers(strin { if (!_analyzerMap.TryGetValue((workspaceKind, services), out var analyzers)) { -#if false // Not used in unit testing crawling - // Sort list so DiagnosticIncrementalAnalyzers (if any) come first. - analyzers = _analyzerProviders.Select(p => (analyzer: p.Value.CreateIncrementalAnalyzer(), highPriorityForActiveFile: p.Metadata.HighPriorityForActiveFile)) - .Where(t => t.analyzer != null) - .OrderBy(t => t.analyzer!.Priority) - .ToImmutableArray()!; -#else analyzers = _analyzerProviders .Select(p => p.Value.CreateIncrementalAnalyzer()) .WhereNotNull() .ToImmutableArray(); -#endif _analyzerMap[(workspaceKind, services)] = analyzers; } if (onlyHighPriorityAnalyzer) { -#if false // Not used in unit testing crawling - // include only high priority analyzer for active file - return analyzers.SelectAsArray(t => t.highPriorityForActiveFile, t => t.analyzer); -#else return ImmutableArray.Empty; -#endif } -#if false // Not used in unit testing crawling - // return all analyzers - return analyzers.Select(t => t.analyzer).ToImmutableArray(); -#else return analyzers; -#endif } } } diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs index 238dc77e65ab1..ffe72ba40affb 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs @@ -58,10 +58,6 @@ protected override async Task ExecuteAsync() if (_workItemQueue.TryTakeAnyWork( preferableProjectId, -#if false // Not used in unit testing crawling - Processor.DependencyGraph, - Processor.DiagnosticAnalyzerService, -#endif out var workItem, out var projectCancellation)) { await ProcessProjectAsync(Analyzers, workItem, projectCancellation).ConfigureAwait(false); @@ -77,11 +73,7 @@ protected override Task HigherQueueOperationTask { get { -#if false // Not used in unit testing crawling - return Task.WhenAll(Processor._highPriorityProcessor.Running, Processor._normalPriorityProcessor.Running); -#else return Processor._normalPriorityProcessor.Running; -#endif } } @@ -89,11 +81,7 @@ protected override bool HigherQueueHasWorkItem { get { - return -#if false // Not used in unit testing crawling - Processor._highPriorityProcessor.HasAnyWork || -#endif - Processor._normalPriorityProcessor.HasAnyWork; + return Processor._normalPriorityProcessor.HasAnyWork; } } @@ -152,25 +140,13 @@ private async Task ProcessProjectAsync(ImmutableArray a.AnalyzeProjectAsync(p, -#if false // Not used in unit testing crawling - semanticsChanged, -#endif - reasons, c), cancellationToken).ConfigureAwait(false); + (a, p, c) => a.AnalyzeProjectAsync(p, reasons, c), cancellationToken).ConfigureAwait(false); } else { UnitTestingSolutionCrawlerLogger.LogProcessProjectNotExist(Processor._logAggregator); - -#if false // Not used in unit testing crawling - await RemoveProjectAsync(projectId, cancellationToken).ConfigureAwait(false); -#endif } if (!cancellationToken.IsCancellationRequested) @@ -201,16 +177,6 @@ await Processor.RunAnalyzersAsync(analyzers, project, workItem, } } -#if false // Not used in unit testing crawling - private async Task RemoveProjectAsync(ProjectId projectId, CancellationToken cancellationToken) - { - foreach (var analyzer in Analyzers) - { - await analyzer.RemoveProjectAsync(projectId, cancellationToken).ConfigureAwait(false); - } - } -#endif - public override void Shutdown() { base.Shutdown(); diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs index 2ad11273ef70e..8ac4ec060ef2e 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs @@ -129,10 +129,6 @@ protected override async Task ExecuteAsync() // process one of documents remaining if (!_workItemQueue.TryTakeAnyWork( _currentProjectProcessing, -#if false // Not used in unit testing crawling - Processor.DependencyGraph, - Processor.DiagnosticAnalyzerService, -#endif out var workItem, out var documentCancellation)) { @@ -163,28 +159,10 @@ protected override async Task ExecuteAsync() } protected override Task HigherQueueOperationTask -#if false // Not used in unit testing crawling - { - get - { - return Processor._highPriorityProcessor.Running; - } - } -#else => Task.CompletedTask; -#endif protected override bool HigherQueueHasWorkItem -#if false // Not used in unit testing crawling - { - get - { - return Processor._highPriorityProcessor.HasAnyWork; - } - } -#else => false; -#endif protected override void OnPaused() { @@ -307,19 +285,6 @@ private async Task ProcessDocumentAsync(ImmutableArray analyzers, UnitTestingWorkItem workItem, TextDocument textDocument, bool isOpen, CancellationToken cancellationToken) - { - if (!isOpen || !workItem.InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.DocumentOpened)) - { - return; - } - - UnitTestingSolutionCrawlerLogger.LogProcessOpenDocument(Processor._logAggregator, textDocument.Id.Id); - - await Processor.RunAnalyzersAsync(analyzers, textDocument, workItem, DocumentOpenAsync, cancellationToken).ConfigureAwait(false); - return; - - static async Task DocumentOpenAsync(IUnitTestingIncrementalAnalyzer analyzer, TextDocument textDocument, CancellationToken cancellationToken) - { - if (textDocument is Document document) - { - await analyzer.DocumentOpenAsync(document, cancellationToken).ConfigureAwait(false); - } - else - { - await analyzer.NonSourceDocumentOpenAsync(textDocument, cancellationToken).ConfigureAwait(false); - } - } - } - - private async Task ProcessCloseDocumentIfNeededAsync(ImmutableArray analyzers, UnitTestingWorkItem workItem, TextDocument textDocument, bool isOpen, CancellationToken cancellationToken) - { - if (isOpen || !workItem.InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.DocumentClosed)) - { - return; - } - - UnitTestingSolutionCrawlerLogger.LogProcessCloseDocument(Processor._logAggregator, textDocument.Id.Id); - - await Processor.RunAnalyzersAsync(analyzers, textDocument, workItem, DocumentCloseAsync, cancellationToken).ConfigureAwait(false); - return; - - static async Task DocumentCloseAsync(IUnitTestingIncrementalAnalyzer analyzer, TextDocument textDocument, CancellationToken cancellationToken) - { - if (textDocument is Document document) - { - await analyzer.DocumentCloseAsync(document, cancellationToken).ConfigureAwait(false); - } - else - { - await analyzer.NonSourceDocumentCloseAsync(textDocument, cancellationToken).ConfigureAwait(false); - } - } - } -#endif - private async Task ProcessReanalyzeDocumentAsync(UnitTestingWorkItem workItem, TextDocument document, CancellationToken cancellationToken) { try @@ -421,29 +334,16 @@ private async Task ProcessReanalyzeDocumentAsync(UnitTestingWorkItem workItem, T #endif // No-reanalyze request or we already have a request to re-analyze every thing - if ( -#if false // Not used in unit testing crawling - workItem.MustRefresh || -#endif - !workItem.InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.Reanalyze)) + if (!workItem.InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.Reanalyze)) { return; } // First reset the document state in analyzers. var reanalyzers = workItem.SpecificAnalyzers.ToImmutableArray(); -#if false // Not used in unit testing crawling - await Processor.RunAnalyzersAsync(reanalyzers, document, workItem, DocumentResetAsync, cancellationToken).ConfigureAwait(false); -#endif // No request to re-run syntax change analysis. run it here var reasons = workItem.InvocationReasons; -#if false // Not used in unit testing crawling - if (!reasons.Contains(UnitTestingPredefinedInvocationReasons.SyntaxChanged)) - { - await Processor.RunAnalyzersAsync(reanalyzers, document, workItem, (a, d, c) => AnalyzeSyntaxAsync(a, d, reasons, c), cancellationToken).ConfigureAwait(false); - } -#endif // No request to re-run semantic change analysis. run it here // Note: Semantic analysis is not supported for non-source documents. @@ -453,9 +353,6 @@ private async Task ProcessReanalyzeDocumentAsync(UnitTestingWorkItem workItem, T await Processor.RunAnalyzersAsync(reanalyzers, sourceDocument, workItem, (a, d, c) => a.AnalyzeDocumentAsync( d, -#if false // Not used in unit testing crawling - bodyOpt: null, -#endif reasons, c), cancellationToken).ConfigureAwait(false); } @@ -466,34 +363,6 @@ await Processor.RunAnalyzersAsync(reanalyzers, sourceDocument, workItem, } return; - -#if false // Not used in unit testing crawling - static async Task DocumentResetAsync(IUnitTestingIncrementalAnalyzer analyzer, TextDocument textDocument, CancellationToken cancellationToken) - { - if (textDocument is Document document) - { - await analyzer.DocumentResetAsync(document, cancellationToken).ConfigureAwait(false); - } - else - { - await analyzer.NonSourceDocumentResetAsync(textDocument, cancellationToken).ConfigureAwait(false); - } - } -#endif - -#if false // Not used in unit testing crawling - static async Task AnalyzeSyntaxAsync(IUnitTestingIncrementalAnalyzer analyzer, TextDocument textDocument, UnitTestingInvocationReasons reasons, CancellationToken cancellationToken) - { - if (textDocument is Document document) - { - await analyzer.AnalyzeSyntaxAsync(document, reasons, cancellationToken).ConfigureAwait(false); - } - else - { - await analyzer.AnalyzeNonSourceDocumentAsync(textDocument, reasons, cancellationToken).ConfigureAwait(false); - } - } -#endif } private Task RemoveDocumentAsync(DocumentId documentId, CancellationToken cancellationToken) @@ -516,20 +385,6 @@ private void ResetStates() return; } -#if false // Not used in unit testing crawling - await Processor.RunAnalyzersAsync( - Analyzers, - Processor._registration.GetSolutionToAnalyze(), - workItem: new UnitTestingWorkItem(), (a, s, c) => a.NewSolutionSnapshotAsync(s, c), CancellationToken).ConfigureAwait(false); -#endif - -#if false // Not used in unit testing crawling - foreach (var id in Processor.GetOpenDocumentIds()) - { - AddHigherPriorityDocument(id); - } -#endif - UnitTestingSolutionCrawlerLogger.LogResetStates(Processor._logAggregator); } catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e)) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingWorkItem.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingWorkItem.cs index 6b713e99c5426..a94040cb337bf 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingWorkItem.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingWorkItem.cs @@ -52,20 +52,6 @@ public IEnumerable GetApplicableAnalyzers(Immut // common public readonly IAsyncToken AsyncToken; -#if false // Not used in unit testing crawling - public bool MustRefresh - { - get - { - // in current design, we need to re-run all incremental analyzer on document open and close - // so that incremental analyzer who only cares about opened document can have a chance to clean up - // its state. - return InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.DocumentOpened) || - InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.DocumentClosed); - } - } -#endif - private UnitTestingWorkItem( DocumentId? documentId, ProjectId projectId, diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs index 0e23b1217431e..f7ffc6b99a74c 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs @@ -22,11 +22,6 @@ internal partial class UnitTestingSolutionCrawlerRegistrationService { internal sealed partial class UnitTestingWorkCoordinator : IUnitTestingWorkCoordinator { -#if false // Not used in unit testing crawling - private readonly object _gate = new(); - private readonly IUnitTestingDocumentTrackingService _documentTrackingService; -#endif - private readonly UnitTestingRegistration _registration; private readonly CountLogAggregator _logAggregator = new(); @@ -44,17 +39,11 @@ internal sealed partial class UnitTestingWorkCoordinator : IUnitTestingWorkCoord public UnitTestingWorkCoordinator( IAsynchronousOperationListener listener, IEnumerable> analyzerProviders, -#if false // Not used in unit testing crawling - bool initializeLazily, -#endif UnitTestingRegistration registration) { _registration = registration; _listener = listener; -#if false // Not used in unit testing crawling - _documentTrackingService = _registration.Services.GetRequiredService(); -#endif _solutionCrawlerOptionsService = _registration.Services.GetService(); // event and worker queues @@ -69,9 +58,6 @@ public UnitTestingWorkCoordinator( _documentAndProjectWorkerProcessor = new UnitTestingIncrementalAnalyzerProcessor( listener, analyzerProviders, -#if false // Not used in unit testing crawling - initializeLazily, -#endif _registration, activeFileBackOffTimeSpan, allFilesWorkerBackOffTimeSpan, @@ -82,94 +68,25 @@ public UnitTestingWorkCoordinator( var projectBackOffTimeSpan = UnitTestingSolutionCrawlerTimeSpan.ProjectPropagationBackOff; _semanticChangeProcessor = new UnitTestingSemanticChangeProcessor(listener, _registration, _documentAndProjectWorkerProcessor, semanticBackOffTimeSpan, projectBackOffTimeSpan, _shutdownToken); - -#if false // Not used in unit testing crawling - // subscribe to active document changed event for active file background analysis scope. - _documentTrackingService.ActiveDocumentChanged += OnActiveDocumentSwitched; -#endif } public UnitTestingRegistration Registration => _registration; public int CorrelationId => _registration.CorrelationId; - public void AddAnalyzer( - IUnitTestingIncrementalAnalyzer analyzer -#if false // Not used in unit testing crawling - , bool highPriorityForActiveFile -#endif - ) + public void AddAnalyzer(IUnitTestingIncrementalAnalyzer analyzer) { // add analyzer - _documentAndProjectWorkerProcessor.AddAnalyzer( - analyzer -#if false // Not used in unit testing crawling - , highPriorityForActiveFile -#endif - ); + _documentAndProjectWorkerProcessor.AddAnalyzer(analyzer); // and ask to re-analyze whole solution for the given analyzer var scope = new UnitTestingReanalyzeScope(_registration.GetSolutionToAnalyze().Id); Reanalyze(analyzer, scope); } -#if false // Not used in unit testing crawling - public void Shutdown(bool blockingShutdown) - { - _documentTrackingService.ActiveDocumentChanged -= OnActiveDocumentSwitched; - - // detach from the workspace - _registration.Workspace.WorkspaceChanged -= OnWorkspaceChanged; - _registration.Workspace.TextDocumentOpened -= OnTextDocumentOpened; - _registration.Workspace.TextDocumentClosed -= OnTextDocumentClosed; - - // cancel any pending blocks - _shutdownNotificationSource.Cancel(); - - _documentAndProjectWorkerProcessor.Shutdown(); - - UnitTestingSolutionCrawlerLogger.LogWorkCoordinatorShutdown(CorrelationId, _logAggregator); - - if (blockingShutdown) - { - var shutdownTask = Task.WhenAll( - _eventProcessingQueue.LastScheduledTask, - _documentAndProjectWorkerProcessor.AsyncProcessorTask, - _semanticChangeProcessor.AsyncProcessorTask); - - try - { - shutdownTask.Wait(TimeSpan.FromSeconds(5)); - } - catch (AggregateException ex) - { - ex.Handle(e => e is OperationCanceledException); - } - - if (!shutdownTask.IsCompleted) - { - UnitTestingSolutionCrawlerLogger.LogWorkCoordinatorShutdownTimeout(CorrelationId); - } - } - - foreach (var analyzer in _documentAndProjectWorkerProcessor.Analyzers) - { - (analyzer as IDisposable)?.Dispose(); - } - } -#endif - - public void Reanalyze(IUnitTestingIncrementalAnalyzer analyzer, UnitTestingReanalyzeScope scope -#if false // Not used in unit testing crawling - , bool highPriority = false -#endif - ) + public void Reanalyze(IUnitTestingIncrementalAnalyzer analyzer, UnitTestingReanalyzeScope scope) { _eventProcessingQueue.ScheduleTask("Reanalyze", - () => EnqueueWorkItemAsync(analyzer, scope -#if false // Not used in unit testing crawling - , highPriority -#endif - ), _shutdownToken); + () => EnqueueWorkItemAsync(analyzer, scope), _shutdownToken); if (scope.HasMultipleDocuments) { @@ -177,25 +94,10 @@ public void Reanalyze(IUnitTestingIncrementalAnalyzer analyzer, UnitTestingReana // we are not interested in 1 file re-analysis request which can happen from like venus typing var solution = _registration.GetSolutionToAnalyze(); UnitTestingSolutionCrawlerLogger.LogReanalyze( - CorrelationId, analyzer, scope.GetDocumentCount(solution), scope.GetLanguagesStringForTelemetry(solution) -#if false // Not used in unit testing crawling - , highPriority -#endif - ); + CorrelationId, analyzer, scope.GetDocumentCount(solution), scope.GetLanguagesStringForTelemetry(solution)); } } -#if false // Not used in unit testing crawling - private void OnActiveDocumentSwitched(object? sender, DocumentId? activeDocumentId) - { - if (activeDocumentId == null) - return; - - var solution = _registration.GetSolutionToAnalyze(); - EnqueueFullDocumentEvent(solution, activeDocumentId, UnitTestingInvocationReasons.ActiveDocumentSwitched, eventName: nameof(OnActiveDocumentSwitched)); - } -#endif - public void OnWorkspaceChanged(WorkspaceChangeEventArgs args) { // guard us from cancellation @@ -247,20 +149,10 @@ private void ProcessEvent(WorkspaceChangeEventArgs args, string eventName) EnqueueSolutionChangedEvent(args.OldSolution, args.NewSolution, eventName); break; -#if false // Not used in unit testing crawling - case WorkspaceChangeKind.SolutionRemoved: - EnqueueFullSolutionEvent(args.OldSolution, UnitTestingInvocationReasons.SolutionRemoved, eventName); - break; - - case WorkspaceChangeKind.SolutionCleared: - EnqueueFullSolutionEvent(args.OldSolution, UnitTestingInvocationReasons.SolutionRemoved, eventName); - break; -#else case WorkspaceChangeKind.SolutionCleared: case WorkspaceChangeKind.SolutionRemoved: // Not used in unit testing crawling break; -#endif case WorkspaceChangeKind.ProjectAdded: Contract.ThrowIfNull(args.ProjectId); @@ -312,20 +204,6 @@ private void ProcessEvent(WorkspaceChangeEventArgs args, string eventName) } } -#if false // Not used in unit testing crawling - public void OnTextDocumentOpened(TextDocumentEventArgs e) - { - _eventProcessingQueue.ScheduleTask("OnTextDocumentOpened", - () => EnqueueDocumentWorkItemAsync(e.Document.Project, e.Document.Id, e.Document, UnitTestingInvocationReasons.DocumentOpened), _shutdownToken); - } - - public void OnTextDocumentClosed(TextDocumentEventArgs e) - { - _eventProcessingQueue.ScheduleTask("OnTextDocumentClosed", - () => EnqueueDocumentWorkItemAsync(e.Document.Project, e.Document.Id, e.Document, UnitTestingInvocationReasons.DocumentClosed), _shutdownToken); - } -#endif - private void EnqueueSolutionChangedEvent(Solution oldSolution, Solution newSolution, string eventName) { _eventProcessingQueue.ScheduleTask( @@ -509,17 +387,10 @@ private async Task EnqueueFullProjectWorkItemAsync(Project project, UnitTestingI } } - private async Task EnqueueWorkItemAsync(IUnitTestingIncrementalAnalyzer analyzer, UnitTestingReanalyzeScope scope -#if false // Not used in unit testing crawling - , bool highPriority -#endif - ) + private async Task EnqueueWorkItemAsync(IUnitTestingIncrementalAnalyzer analyzer, UnitTestingReanalyzeScope scope) { var solution = _registration.GetSolutionToAnalyze(); var invocationReasons = -#if false // Not used in unit testing crawling - highPriority ? UnitTestingInvocationReasons.ReanalyzeHighPriority : -#endif UnitTestingInvocationReasons.Reanalyze; foreach (var (project, documentId) in scope.GetDocumentIds(solution)) @@ -563,13 +434,6 @@ private async Task EnqueueProjectConfigurationChangeWorkItemAsync(ProjectChanges // TODO: why solution changes return Project not ProjectId but ProjectChanges return DocumentId not Document? var projectConfigurationChange = UnitTestingInvocationReasons.Empty; -#if false // Not used in unit testing crawling - if (!object.Equals(oldProject.ParseOptions, newProject.ParseOptions)) - { - projectConfigurationChange = projectConfigurationChange.With(UnitTestingInvocationReasons.ProjectParseOptionChanged); - } -#endif - if (projectChanges.GetAddedMetadataReferences().Any() || projectChanges.GetAddedProjectReferences().Any() || projectChanges.GetAddedAnalyzerReferences().Any() || @@ -607,11 +471,7 @@ private async Task EnqueueChangedDocumentWorkItemAsync(Document oldDocument, Doc } else { -#if false // Not used in unit testing crawling - var differenceResult = await differenceService.GetDifferenceAsync(oldDocument, newDocument, _shutdownToken).ConfigureAwait(false); -#else var differenceResult = differenceService.GetDifference(oldDocument, newDocument, _shutdownToken); -#endif if (differenceResult != null) await EnqueueDocumentWorkItemAsync(newDocument.Project, newDocument.Id, newDocument, differenceResult.ChangeType, differenceResult.ChangedMember).ConfigureAwait(false); diff --git a/src/Features/Core/Portable/LegacySolutionEvents/ILegacySolutionEventsAggregationService.cs b/src/Features/Core/Portable/LegacySolutionEvents/ILegacySolutionEventsAggregationService.cs index 628002213c320..778627d02b1a6 100644 --- a/src/Features/Core/Portable/LegacySolutionEvents/ILegacySolutionEventsAggregationService.cs +++ b/src/Features/Core/Portable/LegacySolutionEvents/ILegacySolutionEventsAggregationService.cs @@ -24,10 +24,6 @@ internal interface ILegacySolutionEventsAggregationService : IWorkspaceService bool ShouldReportChanges(SolutionServices services); ValueTask OnWorkspaceChangedAsync(WorkspaceChangeEventArgs args, CancellationToken cancellationToken); -#if false // Not used in unit testing crawling - ValueTask OnTextDocumentOpenedAsync(TextDocumentEventArgs args, CancellationToken cancellationToken); - ValueTask OnTextDocumentClosedAsync(TextDocumentEventArgs args, CancellationToken cancellationToken); -#endif } [ExportWorkspaceService(typeof(ILegacySolutionEventsAggregationService)), Shared] @@ -54,19 +50,5 @@ public async ValueTask OnWorkspaceChangedAsync(WorkspaceChangeEventArgs args, Ca foreach (var service in _eventsServices) await service.Value.OnWorkspaceChangedAsync(args, cancellationToken).ConfigureAwait(false); } - -#if false // Not used in unit testing crawling - public async ValueTask OnTextDocumentOpenedAsync(TextDocumentEventArgs args, CancellationToken cancellationToken) - { - foreach (var service in _eventsServices) - await service.Value.OnTextDocumentOpenedAsync(args, cancellationToken).ConfigureAwait(false); - } - - public async ValueTask OnTextDocumentClosedAsync(TextDocumentEventArgs args, CancellationToken cancellationToken) - { - foreach (var service in _eventsServices) - await service.Value.OnTextDocumentClosedAsync(args, cancellationToken).ConfigureAwait(false); - } -#endif } } diff --git a/src/Features/Core/Portable/LegacySolutionEvents/ILegacySolutionEventsListener.cs b/src/Features/Core/Portable/LegacySolutionEvents/ILegacySolutionEventsListener.cs index 8b11939aa14f6..ae6ca166e5f4e 100644 --- a/src/Features/Core/Portable/LegacySolutionEvents/ILegacySolutionEventsListener.cs +++ b/src/Features/Core/Portable/LegacySolutionEvents/ILegacySolutionEventsListener.cs @@ -17,10 +17,5 @@ internal interface ILegacySolutionEventsListener { bool ShouldReportChanges(SolutionServices services); ValueTask OnWorkspaceChangedAsync(WorkspaceChangeEventArgs args, CancellationToken cancellationToken); - -#if false // Not used in unit testing crawling - ValueTask OnTextDocumentOpenedAsync(TextDocumentEventArgs args, CancellationToken cancellationToken); - ValueTask OnTextDocumentClosedAsync(TextDocumentEventArgs args, CancellationToken cancellationToken); -#endif } } From fb408061bdcde3478a33279b92beda3f2861659f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:00:07 -0800 Subject: [PATCH 070/141] simplify --- .../CSharpSyntaxGenerator/SourceWriter.cs | 42 +++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index e7f1fae9882d5..519912bd8ab8b 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -44,7 +44,9 @@ private void WriteFileHeader() private void WriteInternal() { WriteFileHeader(); - WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;"); + + WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax"); + OpenBlock(); WriteLine(); this.WriteGreenTypes(); @@ -52,15 +54,18 @@ private void WriteInternal() this.WriteGreenRewriter(); this.WriteContextualGreenFactories(); this.WriteStaticGreenFactories(); + CloseBlock(); } private void WriteSyntax() { WriteFileHeader(); - WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax;"); + WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax"); + OpenBlock(); WriteLine(); this.WriteRedTypes(); + CloseBlock(); } private void WriteMain() @@ -855,18 +860,31 @@ private void WriteRedType(TreeType node) Write($"public {OverrideOrNewModifier(field)}{GetRedPropertyType(field)} {field.Name}"); if (IsOptional(field)) { - WriteLine($" => ((InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)} is {{ }} slot ? new(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); + WriteLine(); + OpenBlock(); + WriteLine("get"); + OpenBlock(); + WriteLine($"var slot = ((Syntax.InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)};"); + WriteLine($"return slot != null ? new SyntaxToken(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); + CloseBlock(); + CloseBlock(); } else { - WriteLine($" => new(this, ((InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)}, {GetChildPosition(i)}, {GetChildIndex(i)});"); + WriteLine($" => new SyntaxToken(this, ((InternalSyntax.{node.Name})this.Green).{CamelCase(field.Name)}, {GetChildPosition(i)}, {GetChildIndex(i)});"); } } else if (field.Type == "SyntaxList") { WriteComment(field.PropertyComment, ""); - Write($"public {OverrideOrNewModifier(field)}SyntaxTokenList {field.Name} => "); - WriteLine($"this.Green.GetSlot({i}) is {{ }} slot ? new(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); + WriteLine($"public {OverrideOrNewModifier(field)}SyntaxTokenList {field.Name}"); + OpenBlock(); + WriteLine("get"); + OpenBlock(); + WriteLine($"var slot = this.Green.GetSlot({i});"); + WriteLine($"return slot != null ? new SyntaxTokenList(this, slot, {GetChildPosition(i)}, {GetChildIndex(i)}) : default;"); + CloseBlock(); + CloseBlock(); } else { @@ -875,11 +893,19 @@ private void WriteRedType(TreeType node) if (IsNodeList(field.Type)) { - WriteLine($" => new(GetRed(ref this.{CamelCase(field.Name)}, {i}));"); + WriteLine($" => new {field.Type}(GetRed(ref this.{CamelCase(field.Name)}, {i}));"); } else if (IsSeparatedNodeList(field.Type)) { - WriteLine($" => GetRed(ref this.{CamelCase(field.Name)}, {i}) is {{ }} red ? new(red, {GetChildIndex(i)}) : default;"); + WriteLine(); + OpenBlock(); + WriteLine("get"); + OpenBlock(); + + WriteLine($"var red = GetRed(ref this.{CamelCase(field.Name)}, {i});"); + WriteLine($"return red != null ? new {field.Type}(red, {GetChildIndex(i)}) : default;"); + CloseBlock(); + CloseBlock(); } else if (field.Type == "SyntaxNodeOrTokenList") { From a109c65e97fff33867209411ac576afba71acb4e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:05:32 -0800 Subject: [PATCH 071/141] Update src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs --- .../Source/CSharpSyntaxGenerator/SourceWriter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index 519912bd8ab8b..89ef5492b4a18 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -63,7 +63,6 @@ private void WriteSyntax() WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax"); OpenBlock(); WriteLine(); - this.WriteRedTypes(); CloseBlock(); } From 9f925b4e1f8687e0f105a57e7f64cd79f76ba508 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:05:39 -0800 Subject: [PATCH 072/141] Update src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs --- .../Source/CSharpSyntaxGenerator/SourceWriter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index 89ef5492b4a18..e53448307977b 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -48,7 +48,6 @@ private void WriteInternal() WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax"); OpenBlock(); WriteLine(); - this.WriteGreenTypes(); this.WriteGreenVisitors(); this.WriteGreenRewriter(); From e8ce238019fb4f8a8fd58351245c371f1ccbd4b2 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:09:08 -0800 Subject: [PATCH 073/141] tweak --- .../Syntax.xml.Internal.Generated.cs | 925 +- .../Syntax.xml.Syntax.Generated.cs | 24651 ++++++++-------- .../CSharpSyntaxGenerator/SourceWriter.cs | 9 +- 3 files changed, 13219 insertions(+), 12366 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs index 31eeee3999d58..a071658bfaf1a 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs @@ -7,6 +7,7 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.Syntax.InternalSyntax; using Roslyn.Utilities; +using CoreSyntax = Microsoft.CodeAnalysis.Syntax.InternalSyntax; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax { @@ -332,7 +333,7 @@ internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Gree /// SyntaxToken representing less than. public SyntaxToken LessThanToken => this.lessThanToken; /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arguments)); + public CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); /// SyntaxToken representing greater than. public SyntaxToken GreaterThanToken => this.greaterThanToken; @@ -350,7 +351,7 @@ internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Gree public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); - public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) { if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) { @@ -591,7 +592,7 @@ internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? ran /// TypeSyntax node representing the type of the element of the array. public TypeSyntax ElementType => this.elementType; /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList RankSpecifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.rankSpecifiers); + public CoreSyntax.SyntaxList RankSpecifiers => new(this.rankSpecifiers); internal override GreenNode? GetSlot(int index) => index switch @@ -606,7 +607,7 @@ internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? ran public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); - public ArrayTypeSyntax Update(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList rankSpecifiers) + public ArrayTypeSyntax Update(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) { if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) { @@ -683,7 +684,7 @@ internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, } public SyntaxToken OpenBracketToken => this.openBracketToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Sizes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.sizes)); + public CoreSyntax.SeparatedSyntaxList Sizes => new(new(this.sizes)); public SyntaxToken CloseBracketToken => this.closeBracketToken; internal override GreenNode? GetSlot(int index) @@ -700,7 +701,7 @@ internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); - public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) { if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) { @@ -966,7 +967,7 @@ internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessTha /// SyntaxToken representing the less than token. public SyntaxToken LessThanToken => this.lessThanToken; /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); + public CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// SyntaxToken representing the greater than token. public SyntaxToken GreaterThanToken => this.greaterThanToken; @@ -984,7 +985,7 @@ internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessTha public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); - public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) { if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) { @@ -1152,7 +1153,7 @@ internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, Sy /// SyntaxToken representing open bracket. public SyntaxToken OpenBracketToken => this.openBracketToken; /// SeparatedSyntaxList of calling convention identifiers. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList CallingConventions => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.callingConventions)); + public CoreSyntax.SeparatedSyntaxList CallingConventions => new(new(this.callingConventions)); /// SyntaxToken representing close bracket. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -1170,7 +1171,7 @@ internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, Sy public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) { if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) { @@ -1393,7 +1394,7 @@ internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? /// SyntaxToken representing the open parenthesis. public SyntaxToken OpenParenToken => this.openParenToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Elements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.elements)); + public CoreSyntax.SeparatedSyntaxList Elements => new(new(this.elements)); /// SyntaxToken representing the close parenthesis. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -1411,7 +1412,7 @@ internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); - public TupleTypeSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + public TupleTypeSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) { if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) { @@ -1933,7 +1934,7 @@ internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, Gree /// SyntaxToken representing the open parenthesis. public SyntaxToken OpenParenToken => this.openParenToken; /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arguments)); + public CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); /// SyntaxToken representing the close parenthesis. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -1951,7 +1952,7 @@ internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, Gree public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); - public TupleExpressionSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public TupleExpressionSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) { if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { @@ -4087,7 +4088,7 @@ internal BaseArgumentListSyntax(SyntaxKind kind) } /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments { get; } + public abstract CoreSyntax.SeparatedSyntaxList Arguments { get; } } /// Class which represents the syntax node for the list of arguments. @@ -4146,7 +4147,7 @@ internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNo /// SyntaxToken representing open parenthesis. public SyntaxToken OpenParenToken => this.openParenToken; /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arguments)); + public override CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); /// SyntaxToken representing close parenthesis. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -4164,7 +4165,7 @@ internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNo public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); - public ArgumentListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public ArgumentListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) { if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { @@ -4244,7 +4245,7 @@ internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketTok /// SyntaxToken representing open bracket. public SyntaxToken OpenBracketToken => this.openBracketToken; /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arguments)); + public override CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); /// SyntaxToken representing close bracket. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -4262,7 +4263,7 @@ internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketTok public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); - public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) { if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) { @@ -4755,7 +4756,7 @@ internal AnonymousFunctionExpressionSyntax(SyntaxKind kind) { } - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers { get; } + public abstract CoreSyntax.SyntaxList Modifiers { get; } /// /// BlockSyntax node representing the body of the anonymous function. @@ -4855,7 +4856,7 @@ internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// SyntaxToken representing the delegate keyword. public SyntaxToken DelegateKeyword => this.delegateKeyword; /// List of parameters of the anonymous method expression, or null if there no parameters are specified. @@ -4887,7 +4888,7 @@ internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); - public AnonymousMethodExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax parameterList, BlockSyntax block, ExpressionSyntax expressionBody) + public AnonymousMethodExpressionSyntax Update(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax parameterList, BlockSyntax block, ExpressionSyntax expressionBody) { if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) { @@ -4924,7 +4925,7 @@ internal LambdaExpressionSyntax(SyntaxKind kind) { } - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists { get; } + public abstract CoreSyntax.SyntaxList AttributeLists { get; } /// SyntaxToken representing equals greater than. public abstract SyntaxToken ArrowToken { get; } @@ -5031,8 +5032,8 @@ internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// ParameterSyntax node representing the parameter of the lambda expression. public ParameterSyntax Parameter => this.parameter; /// SyntaxToken representing equals greater than. @@ -5065,7 +5066,7 @@ internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); - public SimpleLambdaExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) + public SimpleLambdaExpressionSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) { @@ -5282,8 +5283,8 @@ internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attribu } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public TypeSyntax? ReturnType => this.returnType; /// ParameterListSyntax node representing the list of parameters for the lambda expression. public ParameterListSyntax ParameterList => this.parameterList; @@ -5318,7 +5319,7 @@ internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attribu public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); - public ParenthesizedLambdaExpressionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) + public ParenthesizedLambdaExpressionSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) { @@ -5398,7 +5399,7 @@ internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken /// SyntaxToken representing the open brace. public SyntaxToken OpenBraceToken => this.openBraceToken; /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Expressions => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.expressions)); + public CoreSyntax.SeparatedSyntaxList Expressions => new(new(this.expressions)); /// SyntaxToken representing the close brace. public SyntaxToken CloseBraceToken => this.closeBraceToken; @@ -5416,7 +5417,7 @@ internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); - public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) { if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) { @@ -5915,7 +5916,7 @@ internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken ne /// SyntaxToken representing the open brace. public SyntaxToken OpenBraceToken => this.openBraceToken; /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Initializers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.initializers)); + public CoreSyntax.SeparatedSyntaxList Initializers => new(new(this.initializers)); /// SyntaxToken representing the close brace. public SyntaxToken CloseBraceToken => this.closeBraceToken; @@ -5934,7 +5935,7 @@ internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken ne public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); - public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) { if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) { @@ -6128,7 +6129,7 @@ internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newK /// SyntaxToken representing the open bracket. public SyntaxToken OpenBracketToken => this.openBracketToken; /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Commas => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.commas); + public CoreSyntax.SyntaxList Commas => new(this.commas); /// SyntaxToken representing the close bracket. public SyntaxToken CloseBracketToken => this.closeBracketToken; /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. @@ -6150,7 +6151,7 @@ internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newK public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); - public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) { if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) { @@ -6425,7 +6426,7 @@ internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToke public SyntaxToken OpenBracketToken => this.openBracketToken; /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Elements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.elements)); + public CoreSyntax.SeparatedSyntaxList Elements => new(new(this.elements)); public SyntaxToken CloseBracketToken => this.closeBracketToken; internal override GreenNode? GetSlot(int index) @@ -6442,7 +6443,7 @@ internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToke public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); - public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) { if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) { @@ -6781,7 +6782,7 @@ internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClaus } } - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Clauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.clauses); + public CoreSyntax.SyntaxList Clauses => new(this.clauses); public SelectOrGroupClauseSyntax SelectOrGroup => this.selectOrGroup; public QueryContinuationSyntax? Continuation => this.continuation; @@ -6799,7 +6800,7 @@ internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClaus public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); - public QueryBodySyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax continuation) + public QueryBodySyntax Update(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax continuation) { if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) { @@ -7397,7 +7398,7 @@ internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenN } public SyntaxToken OrderByKeyword => this.orderByKeyword; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Orderings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.orderings)); + public CoreSyntax.SeparatedSyntaxList Orderings => new(new(this.orderings)); internal override GreenNode? GetSlot(int index) => index switch @@ -7412,7 +7413,7 @@ internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenN public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); - public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList orderings) + public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) { if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) { @@ -7897,7 +7898,7 @@ internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringS /// The first part of an interpolated string, $" or $@" or $""" public SyntaxToken StringStartToken => this.stringStartToken; /// List of parts of the interpolated string, each one is either a literal part or an interpolation. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Contents => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.contents); + public CoreSyntax.SyntaxList Contents => new(this.contents); /// The closing quote of the interpolated string. public SyntaxToken StringEndToken => this.stringEndToken; @@ -7915,7 +7916,7 @@ internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringS public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); - public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList contents, SyntaxToken stringEndToken) + public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) { if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) { @@ -8590,7 +8591,7 @@ internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenTok } public SyntaxToken OpenParenToken => this.openParenToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Subpatterns => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.subpatterns)); + public CoreSyntax.SeparatedSyntaxList Subpatterns => new(new(this.subpatterns)); public SyntaxToken CloseParenToken => this.closeParenToken; internal override GreenNode? GetSlot(int index) @@ -8607,7 +8608,7 @@ internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenTok public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); - public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) { if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) { @@ -8684,7 +8685,7 @@ internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken } public SyntaxToken OpenBraceToken => this.openBraceToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Subpatterns => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.subpatterns)); + public CoreSyntax.SeparatedSyntaxList Subpatterns => new(new(this.subpatterns)); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -8701,7 +8702,7 @@ internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); - public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) { if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) { @@ -9330,7 +9331,7 @@ internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenN } public SyntaxToken OpenBracketToken => this.openBracketToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Patterns => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.patterns)); + public CoreSyntax.SeparatedSyntaxList Patterns => new(new(this.patterns)); public SyntaxToken CloseBracketToken => this.closeBracketToken; public VariableDesignationSyntax? Designation => this.designation; @@ -9349,7 +9350,7 @@ internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenN public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); - public ListPatternSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax designation) + public ListPatternSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax designation) { if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) { @@ -9874,8 +9875,8 @@ internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Green this.statement = statement; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public StatementSyntax Statement => this.statement; internal override GreenNode? GetSlot(int index) @@ -9892,7 +9893,7 @@ internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Green public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); - public GlobalStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, StatementSyntax statement) + public GlobalStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) { @@ -9929,7 +9930,7 @@ internal StatementSyntax(SyntaxKind kind) { } - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists { get; } + public abstract CoreSyntax.SyntaxList AttributeLists { get; } } internal sealed partial class BlockSyntax : StatementSyntax @@ -10000,9 +10001,9 @@ internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ope this.closeBraceToken = closeBraceToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken OpenBraceToken => this.openBraceToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Statements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.statements); + public CoreSyntax.SyntaxList Statements => new(this.statements); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -10020,7 +10021,7 @@ internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ope public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); - public BlockSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + public BlockSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) { if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) { @@ -10199,14 +10200,14 @@ internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public TypeSyntax ReturnType => this.returnType; /// Gets the identifier. public SyntaxToken Identifier => this.identifier; public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public ParameterListSyntax ParameterList => this.parameterList; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); + public CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public BlockSyntax? Body => this.body; public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; /// Gets the optional semicolon token. @@ -10233,7 +10234,7 @@ internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); - public LocalFunctionStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + public LocalFunctionStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { @@ -10357,11 +10358,11 @@ internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLi this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken? AwaitKeyword => this.awaitKeyword; public SyntaxToken? UsingKeyword => this.usingKeyword; /// Gets the modifier list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public VariableDeclarationSyntax Declaration => this.declaration; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -10382,7 +10383,7 @@ internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLi public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); - public LocalDeclarationStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public LocalDeclarationStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { @@ -10452,7 +10453,7 @@ internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? } public TypeSyntax Type => this.type; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Variables => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.variables)); + public CoreSyntax.SeparatedSyntaxList Variables => new(new(this.variables)); internal override GreenNode? GetSlot(int index) => index switch @@ -10467,7 +10468,7 @@ internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); - public VariableDeclarationSyntax Update(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables) + public VariableDeclarationSyntax Update(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) { if (type != this.Type || variables != this.Variables) { @@ -10863,7 +10864,7 @@ internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken ope } public SyntaxToken OpenParenToken => this.openParenToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Variables => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.variables)); + public CoreSyntax.SeparatedSyntaxList Variables => new(new(this.variables)); public SyntaxToken CloseParenToken => this.closeParenToken; internal override GreenNode? GetSlot(int index) @@ -10880,7 +10881,7 @@ internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken ope public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); - public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) { if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) { @@ -10956,7 +10957,7 @@ internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, E this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public ExpressionSyntax Expression => this.expression; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -10974,7 +10975,7 @@ internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, E public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); - public ExpressionStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + public ExpressionStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) { @@ -11043,7 +11044,7 @@ internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken SemicolonToken => this.semicolonToken; internal override GreenNode? GetSlot(int index) @@ -11059,7 +11060,7 @@ internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); - public EmptyStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + public EmptyStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) { @@ -11143,7 +11144,7 @@ internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt this.statement = statement; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// Gets the identifier. public SyntaxToken Identifier => this.identifier; /// Gets a SyntaxToken that represents the colon following the statement's label. @@ -11165,7 +11166,7 @@ internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); - public LabeledStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + public LabeledStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) { if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) { @@ -11276,7 +11277,7 @@ internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// /// Gets a SyntaxToken that represents the goto keyword. /// @@ -11310,7 +11311,7 @@ internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); - public GotoStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + public GotoStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { @@ -11386,7 +11387,7 @@ internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken BreakKeyword => this.breakKeyword; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -11404,7 +11405,7 @@ internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); - public BreakStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + public BreakStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) { @@ -11480,7 +11481,7 @@ internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syn this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken ContinueKeyword => this.continueKeyword; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -11498,7 +11499,7 @@ internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syn public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); - public ContinueStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + public ContinueStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) { @@ -11590,7 +11591,7 @@ internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken ReturnKeyword => this.returnKeyword; public ExpressionSyntax? Expression => this.expression; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -11610,7 +11611,7 @@ internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); - public ReturnStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + public ReturnStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { @@ -11702,7 +11703,7 @@ internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken ThrowKeyword => this.throwKeyword; public ExpressionSyntax? Expression => this.expression; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -11722,7 +11723,7 @@ internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); - public ThrowStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + public ThrowStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { @@ -11821,7 +11822,7 @@ internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken YieldKeyword => this.yieldKeyword; public SyntaxToken ReturnOrBreakKeyword => this.returnOrBreakKeyword; public ExpressionSyntax? Expression => this.expression; @@ -11843,7 +11844,7 @@ internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); - public YieldStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + public YieldStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { @@ -11940,7 +11941,7 @@ internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.statement = statement; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken WhileKeyword => this.whileKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public ExpressionSyntax Condition => this.condition; @@ -11964,7 +11965,7 @@ internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); - public WhileStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + public WhileStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) { if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) { @@ -12075,7 +12076,7 @@ internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTok this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken DoKeyword => this.doKeyword; public StatementSyntax Statement => this.statement; public SyntaxToken WhileKeyword => this.whileKeyword; @@ -12103,7 +12104,7 @@ internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTok public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); - public DoStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + public DoStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) { @@ -12271,15 +12272,15 @@ internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTo this.statement = statement; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken ForKeyword => this.forKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public VariableDeclarationSyntax? Declaration => this.declaration; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Initializers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.initializers)); + public CoreSyntax.SeparatedSyntaxList Initializers => new(new(this.initializers)); public SyntaxToken FirstSemicolonToken => this.firstSemicolonToken; public ExpressionSyntax? Condition => this.condition; public SyntaxToken SecondSemicolonToken => this.secondSemicolonToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Incrementors => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.incrementors)); + public CoreSyntax.SeparatedSyntaxList Incrementors => new(new(this.incrementors)); public SyntaxToken CloseParenToken => this.closeParenToken; public StatementSyntax Statement => this.statement; @@ -12305,7 +12306,7 @@ internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTo public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); - public ForStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + public ForStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) { if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) { @@ -12466,7 +12467,7 @@ internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt this.statement = statement; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public override SyntaxToken? AwaitKeyword => this.awaitKeyword; public override SyntaxToken ForEachKeyword => this.forEachKeyword; public override SyntaxToken OpenParenToken => this.openParenToken; @@ -12499,7 +12500,7 @@ internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); - public ForEachStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public ForEachStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { @@ -12626,7 +12627,7 @@ internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLis this.statement = statement; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public override SyntaxToken? AwaitKeyword => this.awaitKeyword; public override SyntaxToken ForEachKeyword => this.forEachKeyword; public override SyntaxToken OpenParenToken => this.openParenToken; @@ -12662,7 +12663,7 @@ internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLis public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); - public ForEachVariableStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public ForEachVariableStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { @@ -12800,7 +12801,7 @@ internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.statement = statement; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken? AwaitKeyword => this.awaitKeyword; public SyntaxToken UsingKeyword => this.usingKeyword; public SyntaxToken OpenParenToken => this.openParenToken; @@ -12828,7 +12829,7 @@ internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); - public UsingStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public UsingStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { @@ -12925,7 +12926,7 @@ internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.statement = statement; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken FixedKeyword => this.fixedKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public VariableDeclarationSyntax Declaration => this.declaration; @@ -12949,7 +12950,7 @@ internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); - public FixedStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + public FixedStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) { if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) { @@ -13025,7 +13026,7 @@ internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt this.block = block; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken Keyword => this.keyword; public BlockSyntax Block => this.block; @@ -13043,7 +13044,7 @@ internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); - public CheckedStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + public CheckedStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) { if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) { @@ -13119,7 +13120,7 @@ internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta this.block = block; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken UnsafeKeyword => this.unsafeKeyword; public BlockSyntax Block => this.block; @@ -13137,7 +13138,7 @@ internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); - public UnsafeStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + public UnsafeStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) { if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) { @@ -13234,7 +13235,7 @@ internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT this.statement = statement; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken LockKeyword => this.lockKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public ExpressionSyntax Expression => this.expression; @@ -13258,7 +13259,7 @@ internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); - public LockStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public LockStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { @@ -13374,7 +13375,7 @@ internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTok } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// /// Gets a SyntaxToken that represents the if keyword. /// @@ -13418,7 +13419,7 @@ internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTok public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); - public IfStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax @else) + public IfStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax @else) { if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) { @@ -13637,7 +13638,7 @@ internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta this.closeBraceToken = closeBraceToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// /// Gets a SyntaxToken that represents the switch keyword. /// @@ -13661,7 +13662,7 @@ internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta /// /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. /// - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Sections => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.sections); + public CoreSyntax.SyntaxList Sections => new(this.sections); /// /// Gets a SyntaxToken that represents the open braces following the switch sections. /// @@ -13686,7 +13687,7 @@ internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); - public SwitchStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + public SwitchStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) { if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) { @@ -13768,11 +13769,11 @@ internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? stat /// /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. /// - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Labels => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.labels); + public CoreSyntax.SyntaxList Labels => new(this.labels); /// /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. /// - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Statements => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.statements); + public CoreSyntax.SyntaxList Statements => new(this.statements); internal override GreenNode? GetSlot(int index) => index switch @@ -13787,7 +13788,7 @@ internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? stat public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); - public SwitchSectionSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements) + public SwitchSectionSyntax Update(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) { if (labels != this.Labels || statements != this.Statements) { @@ -14180,7 +14181,7 @@ internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpre public ExpressionSyntax GoverningExpression => this.governingExpression; public SyntaxToken SwitchKeyword => this.switchKeyword; public SyntaxToken OpenBraceToken => this.openBraceToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arms => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arms)); + public CoreSyntax.SeparatedSyntaxList Arms => new(new(this.arms)); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -14199,7 +14200,7 @@ internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpre public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); - public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) { if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) { @@ -14410,10 +14411,10 @@ internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTo } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken TryKeyword => this.tryKeyword; public BlockSyntax Block => this.block; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Catches => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.catches); + public CoreSyntax.SyntaxList Catches => new(this.catches); public FinallyClauseSyntax? Finally => this.@finally; internal override GreenNode? GetSlot(int index) @@ -14432,7 +14433,7 @@ internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTo public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); - public TryStatementSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList catches, FinallyClauseSyntax @finally) + public TryStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax @finally) { if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) { @@ -14934,11 +14935,11 @@ internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? u this.endOfFileToken = endOfFileToken; } - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.externs); - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.usings); + public CoreSyntax.SyntaxList Externs => new(this.externs); + public CoreSyntax.SyntaxList Usings => new(this.usings); /// Gets the attribute declaration list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); + public CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public CoreSyntax.SyntaxList Members => new(this.members); public SyntaxToken EndOfFileToken => this.endOfFileToken; internal override GreenNode? GetSlot(int index) @@ -14957,7 +14958,7 @@ internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? u public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); - public CompilationUnitSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken endOfFileToken) + public CompilationUnitSyntax Update(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) { if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) { @@ -15253,10 +15254,10 @@ internal MemberDeclarationSyntax(SyntaxKind kind) } /// Gets the attribute declaration list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists { get; } + public abstract CoreSyntax.SyntaxList AttributeLists { get; } /// Gets the modifier list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers { get; } + public abstract CoreSyntax.SyntaxList Modifiers { get; } } internal abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax @@ -15275,11 +15276,11 @@ internal BaseNamespaceDeclarationSyntax(SyntaxKind kind) public abstract NameSyntax Name { get; } - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Externs { get; } + public abstract CoreSyntax.SyntaxList Externs { get; } - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Usings { get; } + public abstract CoreSyntax.SyntaxList Usings { get; } - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members { get; } + public abstract CoreSyntax.SyntaxList Members { get; } } internal sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax @@ -15428,14 +15429,14 @@ internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; public override NameSyntax Name => this.name; public SyntaxToken OpenBraceToken => this.openBraceToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.externs); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.usings); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Externs => new(this.externs); + public override CoreSyntax.SyntaxList Usings => new(this.usings); + public override CoreSyntax.SyntaxList Members => new(this.members); public SyntaxToken CloseBraceToken => this.closeBraceToken; /// Gets the optional semicolon token. public SyntaxToken? SemicolonToken => this.semicolonToken; @@ -15461,7 +15462,7 @@ internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); - public NamespaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public NamespaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { @@ -15608,14 +15609,14 @@ internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attrib } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; public override NameSyntax Name => this.name; public SyntaxToken SemicolonToken => this.semicolonToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Externs => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.externs); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Usings => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.usings); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Externs => new(this.externs); + public override CoreSyntax.SyntaxList Usings => new(this.usings); + public override CoreSyntax.SyntaxList Members => new(this.members); internal override GreenNode? GetSlot(int index) => index switch @@ -15636,7 +15637,7 @@ internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attrib public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); - public FileScopedNamespaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members) + public FileScopedNamespaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) { @@ -15734,7 +15735,7 @@ internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, Attr /// Gets the optional construct targeted by the attribute. public AttributeTargetSpecifierSyntax? Target => this.target; /// Gets the attribute declaration list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributes)); + public CoreSyntax.SeparatedSyntaxList Attributes => new(new(this.attributes)); /// Gets the close bracket token. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -15753,7 +15754,7 @@ internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, Attr public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); - public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) { if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) { @@ -15999,7 +16000,7 @@ internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken /// Gets the open paren token. public SyntaxToken OpenParenToken => this.openParenToken; /// Gets the arguments syntax list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Arguments => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.arguments)); + public CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); /// Gets the close paren token. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -16017,7 +16018,7 @@ internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); - public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) { if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { @@ -16280,7 +16281,7 @@ internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Gre /// Gets the < token. public SyntaxToken LessThanToken => this.lessThanToken; /// Gets the parameter list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); + public CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// Gets the > token. public SyntaxToken GreaterThanToken => this.greaterThanToken; @@ -16298,7 +16299,7 @@ internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Gre public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); - public TypeParameterListSyntax Update(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public TypeParameterListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) { if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) { @@ -16385,7 +16386,7 @@ internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT } /// Gets the attribute declaration list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); public SyntaxToken? VarianceKeyword => this.varianceKeyword; /// Gets the identifier. public SyntaxToken Identifier => this.identifier; @@ -16404,7 +16405,7 @@ internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); - public TypeParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) + public TypeParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) { if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) { @@ -16478,10 +16479,10 @@ internal TypeDeclarationSyntax(SyntaxKind kind) public abstract ParameterListSyntax? ParameterList { get; } /// Gets the type constraint list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses { get; } + public abstract CoreSyntax.SyntaxList ConstraintClauses { get; } /// Gets the member declarations. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members { get; } + public abstract CoreSyntax.SyntaxList Members { get; } } /// Class type declaration syntax. @@ -16681,17 +16682,17 @@ internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the class keyword token. public override SyntaxToken Keyword => this.keyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Members => new(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -16718,7 +16719,7 @@ internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); - public ClassDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public ClassDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { @@ -16939,17 +16940,17 @@ internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the struct keyword token. public override SyntaxToken Keyword => this.keyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Members => new(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -16976,7 +16977,7 @@ internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); - public StructDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public StructDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { @@ -17197,17 +17198,17 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the interface keyword token. public override SyntaxToken Keyword => this.keyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Members => new(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -17234,7 +17235,7 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); - public InterfaceDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public InterfaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { @@ -17470,17 +17471,17 @@ internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override SyntaxToken Keyword => this.keyword; public SyntaxToken? ClassOrStructKeyword => this.classOrStructKeyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList Members => new(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -17508,7 +17509,7 @@ internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); - public RecordDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public RecordDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { @@ -17681,15 +17682,15 @@ internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Green } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the enum keyword token. public SyntaxToken EnumKeyword => this.enumKeyword; public override SyntaxToken Identifier => this.identifier; public override BaseListSyntax? BaseList => this.baseList; public override SyntaxToken? OpenBraceToken => this.openBraceToken; /// Gets the members declaration list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Members => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.members)); + public CoreSyntax.SeparatedSyntaxList Members => new(new(this.members)); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; /// Gets the optional semicolon token. public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -17714,7 +17715,7 @@ internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Green public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); - public EnumDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax baseList, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public EnumDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax baseList, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { @@ -17860,8 +17861,8 @@ internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the "delegate" keyword. public SyntaxToken DelegateKeyword => this.delegateKeyword; /// Gets the return type. @@ -17872,7 +17873,7 @@ internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G /// Gets the parameter list. public ParameterListSyntax ParameterList => this.parameterList; /// Gets the constraint clause list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); + public CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); /// Gets the semicolon token. public SyntaxToken SemicolonToken => this.semicolonToken; @@ -17896,7 +17897,7 @@ internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); - public DelegateDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) + public DelegateDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) { @@ -17997,8 +17998,8 @@ internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the identifier. public SyntaxToken Identifier => this.identifier; public EqualsValueClauseSyntax? EqualsValue => this.equalsValue; @@ -18018,7 +18019,7 @@ internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); - public EnumMemberDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax equalsValue) + public EnumMemberDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax equalsValue) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) { @@ -18091,7 +18092,7 @@ internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? type /// Gets the colon token. public SyntaxToken ColonToken => this.colonToken; /// Gets the base type references. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Types => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.types)); + public CoreSyntax.SeparatedSyntaxList Types => new(new(this.types)); internal override GreenNode? GetSlot(int index) => index switch @@ -18106,7 +18107,7 @@ internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? type public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); - public BaseListSyntax Update(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList types) + public BaseListSyntax Update(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) { if (colonToken != this.ColonToken || types != this.Types) { @@ -18351,7 +18352,7 @@ internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereK /// Gets the colon token. public SyntaxToken ColonToken => this.colonToken; /// Gets the constraints list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Constraints => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraints)); + public CoreSyntax.SeparatedSyntaxList Constraints => new(new(this.constraints)); internal override GreenNode? GetSlot(int index) => index switch @@ -18368,7 +18369,7 @@ internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereK public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); - public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList constraints) + public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) { if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) { @@ -18798,8 +18799,8 @@ internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override VariableDeclarationSyntax Declaration => this.declaration; public override SyntaxToken SemicolonToken => this.semicolonToken; @@ -18818,7 +18819,7 @@ internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); - public FieldDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public FieldDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { @@ -18917,8 +18918,8 @@ internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, this.semicolonToken = semicolonToken; } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public SyntaxToken EventKeyword => this.eventKeyword; public override VariableDeclarationSyntax Declaration => this.declaration; public override SyntaxToken SemicolonToken => this.semicolonToken; @@ -18939,7 +18940,7 @@ internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); - public EventFieldDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public EventFieldDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { @@ -19235,8 +19236,8 @@ internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the return type syntax. public TypeSyntax ReturnType => this.returnType; public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -19245,7 +19246,7 @@ internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax ParameterList => this.parameterList; /// Gets the constraint clause list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList ConstraintClauses => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.constraintClauses); + public CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); public override BlockSyntax? Body => this.body; public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; /// Gets the optional semicolon token. @@ -19273,7 +19274,7 @@ internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); - public MethodDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + public MethodDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { @@ -19460,8 +19461,8 @@ internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the return type. public TypeSyntax ReturnType => this.returnType; public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -19499,7 +19500,7 @@ internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); - public OperatorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + public OperatorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { @@ -19686,8 +19687,8 @@ internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attribu } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the "implicit" or "explicit" token. public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -19725,7 +19726,7 @@ internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attribu public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); - public ConversionOperatorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + public ConversionOperatorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { @@ -19882,8 +19883,8 @@ internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the identifier. public SyntaxToken Identifier => this.identifier; public override ParameterListSyntax ParameterList => this.parameterList; @@ -19912,7 +19913,7 @@ internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); - public ConstructorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax initializer, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + public ConstructorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax initializer, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { @@ -20148,8 +20149,8 @@ internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the tilde token. public SyntaxToken TildeToken => this.tildeToken; /// Gets the identifier. @@ -20179,7 +20180,7 @@ internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); - public DestructorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + public DestructorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { @@ -20373,8 +20374,8 @@ internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override TypeSyntax Type => this.type; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; /// Gets the identifier. @@ -20404,7 +20405,7 @@ internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); - public PropertyDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, EqualsValueClauseSyntax initializer, SyntaxToken semicolonToken) + public PropertyDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, EqualsValueClauseSyntax initializer, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) { @@ -20628,8 +20629,8 @@ internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public SyntaxToken EventKeyword => this.eventKeyword; public override TypeSyntax Type => this.type; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -20657,7 +20658,7 @@ internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); - public EventDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, SyntaxToken semicolonToken) + public EventDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) { @@ -20820,8 +20821,8 @@ internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gr } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override TypeSyntax Type => this.type; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; public SyntaxToken ThisKeyword => this.thisKeyword; @@ -20851,7 +20852,7 @@ internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gr public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); - public IndexerDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + public IndexerDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { @@ -20928,7 +20929,7 @@ internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNo } public SyntaxToken OpenBraceToken => this.openBraceToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Accessors => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.accessors); + public CoreSyntax.SyntaxList Accessors => new(this.accessors); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -20945,7 +20946,7 @@ internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNo public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); - public AccessorListSyntax Update(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + public AccessorListSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) { if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) { @@ -21079,9 +21080,9 @@ internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G } /// Gets the attribute declaration list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// Gets the modifier list. - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public CoreSyntax.SyntaxList Modifiers => new(this.modifiers); /// Gets the keyword token, or identifier if an erroneous accessor declaration. public SyntaxToken Keyword => this.keyword; /// Gets the optional body block which may be empty, but it is null if there are no braces. @@ -21108,7 +21109,7 @@ internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); - public AccessorDeclarationSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + public AccessorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { @@ -21146,7 +21147,7 @@ internal BaseParameterListSyntax(SyntaxKind kind) } /// Gets the parameter list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters { get; } + public abstract CoreSyntax.SeparatedSyntaxList Parameters { get; } } /// Parameter list syntax. @@ -21204,7 +21205,7 @@ internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenN /// Gets the open paren token. public SyntaxToken OpenParenToken => this.openParenToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// Gets the close paren token. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -21222,7 +21223,7 @@ internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenN public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); - public ParameterListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public ParameterListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) { if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) { @@ -21301,7 +21302,7 @@ internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketTo /// Gets the open bracket token. public SyntaxToken OpenBracketToken => this.openBracketToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// Gets the close bracket token. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -21319,7 +21320,7 @@ internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketTo public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); - public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) { if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) { @@ -21357,10 +21358,10 @@ internal BaseParameterSyntax(SyntaxKind kind) } /// Gets the attribute declaration list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists { get; } + public abstract CoreSyntax.SyntaxList AttributeLists { get; } /// Gets the modifier list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers { get; } + public abstract CoreSyntax.SyntaxList Modifiers { get; } public abstract TypeSyntax? Type { get; } } @@ -21460,9 +21461,9 @@ internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? } /// Gets the attribute declaration list. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// Gets the modifier list. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override TypeSyntax? Type => this.type; /// Gets the identifier. public SyntaxToken Identifier => this.identifier; @@ -21484,7 +21485,7 @@ internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); - public ParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, SyntaxToken identifier, EqualsValueClauseSyntax @default) + public ParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, SyntaxToken identifier, EqualsValueClauseSyntax @default) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) { @@ -21571,9 +21572,9 @@ internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLis } /// Gets the attribute declaration list. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); /// Gets the modifier list. - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public override TypeSyntax Type => this.type; internal override GreenNode? GetSlot(int index) @@ -21590,7 +21591,7 @@ internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLis public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); - public FunctionPointerParameterSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type) + public FunctionPointerParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) { @@ -21684,8 +21685,8 @@ internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree } } - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList AttributeLists => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributeLists); - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Modifiers => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); public TypeSyntax? Type => this.type; internal override GreenNode? GetSlot(int index) @@ -21702,7 +21703,7 @@ internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); - public IncompleteMemberSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type) + public IncompleteMemberSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) { if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) { @@ -21764,7 +21765,7 @@ internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) } } - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Tokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.tokens); + public CoreSyntax.SyntaxList Tokens => new(this.tokens); internal override GreenNode? GetSlot(int index) => index == 0 ? this.tokens : null; @@ -21774,7 +21775,7 @@ internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); - public SkippedTokensTriviaSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList tokens) + public SkippedTokensTriviaSyntax Update(CoreSyntax.SyntaxList tokens) { if (tokens != this.Tokens) { @@ -21843,7 +21844,7 @@ internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, S this.endOfComment = endOfComment; } - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Content => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.content); + public CoreSyntax.SyntaxList Content => new(this.content); public SyntaxToken EndOfComment => this.endOfComment; internal override GreenNode? GetSlot(int index) @@ -21859,7 +21860,7 @@ internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, S public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); - public DocumentationCommentTriviaSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, SyntaxToken endOfComment) + public DocumentationCommentTriviaSyntax Update(CoreSyntax.SyntaxList content, SyntaxToken endOfComment) { if (content != this.Content || endOfComment != this.EndOfComment) { @@ -22522,7 +22523,7 @@ internal BaseCrefParameterListSyntax(SyntaxKind kind) } /// Gets the parameter list. - public abstract Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters { get; } + public abstract CoreSyntax.SeparatedSyntaxList Parameters { get; } } /// @@ -22582,7 +22583,7 @@ internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, Gr /// Gets the open paren token. public SyntaxToken OpenParenToken => this.openParenToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// Gets the close paren token. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -22600,7 +22601,7 @@ internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, Gr public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); - public CrefParameterListSyntax Update(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public CrefParameterListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) { if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) { @@ -22681,7 +22682,7 @@ internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBrack /// Gets the open bracket token. public SyntaxToken OpenBracketToken => this.openBracketToken; - public override Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList Parameters => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); /// Gets the close bracket token. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -22699,7 +22700,7 @@ internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBrack public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); - public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) { if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) { @@ -22898,7 +22899,7 @@ internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, Gr } public XmlElementStartTagSyntax StartTag => this.startTag; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Content => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.content); + public CoreSyntax.SyntaxList Content => new(this.content); public XmlElementEndTagSyntax EndTag => this.endTag; internal override GreenNode? GetSlot(int index) @@ -22915,7 +22916,7 @@ internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, Gr public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); - public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) { if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) { @@ -23000,7 +23001,7 @@ internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Xm public SyntaxToken LessThanToken => this.lessThanToken; public XmlNameSyntax Name => this.name; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributes); + public CoreSyntax.SyntaxList Attributes => new(this.attributes); public SyntaxToken GreaterThanToken => this.greaterThanToken; internal override GreenNode? GetSlot(int index) @@ -23018,7 +23019,7 @@ internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Xm public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); - public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) + public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) { if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) { @@ -23188,7 +23189,7 @@ internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNa public SyntaxToken LessThanToken => this.lessThanToken; public XmlNameSyntax Name => this.name; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList Attributes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.attributes); + public CoreSyntax.SyntaxList Attributes => new(this.attributes); public SyntaxToken SlashGreaterThanToken => this.slashGreaterThanToken; internal override GreenNode? GetSlot(int index) @@ -23206,7 +23207,7 @@ internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNa public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); - public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) + public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) { if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) { @@ -23481,7 +23482,7 @@ internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken public override XmlNameSyntax Name => this.name; public override SyntaxToken EqualsToken => this.equalsToken; public override SyntaxToken StartQuoteToken => this.startQuoteToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); public override SyntaxToken EndQuoteToken => this.endQuoteToken; internal override GreenNode? GetSlot(int index) @@ -23500,7 +23501,7 @@ internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); - public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) + public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) { if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) { @@ -23768,7 +23769,7 @@ internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) } } - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); internal override GreenNode? GetSlot(int index) => index == 0 ? this.textTokens : null; @@ -23778,7 +23779,7 @@ internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); - public XmlTextSyntax Update(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens) + public XmlTextSyntax Update(CoreSyntax.SyntaxList textTokens) { if (textTokens != this.TextTokens) { @@ -23855,7 +23856,7 @@ internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, Gre } public SyntaxToken StartCDataToken => this.startCDataToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); public SyntaxToken EndCDataToken => this.endCDataToken; internal override GreenNode? GetSlot(int index) @@ -23872,7 +23873,7 @@ internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, Gre public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); - public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) { if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) { @@ -23957,7 +23958,7 @@ internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProces public SyntaxToken StartProcessingInstructionToken => this.startProcessingInstructionToken; public XmlNameSyntax Name => this.name; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); public SyntaxToken EndProcessingInstructionToken => this.endProcessingInstructionToken; internal override GreenNode? GetSlot(int index) @@ -23975,7 +23976,7 @@ internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProces public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); - public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) { if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) { @@ -24052,7 +24053,7 @@ internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusM } public SyntaxToken LessThanExclamationMinusMinusToken => this.lessThanExclamationMinusMinusToken; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList TextTokens => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); public SyntaxToken MinusMinusGreaterThanToken => this.minusMinusGreaterThanToken; internal override GreenNode? GetSlot(int index) @@ -24069,7 +24070,7 @@ internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusM public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); - public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) + public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) { if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) { @@ -25659,7 +25660,7 @@ internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashTok public SyntaxToken PragmaKeyword => this.pragmaKeyword; public SyntaxToken WarningKeyword => this.warningKeyword; public SyntaxToken DisableOrRestoreKeyword => this.disableOrRestoreKeyword; - public Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList ErrorCodes => new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList(new Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(this.errorCodes)); + public CoreSyntax.SeparatedSyntaxList ErrorCodes => new(new(this.errorCodes)); public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; public override bool IsActive => this.isActive; @@ -25680,7 +25681,7 @@ internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashTok public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); - public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) { if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) { @@ -27527,7 +27528,7 @@ public GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyn return result; } - public TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + public TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) { #if DEBUG if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); @@ -27610,7 +27611,7 @@ public PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) return result; } - public ArrayTypeSyntax ArrayType(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList rankSpecifiers) + public ArrayTypeSyntax ArrayType(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) { #if DEBUG if (elementType == null) throw new ArgumentNullException(nameof(elementType)); @@ -27629,7 +27630,7 @@ public ArrayTypeSyntax ArrayType(TypeSyntax elementType, Microsoft.CodeAnalysis. return result; } - public ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + public ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -27685,7 +27686,7 @@ public FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList, this.context); } - public FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) { #if DEBUG if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); @@ -27732,7 +27733,7 @@ public FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(S return result; } - public FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + public FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -27795,7 +27796,7 @@ public NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken quest return result; } - public TupleTypeSyntax TupleType(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + public TupleTypeSyntax TupleType(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -27939,7 +27940,7 @@ public ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openPar return result; } - public TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -28587,7 +28588,7 @@ public ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax ex return result; } - public ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -28609,7 +28610,7 @@ public ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, Microsoft.Cod return result; } - public BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + public BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -28735,7 +28736,7 @@ public CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSynta return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression, this.context); } - public AnonymousMethodExpressionSyntax AnonymousMethodExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + public AnonymousMethodExpressionSyntax AnonymousMethodExpression(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) { #if DEBUG if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); @@ -28746,7 +28747,7 @@ public AnonymousMethodExpressionSyntax AnonymousMethodExpression(Microsoft.CodeA return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody, this.context); } - public SimpleLambdaExpressionSyntax SimpleLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + public SimpleLambdaExpressionSyntax SimpleLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) { #if DEBUG if (parameter == null) throw new ArgumentNullException(nameof(parameter)); @@ -28778,7 +28779,7 @@ public RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSynta return result; } - public ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + public ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) { #if DEBUG if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); @@ -28789,7 +28790,7 @@ public ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(Microso return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody, this.context); } - public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) { switch (kind) { @@ -28893,7 +28894,7 @@ public AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(Nam return result; } - public AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + public AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) { #if DEBUG if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); @@ -28928,7 +28929,7 @@ public ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyw return result; } - public ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + public ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) { #if DEBUG if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); @@ -28979,7 +28980,7 @@ public ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCr return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer, this.context); } - public CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + public CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -29061,7 +29062,7 @@ public QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryB return result; } - public QueryBodySyntax QueryBody(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + public QueryBodySyntax QueryBody(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) { #if DEBUG if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); @@ -29174,7 +29175,7 @@ public WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax return result; } - public OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList orderings) + public OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) { #if DEBUG if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword)); @@ -29307,7 +29308,7 @@ public OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken o return result; } - public InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList contents, SyntaxToken stringEndToken) + public InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) { #if DEBUG if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken)); @@ -29474,7 +29475,7 @@ public RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatte return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation, this.context); } - public PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + public PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -29496,7 +29497,7 @@ public PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openPar return result; } - public PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + public PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) { #if DEBUG if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); @@ -29682,7 +29683,7 @@ public UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax return result; } - public ListPatternSyntax ListPattern(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + public ListPatternSyntax ListPattern(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -29788,7 +29789,7 @@ public InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken col return result; } - public GlobalStatementSyntax GlobalStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, StatementSyntax statement) + public GlobalStatementSyntax GlobalStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) { #if DEBUG if (statement == null) throw new ArgumentNullException(nameof(statement)); @@ -29807,7 +29808,7 @@ public GlobalStatementSyntax GlobalStatement(Microsoft.CodeAnalysis.Syntax.Inter return result; } - public BlockSyntax Block(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + public BlockSyntax Block(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) { #if DEBUG if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); @@ -29819,7 +29820,7 @@ public BlockSyntax Block(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken, this.context); } - public LocalFunctionStatementSyntax LocalFunctionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public LocalFunctionStatementSyntax LocalFunctionStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (returnType == null) throw new ArgumentNullException(nameof(returnType)); @@ -29840,7 +29841,7 @@ public LocalFunctionStatementSyntax LocalFunctionStatement(Microsoft.CodeAnalysi return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); } - public LocalDeclarationStatementSyntax LocalDeclarationStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public LocalDeclarationStatementSyntax LocalDeclarationStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { #if DEBUG if (awaitKeyword != null) @@ -29869,7 +29870,7 @@ public LocalDeclarationStatementSyntax LocalDeclarationStatement(Microsoft.CodeA return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken, this.context); } - public VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables) + public VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) { #if DEBUG if (type == null) throw new ArgumentNullException(nameof(type)); @@ -29969,7 +29970,7 @@ public DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) return result; } - public ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + public ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -29991,7 +29992,7 @@ public ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(S return result; } - public ExpressionStatementSyntax ExpressionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + public ExpressionStatementSyntax ExpressionStatement(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) { #if DEBUG if (expression == null) throw new ArgumentNullException(nameof(expression)); @@ -30012,7 +30013,7 @@ public ExpressionStatementSyntax ExpressionStatement(Microsoft.CodeAnalysis.Synt return result; } - public EmptyStatementSyntax EmptyStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + public EmptyStatementSyntax EmptyStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) { #if DEBUG if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); @@ -30032,7 +30033,7 @@ public EmptyStatementSyntax EmptyStatement(Microsoft.CodeAnalysis.Syntax.Interna return result; } - public LabeledStatementSyntax LabeledStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + public LabeledStatementSyntax LabeledStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) { #if DEBUG if (identifier == null) throw new ArgumentNullException(nameof(identifier)); @@ -30045,7 +30046,7 @@ public LabeledStatementSyntax LabeledStatement(Microsoft.CodeAnalysis.Syntax.Int return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement, this.context); } - public GotoStatementSyntax GotoStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { switch (kind) { @@ -30074,7 +30075,7 @@ public GotoStatementSyntax GotoStatement(SyntaxKind kind, Microsoft.CodeAnalysis return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken, this.context); } - public BreakStatementSyntax BreakStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + public BreakStatementSyntax BreakStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) { #if DEBUG if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword)); @@ -30096,7 +30097,7 @@ public BreakStatementSyntax BreakStatement(Microsoft.CodeAnalysis.Syntax.Interna return result; } - public ContinueStatementSyntax ContinueStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + public ContinueStatementSyntax ContinueStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) { #if DEBUG if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword)); @@ -30118,7 +30119,7 @@ public ContinueStatementSyntax ContinueStatement(Microsoft.CodeAnalysis.Syntax.I return result; } - public ReturnStatementSyntax ReturnStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public ReturnStatementSyntax ReturnStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { #if DEBUG if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword)); @@ -30130,7 +30131,7 @@ public ReturnStatementSyntax ReturnStatement(Microsoft.CodeAnalysis.Syntax.Inter return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken, this.context); } - public ThrowStatementSyntax ThrowStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public ThrowStatementSyntax ThrowStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { #if DEBUG if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); @@ -30142,7 +30143,7 @@ public ThrowStatementSyntax ThrowStatement(Microsoft.CodeAnalysis.Syntax.Interna return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken, this.context); } - public YieldStatementSyntax YieldStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { switch (kind) { @@ -30167,7 +30168,7 @@ public YieldStatementSyntax YieldStatement(SyntaxKind kind, Microsoft.CodeAnalys return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken, this.context); } - public WhileStatementSyntax WhileStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + public WhileStatementSyntax WhileStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); @@ -30183,7 +30184,7 @@ public WhileStatementSyntax WhileStatement(Microsoft.CodeAnalysis.Syntax.Interna return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement, this.context); } - public DoStatementSyntax DoStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + public DoStatementSyntax DoStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) { #if DEBUG if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword)); @@ -30203,7 +30204,7 @@ public DoStatementSyntax DoStatement(Microsoft.CodeAnalysis.Syntax.InternalSynta return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.context); } - public ForStatementSyntax ForStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + public ForStatementSyntax ForStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword)); @@ -30222,7 +30223,7 @@ public ForStatementSyntax ForStatement(Microsoft.CodeAnalysis.Syntax.InternalSyn return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement, this.context); } - public ForEachStatementSyntax ForEachStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public ForEachStatementSyntax ForEachStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (awaitKeyword != null) @@ -30252,7 +30253,7 @@ public ForEachStatementSyntax ForEachStatement(Microsoft.CodeAnalysis.Syntax.Int return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement, this.context); } - public ForEachVariableStatementSyntax ForEachVariableStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public ForEachVariableStatementSyntax ForEachVariableStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (awaitKeyword != null) @@ -30280,7 +30281,7 @@ public ForEachVariableStatementSyntax ForEachVariableStatement(Microsoft.CodeAna return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement, this.context); } - public UsingStatementSyntax UsingStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + public UsingStatementSyntax UsingStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (awaitKeyword != null) @@ -30304,7 +30305,7 @@ public UsingStatementSyntax UsingStatement(Microsoft.CodeAnalysis.Syntax.Interna return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement, this.context); } - public FixedStatementSyntax FixedStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + public FixedStatementSyntax FixedStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword)); @@ -30320,7 +30321,7 @@ public FixedStatementSyntax FixedStatement(Microsoft.CodeAnalysis.Syntax.Interna return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement, this.context); } - public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) { switch (kind) { @@ -30352,7 +30353,7 @@ public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, Microsoft.CodeAn return result; } - public UnsafeStatementSyntax UnsafeStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + public UnsafeStatementSyntax UnsafeStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) { #if DEBUG if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword)); @@ -30373,7 +30374,7 @@ public UnsafeStatementSyntax UnsafeStatement(Microsoft.CodeAnalysis.Syntax.Inter return result; } - public LockStatementSyntax LockStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public LockStatementSyntax LockStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword)); @@ -30389,7 +30390,7 @@ public LockStatementSyntax LockStatement(Microsoft.CodeAnalysis.Syntax.InternalS return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement, this.context); } - public IfStatementSyntax IfStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + public IfStatementSyntax IfStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) { #if DEBUG if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); @@ -30426,7 +30427,7 @@ public ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax stat return result; } - public SwitchStatementSyntax SwitchStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + public SwitchStatementSyntax SwitchStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) { #if DEBUG if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); @@ -30459,7 +30460,7 @@ public SwitchStatementSyntax SwitchStatement(Microsoft.CodeAnalysis.Syntax.Inter return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken, this.context); } - public SwitchSectionSyntax SwitchSection(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements) + public SwitchSectionSyntax SwitchSection(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) { #if DEBUG #endif @@ -30532,7 +30533,7 @@ public DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxTo return result; } - public SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + public SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) { #if DEBUG if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); @@ -30559,7 +30560,7 @@ public SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, When return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression, this.context); } - public TryStatementSyntax TryStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) + public TryStatementSyntax TryStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) { #if DEBUG if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword)); @@ -30639,7 +30640,7 @@ public FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax return result; } - public CompilationUnitSyntax CompilationUnit(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken endOfFileToken) + public CompilationUnitSyntax CompilationUnit(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) { #if DEBUG if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken)); @@ -30705,7 +30706,7 @@ public UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxTok return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken, this.context); } - public NamespaceDeclarationSyntax NamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) + public NamespaceDeclarationSyntax NamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) { #if DEBUG if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); @@ -30729,7 +30730,7 @@ public NamespaceDeclarationSyntax NamespaceDeclaration(Microsoft.CodeAnalysis.Sy return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken, this.context); } - public FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members) + public FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) { #if DEBUG if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); @@ -30742,7 +30743,7 @@ public FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(Micro return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node, this.context); } - public AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + public AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -30794,7 +30795,7 @@ public AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? a return result; } - public AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -30856,7 +30857,7 @@ public NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equals return result; } - public TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) { #if DEBUG if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); @@ -30878,7 +30879,7 @@ public TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, Micr return result; } - public TypeParameterSyntax TypeParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) + public TypeParameterSyntax TypeParameter(CoreSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) { #if DEBUG if (varianceKeyword != null) @@ -30908,7 +30909,7 @@ public TypeParameterSyntax TypeParameter(Microsoft.CodeAnalysis.Syntax.InternalS return result; } - public ClassDeclarationSyntax ClassDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public ClassDeclarationSyntax ClassDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) { #if DEBUG if (keyword == null) throw new ArgumentNullException(nameof(keyword)); @@ -30947,7 +30948,7 @@ public ClassDeclarationSyntax ClassDeclaration(Microsoft.CodeAnalysis.Syntax.Int return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); } - public StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public StructDeclarationSyntax StructDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) { #if DEBUG if (keyword == null) throw new ArgumentNullException(nameof(keyword)); @@ -30986,7 +30987,7 @@ public StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.Syntax.I return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); } - public InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public InterfaceDeclarationSyntax InterfaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) { #if DEBUG if (keyword == null) throw new ArgumentNullException(nameof(keyword)); @@ -31025,7 +31026,7 @@ public InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Sy return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); } - public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) { switch (kind) { @@ -31079,7 +31080,7 @@ public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.Code return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); } - public EnumDeclarationSyntax EnumDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public EnumDeclarationSyntax EnumDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) { #if DEBUG if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword)); @@ -31118,7 +31119,7 @@ public EnumDeclarationSyntax EnumDeclaration(Microsoft.CodeAnalysis.Syntax.Inter return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); } - public DelegateDeclarationSyntax DelegateDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) + public DelegateDeclarationSyntax DelegateDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) { #if DEBUG if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); @@ -31134,7 +31135,7 @@ public DelegateDeclarationSyntax DelegateDeclaration(Microsoft.CodeAnalysis.Synt return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken, this.context); } - public EnumMemberDeclarationSyntax EnumMemberDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + public EnumMemberDeclarationSyntax EnumMemberDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) { #if DEBUG if (identifier == null) throw new ArgumentNullException(nameof(identifier)); @@ -31144,7 +31145,7 @@ public EnumMemberDeclarationSyntax EnumMemberDeclaration(Microsoft.CodeAnalysis. return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue, this.context); } - public BaseListSyntax BaseList(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList types) + public BaseListSyntax BaseList(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) { #if DEBUG if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); @@ -31203,7 +31204,7 @@ public PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax ty return result; } - public TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList constraints) + public TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) { #if DEBUG if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); @@ -31319,7 +31320,7 @@ public DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) return result; } - public FieldDeclarationSyntax FieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public FieldDeclarationSyntax FieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { #if DEBUG if (declaration == null) throw new ArgumentNullException(nameof(declaration)); @@ -31330,7 +31331,7 @@ public FieldDeclarationSyntax FieldDeclaration(Microsoft.CodeAnalysis.Syntax.Int return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken, this.context); } - public EventFieldDeclarationSyntax EventFieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public EventFieldDeclarationSyntax EventFieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { #if DEBUG if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); @@ -31364,7 +31365,7 @@ public ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax na return result; } - public MethodDeclarationSyntax MethodDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public MethodDeclarationSyntax MethodDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (returnType == null) throw new ArgumentNullException(nameof(returnType)); @@ -31385,7 +31386,7 @@ public MethodDeclarationSyntax MethodDeclaration(Microsoft.CodeAnalysis.Syntax.I return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); } - public OperatorDeclarationSyntax OperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public OperatorDeclarationSyntax OperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (returnType == null) throw new ArgumentNullException(nameof(returnType)); @@ -31444,7 +31445,7 @@ public OperatorDeclarationSyntax OperatorDeclaration(Microsoft.CodeAnalysis.Synt return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken, this.context); } - public ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); @@ -31481,7 +31482,7 @@ public ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(Microso return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken, this.context); } - public ConstructorDeclarationSyntax ConstructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public ConstructorDeclarationSyntax ConstructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (identifier == null) throw new ArgumentNullException(nameof(identifier)); @@ -31535,7 +31536,7 @@ public ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, Synt return result; } - public DestructorDeclarationSyntax DestructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public DestructorDeclarationSyntax DestructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken)); @@ -31557,7 +31558,7 @@ public DestructorDeclarationSyntax DestructorDeclaration(Microsoft.CodeAnalysis. return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken, this.context); } - public PropertyDeclarationSyntax PropertyDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) + public PropertyDeclarationSyntax PropertyDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) { #if DEBUG if (type == null) throw new ArgumentNullException(nameof(type)); @@ -31598,7 +31599,7 @@ public ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, return result; } - public EventDeclarationSyntax EventDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) + public EventDeclarationSyntax EventDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) { #if DEBUG if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); @@ -31620,7 +31621,7 @@ public EventDeclarationSyntax EventDeclaration(Microsoft.CodeAnalysis.Syntax.Int return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, this.context); } - public IndexerDeclarationSyntax IndexerDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public IndexerDeclarationSyntax IndexerDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (type == null) throw new ArgumentNullException(nameof(type)); @@ -31641,7 +31642,7 @@ public IndexerDeclarationSyntax IndexerDeclaration(Microsoft.CodeAnalysis.Syntax return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, this.context); } - public AccessorListSyntax AccessorList(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + public AccessorListSyntax AccessorList(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) { #if DEBUG if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); @@ -31663,7 +31664,7 @@ public AccessorListSyntax AccessorList(SyntaxToken openBraceToken, Microsoft.Cod return result; } - public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { switch (kind) { @@ -31701,7 +31702,7 @@ public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, Microsoft. return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken, this.context); } - public ParameterListSyntax ParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public ParameterListSyntax ParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -31723,7 +31724,7 @@ public ParameterListSyntax ParameterList(SyntaxToken openParenToken, Microsoft.C return result; } - public BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + public BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -31745,7 +31746,7 @@ public BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBrack return result; } - public ParameterSyntax Parameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) + public ParameterSyntax Parameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) { #if DEBUG if (identifier == null) throw new ArgumentNullException(nameof(identifier)); @@ -31760,7 +31761,7 @@ public ParameterSyntax Parameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.Sy return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default, this.context); } - public FunctionPointerParameterSyntax FunctionPointerParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type) + public FunctionPointerParameterSyntax FunctionPointerParameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) { #if DEBUG if (type == null) throw new ArgumentNullException(nameof(type)); @@ -31779,7 +31780,7 @@ public FunctionPointerParameterSyntax FunctionPointerParameter(Microsoft.CodeAna return result; } - public IncompleteMemberSyntax IncompleteMember(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? type) + public IncompleteMemberSyntax IncompleteMember(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type) { #if DEBUG #endif @@ -31787,7 +31788,7 @@ public IncompleteMemberSyntax IncompleteMember(Microsoft.CodeAnalysis.Syntax.Int return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type, this.context); } - public SkippedTokensTriviaSyntax SkippedTokensTrivia(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList tokens) + public SkippedTokensTriviaSyntax SkippedTokensTrivia(CoreSyntax.SyntaxList tokens) { #if DEBUG #endif @@ -31795,7 +31796,7 @@ public SkippedTokensTriviaSyntax SkippedTokensTrivia(Microsoft.CodeAnalysis.Synt return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node, this.context); } - public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, SyntaxToken endOfComment) + public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList content, SyntaxToken endOfComment) { switch (kind) { @@ -31965,7 +31966,7 @@ public ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxTok return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters, this.context); } - public CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -31987,7 +31988,7 @@ public CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, Mic return result; } - public CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + public CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -32048,7 +32049,7 @@ public CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, SyntaxToke return result; } - public XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + public XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) { #if DEBUG if (startTag == null) throw new ArgumentNullException(nameof(startTag)); @@ -32068,7 +32069,7 @@ public XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, Microsoft. return result; } - public XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) + public XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) { #if DEBUG if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); @@ -32104,7 +32105,7 @@ public XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, X return result; } - public XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) + public XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) { #if DEBUG if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); @@ -32159,7 +32160,7 @@ public XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) return result; } - public XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) + public XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) { #if DEBUG if (name == null) throw new ArgumentNullException(nameof(name)); @@ -32236,7 +32237,7 @@ public XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken e return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken, this.context); } - public XmlTextSyntax XmlText(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens) + public XmlTextSyntax XmlText(CoreSyntax.SyntaxList textTokens) { #if DEBUG #endif @@ -32254,7 +32255,7 @@ public XmlTextSyntax XmlText(Microsoft.CodeAnalysis.Syntax.InternalSyntax.Syntax return result; } - public XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + public XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) { #if DEBUG if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken)); @@ -32276,7 +32277,7 @@ public XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, Micros return result; } - public XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + public XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) { #if DEBUG if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken)); @@ -32289,7 +32290,7 @@ public XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken start return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken, this.context); } - public XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) + public XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) { #if DEBUG if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken)); @@ -32548,7 +32549,7 @@ public LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashTok return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive, this.context); } - public PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + public PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) { #if DEBUG if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); @@ -32743,7 +32744,7 @@ public static GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgument return result; } - public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) { #if DEBUG if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); @@ -32826,7 +32827,7 @@ public static PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) return result; } - public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList rankSpecifiers) + public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) { #if DEBUG if (elementType == null) throw new ArgumentNullException(nameof(elementType)); @@ -32845,7 +32846,7 @@ public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, Microsoft.CodeAn return result; } - public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -32901,7 +32902,7 @@ public static FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegate return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList); } - public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) { #if DEBUG if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); @@ -32948,7 +32949,7 @@ public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConve return result; } - public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -33011,7 +33012,7 @@ public static NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToke return result; } - public static TupleTypeSyntax TupleType(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + public static TupleTypeSyntax TupleType(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -33155,7 +33156,7 @@ public static ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken return result; } - public static TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public static TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -33803,7 +33804,7 @@ public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSy return result; } - public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -33825,7 +33826,7 @@ public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, Micros return result; } - public static BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + public static BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -33951,7 +33952,7 @@ public static CastExpressionSyntax CastExpression(SyntaxToken openParenToken, Ty return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression); } - public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) { #if DEBUG if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); @@ -33962,7 +33963,7 @@ public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(Microsof return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody); } - public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) { #if DEBUG if (parameter == null) throw new ArgumentNullException(nameof(parameter)); @@ -33994,7 +33995,7 @@ public static RefExpressionSyntax RefExpression(SyntaxToken refKeyword, Expressi return result; } - public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) { #if DEBUG if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); @@ -34005,7 +34006,7 @@ public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression( return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody); } - public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) { switch (kind) { @@ -34109,7 +34110,7 @@ public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclara return result; } - public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) { #if DEBUG if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); @@ -34144,7 +34145,7 @@ public static ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken return result; } - public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) { #if DEBUG if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); @@ -34195,7 +34196,7 @@ public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAlloc return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer); } - public static CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + public static CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -34277,7 +34278,7 @@ public static QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, return result; } - public static QueryBodySyntax QueryBody(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + public static QueryBodySyntax QueryBody(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) { #if DEBUG if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); @@ -34390,7 +34391,7 @@ public static WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, Expression return result; } - public static OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList orderings) + public static OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) { #if DEBUG if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword)); @@ -34523,7 +34524,7 @@ public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(Syntax return result; } - public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList contents, SyntaxToken stringEndToken) + public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) { #if DEBUG if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken)); @@ -34690,7 +34691,7 @@ public static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, Position return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation); } - public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -34712,7 +34713,7 @@ public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken return result; } - public static PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + public static PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) { #if DEBUG if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); @@ -34898,7 +34899,7 @@ public static UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, Pattern return result; } - public static ListPatternSyntax ListPattern(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + public static ListPatternSyntax ListPattern(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -35004,7 +35005,7 @@ public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxTo return result; } - public static GlobalStatementSyntax GlobalStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, StatementSyntax statement) + public static GlobalStatementSyntax GlobalStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) { #if DEBUG if (statement == null) throw new ArgumentNullException(nameof(statement)); @@ -35023,7 +35024,7 @@ public static GlobalStatementSyntax GlobalStatement(Microsoft.CodeAnalysis.Synta return result; } - public static BlockSyntax Block(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + public static BlockSyntax Block(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) { #if DEBUG if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); @@ -35035,7 +35036,7 @@ public static BlockSyntax Block(Microsoft.CodeAnalysis.Syntax.InternalSyntax.Syn return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken); } - public static LocalFunctionStatementSyntax LocalFunctionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public static LocalFunctionStatementSyntax LocalFunctionStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (returnType == null) throw new ArgumentNullException(nameof(returnType)); @@ -35056,7 +35057,7 @@ public static LocalFunctionStatementSyntax LocalFunctionStatement(Microsoft.Code return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); } - public static LocalDeclarationStatementSyntax LocalDeclarationStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public static LocalDeclarationStatementSyntax LocalDeclarationStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { #if DEBUG if (awaitKeyword != null) @@ -35085,7 +35086,7 @@ public static LocalDeclarationStatementSyntax LocalDeclarationStatement(Microsof return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken); } - public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables) + public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) { #if DEBUG if (type == null) throw new ArgumentNullException(nameof(type)); @@ -35185,7 +35186,7 @@ public static DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscore return result; } - public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -35207,7 +35208,7 @@ public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesign return result; } - public static ExpressionStatementSyntax ExpressionStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + public static ExpressionStatementSyntax ExpressionStatement(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) { #if DEBUG if (expression == null) throw new ArgumentNullException(nameof(expression)); @@ -35228,7 +35229,7 @@ public static ExpressionStatementSyntax ExpressionStatement(Microsoft.CodeAnalys return result; } - public static EmptyStatementSyntax EmptyStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + public static EmptyStatementSyntax EmptyStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) { #if DEBUG if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); @@ -35248,7 +35249,7 @@ public static EmptyStatementSyntax EmptyStatement(Microsoft.CodeAnalysis.Syntax. return result; } - public static LabeledStatementSyntax LabeledStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + public static LabeledStatementSyntax LabeledStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) { #if DEBUG if (identifier == null) throw new ArgumentNullException(nameof(identifier)); @@ -35261,7 +35262,7 @@ public static LabeledStatementSyntax LabeledStatement(Microsoft.CodeAnalysis.Syn return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement); } - public static GotoStatementSyntax GotoStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public static GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { switch (kind) { @@ -35290,7 +35291,7 @@ public static GotoStatementSyntax GotoStatement(SyntaxKind kind, Microsoft.CodeA return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); } - public static BreakStatementSyntax BreakStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + public static BreakStatementSyntax BreakStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) { #if DEBUG if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword)); @@ -35312,7 +35313,7 @@ public static BreakStatementSyntax BreakStatement(Microsoft.CodeAnalysis.Syntax. return result; } - public static ContinueStatementSyntax ContinueStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + public static ContinueStatementSyntax ContinueStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) { #if DEBUG if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword)); @@ -35334,7 +35335,7 @@ public static ContinueStatementSyntax ContinueStatement(Microsoft.CodeAnalysis.S return result; } - public static ReturnStatementSyntax ReturnStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public static ReturnStatementSyntax ReturnStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { #if DEBUG if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword)); @@ -35346,7 +35347,7 @@ public static ReturnStatementSyntax ReturnStatement(Microsoft.CodeAnalysis.Synta return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken); } - public static ThrowStatementSyntax ThrowStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public static ThrowStatementSyntax ThrowStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { #if DEBUG if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); @@ -35358,7 +35359,7 @@ public static ThrowStatementSyntax ThrowStatement(Microsoft.CodeAnalysis.Syntax. return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken); } - public static YieldStatementSyntax YieldStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public static YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { switch (kind) { @@ -35383,7 +35384,7 @@ public static YieldStatementSyntax YieldStatement(SyntaxKind kind, Microsoft.Cod return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); } - public static WhileStatementSyntax WhileStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + public static WhileStatementSyntax WhileStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); @@ -35399,7 +35400,7 @@ public static WhileStatementSyntax WhileStatement(Microsoft.CodeAnalysis.Syntax. return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement); } - public static DoStatementSyntax DoStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + public static DoStatementSyntax DoStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) { #if DEBUG if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword)); @@ -35419,7 +35420,7 @@ public static DoStatementSyntax DoStatement(Microsoft.CodeAnalysis.Syntax.Intern return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); } - public static ForStatementSyntax ForStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + public static ForStatementSyntax ForStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword)); @@ -35438,7 +35439,7 @@ public static ForStatementSyntax ForStatement(Microsoft.CodeAnalysis.Syntax.Inte return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement); } - public static ForEachStatementSyntax ForEachStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public static ForEachStatementSyntax ForEachStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (awaitKeyword != null) @@ -35468,7 +35469,7 @@ public static ForEachStatementSyntax ForEachStatement(Microsoft.CodeAnalysis.Syn return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); } - public static ForEachVariableStatementSyntax ForEachVariableStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public static ForEachVariableStatementSyntax ForEachVariableStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (awaitKeyword != null) @@ -35496,7 +35497,7 @@ public static ForEachVariableStatementSyntax ForEachVariableStatement(Microsoft. return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); } - public static UsingStatementSyntax UsingStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + public static UsingStatementSyntax UsingStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (awaitKeyword != null) @@ -35520,7 +35521,7 @@ public static UsingStatementSyntax UsingStatement(Microsoft.CodeAnalysis.Syntax. return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); } - public static FixedStatementSyntax FixedStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + public static FixedStatementSyntax FixedStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword)); @@ -35536,7 +35537,7 @@ public static FixedStatementSyntax FixedStatement(Microsoft.CodeAnalysis.Syntax. return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement); } - public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) { switch (kind) { @@ -35568,7 +35569,7 @@ public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, Microsoft return result; } - public static UnsafeStatementSyntax UnsafeStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + public static UnsafeStatementSyntax UnsafeStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) { #if DEBUG if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword)); @@ -35589,7 +35590,7 @@ public static UnsafeStatementSyntax UnsafeStatement(Microsoft.CodeAnalysis.Synta return result; } - public static LockStatementSyntax LockStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public static LockStatementSyntax LockStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { #if DEBUG if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword)); @@ -35605,7 +35606,7 @@ public static LockStatementSyntax LockStatement(Microsoft.CodeAnalysis.Syntax.In return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement); } - public static IfStatementSyntax IfStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + public static IfStatementSyntax IfStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) { #if DEBUG if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); @@ -35642,7 +35643,7 @@ public static ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSynt return result; } - public static SwitchStatementSyntax SwitchStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + public static SwitchStatementSyntax SwitchStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) { #if DEBUG if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); @@ -35675,7 +35676,7 @@ public static SwitchStatementSyntax SwitchStatement(Microsoft.CodeAnalysis.Synta return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken); } - public static SwitchSectionSyntax SwitchSection(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList labels, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList statements) + public static SwitchSectionSyntax SwitchSection(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) { #if DEBUG #endif @@ -35748,7 +35749,7 @@ public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, S return result; } - public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) { #if DEBUG if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); @@ -35775,7 +35776,7 @@ public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax patter return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression); } - public static TryStatementSyntax TryStatement(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) + public static TryStatementSyntax TryStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) { #if DEBUG if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword)); @@ -35855,7 +35856,7 @@ public static FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, Bloc return result; } - public static CompilationUnitSyntax CompilationUnit(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken endOfFileToken) + public static CompilationUnitSyntax CompilationUnit(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) { #if DEBUG if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken)); @@ -35921,7 +35922,7 @@ public static UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, Sy return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); } - public static NamespaceDeclarationSyntax NamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) + public static NamespaceDeclarationSyntax NamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) { #if DEBUG if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); @@ -35945,7 +35946,7 @@ public static NamespaceDeclarationSyntax NamespaceDeclaration(Microsoft.CodeAnal return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken); } - public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList externs, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList usings, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members) + public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) { #if DEBUG if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); @@ -35958,7 +35959,7 @@ public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaratio return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node); } - public static AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + public static AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -36010,7 +36011,7 @@ public static AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSy return result; } - public static AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public static AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -36072,7 +36073,7 @@ public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken return result; } - public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) { #if DEBUG if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); @@ -36094,7 +36095,7 @@ public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToke return result; } - public static TypeParameterSyntax TypeParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) + public static TypeParameterSyntax TypeParameter(CoreSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) { #if DEBUG if (varianceKeyword != null) @@ -36124,7 +36125,7 @@ public static TypeParameterSyntax TypeParameter(Microsoft.CodeAnalysis.Syntax.In return result; } - public static ClassDeclarationSyntax ClassDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public static ClassDeclarationSyntax ClassDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) { #if DEBUG if (keyword == null) throw new ArgumentNullException(nameof(keyword)); @@ -36163,7 +36164,7 @@ public static ClassDeclarationSyntax ClassDeclaration(Microsoft.CodeAnalysis.Syn return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); } - public static StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public static StructDeclarationSyntax StructDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) { #if DEBUG if (keyword == null) throw new ArgumentNullException(nameof(keyword)); @@ -36202,7 +36203,7 @@ public static StructDeclarationSyntax StructDeclaration(Microsoft.CodeAnalysis.S return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); } - public static InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public static InterfaceDeclarationSyntax InterfaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) { #if DEBUG if (keyword == null) throw new ArgumentNullException(nameof(keyword)); @@ -36241,7 +36242,7 @@ public static InterfaceDeclarationSyntax InterfaceDeclaration(Microsoft.CodeAnal return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); } - public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) { switch (kind) { @@ -36295,7 +36296,7 @@ public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, Microso return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); } - public static EnumDeclarationSyntax EnumDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public static EnumDeclarationSyntax EnumDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) { #if DEBUG if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword)); @@ -36334,7 +36335,7 @@ public static EnumDeclarationSyntax EnumDeclaration(Microsoft.CodeAnalysis.Synta return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken); } - public static DelegateDeclarationSyntax DelegateDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) + public static DelegateDeclarationSyntax DelegateDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) { #if DEBUG if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); @@ -36350,7 +36351,7 @@ public static DelegateDeclarationSyntax DelegateDeclaration(Microsoft.CodeAnalys return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken); } - public static EnumMemberDeclarationSyntax EnumMemberDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + public static EnumMemberDeclarationSyntax EnumMemberDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) { #if DEBUG if (identifier == null) throw new ArgumentNullException(nameof(identifier)); @@ -36360,7 +36361,7 @@ public static EnumMemberDeclarationSyntax EnumMemberDeclaration(Microsoft.CodeAn return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue); } - public static BaseListSyntax BaseList(SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList types) + public static BaseListSyntax BaseList(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) { #if DEBUG if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); @@ -36419,7 +36420,7 @@ public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSy return result; } - public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList constraints) + public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) { #if DEBUG if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); @@ -36535,7 +36536,7 @@ public static DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeywo return result; } - public static FieldDeclarationSyntax FieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public static FieldDeclarationSyntax FieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { #if DEBUG if (declaration == null) throw new ArgumentNullException(nameof(declaration)); @@ -36546,7 +36547,7 @@ public static FieldDeclarationSyntax FieldDeclaration(Microsoft.CodeAnalysis.Syn return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken); } - public static EventFieldDeclarationSyntax EventFieldDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public static EventFieldDeclarationSyntax EventFieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { #if DEBUG if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); @@ -36580,7 +36581,7 @@ public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSy return result; } - public static MethodDeclarationSyntax MethodDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public static MethodDeclarationSyntax MethodDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (returnType == null) throw new ArgumentNullException(nameof(returnType)); @@ -36601,7 +36602,7 @@ public static MethodDeclarationSyntax MethodDeclaration(Microsoft.CodeAnalysis.S return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); } - public static OperatorDeclarationSyntax OperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public static OperatorDeclarationSyntax OperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (returnType == null) throw new ArgumentNullException(nameof(returnType)); @@ -36660,7 +36661,7 @@ public static OperatorDeclarationSyntax OperatorDeclaration(Microsoft.CodeAnalys return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); } - public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); @@ -36697,7 +36698,7 @@ public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration( return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); } - public static ConstructorDeclarationSyntax ConstructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public static ConstructorDeclarationSyntax ConstructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (identifier == null) throw new ArgumentNullException(nameof(identifier)); @@ -36751,7 +36752,7 @@ public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kin return result; } - public static DestructorDeclarationSyntax DestructorDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public static DestructorDeclarationSyntax DestructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken)); @@ -36773,7 +36774,7 @@ public static DestructorDeclarationSyntax DestructorDeclaration(Microsoft.CodeAn return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); } - public static PropertyDeclarationSyntax PropertyDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) + public static PropertyDeclarationSyntax PropertyDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) { #if DEBUG if (type == null) throw new ArgumentNullException(nameof(type)); @@ -36814,7 +36815,7 @@ public static ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arro return result; } - public static EventDeclarationSyntax EventDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) + public static EventDeclarationSyntax EventDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) { #if DEBUG if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); @@ -36836,7 +36837,7 @@ public static EventDeclarationSyntax EventDeclaration(Microsoft.CodeAnalysis.Syn return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); } - public static IndexerDeclarationSyntax IndexerDeclaration(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public static IndexerDeclarationSyntax IndexerDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { #if DEBUG if (type == null) throw new ArgumentNullException(nameof(type)); @@ -36857,7 +36858,7 @@ public static IndexerDeclarationSyntax IndexerDeclaration(Microsoft.CodeAnalysis return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); } - public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) { #if DEBUG if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); @@ -36879,7 +36880,7 @@ public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, Micros return result; } - public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) { switch (kind) { @@ -36917,7 +36918,7 @@ public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, Mic return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken); } - public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -36939,7 +36940,7 @@ public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, Micr return result; } - public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -36961,7 +36962,7 @@ public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken op return result; } - public static ParameterSyntax Parameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) + public static ParameterSyntax Parameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) { #if DEBUG if (identifier == null) throw new ArgumentNullException(nameof(identifier)); @@ -36976,7 +36977,7 @@ public static ParameterSyntax Parameter(Microsoft.CodeAnalysis.Syntax.InternalSy return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default); } - public static FunctionPointerParameterSyntax FunctionPointerParameter(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax type) + public static FunctionPointerParameterSyntax FunctionPointerParameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) { #if DEBUG if (type == null) throw new ArgumentNullException(nameof(type)); @@ -36995,7 +36996,7 @@ public static FunctionPointerParameterSyntax FunctionPointerParameter(Microsoft. return result; } - public static IncompleteMemberSyntax IncompleteMember(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributeLists, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList modifiers, TypeSyntax? type) + public static IncompleteMemberSyntax IncompleteMember(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type) { #if DEBUG #endif @@ -37003,7 +37004,7 @@ public static IncompleteMemberSyntax IncompleteMember(Microsoft.CodeAnalysis.Syn return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type); } - public static SkippedTokensTriviaSyntax SkippedTokensTrivia(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList tokens) + public static SkippedTokensTriviaSyntax SkippedTokensTrivia(CoreSyntax.SyntaxList tokens) { #if DEBUG #endif @@ -37011,7 +37012,7 @@ public static SkippedTokensTriviaSyntax SkippedTokensTrivia(Microsoft.CodeAnalys return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node); } - public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, SyntaxToken endOfComment) + public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList content, SyntaxToken endOfComment) { switch (kind) { @@ -37181,7 +37182,7 @@ public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(Sy return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); } - public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) { #if DEBUG if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); @@ -37203,7 +37204,7 @@ public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenTok return result; } - public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) { #if DEBUG if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); @@ -37264,7 +37265,7 @@ public static CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, Syn return result; } - public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) { #if DEBUG if (startTag == null) throw new ArgumentNullException(nameof(startTag)); @@ -37284,7 +37285,7 @@ public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, Mic return result; } - public static XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) + public static XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) { #if DEBUG if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); @@ -37320,7 +37321,7 @@ public static XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashT return result; } - public static XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) + public static XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) { #if DEBUG if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); @@ -37375,7 +37376,7 @@ public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonTok return result; } - public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) + public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) { #if DEBUG if (name == null) throw new ArgumentNullException(nameof(name)); @@ -37452,7 +37453,7 @@ public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, Syntax return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken); } - public static XmlTextSyntax XmlText(Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens) + public static XmlTextSyntax XmlText(CoreSyntax.SyntaxList textTokens) { #if DEBUG #endif @@ -37470,7 +37471,7 @@ public static XmlTextSyntax XmlText(Microsoft.CodeAnalysis.Syntax.InternalSyntax return result; } - public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) { #if DEBUG if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken)); @@ -37492,7 +37493,7 @@ public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, return result; } - public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) { #if DEBUG if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken)); @@ -37505,7 +37506,7 @@ public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToke return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken); } - public static XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) + public static XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) { #if DEBUG if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken)); @@ -37764,7 +37765,7 @@ public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); } - public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, Microsoft.CodeAnalysis.Syntax.InternalSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) { #if DEBUG if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs index 89bb63e7e5015..9130442f9c4a8 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs @@ -9,15480 +9,16329 @@ using Roslyn.Utilities; using CoreSyntax = Microsoft.CodeAnalysis.Syntax.InternalSyntax; -namespace Microsoft.CodeAnalysis.CSharp.Syntax; - - -/// Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. -public abstract partial class NameSyntax : TypeSyntax -{ - internal NameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } -} - -/// Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. -public abstract partial class SimpleNameSyntax : NameSyntax +namespace Microsoft.CodeAnalysis.CSharp.Syntax { - internal SimpleNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// SyntaxToken representing the identifier of the simple name. - public abstract SyntaxToken Identifier { get; } - public SimpleNameSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); - internal abstract SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier); -} -/// Class which represents the syntax node for identifier name. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class IdentifierNameSyntax : SimpleNameSyntax -{ - internal IdentifierNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. + public abstract partial class NameSyntax : TypeSyntax { + internal NameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } } - /// SyntaxToken representing the keyword for the kind of the identifier name. - public override SyntaxToken Identifier => new(this, ((InternalSyntax.IdentifierNameSyntax)this.Green).identifier, Position, 0); - - internal override SyntaxNode? GetNodeSlot(int index) => null; - - internal override SyntaxNode? GetCachedSlot(int index) => null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIdentifierName(this); - - public IdentifierNameSyntax Update(SyntaxToken identifier) + /// Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. + public abstract partial class SimpleNameSyntax : NameSyntax { - if (identifier != this.Identifier) + internal SimpleNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.IdentifierName(identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; + /// SyntaxToken representing the identifier of the simple name. + public abstract SyntaxToken Identifier { get; } + public SimpleNameSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); + internal abstract SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier); } - internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new IdentifierNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); -} + /// Class which represents the syntax node for identifier name. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class IdentifierNameSyntax : SimpleNameSyntax + { -/// Class which represents the syntax node for qualified name. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class QualifiedNameSyntax : NameSyntax -{ - private NameSyntax? left; - private SimpleNameSyntax? right; + internal IdentifierNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal QualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the keyword for the kind of the identifier name. + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.IdentifierNameSyntax)this.Green).identifier, Position, 0); - /// NameSyntax node representing the name on the left side of the dot token of the qualified name. - public NameSyntax Left => GetRedAtZero(ref this.left)!; + internal override SyntaxNode? GetNodeSlot(int index) => null; - /// SyntaxToken representing the dot. - public SyntaxToken DotToken => new(this, ((InternalSyntax.QualifiedNameSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. - public SimpleNameSyntax Right => GetRed(ref this.right, 2)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIdentifierName(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public IdentifierNameSyntax Update(SyntaxToken identifier) { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + if (identifier != this.Identifier) + { + var newNode = SyntaxFactory.IdentifierName(identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.left, - 2 => this.right, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedName(this); + internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new IdentifierNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); + } - public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + /// Class which represents the syntax node for qualified name. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class QualifiedNameSyntax : NameSyntax { - if (left != this.Left || dotToken != this.DotToken || right != this.Right) + private NameSyntax? left; + private SimpleNameSyntax? right; + + internal QualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.QualifiedName(left, dotToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// NameSyntax node representing the name on the left side of the dot token of the qualified name. + public NameSyntax Left => GetRedAtZero(ref this.left)!; - public QualifiedNameSyntax WithLeft(NameSyntax left) => Update(left, this.DotToken, this.Right); - public QualifiedNameSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Left, dotToken, this.Right); - public QualifiedNameSyntax WithRight(SimpleNameSyntax right) => Update(this.Left, this.DotToken, right); -} + /// SyntaxToken representing the dot. + public SyntaxToken DotToken => new SyntaxToken(this, ((InternalSyntax.QualifiedNameSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); -/// Class which represents the syntax node for generic name. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class GenericNameSyntax : SimpleNameSyntax -{ - private TypeArgumentListSyntax? typeArgumentList; + /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. + public SimpleNameSyntax Right => GetRed(ref this.right, 2)!; - internal GenericNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - /// SyntaxToken representing the name of the identifier of the generic name. - public override SyntaxToken Identifier => new(this, ((InternalSyntax.GenericNameSyntax)this.Green).identifier, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.left, + 2 => this.right, + _ => null, + }; - /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. - public TypeArgumentListSyntax TypeArgumentList => GetRed(ref this.typeArgumentList, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedName(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.typeArgumentList, 1)! : null; + public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + { + if (left != this.Left || dotToken != this.DotToken || right != this.Right) + { + var newNode = SyntaxFactory.QualifiedName(left, dotToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.typeArgumentList : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGenericName(this); + public QualifiedNameSyntax WithLeft(NameSyntax left) => Update(left, this.DotToken, this.Right); + public QualifiedNameSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Left, dotToken, this.Right); + public QualifiedNameSyntax WithRight(SimpleNameSyntax right) => Update(this.Left, this.DotToken, right); + } - public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + /// Class which represents the syntax node for generic name. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class GenericNameSyntax : SimpleNameSyntax { - if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList) + private TypeArgumentListSyntax? typeArgumentList; + + internal GenericNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new GenericNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.TypeArgumentList); - public GenericNameSyntax WithTypeArgumentList(TypeArgumentListSyntax typeArgumentList) => Update(this.Identifier, typeArgumentList); + /// SyntaxToken representing the name of the identifier of the generic name. + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.GenericNameSyntax)this.Green).identifier, Position, 0); - public GenericNameSyntax AddTypeArgumentListArguments(params TypeSyntax[] items) => WithTypeArgumentList(this.TypeArgumentList.WithArguments(this.TypeArgumentList.Arguments.AddRange(items))); -} - -/// Class which represents the syntax node for type argument list. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode -{ - private SyntaxNode? arguments; + /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. + public TypeArgumentListSyntax TypeArgumentList => GetRed(ref this.typeArgumentList, 1)!; - internal TypeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.typeArgumentList, 1)! : null; - /// SyntaxToken representing less than. - public SyntaxToken LessThanToken => new(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.typeArgumentList : null; - /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. - public SeparatedSyntaxList Arguments => GetRed(ref this.arguments, 1) is { } red ? new(red, GetChildIndex(1)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGenericName(this); - /// SyntaxToken representing greater than. - public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + { + if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList) + { + var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new GenericNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.TypeArgumentList); + public GenericNameSyntax WithTypeArgumentList(TypeArgumentListSyntax typeArgumentList) => Update(this.Identifier, typeArgumentList); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeArgumentList(this); + public GenericNameSyntax AddTypeArgumentListArguments(params TypeSyntax[] items) => WithTypeArgumentList(this.TypeArgumentList.WithArguments(this.TypeArgumentList.Arguments.AddRange(items))); + } - public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + /// Class which represents the syntax node for type argument list. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode { - if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) + private SyntaxNode? arguments; + + internal TypeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public TypeArgumentListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Arguments, this.GreaterThanToken); - public TypeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.LessThanToken, arguments, this.GreaterThanToken); - public TypeArgumentListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Arguments, greaterThanToken); - - public TypeArgumentListSyntax AddArguments(params TypeSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); -} + /// SyntaxToken representing less than. + public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); -/// Class which represents the syntax node for alias qualified name. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AliasQualifiedNameSyntax : NameSyntax -{ - private IdentifierNameSyntax? alias; - private SimpleNameSyntax? name; + /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. + public SeparatedSyntaxList Arguments + { + get + { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - internal AliasQualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing greater than. + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - /// IdentifierNameSyntax node representing the name of the alias - public IdentifierNameSyntax Alias => GetRedAtZero(ref this.alias)!; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - /// SyntaxToken representing colon colon. - public SyntaxToken ColonColonToken => new(this, ((InternalSyntax.AliasQualifiedNameSyntax)this.Green).colonColonToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - /// SimpleNameSyntax node representing the name that is being alias qualified. - public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeArgumentList(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) { - 0 => GetRedAtZero(ref this.alias)!, - 2 => GetRed(ref this.name, 2)!, - _ => null, - }; + if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) + { + var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.alias, - 2 => this.name, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAliasQualifiedName(this); + public TypeArgumentListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Arguments, this.GreaterThanToken); + public TypeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.LessThanToken, arguments, this.GreaterThanToken); + public TypeArgumentListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Arguments, greaterThanToken); - public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + public TypeArgumentListSyntax AddArguments(params TypeSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); + } + + /// Class which represents the syntax node for alias qualified name. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AliasQualifiedNameSyntax : NameSyntax { - if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name) + private IdentifierNameSyntax? alias; + private SimpleNameSyntax? name; + + internal AliasQualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// IdentifierNameSyntax node representing the name of the alias + public IdentifierNameSyntax Alias => GetRedAtZero(ref this.alias)!; - public AliasQualifiedNameSyntax WithAlias(IdentifierNameSyntax alias) => Update(alias, this.ColonColonToken, this.Name); - public AliasQualifiedNameSyntax WithColonColonToken(SyntaxToken colonColonToken) => Update(this.Alias, colonColonToken, this.Name); - public AliasQualifiedNameSyntax WithName(SimpleNameSyntax name) => Update(this.Alias, this.ColonColonToken, name); -} + /// SyntaxToken representing colon colon. + public SyntaxToken ColonColonToken => new SyntaxToken(this, ((InternalSyntax.AliasQualifiedNameSyntax)this.Green).colonColonToken, GetChildPosition(1), GetChildIndex(1)); -/// Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. -public abstract partial class TypeSyntax : ExpressionSyntax -{ - internal TypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } -} + /// SimpleNameSyntax node representing the name that is being alias qualified. + public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; -/// Class which represents the syntax node for predefined types. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class PredefinedTypeSyntax : TypeSyntax -{ + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.alias)!, + 2 => GetRed(ref this.name, 2)!, + _ => null, + }; - internal PredefinedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.alias, + 2 => this.name, + _ => null, + }; - /// SyntaxToken which represents the keyword corresponding to the predefined type. - public SyntaxToken Keyword => new(this, ((InternalSyntax.PredefinedTypeSyntax)this.Green).keyword, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAliasQualifiedName(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + { + if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name) + { + var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPredefinedType(this); + public AliasQualifiedNameSyntax WithAlias(IdentifierNameSyntax alias) => Update(alias, this.ColonColonToken, this.Name); + public AliasQualifiedNameSyntax WithColonColonToken(SyntaxToken colonColonToken) => Update(this.Alias, colonColonToken, this.Name); + public AliasQualifiedNameSyntax WithName(SimpleNameSyntax name) => Update(this.Alias, this.ColonColonToken, name); + } - public PredefinedTypeSyntax Update(SyntaxToken keyword) + /// Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. + public abstract partial class TypeSyntax : ExpressionSyntax { - if (keyword != this.Keyword) + internal TypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.PredefinedType(keyword); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - - return this; } - public PredefinedTypeSyntax WithKeyword(SyntaxToken keyword) => Update(keyword); -} - -/// Class which represents the syntax node for the array type. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ArrayTypeSyntax : TypeSyntax -{ - private TypeSyntax? elementType; - private SyntaxNode? rankSpecifiers; - - internal ArrayTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Class which represents the syntax node for predefined types. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class PredefinedTypeSyntax : TypeSyntax { - } - /// TypeSyntax node representing the type of the element of the array. - public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; + internal PredefinedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. - public SyntaxList RankSpecifiers => new(GetRed(ref this.rankSpecifiers, 1)); + /// SyntaxToken which represents the keyword corresponding to the predefined type. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.PredefinedTypeSyntax)this.Green).keyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.elementType)!, - 1 => GetRed(ref this.rankSpecifiers, 1)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.elementType, - 1 => this.rankSpecifiers, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPredefinedType(this); - public ArrayTypeSyntax Update(TypeSyntax elementType, SyntaxList rankSpecifiers) - { - if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) + public PredefinedTypeSyntax Update(SyntaxToken keyword) { - var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (keyword != this.Keyword) + { + var newNode = SyntaxFactory.PredefinedType(keyword); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public PredefinedTypeSyntax WithKeyword(SyntaxToken keyword) => Update(keyword); } - public ArrayTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.RankSpecifiers); - public ArrayTypeSyntax WithRankSpecifiers(SyntaxList rankSpecifiers) => Update(this.ElementType, rankSpecifiers); - - public ArrayTypeSyntax AddRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithRankSpecifiers(this.RankSpecifiers.AddRange(items)); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode -{ - private SyntaxNode? sizes; - - internal ArrayRankSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Class which represents the syntax node for the array type. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ArrayTypeSyntax : TypeSyntax { - } + private TypeSyntax? elementType; + private SyntaxNode? rankSpecifiers; - public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); + internal ArrayTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SeparatedSyntaxList Sizes => GetRed(ref this.sizes, 1) is { } red ? new(red, GetChildIndex(1)) : default; + /// TypeSyntax node representing the type of the element of the array. + public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. + public SyntaxList RankSpecifiers => new SyntaxList(GetRed(ref this.rankSpecifiers, 1)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.sizes, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.elementType)!, + 1 => GetRed(ref this.rankSpecifiers, 1)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.sizes : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.elementType, + 1 => this.rankSpecifiers, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayRankSpecifier(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayType(this); - public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) + public ArrayTypeSyntax Update(TypeSyntax elementType, SyntaxList rankSpecifiers) { - var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) + { + var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; - } + public ArrayTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.RankSpecifiers); + public ArrayTypeSyntax WithRankSpecifiers(SyntaxList rankSpecifiers) => Update(this.ElementType, rankSpecifiers); - public ArrayRankSpecifierSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Sizes, this.CloseBracketToken); - public ArrayRankSpecifierSyntax WithSizes(SeparatedSyntaxList sizes) => Update(this.OpenBracketToken, sizes, this.CloseBracketToken); - public ArrayRankSpecifierSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Sizes, closeBracketToken); + public ArrayTypeSyntax AddRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithRankSpecifiers(this.RankSpecifiers.AddRange(items)); + } - public ArrayRankSpecifierSyntax AddSizes(params ExpressionSyntax[] items) => WithSizes(this.Sizes.AddRange(items)); -} + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode + { + private SyntaxNode? sizes; -/// Class which represents the syntax node for pointer type. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class PointerTypeSyntax : TypeSyntax -{ - private TypeSyntax? elementType; + internal ArrayRankSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal PointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); - /// TypeSyntax node that represents the element type of the pointer. - public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; + public SeparatedSyntaxList Sizes + { + get + { + var red = GetRed(ref this.sizes, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => new(this, ((InternalSyntax.PointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.sizes, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.sizes : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPointerType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayRankSpecifier(this); - public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) - { - if (elementType != this.ElementType || asteriskToken != this.AsteriskToken) + public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) { - var newNode = SyntaxFactory.PointerType(elementType, asteriskToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) + { + var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public ArrayRankSpecifierSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Sizes, this.CloseBracketToken); + public ArrayRankSpecifierSyntax WithSizes(SeparatedSyntaxList sizes) => Update(this.OpenBracketToken, sizes, this.CloseBracketToken); + public ArrayRankSpecifierSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Sizes, closeBracketToken); + + public ArrayRankSpecifierSyntax AddSizes(params ExpressionSyntax[] items) => WithSizes(this.Sizes.AddRange(items)); } - public PointerTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.AsteriskToken); - public PointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.ElementType, asteriskToken); -} + /// Class which represents the syntax node for pointer type. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class PointerTypeSyntax : TypeSyntax + { + private TypeSyntax? elementType; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FunctionPointerTypeSyntax : TypeSyntax -{ - private FunctionPointerCallingConventionSyntax? callingConvention; - private FunctionPointerParameterListSyntax? parameterList; + internal PointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal FunctionPointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// TypeSyntax node that represents the element type of the pointer. + public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => new(this, ((InternalSyntax.FunctionPointerTypeSyntax)this.Green).delegateKeyword, Position, 0); + /// SyntaxToken representing the asterisk. + public SyntaxToken AsteriskToken => new SyntaxToken(this, ((InternalSyntax.PointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => new(this, ((InternalSyntax.FunctionPointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; - /// Node representing the optional calling convention. - public FunctionPointerCallingConventionSyntax? CallingConvention => GetRed(ref this.callingConvention, 2); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; - /// List of the parameter types and return type of the function pointer. - public FunctionPointerParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPointerType(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) { - 2 => GetRed(ref this.callingConvention, 2), - 3 => GetRed(ref this.parameterList, 3)!, - _ => null, - }; + if (elementType != this.ElementType || asteriskToken != this.AsteriskToken) + { + var newNode = SyntaxFactory.PointerType(elementType, asteriskToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.callingConvention, - 3 => this.parameterList, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerType(this); + public PointerTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.AsteriskToken); + public PointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.ElementType, asteriskToken); + } - public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FunctionPointerTypeSyntax : TypeSyntax { - if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList) + private FunctionPointerCallingConventionSyntax? callingConvention; + private FunctionPointerParameterListSyntax? parameterList; + + internal FunctionPointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// SyntaxToken representing the delegate keyword. + public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((InternalSyntax.FunctionPointerTypeSyntax)this.Green).delegateKeyword, Position, 0); - public FunctionPointerTypeSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(delegateKeyword, this.AsteriskToken, this.CallingConvention, this.ParameterList); - public FunctionPointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.DelegateKeyword, asteriskToken, this.CallingConvention, this.ParameterList); - public FunctionPointerTypeSyntax WithCallingConvention(FunctionPointerCallingConventionSyntax? callingConvention) => Update(this.DelegateKeyword, this.AsteriskToken, callingConvention, this.ParameterList); - public FunctionPointerTypeSyntax WithParameterList(FunctionPointerParameterListSyntax parameterList) => Update(this.DelegateKeyword, this.AsteriskToken, this.CallingConvention, parameterList); + /// SyntaxToken representing the asterisk. + public SyntaxToken AsteriskToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); - public FunctionPointerTypeSyntax AddParameterListParameters(params FunctionPointerParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); -} + /// Node representing the optional calling convention. + public FunctionPointerCallingConventionSyntax? CallingConvention => GetRed(ref this.callingConvention, 2); -/// Function pointer parameter list syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode -{ - private SyntaxNode? parameters; + /// List of the parameter types and return type of the function pointer. + public FunctionPointerParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - internal FunctionPointerParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 2 => GetRed(ref this.callingConvention, 2), + 3 => GetRed(ref this.parameterList, 3)!, + _ => null, + }; - /// SyntaxToken representing the less than token. - public SyntaxToken LessThanToken => new(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 2 => this.callingConvention, + 3 => this.parameterList, + _ => null, + }; - /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. - public SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerType(this); - /// SyntaxToken representing the greater than token. - public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + { + if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList) + { + var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + public FunctionPointerTypeSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(delegateKeyword, this.AsteriskToken, this.CallingConvention, this.ParameterList); + public FunctionPointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.DelegateKeyword, asteriskToken, this.CallingConvention, this.ParameterList); + public FunctionPointerTypeSyntax WithCallingConvention(FunctionPointerCallingConventionSyntax? callingConvention) => Update(this.DelegateKeyword, this.AsteriskToken, callingConvention, this.ParameterList); + public FunctionPointerTypeSyntax WithParameterList(FunctionPointerParameterListSyntax parameterList) => Update(this.DelegateKeyword, this.AsteriskToken, this.CallingConvention, parameterList); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameterList(this); + public FunctionPointerTypeSyntax AddParameterListParameters(params FunctionPointerParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + } - public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + /// Function pointer parameter list syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode { - if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) + private SyntaxNode? parameters; + + internal FunctionPointerParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// SyntaxToken representing the less than token. + public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); - public FunctionPointerParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); - public FunctionPointerParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); - public FunctionPointerParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); + /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. + public SeparatedSyntaxList Parameters + { + get + { + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - public FunctionPointerParameterListSyntax AddParameters(params FunctionPointerParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); -} + /// SyntaxToken representing the greater than token. + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); -/// Function pointer calling convention syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode -{ - private FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - internal FunctionPointerCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - /// SyntaxToken representing whether the calling convention is managed or unmanaged. - public SyntaxToken ManagedOrUnmanagedKeyword => new(this, ((InternalSyntax.FunctionPointerCallingConventionSyntax)this.Green).managedOrUnmanagedKeyword, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameterList(this); - /// Optional list of identifiers that will contribute to an unmanaged calling convention. - public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => GetRed(ref this.unmanagedCallingConventionList, 1); + public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) + { + var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.unmanagedCallingConventionList, 1) : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.unmanagedCallingConventionList : null; + public FunctionPointerParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); + public FunctionPointerParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); + public FunctionPointerParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerCallingConvention(this); + public FunctionPointerParameterListSyntax AddParameters(params FunctionPointerParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); + } - public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + /// Function pointer calling convention syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode { - if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList) + private FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList; + + internal FunctionPointerCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public FunctionPointerCallingConventionSyntax WithManagedOrUnmanagedKeyword(SyntaxToken managedOrUnmanagedKeyword) => Update(managedOrUnmanagedKeyword, this.UnmanagedCallingConventionList); - public FunctionPointerCallingConventionSyntax WithUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) => Update(this.ManagedOrUnmanagedKeyword, unmanagedCallingConventionList); + /// SyntaxToken representing whether the calling convention is managed or unmanaged. + public SyntaxToken ManagedOrUnmanagedKeyword => new SyntaxToken(this, ((InternalSyntax.FunctionPointerCallingConventionSyntax)this.Green).managedOrUnmanagedKeyword, Position, 0); - public FunctionPointerCallingConventionSyntax AddUnmanagedCallingConventionListCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) - { - var unmanagedCallingConventionList = this.UnmanagedCallingConventionList ?? SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(); - return WithUnmanagedCallingConventionList(unmanagedCallingConventionList.WithCallingConventions(unmanagedCallingConventionList.CallingConventions.AddRange(items))); - } -} - -/// Function pointer calling convention syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode -{ - private SyntaxNode? callingConventions; - - internal FunctionPointerUnmanagedCallingConventionListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Optional list of identifiers that will contribute to an unmanaged calling convention. + public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => GetRed(ref this.unmanagedCallingConventionList, 1); - /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.unmanagedCallingConventionList, 1) : null; - /// SeparatedSyntaxList of calling convention identifiers. - public SeparatedSyntaxList CallingConventions => GetRed(ref this.callingConventions, 1) is { } red ? new(red, GetChildIndex(1)) : default; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.unmanagedCallingConventionList : null; - /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerCallingConvention(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.callingConventions, 1)! : null; + public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + { + if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList) + { + var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.callingConventions : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); + public FunctionPointerCallingConventionSyntax WithManagedOrUnmanagedKeyword(SyntaxToken managedOrUnmanagedKeyword) => Update(managedOrUnmanagedKeyword, this.UnmanagedCallingConventionList); + public FunctionPointerCallingConventionSyntax WithUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) => Update(this.ManagedOrUnmanagedKeyword, unmanagedCallingConventionList); - public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) + public FunctionPointerCallingConventionSyntax AddUnmanagedCallingConventionListCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) { - var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var unmanagedCallingConventionList = this.UnmanagedCallingConventionList ?? SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(); + return WithUnmanagedCallingConventionList(unmanagedCallingConventionList.WithCallingConventions(unmanagedCallingConventionList.CallingConventions.AddRange(items))); } - - return this; } - public FunctionPointerUnmanagedCallingConventionListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.CallingConventions, this.CloseBracketToken); - public FunctionPointerUnmanagedCallingConventionListSyntax WithCallingConventions(SeparatedSyntaxList callingConventions) => Update(this.OpenBracketToken, callingConventions, this.CloseBracketToken); - public FunctionPointerUnmanagedCallingConventionListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.CallingConventions, closeBracketToken); + /// Function pointer calling convention syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode + { + private SyntaxNode? callingConventions; - public FunctionPointerUnmanagedCallingConventionListSyntax AddCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) => WithCallingConventions(this.CallingConventions.AddRange(items)); -} + internal FunctionPointerUnmanagedCallingConventionListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// Individual function pointer unmanaged calling convention. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode -{ + /// SyntaxToken representing open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); - internal FunctionPointerUnmanagedCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SeparatedSyntaxList of calling convention identifiers. + public SeparatedSyntaxList CallingConventions + { + get + { + var red = GetRed(ref this.callingConventions, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - /// SyntaxToken representing the calling convention identifier. - public SyntaxToken Name => new(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionSyntax)this.Green).name, Position, 0); + /// SyntaxToken representing close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.callingConventions, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.callingConventions : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name) - { - if (name != this.Name) + public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) { - var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) + { + var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - return this; - } + return this; + } - public FunctionPointerUnmanagedCallingConventionSyntax WithName(SyntaxToken name) => Update(name); -} + public FunctionPointerUnmanagedCallingConventionListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.CallingConventions, this.CloseBracketToken); + public FunctionPointerUnmanagedCallingConventionListSyntax WithCallingConventions(SeparatedSyntaxList callingConventions) => Update(this.OpenBracketToken, callingConventions, this.CloseBracketToken); + public FunctionPointerUnmanagedCallingConventionListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.CallingConventions, closeBracketToken); -/// Class which represents the syntax node for a nullable type. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class NullableTypeSyntax : TypeSyntax -{ - private TypeSyntax? elementType; + public FunctionPointerUnmanagedCallingConventionListSyntax AddCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) => WithCallingConventions(this.CallingConventions.AddRange(items)); + } - internal NullableTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Individual function pointer unmanaged calling convention. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode { - } - /// TypeSyntax node representing the type of the element. - public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; + internal FunctionPointerUnmanagedCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => new(this, ((InternalSyntax.NullableTypeSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the calling convention identifier. + public SyntaxToken Name => new SyntaxToken(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionSyntax)this.Green).name, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) - { - if (elementType != this.ElementType || questionToken != this.QuestionToken) + public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name) { - var newNode = SyntaxFactory.NullableType(elementType, questionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (name != this.Name) + { + var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public FunctionPointerUnmanagedCallingConventionSyntax WithName(SyntaxToken name) => Update(name); } - public NullableTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.QuestionToken); - public NullableTypeSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ElementType, questionToken); -} - -/// Class which represents the syntax node for tuple type. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TupleTypeSyntax : TypeSyntax -{ - private SyntaxNode? elements; - - internal TupleTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Class which represents the syntax node for a nullable type. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class NullableTypeSyntax : TypeSyntax { - } + private TypeSyntax? elementType; - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); + internal NullableTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SeparatedSyntaxList Elements => GetRed(ref this.elements, 1) is { } red ? new(red, GetChildIndex(1)) : default; + /// TypeSyntax node representing the type of the element. + public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken => new SyntaxToken(this, ((InternalSyntax.NullableTypeSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableType(this); - public TupleTypeSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList elements, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) + public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) { - var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (elementType != this.ElementType || questionToken != this.QuestionToken) + { + var newNode = SyntaxFactory.NullableType(elementType, questionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public NullableTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.QuestionToken); + public NullableTypeSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ElementType, questionToken); } - public TupleTypeSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Elements, this.CloseParenToken); - public TupleTypeSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenParenToken, elements, this.CloseParenToken); - public TupleTypeSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Elements, closeParenToken); - - public TupleTypeSyntax AddElements(params TupleElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); -} + /// Class which represents the syntax node for tuple type. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TupleTypeSyntax : TypeSyntax + { + private SyntaxNode? elements; -/// Tuple type element. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TupleElementSyntax : CSharpSyntaxNode -{ - private TypeSyntax? type; + internal TupleTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal TupleElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); - /// Gets the type of the tuple element. - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + public SeparatedSyntaxList Elements + { + get + { + var red = GetRed(ref this.elements, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - /// Gets the name of the tuple element. - public SyntaxToken Identifier => ((InternalSyntax.TupleElementSyntax)this.Green).identifier is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleElement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleType(this); - public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) - { - if (type != this.Type || identifier != this.Identifier) + public TupleTypeSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList elements, SyntaxToken closeParenToken) { - var newNode = SyntaxFactory.TupleElement(type, identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public TupleTypeSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Elements, this.CloseParenToken); + public TupleTypeSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenParenToken, elements, this.CloseParenToken); + public TupleTypeSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Elements, closeParenToken); + + public TupleTypeSyntax AddElements(params TupleElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); } - public TupleElementSyntax WithType(TypeSyntax type) => Update(type, this.Identifier); - public TupleElementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.Type, identifier); -} + /// Tuple type element. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TupleElementSyntax : CSharpSyntaxNode + { + private TypeSyntax? type; -/// Class which represents a placeholder in the type argument list of an unbound generic type. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class OmittedTypeArgumentSyntax : TypeSyntax -{ + internal TupleElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal OmittedTypeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the type of the tuple element. + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - /// SyntaxToken representing the omitted type argument. - public SyntaxToken OmittedTypeArgumentToken => new(this, ((InternalSyntax.OmittedTypeArgumentSyntax)this.Green).omittedTypeArgumentToken, Position, 0); + /// Gets the name of the tuple element. + public SyntaxToken Identifier + { + get + { + var slot = ((Syntax.InternalSyntax.TupleElementSyntax)this.Green).identifier; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedTypeArgument(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleElement(this); - public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken) - { - if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken) + public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) { - var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (type != this.Type || identifier != this.Identifier) + { + var newNode = SyntaxFactory.TupleElement(type, identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public TupleElementSyntax WithType(TypeSyntax type) => Update(type, this.Identifier); + public TupleElementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.Type, identifier); } - public OmittedTypeArgumentSyntax WithOmittedTypeArgumentToken(SyntaxToken omittedTypeArgumentToken) => Update(omittedTypeArgumentToken); -} - -/// The ref modifier of a method's return value or a local. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class RefTypeSyntax : TypeSyntax -{ - private TypeSyntax? type; - - internal RefTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Class which represents a placeholder in the type argument list of an unbound generic type. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class OmittedTypeArgumentSyntax : TypeSyntax { - } - - public SyntaxToken RefKeyword => new(this, ((InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); - /// Gets the optional "readonly" keyword. - public SyntaxToken ReadOnlyKeyword => ((InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal OmittedTypeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public TypeSyntax Type => GetRed(ref this.type, 2)!; + /// SyntaxToken representing the omitted type argument. + public SyntaxToken OmittedTypeArgumentToken => new SyntaxToken(this, ((InternalSyntax.OmittedTypeArgumentSyntax)this.Green).omittedTypeArgumentToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedTypeArgument(this); - public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) - { - if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) + public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken) { - var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken) + { + var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public OmittedTypeArgumentSyntax WithOmittedTypeArgumentToken(SyntaxToken omittedTypeArgumentToken) => Update(omittedTypeArgumentToken); } - public RefTypeSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.ReadOnlyKeyword, this.Type); - public RefTypeSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKeyword, readOnlyKeyword, this.Type); - public RefTypeSyntax WithType(TypeSyntax type) => Update(this.RefKeyword, this.ReadOnlyKeyword, type); -} + /// The ref modifier of a method's return value or a local. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class RefTypeSyntax : TypeSyntax + { + private TypeSyntax? type; -/// The 'scoped' modifier of a local. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ScopedTypeSyntax : TypeSyntax -{ - private TypeSyntax? type; + internal RefTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal ScopedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken RefKeyword => new SyntaxToken(this, ((InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); - public SyntaxToken ScopedKeyword => new(this, ((InternalSyntax.ScopedTypeSyntax)this.Green).scopedKeyword, Position, 0); + /// Gets the optional "readonly" keyword. + public SyntaxToken ReadOnlyKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public TypeSyntax Type => GetRed(ref this.type, 1)!; + public TypeSyntax Type => GetRed(ref this.type, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitScopedType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefType(this); - public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) - { - if (scopedKeyword != this.ScopedKeyword || type != this.Type) + public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) { - var newNode = SyntaxFactory.ScopedType(scopedKeyword, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) + { + var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public RefTypeSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.ReadOnlyKeyword, this.Type); + public RefTypeSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKeyword, readOnlyKeyword, this.Type); + public RefTypeSyntax WithType(TypeSyntax type) => Update(this.RefKeyword, this.ReadOnlyKeyword, type); } - public ScopedTypeSyntax WithScopedKeyword(SyntaxToken scopedKeyword) => Update(scopedKeyword, this.Type); - public ScopedTypeSyntax WithType(TypeSyntax type) => Update(this.ScopedKeyword, type); -} - -public abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode -{ - internal ExpressionOrPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// The 'scoped' modifier of a local. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ScopedTypeSyntax : TypeSyntax { - } -} + private TypeSyntax? type; -/// Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. -public abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax -{ - internal ExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } -} + internal ScopedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// Class which represents the syntax node for parenthesized expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; + public SyntaxToken ScopedKeyword => new SyntaxToken(this, ((InternalSyntax.ScopedTypeSyntax)this.Green).scopedKeyword, Position, 0); - internal ParenthesizedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TypeSyntax Type => GetRed(ref this.type, 1)!; - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ParenthesizedExpressionSyntax)this.Green).openParenToken, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; - /// ExpressionSyntax node representing the expression enclosed within the parenthesis. - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ParenthesizedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitScopedType(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) + { + if (scopedKeyword != this.ScopedKeyword || type != this.Type) + { + var newNode = SyntaxFactory.ScopedType(scopedKeyword, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedExpression(this); + public ScopedTypeSyntax WithScopedKeyword(SyntaxToken scopedKeyword) => Update(scopedKeyword, this.Type); + public ScopedTypeSyntax WithType(TypeSyntax type) => Update(this.ScopedKeyword, type); + } - public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + public abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode { - if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + internal ExpressionOrPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - - return this; } - public ParenthesizedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Expression, this.CloseParenToken); - public ParenthesizedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, expression, this.CloseParenToken); - public ParenthesizedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Expression, closeParenToken); -} - -/// Class which represents the syntax node for tuple expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TupleExpressionSyntax : ExpressionSyntax -{ - private SyntaxNode? arguments; - - internal TupleExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. + public abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax { + internal ExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } } - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); + /// Class which represents the syntax node for parenthesized expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax + { + private ExpressionSyntax? expression; - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public SeparatedSyntaxList Arguments => GetRed(ref this.arguments, 1) is { } red ? new(red, GetChildIndex(1)) : default; + internal ParenthesizedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedExpressionSyntax)this.Green).openParenToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + /// ExpressionSyntax node representing the expression enclosed within the parenthesis. + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleExpression(this); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - public TupleExpressionSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedExpression(this); + + public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) { - var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public ParenthesizedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Expression, this.CloseParenToken); + public ParenthesizedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, expression, this.CloseParenToken); + public ParenthesizedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Expression, closeParenToken); } - public TupleExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); - public TupleExpressionSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); - public TupleExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); - - public TupleExpressionSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); -} + /// Class which represents the syntax node for tuple expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TupleExpressionSyntax : ExpressionSyntax + { + private SyntaxNode? arguments; -/// Class which represents the syntax node for prefix unary expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -public sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? operand; + internal TupleExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal PrefixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); - /// SyntaxToken representing the kind of the operator of the prefix unary expression. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.PrefixUnaryExpressionSyntax)this.Green).operatorToken, Position, 0); + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public SeparatedSyntaxList Arguments + { + get + { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - /// ExpressionSyntax representing the operand of the prefix unary expression. - public ExpressionSyntax Operand => GetRed(ref this.operand, 1)!; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.operand, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.operand : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrefixUnaryExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleExpression(this); - public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand) - { - if (operatorToken != this.OperatorToken || operand != this.Operand) + public TupleExpressionSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) { - var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind(), operatorToken, operand); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - return this; - } + return this; + } - public PrefixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Operand); - public PrefixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(this.OperatorToken, operand); -} + public TupleExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); + public TupleExpressionSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); + public TupleExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); -/// Class which represents the syntax node for an "await" expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AwaitExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; + public TupleExpressionSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); + } - internal AwaitExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Class which represents the syntax node for prefix unary expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax { - } + private ExpressionSyntax? operand; - /// SyntaxToken representing the kind "await" keyword. - public SyntaxToken AwaitKeyword => new(this, ((InternalSyntax.AwaitExpressionSyntax)this.Green).awaitKeyword, Position, 0); + internal PrefixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// ExpressionSyntax representing the operand of the "await" operator. - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + /// SyntaxToken representing the kind of the operator of the prefix unary expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.PrefixUnaryExpressionSyntax)this.Green).operatorToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + /// ExpressionSyntax representing the operand of the prefix unary expression. + public ExpressionSyntax Operand => GetRed(ref this.operand, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.operand, 1)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAwaitExpression(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.operand : null; - public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression) - { - if (awaitKeyword != this.AwaitKeyword || expression != this.Expression) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrefixUnaryExpression(this); + + public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand) { - var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (operatorToken != this.OperatorToken || operand != this.Operand) + { + var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind(), operatorToken, operand); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public PrefixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Operand); + public PrefixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(this.OperatorToken, operand); } - public AwaitExpressionSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(awaitKeyword, this.Expression); - public AwaitExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.AwaitKeyword, expression); -} - -/// Class which represents the syntax node for postfix unary expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -/// -public sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? operand; - - internal PostfixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Class which represents the syntax node for an "await" expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AwaitExpressionSyntax : ExpressionSyntax { - } + private ExpressionSyntax? expression; + + internal AwaitExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// ExpressionSyntax representing the operand of the postfix unary expression. - public ExpressionSyntax Operand => GetRedAtZero(ref this.operand)!; + /// SyntaxToken representing the kind "await" keyword. + public SyntaxToken AwaitKeyword => new SyntaxToken(this, ((InternalSyntax.AwaitExpressionSyntax)this.Green).awaitKeyword, Position, 0); - /// SyntaxToken representing the kind of the operator of the postfix unary expression. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.PostfixUnaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + /// ExpressionSyntax representing the operand of the "await" operator. + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.operand)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.operand : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPostfixUnaryExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAwaitExpression(this); - public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken) - { - if (operand != this.Operand || operatorToken != this.OperatorToken) + public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression) { - var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind(), operand, operatorToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (awaitKeyword != this.AwaitKeyword || expression != this.Expression) + { + var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public AwaitExpressionSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(awaitKeyword, this.Expression); + public AwaitExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.AwaitKeyword, expression); } - public PostfixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(operand, this.OperatorToken); - public PostfixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Operand, operatorToken); -} + /// Class which represents the syntax node for postfix unary expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + /// + public sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax + { + private ExpressionSyntax? operand; -/// Class which represents the syntax node for member access expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -public sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; - private SimpleNameSyntax? name; + internal PostfixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal MemberAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// ExpressionSyntax representing the operand of the postfix unary expression. + public ExpressionSyntax Operand => GetRedAtZero(ref this.operand)!; - /// ExpressionSyntax node representing the object that the member belongs to. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + /// SyntaxToken representing the kind of the operator of the postfix unary expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.PostfixUnaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken representing the kind of the operator in the member access expression. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.MemberAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.operand)! : null; - /// SimpleNameSyntax node representing the member being accessed. - public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.operand : null; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.name, 2)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPostfixUnaryExpression(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken) { - 0 => this.expression, - 2 => this.name, - _ => null, - }; + if (operand != this.Operand || operatorToken != this.OperatorToken) + { + var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind(), operand, operatorToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberAccessExpression(this); + public PostfixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(operand, this.OperatorToken); + public PostfixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Operand, operatorToken); + } - public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + /// Class which represents the syntax node for member access expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + public sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax { - if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name) + private ExpressionSyntax? expression; + private SimpleNameSyntax? name; + + internal MemberAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.MemberAccessExpression(this.Kind(), expression, operatorToken, name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public MemberAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.Name); - public MemberAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.Name); - public MemberAccessExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.Expression, this.OperatorToken, name); -} + /// ExpressionSyntax node representing the object that the member belongs to. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; -/// Class which represents the syntax node for conditional access expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; - private ExpressionSyntax? whenNotNull; + /// SyntaxToken representing the kind of the operator in the member access expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.MemberAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - internal ConditionalAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SimpleNameSyntax node representing the member being accessed. + public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; - /// ExpressionSyntax node representing the object conditionally accessed. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.name, 2)!, + _ => null, + }; - /// SyntaxToken representing the question mark. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.ConditionalAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 2 => this.name, + _ => null, + }; - /// ExpressionSyntax node representing the access expression to be executed when the object is not null. - public ExpressionSyntax WhenNotNull => GetRed(ref this.whenNotNull, 2)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberAccessExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.whenNotNull, 2)!, - _ => null, - }; + if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name) + { + var newNode = SyntaxFactory.MemberAccessExpression(this.Kind(), expression, operatorToken, name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.whenNotNull, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalAccessExpression(this); + public MemberAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.Name); + public MemberAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.Name); + public MemberAccessExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.Expression, this.OperatorToken, name); + } - public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + /// Class which represents the syntax node for conditional access expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax { - if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull) + private ExpressionSyntax? expression; + private ExpressionSyntax? whenNotNull; + + internal ConditionalAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// ExpressionSyntax node representing the object conditionally accessed. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public ConditionalAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.WhenNotNull); - public ConditionalAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.WhenNotNull); - public ConditionalAccessExpressionSyntax WithWhenNotNull(ExpressionSyntax whenNotNull) => Update(this.Expression, this.OperatorToken, whenNotNull); -} + /// SyntaxToken representing the question mark. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.ConditionalAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); -/// Class which represents the syntax node for member binding expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax -{ - private SimpleNameSyntax? name; + /// ExpressionSyntax node representing the access expression to be executed when the object is not null. + public ExpressionSyntax WhenNotNull => GetRed(ref this.whenNotNull, 2)!; - internal MemberBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.whenNotNull, 2)!, + _ => null, + }; - /// SyntaxToken representing dot. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.MemberBindingExpressionSyntax)this.Green).operatorToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 2 => this.whenNotNull, + _ => null, + }; - /// SimpleNameSyntax node representing the member being bound to. - public SimpleNameSyntax Name => GetRed(ref this.name, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalAccessExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; + public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + { + if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull) + { + var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberBindingExpression(this); + public ConditionalAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.WhenNotNull); + public ConditionalAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.WhenNotNull); + public ConditionalAccessExpressionSyntax WithWhenNotNull(ExpressionSyntax whenNotNull) => Update(this.Expression, this.OperatorToken, whenNotNull); + } - public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name) + /// Class which represents the syntax node for member binding expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax { - if (operatorToken != this.OperatorToken || name != this.Name) + private SimpleNameSyntax? name; + + internal MemberBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// SyntaxToken representing dot. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.MemberBindingExpressionSyntax)this.Green).operatorToken, Position, 0); - public MemberBindingExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Name); - public MemberBindingExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.OperatorToken, name); -} + /// SimpleNameSyntax node representing the member being bound to. + public SimpleNameSyntax Name => GetRed(ref this.name, 1)!; -/// Class which represents the syntax node for element binding expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax -{ - private BracketedArgumentListSyntax? argumentList; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; - internal ElementBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; - /// BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. - public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberBindingExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; + public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name) + { + if (operatorToken != this.OperatorToken || name != this.Name) + { + var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementBindingExpression(this); + public MemberBindingExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Name); + public MemberBindingExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.OperatorToken, name); + } - public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList) + /// Class which represents the syntax node for element binding expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax { - if (argumentList != this.ArgumentList) + private BracketedArgumentListSyntax? argumentList; + + internal ElementBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ElementBindingExpression(argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. + public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; - public ElementBindingExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; - public ElementBindingExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); -} + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; -/// Class which represents the syntax node for a range expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class RangeExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? leftOperand; - private ExpressionSyntax? rightOperand; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementBindingExpression(this); - internal RangeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList) + { + if (argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.ElementBindingExpression(argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - /// ExpressionSyntax node representing the expression on the left of the range operator. - public ExpressionSyntax? LeftOperand => GetRedAtZero(ref this.leftOperand); + public ElementBindingExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); - /// SyntaxToken representing the operator of the range expression. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.RangeExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public ElementBindingExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); + } - /// ExpressionSyntax node representing the expression on the right of the range operator. - public ExpressionSyntax? RightOperand => GetRed(ref this.rightOperand, 2); + /// Class which represents the syntax node for a range expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class RangeExpressionSyntax : ExpressionSyntax + { + private ExpressionSyntax? leftOperand; + private ExpressionSyntax? rightOperand; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + internal RangeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => GetRedAtZero(ref this.leftOperand), - 2 => GetRed(ref this.rightOperand, 2), - _ => null, - }; + } + + /// ExpressionSyntax node representing the expression on the left of the range operator. + public ExpressionSyntax? LeftOperand => GetRedAtZero(ref this.leftOperand); + + /// SyntaxToken representing the operator of the range expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.RangeExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + + /// ExpressionSyntax node representing the expression on the right of the range operator. + public ExpressionSyntax? RightOperand => GetRed(ref this.rightOperand, 2); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.leftOperand), + 2 => GetRed(ref this.rightOperand, 2), + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.leftOperand, + 2 => this.rightOperand, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRangeExpression(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public RangeExpressionSyntax Update(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) { - 0 => this.leftOperand, - 2 => this.rightOperand, - _ => null, - }; + if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand) + { + var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRangeExpression(this); + return this; + } + + public RangeExpressionSyntax WithLeftOperand(ExpressionSyntax? leftOperand) => Update(leftOperand, this.OperatorToken, this.RightOperand); + public RangeExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.LeftOperand, operatorToken, this.RightOperand); + public RangeExpressionSyntax WithRightOperand(ExpressionSyntax? rightOperand) => Update(this.LeftOperand, this.OperatorToken, rightOperand); + } - public RangeExpressionSyntax Update(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) + /// Class which represents the syntax node for implicit element access expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax { - if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand) + private BracketedArgumentListSyntax? argumentList; + + internal ImplicitElementAccessSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. + public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; - public RangeExpressionSyntax WithLeftOperand(ExpressionSyntax? leftOperand) => Update(leftOperand, this.OperatorToken, this.RightOperand); - public RangeExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.LeftOperand, operatorToken, this.RightOperand); - public RangeExpressionSyntax WithRightOperand(ExpressionSyntax? rightOperand) => Update(this.LeftOperand, this.OperatorToken, rightOperand); -} + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; -/// Class which represents the syntax node for implicit element access expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax -{ - private BracketedArgumentListSyntax? argumentList; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; - internal ImplicitElementAccessSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitElementAccess(this); - /// BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. - public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; + public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList) + { + if (argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.ImplicitElementAccess(argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; + public ImplicitElementAccessSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitElementAccess(this); + public ImplicitElementAccessSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); + } - public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList) + /// Class which represents an expression that has a binary operator. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public sealed partial class BinaryExpressionSyntax : ExpressionSyntax { - if (argumentList != this.ArgumentList) + private ExpressionSyntax? left; + private ExpressionSyntax? right; + + internal BinaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ImplicitElementAccess(argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// ExpressionSyntax node representing the expression on the left of the binary operator. + public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; - public ImplicitElementAccessSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); + /// SyntaxToken representing the operator of the binary expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.BinaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - public ImplicitElementAccessSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); -} + /// ExpressionSyntax node representing the expression on the right of the binary operator. + public ExpressionSyntax Right => GetRed(ref this.right, 2)!; -/// Class which represents an expression that has a binary operator. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -public sealed partial class BinaryExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? left; - private ExpressionSyntax? right; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - internal BinaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.left, + 2 => this.right, + _ => null, + }; - /// ExpressionSyntax node representing the expression on the left of the binary operator. - public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryExpression(this); - /// SyntaxToken representing the operator of the binary expression. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.BinaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + { + var newNode = SyntaxFactory.BinaryExpression(this.Kind(), left, operatorToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - /// ExpressionSyntax node representing the expression on the right of the binary operator. - public ExpressionSyntax Right => GetRed(ref this.right, 2)!; + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + public BinaryExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); + public BinaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); + public BinaryExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); + } + + /// Class which represents an expression that has an assignment operator. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public sealed partial class AssignmentExpressionSyntax : ExpressionSyntax + { + private ExpressionSyntax? left; + private ExpressionSyntax? right; + + internal AssignmentExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// ExpressionSyntax node representing the expression on the left of the assignment operator. + public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; + + /// SyntaxToken representing the operator of the assignment expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.AssignmentExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + + /// ExpressionSyntax node representing the expression on the right of the assignment operator. + public ExpressionSyntax Right => GetRed(ref this.right, 2)!; + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.left, + 2 => this.right, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAssignmentExpression(this); + + public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) { - 0 => this.left, - 2 => this.right, - _ => null, - }; + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + { + var newNode = SyntaxFactory.AssignmentExpression(this.Kind(), left, operatorToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryExpression(this); + public AssignmentExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); + public AssignmentExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); + public AssignmentExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); + } - public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + /// Class which represents the syntax node for conditional expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ConditionalExpressionSyntax : ExpressionSyntax { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + private ExpressionSyntax? condition; + private ExpressionSyntax? whenTrue; + private ExpressionSyntax? whenFalse; + + internal ConditionalExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.BinaryExpression(this.Kind(), left, operatorToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// ExpressionSyntax node representing the condition of the conditional expression. + public ExpressionSyntax Condition => GetRedAtZero(ref this.condition)!; - public BinaryExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); - public BinaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); - public BinaryExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); -} + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken => new SyntaxToken(this, ((InternalSyntax.ConditionalExpressionSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); -/// Class which represents an expression that has an assignment operator. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -public sealed partial class AssignmentExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? left; - private ExpressionSyntax? right; + /// ExpressionSyntax node representing the expression to be executed when the condition is true. + public ExpressionSyntax WhenTrue => GetRed(ref this.whenTrue, 2)!; - internal AssignmentExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the colon. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.ConditionalExpressionSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); - /// ExpressionSyntax node representing the expression on the left of the assignment operator. - public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; + /// ExpressionSyntax node representing the expression to be executed when the condition is false. + public ExpressionSyntax WhenFalse => GetRed(ref this.whenFalse, 4)!; - /// SyntaxToken representing the operator of the assignment expression. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.AssignmentExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.condition)!, + 2 => GetRed(ref this.whenTrue, 2)!, + 4 => GetRed(ref this.whenFalse, 4)!, + _ => null, + }; - /// ExpressionSyntax node representing the expression on the right of the assignment operator. - public ExpressionSyntax Right => GetRed(ref this.right, 2)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.condition, + 2 => this.whenTrue, + 4 => this.whenFalse, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalExpression(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) { - 0 => this.left, - 2 => this.right, - _ => null, - }; + if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse) + { + var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAssignmentExpression(this); + return this; + } + + public ConditionalExpressionSyntax WithCondition(ExpressionSyntax condition) => Update(condition, this.QuestionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.Condition, questionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithWhenTrue(ExpressionSyntax whenTrue) => Update(this.Condition, this.QuestionToken, whenTrue, this.ColonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Condition, this.QuestionToken, this.WhenTrue, colonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithWhenFalse(ExpressionSyntax whenFalse) => Update(this.Condition, this.QuestionToken, this.WhenTrue, this.ColonToken, whenFalse); + } - public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + /// Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. + public abstract partial class InstanceExpressionSyntax : ExpressionSyntax { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + internal InstanceExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.AssignmentExpression(this.Kind(), left, operatorToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - - return this; } - public AssignmentExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); - public AssignmentExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); - public AssignmentExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); -} - -/// Class which represents the syntax node for conditional expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ConditionalExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? condition; - private ExpressionSyntax? whenTrue; - private ExpressionSyntax? whenFalse; - - internal ConditionalExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Class which represents the syntax node for a this expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax { - } - /// ExpressionSyntax node representing the condition of the conditional expression. - public ExpressionSyntax Condition => GetRedAtZero(ref this.condition)!; + internal ThisExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => new(this, ((InternalSyntax.ConditionalExpressionSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the this keyword. + public SyntaxToken Token => new SyntaxToken(this, ((InternalSyntax.ThisExpressionSyntax)this.Green).token, Position, 0); - /// ExpressionSyntax node representing the expression to be executed when the condition is true. - public ExpressionSyntax WhenTrue => GetRed(ref this.whenTrue, 2)!; + internal override SyntaxNode? GetNodeSlot(int index) => null; - /// SyntaxToken representing the colon. - public SyntaxToken ColonToken => new(this, ((InternalSyntax.ConditionalExpressionSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// ExpressionSyntax node representing the expression to be executed when the condition is false. - public ExpressionSyntax WhenFalse => GetRed(ref this.whenFalse, 4)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThisExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public ThisExpressionSyntax Update(SyntaxToken token) { - 0 => GetRedAtZero(ref this.condition)!, - 2 => GetRed(ref this.whenTrue, 2)!, - 4 => GetRed(ref this.whenFalse, 4)!, - _ => null, - }; + if (token != this.Token) + { + var newNode = SyntaxFactory.ThisExpression(token); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.condition, - 2 => this.whenTrue, - 4 => this.whenFalse, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalExpression(this); + public ThisExpressionSyntax WithToken(SyntaxToken token) => Update(token); + } - public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + /// Class which represents the syntax node for a base expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax { - if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse) + + internal BaseExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public ConditionalExpressionSyntax WithCondition(ExpressionSyntax condition) => Update(condition, this.QuestionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.Condition, questionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithWhenTrue(ExpressionSyntax whenTrue) => Update(this.Condition, this.QuestionToken, whenTrue, this.ColonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Condition, this.QuestionToken, this.WhenTrue, colonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithWhenFalse(ExpressionSyntax whenFalse) => Update(this.Condition, this.QuestionToken, this.WhenTrue, this.ColonToken, whenFalse); -} - -/// Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. -public abstract partial class InstanceExpressionSyntax : ExpressionSyntax -{ - internal InstanceExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } -} + /// SyntaxToken representing the base keyword. + public SyntaxToken Token => new SyntaxToken(this, ((InternalSyntax.BaseExpressionSyntax)this.Green).token, Position, 0); -/// Class which represents the syntax node for a this expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax -{ + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal ThisExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// SyntaxToken representing the this keyword. - public SyntaxToken Token => new(this, ((InternalSyntax.ThisExpressionSyntax)this.Green).token, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public BaseExpressionSyntax Update(SyntaxToken token) + { + if (token != this.Token) + { + var newNode = SyntaxFactory.BaseExpression(token); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThisExpression(this); + public BaseExpressionSyntax WithToken(SyntaxToken token) => Update(token); + } - public ThisExpressionSyntax Update(SyntaxToken token) + /// Class which represents the syntax node for a literal expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public sealed partial class LiteralExpressionSyntax : ExpressionSyntax { - if (token != this.Token) + + internal LiteralExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ThisExpression(token); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public ThisExpressionSyntax WithToken(SyntaxToken token) => Update(token); -} + /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. + public SyntaxToken Token => new SyntaxToken(this, ((InternalSyntax.LiteralExpressionSyntax)this.Green).token, Position, 0); -/// Class which represents the syntax node for a base expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax -{ + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal BaseExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// SyntaxToken representing the base keyword. - public SyntaxToken Token => new(this, ((InternalSyntax.BaseExpressionSyntax)this.Green).token, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLiteralExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public LiteralExpressionSyntax Update(SyntaxToken token) + { + if (token != this.Token) + { + var newNode = SyntaxFactory.LiteralExpression(this.Kind(), token); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseExpression(this); + public LiteralExpressionSyntax WithToken(SyntaxToken token) => Update(token); + } - public BaseExpressionSyntax Update(SyntaxToken token) + /// Class which represents the syntax node for MakeRef expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class MakeRefExpressionSyntax : ExpressionSyntax { - if (token != this.Token) + private ExpressionSyntax? expression; + + internal MakeRefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.BaseExpression(token); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public BaseExpressionSyntax WithToken(SyntaxToken token) => Update(token); -} + /// SyntaxToken representing the MakeRefKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).keyword, Position, 0); -/// Class which represents the syntax node for a literal expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -public sealed partial class LiteralExpressionSyntax : ExpressionSyntax -{ + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - internal LiteralExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Argument of the primary function. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. - public SyntaxToken Token => new(this, ((InternalSyntax.LiteralExpressionSyntax)this.Green).token, Position, 0); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLiteralExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMakeRefExpression(this); - public LiteralExpressionSyntax Update(SyntaxToken token) - { - if (token != this.Token) + public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) { - var newNode = SyntaxFactory.LiteralExpression(this.Kind(), token); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public MakeRefExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); + public MakeRefExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); + public MakeRefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); + public MakeRefExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); } - public LiteralExpressionSyntax WithToken(SyntaxToken token) => Update(token); -} - -/// Class which represents the syntax node for MakeRef expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class MakeRefExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; - - internal MakeRefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Class which represents the syntax node for RefType expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class RefTypeExpressionSyntax : ExpressionSyntax { - } + private ExpressionSyntax? expression; - /// SyntaxToken representing the MakeRefKeyword. - public SyntaxToken Keyword => new(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).keyword, Position, 0); + internal RefTypeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the RefTypeKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).keyword, Position, 0); - /// Argument of the primary function. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// Argument of the primary function. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMakeRefExpression(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; - public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefTypeExpression(this); + + public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) { - var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public RefTypeExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); + public RefTypeExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); + public RefTypeExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); + public RefTypeExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); } - public MakeRefExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); - public MakeRefExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); - public MakeRefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); - public MakeRefExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); -} + /// Class which represents the syntax node for RefValue expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class RefValueExpressionSyntax : ExpressionSyntax + { + private ExpressionSyntax? expression; + private TypeSyntax? type; -/// Class which represents the syntax node for RefType expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class RefTypeExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; + internal RefValueExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal RefTypeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the RefValueKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).keyword, Position, 0); - /// SyntaxToken representing the RefTypeKeyword. - public SyntaxToken Keyword => new(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).keyword, Position, 0); + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + /// Typed reference expression. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - /// Argument of the primary function. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + /// Comma separating the arguments. + public SyntaxToken Comma => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).comma, GetChildPosition(3), GetChildIndex(3)); - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// The type of the value. + public TypeSyntax Type => GetRed(ref this.type, 4)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).closeParenToken, GetChildPosition(5), GetChildIndex(5)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 2 => GetRed(ref this.expression, 2)!, + 4 => GetRed(ref this.type, 4)!, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefTypeExpression(this); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 2 => this.expression, + 4 => this.type, + _ => null, + }; - public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefValueExpression(this); + + public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) { - var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public RefValueExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.Comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithComma(SyntaxToken comma) => Update(this.Keyword, this.OpenParenToken, this.Expression, comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, type, this.CloseParenToken); + public RefValueExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, closeParenToken); } - public RefTypeExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); - public RefTypeExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); - public RefTypeExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); - public RefTypeExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); -} + /// Class which represents the syntax node for Checked or Unchecked expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + public sealed partial class CheckedExpressionSyntax : ExpressionSyntax + { + private ExpressionSyntax? expression; -/// Class which represents the syntax node for RefValue expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class RefValueExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; - private TypeSyntax? type; + internal CheckedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal RefValueExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the checked or unchecked keyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).keyword, Position, 0); - /// SyntaxToken representing the RefValueKeyword. - public SyntaxToken Keyword => new(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).keyword, Position, 0); + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + /// Argument of the primary function. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - /// Typed reference expression. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - /// Comma separating the arguments. - public SyntaxToken Comma => new(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).comma, GetChildPosition(3), GetChildIndex(3)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; - /// The type of the value. - public TypeSyntax Type => GetRed(ref this.type, 4)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).closeParenToken, GetChildPosition(5), GetChildIndex(5)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) { - 2 => GetRed(ref this.expression, 2)!, - 4 => GetRed(ref this.type, 4)!, - _ => null, - }; + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.CheckedExpression(this.Kind(), keyword, openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.expression, - 4 => this.type, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefValueExpression(this); + public CheckedExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); + public CheckedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); + public CheckedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); + public CheckedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); + } - public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + /// Class which represents the syntax node for Default expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DefaultExpressionSyntax : ExpressionSyntax { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken) + private TypeSyntax? type; + + internal DefaultExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public RefValueExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.Comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithComma(SyntaxToken comma) => Update(this.Keyword, this.OpenParenToken, this.Expression, comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, type, this.CloseParenToken); - public RefValueExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, closeParenToken); -} + /// SyntaxToken representing the DefaultKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).keyword, Position, 0); -/// Class which represents the syntax node for Checked or Unchecked expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -public sealed partial class CheckedExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - internal CheckedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Argument of the primary function. + public TypeSyntax Type => GetRed(ref this.type, 2)!; - /// SyntaxToken representing the checked or unchecked keyword. - public SyntaxToken Keyword => new(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).keyword, Position, 0); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - /// Argument of the primary function. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; + public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedExpression(this); + public DefaultExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); + public DefaultExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); + public DefaultExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); + public DefaultExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); + } - public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + /// Class which represents the syntax node for TypeOf expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TypeOfExpressionSyntax : ExpressionSyntax { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + private TypeSyntax? type; + + internal TypeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.CheckedExpression(this.Kind(), keyword, openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public CheckedExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); - public CheckedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); - public CheckedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); - public CheckedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); -} + /// SyntaxToken representing the TypeOfKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).keyword, Position, 0); -/// Class which represents the syntax node for Default expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DefaultExpressionSyntax : ExpressionSyntax -{ - private TypeSyntax? type; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - internal DefaultExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// The expression to return type of. + public TypeSyntax Type => GetRed(ref this.type, 2)!; - /// SyntaxToken representing the DefaultKeyword. - public SyntaxToken Keyword => new(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).keyword, Position, 0); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - /// Argument of the primary function. - public TypeSyntax Type => GetRed(ref this.type, 2)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeOfExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultExpression(this); + public TypeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); + public TypeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); + public TypeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); + public TypeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); + } - public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + /// Class which represents the syntax node for SizeOf expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SizeOfExpressionSyntax : ExpressionSyntax { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) + private TypeSyntax? type; + + internal SizeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public DefaultExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); - public DefaultExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); - public DefaultExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); - public DefaultExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); -} + /// SyntaxToken representing the SizeOfKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).keyword, Position, 0); -/// Class which represents the syntax node for TypeOf expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TypeOfExpressionSyntax : ExpressionSyntax -{ - private TypeSyntax? type; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - internal TypeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Argument of the primary function. + public TypeSyntax Type => GetRed(ref this.type, 2)!; - /// SyntaxToken representing the TypeOfKeyword. - public SyntaxToken Keyword => new(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).keyword, Position, 0); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - /// The expression to return type of. - public TypeSyntax Type => GetRed(ref this.type, 2)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSizeOfExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeOfExpression(this); + public SizeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); + public SizeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); + public SizeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); + public SizeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); + } - public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + /// Class which represents the syntax node for invocation expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class InvocationExpressionSyntax : ExpressionSyntax { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) + private ExpressionSyntax? expression; + private ArgumentListSyntax? argumentList; + + internal InvocationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public TypeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); - public TypeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); - public TypeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); - public TypeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); -} - -/// Class which represents the syntax node for SizeOf expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SizeOfExpressionSyntax : ExpressionSyntax -{ - private TypeSyntax? type; + /// ExpressionSyntax node representing the expression part of the invocation. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal SizeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// ArgumentListSyntax node representing the list of arguments of the invocation expression. + public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - /// SyntaxToken representing the SizeOfKeyword. - public SyntaxToken Keyword => new(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).keyword, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expression)!, + 1 => GetRed(ref this.argumentList, 1)!, + _ => null, + }; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 1 => this.argumentList, + _ => null, + }; - /// Argument of the primary function. - public TypeSyntax Type => GetRed(ref this.type, 2)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInvocationExpression(this); - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList) + { + if (expression != this.Expression || argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.InvocationExpression(expression, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + public InvocationExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); + public InvocationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Expression, argumentList); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSizeOfExpression(this); + public InvocationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); + } - public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + /// Class which represents the syntax node for element access expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) + private ExpressionSyntax? expression; + private BracketedArgumentListSyntax? argumentList; + + internal ElementAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public SizeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); - public SizeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); - public SizeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); - public SizeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); -} + /// ExpressionSyntax node representing the expression which is accessing the element. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; -/// Class which represents the syntax node for invocation expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class InvocationExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; - private ArgumentListSyntax? argumentList; + /// BracketedArgumentListSyntax node representing the list of arguments of the element access expression. + public BracketedArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - internal InvocationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expression)!, + 1 => GetRed(ref this.argumentList, 1)!, + _ => null, + }; - /// ExpressionSyntax node representing the expression part of the invocation. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 1 => this.argumentList, + _ => null, + }; - /// ArgumentListSyntax node representing the list of arguments of the invocation expression. - public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementAccessExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) { - 0 => GetRedAtZero(ref this.expression)!, - 1 => GetRed(ref this.argumentList, 1)!, - _ => null, - }; + if (expression != this.Expression || argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.argumentList, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInvocationExpression(this); + public ElementAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); + public ElementAccessExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(this.Expression, argumentList); - public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList) + public ElementAccessExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); + } + + /// Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. + public abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode { - if (expression != this.Expression || argumentList != this.ArgumentList) + internal BaseArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.InvocationExpression(expression, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public InvocationExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); - public InvocationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Expression, argumentList); - - public InvocationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); -} - -/// Class which represents the syntax node for element access expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; - private BracketedArgumentListSyntax? argumentList; + /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. + public abstract SeparatedSyntaxList Arguments { get; } + public BaseArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => WithArgumentsCore(arguments); + internal abstract BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments); - internal ElementAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + public BaseArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => AddArgumentsCore(items); + internal abstract BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items); } - /// ExpressionSyntax node representing the expression which is accessing the element. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - - /// BracketedArgumentListSyntax node representing the list of arguments of the element access expression. - public BracketedArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 1 => GetRed(ref this.argumentList, 1)!, - _ => null, - }; + /// Class which represents the syntax node for the list of arguments. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ArgumentListSyntax : BaseArgumentListSyntax + { + private SyntaxNode? arguments; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + internal ArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.expression, - 1 => this.argumentList, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementAccessExpression(this); + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); - public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - { - if (expression != this.Expression || argumentList != this.ArgumentList) + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public override SeparatedSyntaxList Arguments { - var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } } - return this; - } + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - public ElementAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); - public ElementAccessExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(this.Expression, argumentList); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - public ElementAccessExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); -} + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; -/// Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. -public abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode -{ - internal BaseArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgumentList(this); - /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. - public abstract SeparatedSyntaxList Arguments { get; } - public BaseArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => WithArgumentsCore(arguments); - internal abstract BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments); + public ArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public BaseArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => AddArgumentsCore(items); - internal abstract BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items); -} + return this; + } -/// Class which represents the syntax node for the list of arguments. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ArgumentListSyntax : BaseArgumentListSyntax -{ - private SyntaxNode? arguments; + public ArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); + internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); + public new ArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); + public ArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); - internal ArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); + public new ArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); - - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override SeparatedSyntaxList Arguments => GetRed(ref this.arguments, 1) is { } red ? new(red, GetChildIndex(1)) : default; - - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgumentList(this); - - public ArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + /// Class which represents the syntax node for bracketed argument list. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) + private SyntaxNode? arguments; + + internal BracketedArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public ArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); - internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); - public new ArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); - public ArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); + /// SyntaxToken representing open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); - internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); - public new ArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); -} + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public override SeparatedSyntaxList Arguments + { + get + { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } -/// Class which represents the syntax node for bracketed argument list. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax -{ - private SyntaxNode? arguments; + /// SyntaxToken representing close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal BracketedArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override SeparatedSyntaxList Arguments => GetRed(ref this.arguments, 1) is { } red ? new(red, GetChildIndex(1)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedArgumentList(this); - /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) + { + var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + public BracketedArgumentListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Arguments, this.CloseBracketToken); + internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); + public new BracketedArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenBracketToken, arguments, this.CloseBracketToken); + public BracketedArgumentListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Arguments, closeBracketToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedArgumentList(this); + internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); + public new BracketedArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); + } - public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + /// Class which represents the syntax node for argument. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ArgumentSyntax : CSharpSyntaxNode { - if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) + private NameColonSyntax? nameColon; + private ExpressionSyntax? expression; + + internal ArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public BracketedArgumentListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Arguments, this.CloseBracketToken); - internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); - public new BracketedArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenBracketToken, arguments, this.CloseBracketToken); - public BracketedArgumentListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Arguments, closeBracketToken); - - internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); - public new BracketedArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); -} + /// NameColonSyntax node representing the optional name arguments. + public NameColonSyntax? NameColon => GetRedAtZero(ref this.nameColon); -/// Class which represents the syntax node for argument. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ArgumentSyntax : CSharpSyntaxNode -{ - private NameColonSyntax? nameColon; - private ExpressionSyntax? expression; + /// SyntaxToken representing the optional ref or out keyword. + public SyntaxToken RefKindKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - internal ArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// ExpressionSyntax node representing the argument. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - /// NameColonSyntax node representing the optional name arguments. - public NameColonSyntax? NameColon => GetRedAtZero(ref this.nameColon); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.nameColon), + 2 => GetRed(ref this.expression, 2)!, + _ => null, + }; - /// SyntaxToken representing the optional ref or out keyword. - public SyntaxToken RefKindKeyword => ((InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.nameColon, + 2 => this.expression, + _ => null, + }; - /// ExpressionSyntax node representing the argument. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgument(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public ArgumentSyntax Update(NameColonSyntax? nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) { - 0 => GetRedAtZero(ref this.nameColon), - 2 => GetRed(ref this.expression, 2)!, - _ => null, - }; + if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) + { + var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.nameColon, - 2 => this.expression, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgument(this); + public ArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(nameColon, this.RefKindKeyword, this.Expression); + public ArgumentSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(this.NameColon, refKindKeyword, this.Expression); + public ArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameColon, this.RefKindKeyword, expression); + } - public ArgumentSyntax Update(NameColonSyntax? nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) + public abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode { - if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) + internal BaseExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public abstract ExpressionSyntax Expression { get; } + public BaseExpressionColonSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); + internal abstract BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression); - public ArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(nameColon, this.RefKindKeyword, this.Expression); - public ArgumentSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(this.NameColon, refKindKeyword, this.Expression); - public ArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameColon, this.RefKindKeyword, expression); -} + public abstract SyntaxToken ColonToken { get; } + public BaseExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); + internal abstract BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken); + } -public abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode -{ - internal BaseExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax { - } + private ExpressionSyntax? expression; - public abstract ExpressionSyntax Expression { get; } - public BaseExpressionColonSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); - internal abstract BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression); + internal ExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public abstract SyntaxToken ColonToken { get; } - public BaseExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); - internal abstract BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken); -} + public override ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax -{ - private ExpressionSyntax? expression; + public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.ExpressionColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - internal ExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - public override ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public override SyntaxToken ColonToken => new(this, ((InternalSyntax.ExpressionColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionColon(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken) + { + if (expression != this.Expression || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.ExpressionColon(expression, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionColon(this); + internal override BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); + public new ExpressionColonSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ColonToken); + internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new ExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Expression, colonToken); + } - public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken) + /// Class which represents the syntax node for name colon syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class NameColonSyntax : BaseExpressionColonSyntax { - if (expression != this.Expression || colonToken != this.ColonToken) + private IdentifierNameSyntax? name; + + internal NameColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ExpressionColon(expression, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); - public new ExpressionColonSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ColonToken); - internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new ExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Expression, colonToken); -} + /// IdentifierNameSyntax representing the identifier name. + public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; -/// Class which represents the syntax node for name colon syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class NameColonSyntax : BaseExpressionColonSyntax -{ - private IdentifierNameSyntax? name; + /// SyntaxToken representing colon. + public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.NameColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - internal NameColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - /// IdentifierNameSyntax representing the identifier name. - public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - /// SyntaxToken representing colon. - public override SyntaxToken ColonToken => new(this, ((InternalSyntax.NameColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameColon(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken) + { + if (name != this.Name || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.NameColon(name, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameColon(this); + public NameColonSyntax WithName(IdentifierNameSyntax name) => Update(name, this.ColonToken); + internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new NameColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Name, colonToken); + } - public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken) + /// Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DeclarationExpressionSyntax : ExpressionSyntax { - if (name != this.Name || colonToken != this.ColonToken) + private TypeSyntax? type; + private VariableDesignationSyntax? designation; + + internal DeclarationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.NameColon(name, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public NameColonSyntax WithName(IdentifierNameSyntax name) => Update(name, this.ColonToken); - internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new NameColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Name, colonToken); -} + public TypeSyntax Type => GetRedAtZero(ref this.type)!; -/// Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DeclarationExpressionSyntax : ExpressionSyntax -{ - private TypeSyntax? type; - private VariableDesignationSyntax? designation; + /// Declaration representing the variable declared in an out parameter or deconstruction. + public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; - internal DeclarationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.designation, 1)!, + _ => null, + }; - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.designation, + _ => null, + }; - /// Declaration representing the variable declared in an out parameter or deconstruction. - public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.designation, 1)!, - _ => null, - }; + if (type != this.Type || designation != this.Designation) + { + var newNode = SyntaxFactory.DeclarationExpression(type, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.designation, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationExpression(this); + public DeclarationExpressionSyntax WithType(TypeSyntax type) => Update(type, this.Designation); + public DeclarationExpressionSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); + } - public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + /// Class which represents the syntax node for cast expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CastExpressionSyntax : ExpressionSyntax { - if (type != this.Type || designation != this.Designation) + private TypeSyntax? type; + private ExpressionSyntax? expression; + + internal CastExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.DeclarationExpression(type, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public DeclarationExpressionSyntax WithType(TypeSyntax type) => Update(type, this.Designation); - public DeclarationExpressionSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); -} + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CastExpressionSyntax)this.Green).openParenToken, Position, 0); -/// Class which represents the syntax node for cast expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CastExpressionSyntax : ExpressionSyntax -{ - private TypeSyntax? type; - private ExpressionSyntax? expression; + /// TypeSyntax node representing the type to which the expression is being cast. + public TypeSyntax Type => GetRed(ref this.type, 1)!; - internal CastExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CastExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CastExpressionSyntax)this.Green).openParenToken, Position, 0); + /// ExpressionSyntax node representing the expression that is being casted. + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - /// TypeSyntax node representing the type to which the expression is being cast. - public TypeSyntax Type => GetRed(ref this.type, 1)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1)!, + 3 => GetRed(ref this.expression, 3)!, + _ => null, + }; - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CastExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 3 => this.expression, + _ => null, + }; - /// ExpressionSyntax node representing the expression that is being casted. - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCastExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) { - 1 => GetRed(ref this.type, 1)!, - 3 => GetRed(ref this.expression, 3)!, - _ => null, - }; + if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression) + { + var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 3 => this.expression, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCastExpression(this); + public CastExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.CloseParenToken, this.Expression); + public CastExpressionSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.CloseParenToken, this.Expression); + public CastExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, closeParenToken, this.Expression); + public CastExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, this.Type, this.CloseParenToken, expression); + } - public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + /// Provides the base class from which the classes that represent anonymous function expressions are derived. + public abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax { - if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression) + internal AnonymousFunctionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public abstract SyntaxTokenList Modifiers { get; } + public AnonymousFunctionExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); + internal abstract AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers); - public CastExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.CloseParenToken, this.Expression); - public CastExpressionSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.CloseParenToken, this.Expression); - public CastExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, closeParenToken, this.Expression); - public CastExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, this.Type, this.CloseParenToken, expression); -} + public AnonymousFunctionExpressionSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); + internal abstract AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items); -/// Provides the base class from which the classes that represent anonymous function expressions are derived. -public abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax -{ - internal AnonymousFunctionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// + /// BlockSyntax node representing the body of the anonymous function. + /// Only one of Block or ExpressionBody will be non-null. + /// + public abstract BlockSyntax? Block { get; } + public AnonymousFunctionExpressionSyntax WithBlock(BlockSyntax? block) => WithBlockCore(block); + internal abstract AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block); - public abstract SyntaxTokenList Modifiers { get; } - public AnonymousFunctionExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); - internal abstract AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers); + public AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); + internal abstract AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items); - public AnonymousFunctionExpressionSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); - internal abstract AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items); + public AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); + internal abstract AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items); - /// - /// BlockSyntax node representing the body of the anonymous function. - /// Only one of Block or ExpressionBody will be non-null. - /// - public abstract BlockSyntax? Block { get; } - public AnonymousFunctionExpressionSyntax WithBlock(BlockSyntax? block) => WithBlockCore(block); - internal abstract AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block); + /// + /// ExpressionSyntax node representing the body of the anonymous function. + /// Only one of Block or ExpressionBody will be non-null. + /// + public abstract ExpressionSyntax? ExpressionBody { get; } + public AnonymousFunctionExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); + internal abstract AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody); + } - public AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); - internal abstract AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items); + /// Class which represents the syntax node for anonymous method expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax + { + private ParameterListSyntax? parameterList; + private BlockSyntax? block; + private ExpressionSyntax? expressionBody; - public AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); - internal abstract AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items); + internal AnonymousMethodExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// - /// ExpressionSyntax node representing the body of the anonymous function. - /// Only one of Block or ExpressionBody will be non-null. - /// - public abstract ExpressionSyntax? ExpressionBody { get; } - public AnonymousFunctionExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); - internal abstract AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody); -} + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(0); + return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; + } + } -/// Class which represents the syntax node for anonymous method expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax -{ - private ParameterListSyntax? parameterList; - private BlockSyntax? block; - private ExpressionSyntax? expressionBody; + /// SyntaxToken representing the delegate keyword. + public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); - internal AnonymousMethodExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// List of parameters of the anonymous method expression, or null if there no parameters are specified. + public ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 2); - public override SyntaxTokenList Modifiers => this.Green.GetSlot(0) is { } slot ? new(this, slot, Position, 0) : default; + /// + /// BlockSyntax node representing the body of the anonymous function. + /// This will never be null. + /// + public override BlockSyntax Block => GetRed(ref this.block, 3)!; - /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => new(this, ((InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); + /// + /// Inherited from AnonymousFunctionExpressionSyntax, but not used for + /// AnonymousMethodExpressionSyntax. This will always be null. + /// + public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); - /// List of parameters of the anonymous method expression, or null if there no parameters are specified. - public ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 2); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 2 => GetRed(ref this.parameterList, 2), + 3 => GetRed(ref this.block, 3)!, + 4 => GetRed(ref this.expressionBody, 4), + _ => null, + }; - /// - /// BlockSyntax node representing the body of the anonymous function. - /// This will never be null. - /// - public override BlockSyntax Block => GetRed(ref this.block, 3)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 2 => this.parameterList, + 3 => this.block, + 4 => this.expressionBody, + _ => null, + }; - /// - /// Inherited from AnonymousFunctionExpressionSyntax, but not used for - /// AnonymousMethodExpressionSyntax. This will always be null. - /// - public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousMethodExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public AnonymousMethodExpressionSyntax Update(SyntaxTokenList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) { - 2 => GetRed(ref this.parameterList, 2), - 3 => GetRed(ref this.block, 3)!, - 4 => GetRed(ref this.expressionBody, 4), - _ => null, - }; + if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) + { + var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.parameterList, - 3 => this.block, - 4 => this.expressionBody, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousMethodExpression(this); + internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new AnonymousMethodExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(modifiers, this.DelegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); + public AnonymousMethodExpressionSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.Modifiers, delegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); + public AnonymousMethodExpressionSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.Modifiers, this.DelegateKeyword, parameterList, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block ?? throw new ArgumentNullException(nameof(block))); + public new AnonymousMethodExpressionSyntax WithBlock(BlockSyntax block) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new AnonymousMethodExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, this.Block, expressionBody); - public AnonymousMethodExpressionSyntax Update(SyntaxTokenList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) - { - if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) + internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new AnonymousMethodExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public AnonymousMethodExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) { - var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); } - - return this; + internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); + public new AnonymousMethodExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); + public new AnonymousMethodExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); } - internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new AnonymousMethodExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(modifiers, this.DelegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); - public AnonymousMethodExpressionSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.Modifiers, delegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); - public AnonymousMethodExpressionSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.Modifiers, this.DelegateKeyword, parameterList, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block ?? throw new ArgumentNullException(nameof(block))); - public new AnonymousMethodExpressionSyntax WithBlock(BlockSyntax block) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new AnonymousMethodExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, this.Block, expressionBody); - - internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new AnonymousMethodExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public AnonymousMethodExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) + /// Provides the base class from which the classes that represent lambda expressions are derived. + public abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); - } - internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); - public new AnonymousMethodExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); - public new AnonymousMethodExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); -} + internal LambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// Provides the base class from which the classes that represent lambda expressions are derived. -public abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax -{ - internal LambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public abstract SyntaxList AttributeLists { get; } + public LambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists); - public abstract SyntaxList AttributeLists { get; } - public LambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists); + public LambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items); - public LambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + /// SyntaxToken representing equals greater than. + public abstract SyntaxToken ArrowToken { get; } + public LambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => WithArrowTokenCore(arrowToken); + internal abstract LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken); - /// SyntaxToken representing equals greater than. - public abstract SyntaxToken ArrowToken { get; } - public LambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => WithArrowTokenCore(arrowToken); - internal abstract LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken); + public new LambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => (LambdaExpressionSyntax)WithModifiersCore(modifiers); + public new LambdaExpressionSyntax WithBlock(BlockSyntax? block) => (LambdaExpressionSyntax)WithBlockCore(block); + public new LambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => (LambdaExpressionSyntax)WithExpressionBodyCore(expressionBody); - public new LambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => (LambdaExpressionSyntax)WithModifiersCore(modifiers); - public new LambdaExpressionSyntax WithBlock(BlockSyntax? block) => (LambdaExpressionSyntax)WithBlockCore(block); - public new LambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => (LambdaExpressionSyntax)WithExpressionBodyCore(expressionBody); + public new LambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => (LambdaExpressionSyntax)AddModifiersCore(items); - public new LambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => (LambdaExpressionSyntax)AddModifiersCore(items); + public new AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); + + public new AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); + } + + /// Class which represents the syntax node for a simple lambda expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax + { + private SyntaxNode? attributeLists; + private ParameterSyntax? parameter; + private BlockSyntax? block; + private ExpressionSyntax? expressionBody; - public new AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); + internal SimpleLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public new AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); -} + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); -/// Class which represents the syntax node for a simple lambda expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax -{ - private SyntaxNode? attributeLists; - private ParameterSyntax? parameter; - private BlockSyntax? block; - private ExpressionSyntax? expressionBody; + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - internal SimpleLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// ParameterSyntax node representing the parameter of the lambda expression. + public ParameterSyntax Parameter => GetRed(ref this.parameter, 2)!; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + /// SyntaxToken representing equals greater than. + public override SyntaxToken ArrowToken => new SyntaxToken(this, ((InternalSyntax.SimpleLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(3), GetChildIndex(3)); - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + /// + /// BlockSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override BlockSyntax? Block => GetRed(ref this.block, 4); - /// ParameterSyntax node representing the parameter of the lambda expression. - public ParameterSyntax Parameter => GetRed(ref this.parameter, 2)!; + /// + /// ExpressionSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 5); - /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => new(this, ((InternalSyntax.SimpleLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(3), GetChildIndex(3)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.parameter, 2)!, + 4 => GetRed(ref this.block, 4), + 5 => GetRed(ref this.expressionBody, 5), + _ => null, + }; - /// - /// BlockSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override BlockSyntax? Block => GetRed(ref this.block, 4); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.parameter, + 4 => this.block, + 5 => this.expressionBody, + _ => null, + }; - /// - /// ExpressionSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 5); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleLambdaExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public SimpleLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.parameter, 2)!, - 4 => GetRed(ref this.block, 4), - 5 => GetRed(ref this.expressionBody, 5), - _ => null, - }; + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) + { + var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.parameter, - 4 => this.block, - 5 => this.expressionBody, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleLambdaExpression(this); + internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new SimpleLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new SimpleLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); + public SimpleLambdaExpressionSyntax WithParameter(ParameterSyntax parameter) => Update(this.AttributeLists, this.Modifiers, parameter, this.ArrowToken, this.Block, this.ExpressionBody); + internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); + public new SimpleLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.Parameter, arrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); + public new SimpleLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new SimpleLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, expressionBody); - public SimpleLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) + internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new SimpleLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new SimpleLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public SimpleLambdaExpressionSyntax AddParameterAttributeLists(params AttributeListSyntax[] items) => WithParameter(this.Parameter.WithAttributeLists(this.Parameter.AttributeLists.AddRange(items))); + public SimpleLambdaExpressionSyntax AddParameterModifiers(params SyntaxToken[] items) => WithParameter(this.Parameter.WithModifiers(this.Parameter.Modifiers.AddRange(items))); + internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); + public new SimpleLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) { - var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); + } + internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); + public new SimpleLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) + { + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithStatements(block.Statements.AddRange(items))); } - - return this; } - internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new SimpleLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new SimpleLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); - public SimpleLambdaExpressionSyntax WithParameter(ParameterSyntax parameter) => Update(this.AttributeLists, this.Modifiers, parameter, this.ArrowToken, this.Block, this.ExpressionBody); - internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); - public new SimpleLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.Parameter, arrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); - public new SimpleLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new SimpleLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, expressionBody); - - internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new SimpleLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new SimpleLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public SimpleLambdaExpressionSyntax AddParameterAttributeLists(params AttributeListSyntax[] items) => WithParameter(this.Parameter.WithAttributeLists(this.Parameter.AttributeLists.AddRange(items))); - public SimpleLambdaExpressionSyntax AddParameterModifiers(params SyntaxToken[] items) => WithParameter(this.Parameter.WithModifiers(this.Parameter.Modifiers.AddRange(items))); - internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); - public new SimpleLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) - { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); - } - internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); - public new SimpleLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class RefExpressionSyntax : ExpressionSyntax { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithStatements(block.Statements.AddRange(items))); - } -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class RefExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; + private ExpressionSyntax? expression; - internal RefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal RefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken RefKeyword => new(this, ((InternalSyntax.RefExpressionSyntax)this.Green).refKeyword, Position, 0); + public SyntaxToken RefKeyword => new SyntaxToken(this, ((InternalSyntax.RefExpressionSyntax)this.Green).refKeyword, Position, 0); - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefExpression(this); - public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression) - { - if (refKeyword != this.RefKeyword || expression != this.Expression) + public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression) { - var newNode = SyntaxFactory.RefExpression(refKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (refKeyword != this.RefKeyword || expression != this.Expression) + { + var newNode = SyntaxFactory.RefExpression(refKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public RefExpressionSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.Expression); + public RefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.RefKeyword, expression); } - public RefExpressionSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.Expression); - public RefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.RefKeyword, expression); -} + /// Class which represents the syntax node for parenthesized lambda expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax + { + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private ParameterListSyntax? parameterList; + private BlockSyntax? block; + private ExpressionSyntax? expressionBody; -/// Class which represents the syntax node for parenthesized lambda expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private ParameterListSyntax? parameterList; - private BlockSyntax? block; - private ExpressionSyntax? expressionBody; + internal ParenthesizedLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal ParenthesizedLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + public TypeSyntax? ReturnType => GetRed(ref this.returnType, 2); - public TypeSyntax? ReturnType => GetRed(ref this.returnType, 2); + /// ParameterListSyntax node representing the list of parameters for the lambda expression. + public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - /// ParameterListSyntax node representing the list of parameters for the lambda expression. - public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; + /// SyntaxToken representing equals greater than. + public override SyntaxToken ArrowToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(4), GetChildIndex(4)); - /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => new(this, ((InternalSyntax.ParenthesizedLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(4), GetChildIndex(4)); + /// + /// BlockSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override BlockSyntax? Block => GetRed(ref this.block, 5); - /// - /// BlockSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override BlockSyntax? Block => GetRed(ref this.block, 5); + /// + /// ExpressionSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - /// - /// ExpressionSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2), + 3 => GetRed(ref this.parameterList, 3)!, + 5 => GetRed(ref this.block, 5), + 6 => GetRed(ref this.expressionBody, 6), + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2), - 3 => GetRed(ref this.parameterList, 3)!, - 5 => GetRed(ref this.block, 5), - 6 => GetRed(ref this.expressionBody, 6), - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.returnType, + 3 => this.parameterList, + 5 => this.block, + 6 => this.expressionBody, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedLambdaExpression(this); + + public ParenthesizedLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) { - 0 => this.attributeLists, - 2 => this.returnType, - 3 => this.parameterList, - 5 => this.block, - 6 => this.expressionBody, - _ => null, - }; + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) + { + var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedLambdaExpression(this); + internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ParenthesizedLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ParenthesizedLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); + public ParenthesizedLambdaExpressionSyntax WithReturnType(TypeSyntax? returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); + public ParenthesizedLambdaExpressionSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, parameterList, this.ArrowToken, this.Block, this.ExpressionBody); + internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); + public new ParenthesizedLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, arrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); + public new ParenthesizedLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new ParenthesizedLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, expressionBody); - public ParenthesizedLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) + internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ParenthesizedLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ParenthesizedLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public ParenthesizedLambdaExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); + public new ParenthesizedLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) { - var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); + } + internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); + public new ParenthesizedLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) + { + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithStatements(block.Statements.AddRange(items))); } - - return this; } - internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ParenthesizedLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ParenthesizedLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); - public ParenthesizedLambdaExpressionSyntax WithReturnType(TypeSyntax? returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); - public ParenthesizedLambdaExpressionSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, parameterList, this.ArrowToken, this.Block, this.ExpressionBody); - internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); - public new ParenthesizedLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, arrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); - public new ParenthesizedLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new ParenthesizedLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, expressionBody); - - internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ParenthesizedLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ParenthesizedLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public ParenthesizedLambdaExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); - public new ParenthesizedLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) + /// Class which represents the syntax node for initializer expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + /// + /// + /// + public sealed partial class InitializerExpressionSyntax : ExpressionSyntax { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); - } - internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); - public new ParenthesizedLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) - { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithStatements(block.Statements.AddRange(items))); - } -} + private SyntaxNode? expressions; -/// Class which represents the syntax node for initializer expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -/// -/// -/// -public sealed partial class InitializerExpressionSyntax : ExpressionSyntax -{ - private SyntaxNode? expressions; + internal InitializerExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal InitializerExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the open brace. + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); + + /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. + public SeparatedSyntaxList Expressions + { + get + { + var red = GetRed(ref this.expressions, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); + /// SyntaxToken representing the close brace. + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); - /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. - public SeparatedSyntaxList Expressions => GetRed(ref this.expressions, 1) is { } red ? new(red, GetChildIndex(1)) : default; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expressions, 1)! : null; - /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expressions : null; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expressions, 1)! : null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInitializerExpression(this); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expressions : null; + public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.InitializerExpression(this.Kind(), openBraceToken, expressions, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public InitializerExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expressions, this.CloseBraceToken); + public InitializerExpressionSyntax WithExpressions(SeparatedSyntaxList expressions) => Update(this.OpenBraceToken, expressions, this.CloseBraceToken); + public InitializerExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expressions, closeBraceToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInitializerExpression(this); + public InitializerExpressionSyntax AddExpressions(params ExpressionSyntax[] items) => WithExpressions(this.Expressions.AddRange(items)); + } - public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + public abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax { - if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) + internal BaseObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.InitializerExpression(this.Kind(), openBraceToken, expressions, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// SyntaxToken representing the new keyword. + public abstract SyntaxToken NewKeyword { get; } + public BaseObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => WithNewKeywordCore(newKeyword); + internal abstract BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword); - public InitializerExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expressions, this.CloseBraceToken); - public InitializerExpressionSyntax WithExpressions(SeparatedSyntaxList expressions) => Update(this.OpenBraceToken, expressions, this.CloseBraceToken); - public InitializerExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expressions, closeBraceToken); + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public abstract ArgumentListSyntax? ArgumentList { get; } + public BaseObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => WithArgumentListCore(argumentList); + internal abstract BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList); - public InitializerExpressionSyntax AddExpressions(params ExpressionSyntax[] items) => WithExpressions(this.Expressions.AddRange(items)); -} + public BaseObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => AddArgumentListArgumentsCore(items); + internal abstract BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items); -public abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax -{ - internal BaseObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public abstract InitializerExpressionSyntax? Initializer { get; } + public BaseObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => WithInitializerCore(initializer); + internal abstract BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer); } - /// SyntaxToken representing the new keyword. - public abstract SyntaxToken NewKeyword { get; } - public BaseObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => WithNewKeywordCore(newKeyword); - internal abstract BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword); - - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public abstract ArgumentListSyntax? ArgumentList { get; } - public BaseObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => WithArgumentListCore(argumentList); - internal abstract BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList); + /// Class which represents the syntax node for implicit object creation expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax + { + private ArgumentListSyntax? argumentList; + private InitializerExpressionSyntax? initializer; - public BaseObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => AddArgumentListArgumentsCore(items); - internal abstract BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items); + internal ImplicitObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public abstract InitializerExpressionSyntax? Initializer { get; } - public BaseObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => WithInitializerCore(initializer); - internal abstract BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer); -} + /// SyntaxToken representing the new keyword. + public override SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ImplicitObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); -/// Class which represents the syntax node for implicit object creation expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax -{ - private ArgumentListSyntax? argumentList; - private InitializerExpressionSyntax? initializer; + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public override ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - internal ImplicitObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); - /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => new(this, ((InternalSyntax.ImplicitObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.argumentList, 1)!, + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public override ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.argumentList, + 2 => this.initializer, + _ => null, + }; - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitObjectCreationExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) { - 1 => GetRed(ref this.argumentList, 1)!, - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; + if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer) + { + var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.argumentList, - 2 => this.initializer, - _ => null, - }; + return this; + } + + internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); + public new ImplicitObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.ArgumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList ?? throw new ArgumentNullException(nameof(argumentList))); + public new ImplicitObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.NewKeyword, argumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); + public new ImplicitObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.ArgumentList, initializer); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitObjectCreationExpression(this); + internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); + public new ImplicitObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); + } - public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + /// Class which represents the syntax node for object creation expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax { - if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer) + private TypeSyntax? type; + private ArgumentListSyntax? argumentList; + private InitializerExpressionSyntax? initializer; + + internal ObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); - public new ImplicitObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.ArgumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList ?? throw new ArgumentNullException(nameof(argumentList))); - public new ImplicitObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.NewKeyword, argumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); - public new ImplicitObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.ArgumentList, initializer); + /// SyntaxToken representing the new keyword. + public override SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); - public new ImplicitObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); -} - -/// Class which represents the syntax node for object creation expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax -{ - private TypeSyntax? type; - private ArgumentListSyntax? argumentList; - private InitializerExpressionSyntax? initializer; + /// TypeSyntax representing the type of the object being created. + public TypeSyntax Type => GetRed(ref this.type, 1)!; - internal ObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public override ArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 2); - /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => new(this, ((InternalSyntax.ObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 3); - /// TypeSyntax representing the type of the object being created. - public TypeSyntax Type => GetRed(ref this.type, 1)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1)!, + 2 => GetRed(ref this.argumentList, 2), + 3 => GetRed(ref this.initializer, 3), + _ => null, + }; - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public override ArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 2); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 2 => this.argumentList, + 3 => this.initializer, + _ => null, + }; - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 3); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitObjectCreationExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) { - 1 => GetRed(ref this.type, 1)!, - 2 => GetRed(ref this.argumentList, 2), - 3 => GetRed(ref this.initializer, 3), - _ => null, - }; + if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) + { + var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 2 => this.argumentList, - 3 => this.initializer, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitObjectCreationExpression(this); + internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); + public new ObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.ArgumentList, this.Initializer); + public ObjectCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.NewKeyword, type, this.ArgumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList); + public new ObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => Update(this.NewKeyword, this.Type, argumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); + public new ObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, this.ArgumentList, initializer); - public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) - { - if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) + internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); + public new ObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) { - var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var argumentList = this.ArgumentList ?? SyntaxFactory.ArgumentList(); + return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); } - - return this; } - internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); - public new ObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.ArgumentList, this.Initializer); - public ObjectCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.NewKeyword, type, this.ArgumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList); - public new ObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => Update(this.NewKeyword, this.Type, argumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); - public new ObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, this.ArgumentList, initializer); - - internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); - public new ObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class WithExpressionSyntax : ExpressionSyntax { - var argumentList = this.ArgumentList ?? SyntaxFactory.ArgumentList(); - return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); - } -} + private ExpressionSyntax? expression; + private InitializerExpressionSyntax? initializer; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class WithExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; - private InitializerExpressionSyntax? initializer; - - internal WithExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal WithExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public SyntaxToken WithKeyword => new(this, ((InternalSyntax.WithExpressionSyntax)this.Green).withKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken WithKeyword => new SyntaxToken(this, ((InternalSyntax.WithExpressionSyntax)this.Green).withKeyword, GetChildPosition(1), GetChildIndex(1)); - /// InitializerExpressionSyntax representing the initializer expression for the with expression. - public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 2)!; + /// InitializerExpressionSyntax representing the initializer expression for the with expression. + public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.initializer, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.initializer, 2)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.initializer, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 2 => this.initializer, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWithExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWithExpression(this); - public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) - { - if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer) + public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) { - var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer) + { + var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public WithExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.WithKeyword, this.Initializer); + public WithExpressionSyntax WithWithKeyword(SyntaxToken withKeyword) => Update(this.Expression, withKeyword, this.Initializer); + public WithExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.Expression, this.WithKeyword, initializer); + + public WithExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); } - public WithExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.WithKeyword, this.Initializer); - public WithExpressionSyntax WithWithKeyword(SyntaxToken withKeyword) => Update(this.Expression, withKeyword, this.Initializer); - public WithExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.Expression, this.WithKeyword, initializer); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode + { + private NameEqualsSyntax? nameEquals; + private ExpressionSyntax? expression; - public WithExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); -} + internal AnonymousObjectMemberDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode -{ - private NameEqualsSyntax? nameEquals; - private ExpressionSyntax? expression; + /// NameEqualsSyntax representing the optional name of the member being initialized. + public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); - internal AnonymousObjectMemberDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// ExpressionSyntax representing the value the member is initialized with. + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - /// NameEqualsSyntax representing the optional name of the member being initialized. - public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.nameEquals), + 1 => GetRed(ref this.expression, 1)!, + _ => null, + }; - /// ExpressionSyntax representing the value the member is initialized with. - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.nameEquals, + 1 => this.expression, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.nameEquals), - 1 => GetRed(ref this.expression, 1)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectMemberDeclarator(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) { - 0 => this.nameEquals, - 1 => this.expression, - _ => null, - }; + if (nameEquals != this.NameEquals || expression != this.Expression) + { + var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectMemberDeclarator(this); + return this; + } - public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) + public AnonymousObjectMemberDeclaratorSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.Expression); + public AnonymousObjectMemberDeclaratorSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, expression); + } + + /// Class which represents the syntax node for anonymous object creation expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax { - if (nameEquals != this.NameEquals || expression != this.Expression) + private SyntaxNode? initializers; + + internal AnonymousObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - public AnonymousObjectMemberDeclaratorSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.Expression); - public AnonymousObjectMemberDeclaratorSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, expression); -} + /// SyntaxToken representing the open brace. + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); -/// Class which represents the syntax node for anonymous object creation expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax -{ - private SyntaxNode? initializers; + /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. + public SeparatedSyntaxList Initializers + { + get + { + var red = GetRed(ref this.initializers, 2); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; + } + } - internal AnonymousObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the close brace. + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.initializers, 2)! : null; - /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.initializers : null; - /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. - public SeparatedSyntaxList Initializers => GetRed(ref this.initializers, 2) is { } red ? new(red, GetChildIndex(2)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectCreationExpression(this); - /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); + public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + { + if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.initializers, 2)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.initializers : null; + public AnonymousObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBraceToken, this.Initializers, this.CloseBraceToken); + public AnonymousObjectCreationExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.NewKeyword, openBraceToken, this.Initializers, this.CloseBraceToken); + public AnonymousObjectCreationExpressionSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.NewKeyword, this.OpenBraceToken, initializers, this.CloseBraceToken); + public AnonymousObjectCreationExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.NewKeyword, this.OpenBraceToken, this.Initializers, closeBraceToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectCreationExpression(this); + public AnonymousObjectCreationExpressionSyntax AddInitializers(params AnonymousObjectMemberDeclaratorSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); + } - public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + /// Class which represents the syntax node for array creation expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax { - if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) + private ArrayTypeSyntax? type; + private InitializerExpressionSyntax? initializer; + + internal ArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public AnonymousObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBraceToken, this.Initializers, this.CloseBraceToken); - public AnonymousObjectCreationExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.NewKeyword, openBraceToken, this.Initializers, this.CloseBraceToken); - public AnonymousObjectCreationExpressionSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.NewKeyword, this.OpenBraceToken, initializers, this.CloseBraceToken); - public AnonymousObjectCreationExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.NewKeyword, this.OpenBraceToken, this.Initializers, closeBraceToken); + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - public AnonymousObjectCreationExpressionSyntax AddInitializers(params AnonymousObjectMemberDeclaratorSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); -} - -/// Class which represents the syntax node for array creation expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax -{ - private ArrayTypeSyntax? type; - private InitializerExpressionSyntax? initializer; + /// ArrayTypeSyntax node representing the type of the array. + public ArrayTypeSyntax Type => GetRed(ref this.type, 1)!; - internal ArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// InitializerExpressionSyntax node representing the initializer of the array creation expression. + public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new(this, ((InternalSyntax.ArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1)!, + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - /// ArrayTypeSyntax node representing the type of the array. - public ArrayTypeSyntax Type => GetRed(ref this.type, 1)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 2 => this.initializer, + _ => null, + }; - /// InitializerExpressionSyntax node representing the initializer of the array creation expression. - public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayCreationExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) { - 1 => GetRed(ref this.type, 1)!, - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; + if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer) + { + var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 2 => this.initializer, - _ => null, - }; + return this; + } + + public ArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.Initializer); + public ArrayCreationExpressionSyntax WithType(ArrayTypeSyntax type) => Update(this.NewKeyword, type, this.Initializer); + public ArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, initializer); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayCreationExpression(this); + public ArrayCreationExpressionSyntax AddTypeRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithType(this.Type.WithRankSpecifiers(this.Type.RankSpecifiers.AddRange(items))); + } - public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + /// Class which represents the syntax node for implicit array creation expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax { - if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer) + private InitializerExpressionSyntax? initializer; + + internal ImplicitArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public ArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.Initializer); - public ArrayCreationExpressionSyntax WithType(ArrayTypeSyntax type) => Update(this.NewKeyword, type, this.Initializer); - public ArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, initializer); + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - public ArrayCreationExpressionSyntax AddTypeRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithType(this.Type.WithRankSpecifiers(this.Type.RankSpecifiers.AddRange(items))); -} + /// SyntaxToken representing the open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); -/// Class which represents the syntax node for implicit array creation expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax -{ - private InitializerExpressionSyntax? initializer; + /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. + public SyntaxTokenList Commas + { + get + { + var slot = this.Green.GetSlot(2); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + } + } - internal ImplicitArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. + public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 4)!; - /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.initializer, 4)! : null; - /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. - public SyntaxTokenList Commas => this.Green.GetSlot(2) is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.initializer : null; - /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitArrayCreationExpression(this); - /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. - public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 4)!; + public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, SyntaxTokenList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) + { + var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.initializer, 4)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.initializer : null; + public ImplicitArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.NewKeyword, openBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithCommas(SyntaxTokenList commas) => Update(this.NewKeyword, this.OpenBracketToken, commas, this.CloseBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, closeBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, initializer); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitArrayCreationExpression(this); + public ImplicitArrayCreationExpressionSyntax AddCommas(params SyntaxToken[] items) => WithCommas(this.Commas.AddRange(items)); + public ImplicitArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); + } - public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, SyntaxTokenList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + /// Class which represents the syntax node for stackalloc array creation expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax { - if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) + private TypeSyntax? type; + private InitializerExpressionSyntax? initializer; + + internal StackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public ImplicitArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.NewKeyword, openBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithCommas(SyntaxTokenList commas) => Update(this.NewKeyword, this.OpenBracketToken, commas, this.CloseBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, closeBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, initializer); + /// SyntaxToken representing the stackalloc keyword. + public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((InternalSyntax.StackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); - public ImplicitArrayCreationExpressionSyntax AddCommas(params SyntaxToken[] items) => WithCommas(this.Commas.AddRange(items)); - public ImplicitArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); -} - -/// Class which represents the syntax node for stackalloc array creation expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax -{ - private TypeSyntax? type; - private InitializerExpressionSyntax? initializer; + /// TypeSyntax node representing the type of the stackalloc array. + public TypeSyntax Type => GetRed(ref this.type, 1)!; - internal StackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. + public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); - /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => new(this, ((InternalSyntax.StackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1)!, + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - /// TypeSyntax node representing the type of the stackalloc array. - public TypeSyntax Type => GetRed(ref this.type, 1)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 2 => this.initializer, + _ => null, + }; - /// InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. - public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStackAllocArrayCreationExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) { - 1 => GetRed(ref this.type, 1)!, - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; + if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer) + { + var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 2 => this.initializer, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStackAllocArrayCreationExpression(this); + public StackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.Type, this.Initializer); + public StackAllocArrayCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.StackAllocKeyword, type, this.Initializer); + public StackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.StackAllocKeyword, this.Type, initializer); + } - public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) + /// Class which represents the syntax node for implicit stackalloc array creation expression. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax { - if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer) + private InitializerExpressionSyntax? initializer; + + internal ImplicitStackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// SyntaxToken representing the stackalloc keyword. + public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); - public StackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.Type, this.Initializer); - public StackAllocArrayCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.StackAllocKeyword, type, this.Initializer); - public StackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.StackAllocKeyword, this.Type, initializer); -} + /// SyntaxToken representing the open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); -/// Class which represents the syntax node for implicit stackalloc array creation expression. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax -{ - private InitializerExpressionSyntax? initializer; + /// SyntaxToken representing the close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal ImplicitStackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. + public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 3)!; - /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => new(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.initializer, 3)! : null; - /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.initializer : null; - /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitStackAllocArrayCreationExpression(this); - /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. - public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 3)!; + public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { + if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) + { + var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.initializer, 3)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.initializer : null; + public ImplicitStackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, this.Initializer); + public ImplicitStackAllocArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.StackAllocKeyword, openBracketToken, this.CloseBracketToken, this.Initializer); + public ImplicitStackAllocArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.StackAllocKeyword, this.OpenBracketToken, closeBracketToken, this.Initializer); + public ImplicitStackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.StackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, initializer); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitStackAllocArrayCreationExpression(this); + public ImplicitStackAllocArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); + } - public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CollectionExpressionSyntax : ExpressionSyntax { - if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) + private SyntaxNode? elements; + + internal CollectionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public ImplicitStackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, this.Initializer); - public ImplicitStackAllocArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.StackAllocKeyword, openBracketToken, this.CloseBracketToken, this.Initializer); - public ImplicitStackAllocArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.StackAllocKeyword, this.OpenBracketToken, closeBracketToken, this.Initializer); - public ImplicitStackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.StackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, initializer); + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); - public ImplicitStackAllocArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); -} + /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. + public SeparatedSyntaxList Elements + { + get + { + var red = GetRed(ref this.elements, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CollectionExpressionSyntax : ExpressionSyntax -{ - private SyntaxNode? elements; + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal CollectionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; - public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; - /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. - public SeparatedSyntaxList Elements => GetRed(ref this.elements, 1) is { } red ? new(red, GetChildIndex(1)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCollectionExpression(this); - public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) + { + var newNode = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; + public CollectionExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Elements, this.CloseBracketToken); + public CollectionExpressionSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenBracketToken, elements, this.CloseBracketToken); + public CollectionExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Elements, closeBracketToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCollectionExpression(this); + public CollectionExpressionSyntax AddElements(params CollectionElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); + } - public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + public abstract partial class CollectionElementSyntax : CSharpSyntaxNode { - if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) + internal CollectionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - - return this; } - public CollectionExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Elements, this.CloseBracketToken); - public CollectionExpressionSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenBracketToken, elements, this.CloseBracketToken); - public CollectionExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Elements, closeBracketToken); - - public CollectionExpressionSyntax AddElements(params CollectionElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); -} - -public abstract partial class CollectionElementSyntax : CSharpSyntaxNode -{ - internal CollectionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ExpressionElementSyntax : CollectionElementSyntax { - } -} + private ExpressionSyntax? expression; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ExpressionElementSyntax : CollectionElementSyntax -{ - private ExpressionSyntax? expression; - - internal ExpressionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal ExpressionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionElement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionElement(this); - public ExpressionElementSyntax Update(ExpressionSyntax expression) - { - if (expression != this.Expression) + public ExpressionElementSyntax Update(ExpressionSyntax expression) { - var newNode = SyntaxFactory.ExpressionElement(expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (expression != this.Expression) + { + var newNode = SyntaxFactory.ExpressionElement(expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public ExpressionElementSyntax WithExpression(ExpressionSyntax expression) => Update(expression); } - public ExpressionElementSyntax WithExpression(ExpressionSyntax expression) => Update(expression); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SpreadElementSyntax : CollectionElementSyntax -{ - private ExpressionSyntax? expression; - - internal SpreadElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SpreadElementSyntax : CollectionElementSyntax { - } + private ExpressionSyntax? expression; - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.SpreadElementSyntax)this.Green).operatorToken, Position, 0); + internal SpreadElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.SpreadElementSyntax)this.Green).operatorToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSpreadElement(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public SpreadElementSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) - { - if (operatorToken != this.OperatorToken || expression != this.Expression) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSpreadElement(this); + + public SpreadElementSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) { - var newNode = SyntaxFactory.SpreadElement(operatorToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (operatorToken != this.OperatorToken || expression != this.Expression) + { + var newNode = SyntaxFactory.SpreadElement(operatorToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public SpreadElementSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); + public SpreadElementSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); } - public SpreadElementSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); - public SpreadElementSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); -} - -public abstract partial class QueryClauseSyntax : CSharpSyntaxNode -{ - internal QueryClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public abstract partial class QueryClauseSyntax : CSharpSyntaxNode { + internal QueryClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } } -} -public abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode -{ - internal SelectOrGroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode { + internal SelectOrGroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } } -} -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class QueryExpressionSyntax : ExpressionSyntax -{ - private FromClauseSyntax? fromClause; - private QueryBodySyntax? body; - - internal QueryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class QueryExpressionSyntax : ExpressionSyntax { - } + private FromClauseSyntax? fromClause; + private QueryBodySyntax? body; - public FromClauseSyntax FromClause => GetRedAtZero(ref this.fromClause)!; + internal QueryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public QueryBodySyntax Body => GetRed(ref this.body, 1)!; + public FromClauseSyntax FromClause => GetRedAtZero(ref this.fromClause)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.fromClause)!, - 1 => GetRed(ref this.body, 1)!, - _ => null, - }; + public QueryBodySyntax Body => GetRed(ref this.body, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.fromClause, - 1 => this.body, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.fromClause)!, + 1 => GetRed(ref this.body, 1)!, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryExpression(this); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.fromClause, + 1 => this.body, + _ => null, + }; - public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body) - { - if (fromClause != this.FromClause || body != this.Body) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryExpression(this); + + public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body) { - var newNode = SyntaxFactory.QueryExpression(fromClause, body); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (fromClause != this.FromClause || body != this.Body) + { + var newNode = SyntaxFactory.QueryExpression(fromClause, body); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public QueryExpressionSyntax WithFromClause(FromClauseSyntax fromClause) => Update(fromClause, this.Body); + public QueryExpressionSyntax WithBody(QueryBodySyntax body) => Update(this.FromClause, body); + + public QueryExpressionSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); } - public QueryExpressionSyntax WithFromClause(FromClauseSyntax fromClause) => Update(fromClause, this.Body); - public QueryExpressionSyntax WithBody(QueryBodySyntax body) => Update(this.FromClause, body); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class QueryBodySyntax : CSharpSyntaxNode + { + private SyntaxNode? clauses; + private SelectOrGroupClauseSyntax? selectOrGroup; + private QueryContinuationSyntax? continuation; - public QueryExpressionSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); -} + internal QueryBodySyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class QueryBodySyntax : CSharpSyntaxNode -{ - private SyntaxNode? clauses; - private SelectOrGroupClauseSyntax? selectOrGroup; - private QueryContinuationSyntax? continuation; + public SyntaxList Clauses => new SyntaxList(GetRed(ref this.clauses, 0)); - internal QueryBodySyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SelectOrGroupClauseSyntax SelectOrGroup => GetRed(ref this.selectOrGroup, 1)!; - public SyntaxList Clauses => new(GetRed(ref this.clauses, 0)); + public QueryContinuationSyntax? Continuation => GetRed(ref this.continuation, 2); - public SelectOrGroupClauseSyntax SelectOrGroup => GetRed(ref this.selectOrGroup, 1)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.clauses)!, + 1 => GetRed(ref this.selectOrGroup, 1)!, + 2 => GetRed(ref this.continuation, 2), + _ => null, + }; - public QueryContinuationSyntax? Continuation => GetRed(ref this.continuation, 2); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.clauses, + 1 => this.selectOrGroup, + 2 => this.continuation, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.clauses)!, - 1 => GetRed(ref this.selectOrGroup, 1)!, - 2 => GetRed(ref this.continuation, 2), - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryBody(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public QueryBodySyntax Update(SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) { - 0 => this.clauses, - 1 => this.selectOrGroup, - 2 => this.continuation, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryBody(this); + if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) + { + var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public QueryBodySyntax Update(SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) - { - if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) - { - var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + return this; } - return this; + public QueryBodySyntax WithClauses(SyntaxList clauses) => Update(clauses, this.SelectOrGroup, this.Continuation); + public QueryBodySyntax WithSelectOrGroup(SelectOrGroupClauseSyntax selectOrGroup) => Update(this.Clauses, selectOrGroup, this.Continuation); + public QueryBodySyntax WithContinuation(QueryContinuationSyntax? continuation) => Update(this.Clauses, this.SelectOrGroup, continuation); + + public QueryBodySyntax AddClauses(params QueryClauseSyntax[] items) => WithClauses(this.Clauses.AddRange(items)); } - public QueryBodySyntax WithClauses(SyntaxList clauses) => Update(clauses, this.SelectOrGroup, this.Continuation); - public QueryBodySyntax WithSelectOrGroup(SelectOrGroupClauseSyntax selectOrGroup) => Update(this.Clauses, selectOrGroup, this.Continuation); - public QueryBodySyntax WithContinuation(QueryContinuationSyntax? continuation) => Update(this.Clauses, this.SelectOrGroup, continuation); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FromClauseSyntax : QueryClauseSyntax + { + private TypeSyntax? type; + private ExpressionSyntax? expression; + + internal FromClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public QueryBodySyntax AddClauses(params QueryClauseSyntax[] items) => WithClauses(this.Clauses.AddRange(items)); -} + public SyntaxToken FromKeyword => new SyntaxToken(this, ((InternalSyntax.FromClauseSyntax)this.Green).fromKeyword, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FromClauseSyntax : QueryClauseSyntax -{ - private TypeSyntax? type; - private ExpressionSyntax? expression; + public TypeSyntax? Type => GetRed(ref this.type, 1); - internal FromClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.FromClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken FromKeyword => new(this, ((InternalSyntax.FromClauseSyntax)this.Green).fromKeyword, Position, 0); + public SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.FromClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); - public TypeSyntax? Type => GetRed(ref this.type, 1); + public ExpressionSyntax Expression => GetRed(ref this.expression, 4)!; - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.FromClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1), + 4 => GetRed(ref this.expression, 4)!, + _ => null, + }; - public SyntaxToken InKeyword => new(this, ((InternalSyntax.FromClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 4 => this.expression, + _ => null, + }; - public ExpressionSyntax Expression => GetRed(ref this.expression, 4)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFromClause(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) { - 1 => GetRed(ref this.type, 1), - 4 => GetRed(ref this.expression, 4)!, - _ => null, - }; + if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression) + { + var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 4 => this.expression, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFromClause(this); + public FromClauseSyntax WithFromKeyword(SyntaxToken fromKeyword) => Update(fromKeyword, this.Type, this.Identifier, this.InKeyword, this.Expression); + public FromClauseSyntax WithType(TypeSyntax? type) => Update(this.FromKeyword, type, this.Identifier, this.InKeyword, this.Expression); + public FromClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.FromKeyword, this.Type, identifier, this.InKeyword, this.Expression); + public FromClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.FromKeyword, this.Type, this.Identifier, inKeyword, this.Expression); + public FromClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.FromKeyword, this.Type, this.Identifier, this.InKeyword, expression); + } - public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class LetClauseSyntax : QueryClauseSyntax { - if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression) + private ExpressionSyntax? expression; + + internal LetClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public FromClauseSyntax WithFromKeyword(SyntaxToken fromKeyword) => Update(fromKeyword, this.Type, this.Identifier, this.InKeyword, this.Expression); - public FromClauseSyntax WithType(TypeSyntax? type) => Update(this.FromKeyword, type, this.Identifier, this.InKeyword, this.Expression); - public FromClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.FromKeyword, this.Type, identifier, this.InKeyword, this.Expression); - public FromClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.FromKeyword, this.Type, this.Identifier, inKeyword, this.Expression); - public FromClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.FromKeyword, this.Type, this.Identifier, this.InKeyword, expression); -} + public SyntaxToken LetKeyword => new SyntaxToken(this, ((InternalSyntax.LetClauseSyntax)this.Green).letKeyword, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class LetClauseSyntax : QueryClauseSyntax -{ - private ExpressionSyntax? expression; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.LetClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal LetClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.LetClauseSyntax)this.Green).equalsToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken LetKeyword => new(this, ((InternalSyntax.LetClauseSyntax)this.Green).letKeyword, Position, 0); + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.LetClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.expression, 3)! : null; - public SyntaxToken EqualsToken => new(this, ((InternalSyntax.LetClauseSyntax)this.Green).equalsToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.expression : null; - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLetClause(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.expression, 3)! : null; + public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + { + if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression) + { + var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.expression : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLetClause(this); + public LetClauseSyntax WithLetKeyword(SyntaxToken letKeyword) => Update(letKeyword, this.Identifier, this.EqualsToken, this.Expression); + public LetClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.LetKeyword, identifier, this.EqualsToken, this.Expression); + public LetClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.LetKeyword, this.Identifier, equalsToken, this.Expression); + public LetClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.LetKeyword, this.Identifier, this.EqualsToken, expression); + } - public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class JoinClauseSyntax : QueryClauseSyntax { - if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression) + private TypeSyntax? type; + private ExpressionSyntax? inExpression; + private ExpressionSyntax? leftExpression; + private ExpressionSyntax? rightExpression; + private JoinIntoClauseSyntax? into; + + internal JoinClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public LetClauseSyntax WithLetKeyword(SyntaxToken letKeyword) => Update(letKeyword, this.Identifier, this.EqualsToken, this.Expression); - public LetClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.LetKeyword, identifier, this.EqualsToken, this.Expression); - public LetClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.LetKeyword, this.Identifier, equalsToken, this.Expression); - public LetClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.LetKeyword, this.Identifier, this.EqualsToken, expression); -} + public SyntaxToken JoinKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).joinKeyword, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class JoinClauseSyntax : QueryClauseSyntax -{ - private TypeSyntax? type; - private ExpressionSyntax? inExpression; - private ExpressionSyntax? leftExpression; - private ExpressionSyntax? rightExpression; - private JoinIntoClauseSyntax? into; + public TypeSyntax? Type => GetRed(ref this.type, 1); - internal JoinClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken JoinKeyword => new(this, ((InternalSyntax.JoinClauseSyntax)this.Green).joinKeyword, Position, 0); + public SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); - public TypeSyntax? Type => GetRed(ref this.type, 1); + public ExpressionSyntax InExpression => GetRed(ref this.inExpression, 4)!; - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.JoinClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OnKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).onKeyword, GetChildPosition(5), GetChildIndex(5)); - public SyntaxToken InKeyword => new(this, ((InternalSyntax.JoinClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); + public ExpressionSyntax LeftExpression => GetRed(ref this.leftExpression, 6)!; - public ExpressionSyntax InExpression => GetRed(ref this.inExpression, 4)!; + public SyntaxToken EqualsKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).equalsKeyword, GetChildPosition(7), GetChildIndex(7)); - public SyntaxToken OnKeyword => new(this, ((InternalSyntax.JoinClauseSyntax)this.Green).onKeyword, GetChildPosition(5), GetChildIndex(5)); + public ExpressionSyntax RightExpression => GetRed(ref this.rightExpression, 8)!; - public ExpressionSyntax LeftExpression => GetRed(ref this.leftExpression, 6)!; + public JoinIntoClauseSyntax? Into => GetRed(ref this.into, 9); - public SyntaxToken EqualsKeyword => new(this, ((InternalSyntax.JoinClauseSyntax)this.Green).equalsKeyword, GetChildPosition(7), GetChildIndex(7)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1), + 4 => GetRed(ref this.inExpression, 4)!, + 6 => GetRed(ref this.leftExpression, 6)!, + 8 => GetRed(ref this.rightExpression, 8)!, + 9 => GetRed(ref this.into, 9), + _ => null, + }; - public ExpressionSyntax RightExpression => GetRed(ref this.rightExpression, 8)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 4 => this.inExpression, + 6 => this.leftExpression, + 8 => this.rightExpression, + 9 => this.into, + _ => null, + }; - public JoinIntoClauseSyntax? Into => GetRed(ref this.into, 9); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinClause(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) { - 1 => GetRed(ref this.type, 1), - 4 => GetRed(ref this.inExpression, 4)!, - 6 => GetRed(ref this.leftExpression, 6)!, - 8 => GetRed(ref this.rightExpression, 8)!, - 9 => GetRed(ref this.into, 9), - _ => null, - }; + if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into) + { + var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 4 => this.inExpression, - 6 => this.leftExpression, - 8 => this.rightExpression, - 9 => this.into, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinClause(this); + public JoinClauseSyntax WithJoinKeyword(SyntaxToken joinKeyword) => Update(joinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithType(TypeSyntax? type) => Update(this.JoinKeyword, type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.JoinKeyword, this.Type, identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, inKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithInExpression(ExpressionSyntax inExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, inExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithOnKeyword(SyntaxToken onKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, onKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithLeftExpression(ExpressionSyntax leftExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, leftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithEqualsKeyword(SyntaxToken equalsKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, equalsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithRightExpression(ExpressionSyntax rightExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, rightExpression, this.Into); + public JoinClauseSyntax WithInto(JoinIntoClauseSyntax? into) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, into); + } - public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode { - if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into) + + internal JoinIntoClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public JoinClauseSyntax WithJoinKeyword(SyntaxToken joinKeyword) => Update(joinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithType(TypeSyntax? type) => Update(this.JoinKeyword, type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.JoinKeyword, this.Type, identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, inKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithInExpression(ExpressionSyntax inExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, inExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithOnKeyword(SyntaxToken onKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, onKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithLeftExpression(ExpressionSyntax leftExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, leftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithEqualsKeyword(SyntaxToken equalsKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, equalsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithRightExpression(ExpressionSyntax rightExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, rightExpression, this.Into); - public JoinClauseSyntax WithInto(JoinIntoClauseSyntax? into) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, into); -} + public SyntaxToken IntoKeyword => new SyntaxToken(this, ((InternalSyntax.JoinIntoClauseSyntax)this.Green).intoKeyword, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode -{ + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.JoinIntoClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal JoinIntoClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - public SyntaxToken IntoKeyword => new(this, ((InternalSyntax.JoinIntoClauseSyntax)this.Green).intoKeyword, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.JoinIntoClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinIntoClause(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier) + { + if (intoKeyword != this.IntoKeyword || identifier != this.Identifier) + { + var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinIntoClause(this); + public JoinIntoClauseSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier); + public JoinIntoClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier); + } - public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class WhereClauseSyntax : QueryClauseSyntax { - if (intoKeyword != this.IntoKeyword || identifier != this.Identifier) + private ExpressionSyntax? condition; + + internal WhereClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public JoinIntoClauseSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier); - public JoinIntoClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier); -} + public SyntaxToken WhereKeyword => new SyntaxToken(this, ((InternalSyntax.WhereClauseSyntax)this.Green).whereKeyword, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class WhereClauseSyntax : QueryClauseSyntax -{ - private ExpressionSyntax? condition; + public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; - internal WhereClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; - public SyntaxToken WhereKeyword => new(this, ((InternalSyntax.WhereClauseSyntax)this.Green).whereKeyword, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; - public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhereClause(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; + public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition) + { + if (whereKeyword != this.WhereKeyword || condition != this.Condition) + { + var newNode = SyntaxFactory.WhereClause(whereKeyword, condition); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhereClause(this); + public WhereClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Condition); + public WhereClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhereKeyword, condition); + } - public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class OrderByClauseSyntax : QueryClauseSyntax { - if (whereKeyword != this.WhereKeyword || condition != this.Condition) + private SyntaxNode? orderings; + + internal OrderByClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.WhereClause(whereKeyword, condition); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public SyntaxToken OrderByKeyword => new SyntaxToken(this, ((InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); - public WhereClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Condition); - public WhereClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhereKeyword, condition); -} + public SeparatedSyntaxList Orderings + { + get + { + var red = GetRed(ref this.orderings, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class OrderByClauseSyntax : QueryClauseSyntax -{ - private SyntaxNode? orderings; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.orderings, 1)! : null; - internal OrderByClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.orderings : null; - public SyntaxToken OrderByKeyword => new(this, ((InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrderByClause(this); - public SeparatedSyntaxList Orderings => GetRed(ref this.orderings, 1) is { } red ? new(red, GetChildIndex(1)) : default; + public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, SeparatedSyntaxList orderings) + { + if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) + { + var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.orderings, 1)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.orderings : null; + public OrderByClauseSyntax WithOrderByKeyword(SyntaxToken orderByKeyword) => Update(orderByKeyword, this.Orderings); + public OrderByClauseSyntax WithOrderings(SeparatedSyntaxList orderings) => Update(this.OrderByKeyword, orderings); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrderByClause(this); + public OrderByClauseSyntax AddOrderings(params OrderingSyntax[] items) => WithOrderings(this.Orderings.AddRange(items)); + } - public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, SeparatedSyntaxList orderings) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + public sealed partial class OrderingSyntax : CSharpSyntaxNode { - if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) + private ExpressionSyntax? expression; + + internal OrderingSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public OrderByClauseSyntax WithOrderByKeyword(SyntaxToken orderByKeyword) => Update(orderByKeyword, this.Orderings); - public OrderByClauseSyntax WithOrderings(SeparatedSyntaxList orderings) => Update(this.OrderByKeyword, orderings); + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public OrderByClauseSyntax AddOrderings(params OrderingSyntax[] items) => WithOrderings(this.Orderings.AddRange(items)); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -public sealed partial class OrderingSyntax : CSharpSyntaxNode -{ - private ExpressionSyntax? expression; + public SyntaxToken AscendingOrDescendingKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - internal OrderingSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public SyntaxToken AscendingOrDescendingKeyword => ((InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrdering(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) + { + if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword) + { + var newNode = SyntaxFactory.Ordering(this.Kind(), expression, ascendingOrDescendingKeyword); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrdering(this); + public OrderingSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.AscendingOrDescendingKeyword); + public OrderingSyntax WithAscendingOrDescendingKeyword(SyntaxToken ascendingOrDescendingKeyword) => Update(this.Expression, ascendingOrDescendingKeyword); + } - public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax { - if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword) + private ExpressionSyntax? expression; + + internal SelectClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.Ordering(this.Kind(), expression, ascendingOrDescendingKeyword); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public OrderingSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.AscendingOrDescendingKeyword); - public OrderingSyntax WithAscendingOrDescendingKeyword(SyntaxToken ascendingOrDescendingKeyword) => Update(this.Expression, ascendingOrDescendingKeyword); -} + public SyntaxToken SelectKeyword => new SyntaxToken(this, ((InternalSyntax.SelectClauseSyntax)this.Green).selectKeyword, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax -{ - private ExpressionSyntax? expression; + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal SelectClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - public SyntaxToken SelectKeyword => new(this, ((InternalSyntax.SelectClauseSyntax)this.Green).selectKeyword, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSelectClause(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression) + { + if (selectKeyword != this.SelectKeyword || expression != this.Expression) + { + var newNode = SyntaxFactory.SelectClause(selectKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSelectClause(this); + public SelectClauseSyntax WithSelectKeyword(SyntaxToken selectKeyword) => Update(selectKeyword, this.Expression); + public SelectClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.SelectKeyword, expression); + } - public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax { - if (selectKeyword != this.SelectKeyword || expression != this.Expression) + private ExpressionSyntax? groupExpression; + private ExpressionSyntax? byExpression; + + internal GroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.SelectClause(selectKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public SelectClauseSyntax WithSelectKeyword(SyntaxToken selectKeyword) => Update(selectKeyword, this.Expression); - public SelectClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.SelectKeyword, expression); -} + public SyntaxToken GroupKeyword => new SyntaxToken(this, ((InternalSyntax.GroupClauseSyntax)this.Green).groupKeyword, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax -{ - private ExpressionSyntax? groupExpression; - private ExpressionSyntax? byExpression; + public ExpressionSyntax GroupExpression => GetRed(ref this.groupExpression, 1)!; - internal GroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken ByKeyword => new SyntaxToken(this, ((InternalSyntax.GroupClauseSyntax)this.Green).byKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken GroupKeyword => new(this, ((InternalSyntax.GroupClauseSyntax)this.Green).groupKeyword, Position, 0); + public ExpressionSyntax ByExpression => GetRed(ref this.byExpression, 3)!; - public ExpressionSyntax GroupExpression => GetRed(ref this.groupExpression, 1)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.groupExpression, 1)!, + 3 => GetRed(ref this.byExpression, 3)!, + _ => null, + }; - public SyntaxToken ByKeyword => new(this, ((InternalSyntax.GroupClauseSyntax)this.Green).byKeyword, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.groupExpression, + 3 => this.byExpression, + _ => null, + }; - public ExpressionSyntax ByExpression => GetRed(ref this.byExpression, 3)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGroupClause(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) { - 1 => GetRed(ref this.groupExpression, 1)!, - 3 => GetRed(ref this.byExpression, 3)!, - _ => null, - }; + if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression) + { + var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.groupExpression, - 3 => this.byExpression, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGroupClause(this); + public GroupClauseSyntax WithGroupKeyword(SyntaxToken groupKeyword) => Update(groupKeyword, this.GroupExpression, this.ByKeyword, this.ByExpression); + public GroupClauseSyntax WithGroupExpression(ExpressionSyntax groupExpression) => Update(this.GroupKeyword, groupExpression, this.ByKeyword, this.ByExpression); + public GroupClauseSyntax WithByKeyword(SyntaxToken byKeyword) => Update(this.GroupKeyword, this.GroupExpression, byKeyword, this.ByExpression); + public GroupClauseSyntax WithByExpression(ExpressionSyntax byExpression) => Update(this.GroupKeyword, this.GroupExpression, this.ByKeyword, byExpression); + } - public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class QueryContinuationSyntax : CSharpSyntaxNode { - if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression) + private QueryBodySyntax? body; + + internal QueryContinuationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public SyntaxToken IntoKeyword => new SyntaxToken(this, ((InternalSyntax.QueryContinuationSyntax)this.Green).intoKeyword, Position, 0); - public GroupClauseSyntax WithGroupKeyword(SyntaxToken groupKeyword) => Update(groupKeyword, this.GroupExpression, this.ByKeyword, this.ByExpression); - public GroupClauseSyntax WithGroupExpression(ExpressionSyntax groupExpression) => Update(this.GroupKeyword, groupExpression, this.ByKeyword, this.ByExpression); - public GroupClauseSyntax WithByKeyword(SyntaxToken byKeyword) => Update(this.GroupKeyword, this.GroupExpression, byKeyword, this.ByExpression); - public GroupClauseSyntax WithByExpression(ExpressionSyntax byExpression) => Update(this.GroupKeyword, this.GroupExpression, this.ByKeyword, byExpression); -} + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.QueryContinuationSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class QueryContinuationSyntax : CSharpSyntaxNode -{ - private QueryBodySyntax? body; + public QueryBodySyntax Body => GetRed(ref this.body, 2)!; - internal QueryContinuationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.body, 2)! : null; - public SyntaxToken IntoKeyword => new(this, ((InternalSyntax.QueryContinuationSyntax)this.Green).intoKeyword, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.body : null; - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.QueryContinuationSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryContinuation(this); - public QueryBodySyntax Body => GetRed(ref this.body, 2)!; + public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + { + if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body) + { + var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.body, 2)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.body : null; + public QueryContinuationSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier, this.Body); + public QueryContinuationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier, this.Body); + public QueryContinuationSyntax WithBody(QueryBodySyntax body) => Update(this.IntoKeyword, this.Identifier, body); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryContinuation(this); + public QueryContinuationSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); + } - public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + /// Class which represents a placeholder in an array size list. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax { - if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body) + + internal OmittedArraySizeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public QueryContinuationSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier, this.Body); - public QueryContinuationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier, this.Body); - public QueryContinuationSyntax WithBody(QueryBodySyntax body) => Update(this.IntoKeyword, this.Identifier, body); - - public QueryContinuationSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); -} + /// SyntaxToken representing the omitted array size expression. + public SyntaxToken OmittedArraySizeExpressionToken => new SyntaxToken(this, ((InternalSyntax.OmittedArraySizeExpressionSyntax)this.Green).omittedArraySizeExpressionToken, Position, 0); -/// Class which represents a placeholder in an array size list. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax -{ + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal OmittedArraySizeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// SyntaxToken representing the omitted array size expression. - public SyntaxToken OmittedArraySizeExpressionToken => new(this, ((InternalSyntax.OmittedArraySizeExpressionSyntax)this.Green).omittedArraySizeExpressionToken, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedArraySizeExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken) + { + if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken) + { + var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedArraySizeExpression(this); + public OmittedArraySizeExpressionSyntax WithOmittedArraySizeExpressionToken(SyntaxToken omittedArraySizeExpressionToken) => Update(omittedArraySizeExpressionToken); + } - public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax { - if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken) + private SyntaxNode? contents; + + internal InterpolatedStringExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// The first part of an interpolated string, $" or $@" or $""" + public SyntaxToken StringStartToken => new SyntaxToken(this, ((InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringStartToken, Position, 0); - public OmittedArraySizeExpressionSyntax WithOmittedArraySizeExpressionToken(SyntaxToken omittedArraySizeExpressionToken) => Update(omittedArraySizeExpressionToken); -} + /// List of parts of the interpolated string, each one is either a literal part or an interpolation. + public SyntaxList Contents => new SyntaxList(GetRed(ref this.contents, 1)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax -{ - private SyntaxNode? contents; + /// The closing quote of the interpolated string. + public SyntaxToken StringEndToken => new SyntaxToken(this, ((InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringEndToken, GetChildPosition(2), GetChildIndex(2)); - internal InterpolatedStringExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.contents, 1)! : null; - /// The first part of an interpolated string, $" or $@" or $""" - public SyntaxToken StringStartToken => new(this, ((InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringStartToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.contents : null; - /// List of parts of the interpolated string, each one is either a literal part or an interpolation. - public SyntaxList Contents => new(GetRed(ref this.contents, 1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringExpression(this); - /// The closing quote of the interpolated string. - public SyntaxToken StringEndToken => new(this, ((InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringEndToken, GetChildPosition(2), GetChildIndex(2)); + public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, SyntaxList contents, SyntaxToken stringEndToken) + { + if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) + { + var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.contents, 1)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.contents : null; + public InterpolatedStringExpressionSyntax WithStringStartToken(SyntaxToken stringStartToken) => Update(stringStartToken, this.Contents, this.StringEndToken); + public InterpolatedStringExpressionSyntax WithContents(SyntaxList contents) => Update(this.StringStartToken, contents, this.StringEndToken); + public InterpolatedStringExpressionSyntax WithStringEndToken(SyntaxToken stringEndToken) => Update(this.StringStartToken, this.Contents, stringEndToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringExpression(this); + public InterpolatedStringExpressionSyntax AddContents(params InterpolatedStringContentSyntax[] items) => WithContents(this.Contents.AddRange(items)); + } - public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, SyntaxList contents, SyntaxToken stringEndToken) + /// Class which represents a simple pattern-matching expression using the "is" keyword. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class IsPatternExpressionSyntax : ExpressionSyntax { - if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) + private ExpressionSyntax? expression; + private PatternSyntax? pattern; + + internal IsPatternExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// ExpressionSyntax node representing the expression on the left of the "is" operator. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public InterpolatedStringExpressionSyntax WithStringStartToken(SyntaxToken stringStartToken) => Update(stringStartToken, this.Contents, this.StringEndToken); - public InterpolatedStringExpressionSyntax WithContents(SyntaxList contents) => Update(this.StringStartToken, contents, this.StringEndToken); - public InterpolatedStringExpressionSyntax WithStringEndToken(SyntaxToken stringEndToken) => Update(this.StringStartToken, this.Contents, stringEndToken); + public SyntaxToken IsKeyword => new SyntaxToken(this, ((InternalSyntax.IsPatternExpressionSyntax)this.Green).isKeyword, GetChildPosition(1), GetChildIndex(1)); - public InterpolatedStringExpressionSyntax AddContents(params InterpolatedStringContentSyntax[] items) => WithContents(this.Contents.AddRange(items)); -} + /// PatternSyntax node representing the pattern on the right of the "is" operator. + public PatternSyntax Pattern => GetRed(ref this.pattern, 2)!; -/// Class which represents a simple pattern-matching expression using the "is" keyword. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class IsPatternExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; - private PatternSyntax? pattern; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.pattern, 2)!, + _ => null, + }; - internal IsPatternExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// ExpressionSyntax node representing the expression on the left of the "is" operator. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 2 => this.pattern, + _ => null, + }; - public SyntaxToken IsKeyword => new(this, ((InternalSyntax.IsPatternExpressionSyntax)this.Green).isKeyword, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIsPatternExpression(this); - /// PatternSyntax node representing the pattern on the right of the "is" operator. - public PatternSyntax Pattern => GetRed(ref this.pattern, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.pattern, 2)!, - _ => null, - }; + if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern) + { + var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.pattern, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIsPatternExpression(this); + public IsPatternExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.IsKeyword, this.Pattern); + public IsPatternExpressionSyntax WithIsKeyword(SyntaxToken isKeyword) => Update(this.Expression, isKeyword, this.Pattern); + public IsPatternExpressionSyntax WithPattern(PatternSyntax pattern) => Update(this.Expression, this.IsKeyword, pattern); + } - public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ThrowExpressionSyntax : ExpressionSyntax { - if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern) + private ExpressionSyntax? expression; + + internal ThrowExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public IsPatternExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.IsKeyword, this.Pattern); - public IsPatternExpressionSyntax WithIsKeyword(SyntaxToken isKeyword) => Update(this.Expression, isKeyword, this.Pattern); - public IsPatternExpressionSyntax WithPattern(PatternSyntax pattern) => Update(this.Expression, this.IsKeyword, pattern); -} + public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((InternalSyntax.ThrowExpressionSyntax)this.Green).throwKeyword, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ThrowExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? expression; + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal ThrowExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - public SyntaxToken ThrowKeyword => new(this, ((InternalSyntax.ThrowExpressionSyntax)this.Green).throwKeyword, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowExpression(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression) + { + if (throwKeyword != this.ThrowKeyword || expression != this.Expression) + { + var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowExpression(this); + public ThrowExpressionSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(throwKeyword, this.Expression); + public ThrowExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.ThrowKeyword, expression); + } - public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class WhenClauseSyntax : CSharpSyntaxNode { - if (throwKeyword != this.ThrowKeyword || expression != this.Expression) + private ExpressionSyntax? condition; + + internal WhenClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public ThrowExpressionSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(throwKeyword, this.Expression); - public ThrowExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.ThrowKeyword, expression); -} + public SyntaxToken WhenKeyword => new SyntaxToken(this, ((InternalSyntax.WhenClauseSyntax)this.Green).whenKeyword, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class WhenClauseSyntax : CSharpSyntaxNode -{ - private ExpressionSyntax? condition; + public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; - internal WhenClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; - public SyntaxToken WhenKeyword => new(this, ((InternalSyntax.WhenClauseSyntax)this.Green).whenKeyword, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; - public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhenClause(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; + public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition) + { + if (whenKeyword != this.WhenKeyword || condition != this.Condition) + { + var newNode = SyntaxFactory.WhenClause(whenKeyword, condition); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhenClause(this); + public WhenClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.Condition); + public WhenClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhenKeyword, condition); + } - public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition) + public abstract partial class PatternSyntax : ExpressionOrPatternSyntax { - if (whenKeyword != this.WhenKeyword || condition != this.Condition) + internal PatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.WhenClause(whenKeyword, condition); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - - return this; } - public WhenClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.Condition); - public WhenClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhenKeyword, condition); -} - -public abstract partial class PatternSyntax : ExpressionOrPatternSyntax -{ - internal PatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DiscardPatternSyntax : PatternSyntax { - } -} -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DiscardPatternSyntax : PatternSyntax -{ - - internal DiscardPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal DiscardPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken UnderscoreToken => new(this, ((InternalSyntax.DiscardPatternSyntax)this.Green).underscoreToken, Position, 0); + public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((InternalSyntax.DiscardPatternSyntax)this.Green).underscoreToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardPattern(this); - public DiscardPatternSyntax Update(SyntaxToken underscoreToken) - { - if (underscoreToken != this.UnderscoreToken) + public DiscardPatternSyntax Update(SyntaxToken underscoreToken) { - var newNode = SyntaxFactory.DiscardPattern(underscoreToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (underscoreToken != this.UnderscoreToken) + { + var newNode = SyntaxFactory.DiscardPattern(underscoreToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public DiscardPatternSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); } - public DiscardPatternSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); -} + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DeclarationPatternSyntax : PatternSyntax + { + private TypeSyntax? type; + private VariableDesignationSyntax? designation; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DeclarationPatternSyntax : PatternSyntax -{ - private TypeSyntax? type; - private VariableDesignationSyntax? designation; + internal DeclarationPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal DeclarationPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; - public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.designation, 1)!, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.designation, 1)!, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.designation, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationPattern(this); + + public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) { - 0 => this.type, - 1 => this.designation, - _ => null, - }; + if (type != this.Type || designation != this.Designation) + { + var newNode = SyntaxFactory.DeclarationPattern(type, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationPattern(this); + public DeclarationPatternSyntax WithType(TypeSyntax type) => Update(type, this.Designation); + public DeclarationPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); + } - public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class VarPatternSyntax : PatternSyntax { - if (type != this.Type || designation != this.Designation) + private VariableDesignationSyntax? designation; + + internal VarPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.DeclarationPattern(type, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public DeclarationPatternSyntax WithType(TypeSyntax type) => Update(type, this.Designation); - public DeclarationPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); -} + public SyntaxToken VarKeyword => new SyntaxToken(this, ((InternalSyntax.VarPatternSyntax)this.Green).varKeyword, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class VarPatternSyntax : PatternSyntax -{ - private VariableDesignationSyntax? designation; + public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; - internal VarPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.designation, 1)! : null; - public SyntaxToken VarKeyword => new(this, ((InternalSyntax.VarPatternSyntax)this.Green).varKeyword, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.designation : null; - public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVarPattern(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.designation, 1)! : null; + public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation) + { + if (varKeyword != this.VarKeyword || designation != this.Designation) + { + var newNode = SyntaxFactory.VarPattern(varKeyword, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.designation : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVarPattern(this); + public VarPatternSyntax WithVarKeyword(SyntaxToken varKeyword) => Update(varKeyword, this.Designation); + public VarPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.VarKeyword, designation); + } - public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class RecursivePatternSyntax : PatternSyntax { - if (varKeyword != this.VarKeyword || designation != this.Designation) + private TypeSyntax? type; + private PositionalPatternClauseSyntax? positionalPatternClause; + private PropertyPatternClauseSyntax? propertyPatternClause; + private VariableDesignationSyntax? designation; + + internal RecursivePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.VarPattern(varKeyword, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public TypeSyntax? Type => GetRedAtZero(ref this.type); - public VarPatternSyntax WithVarKeyword(SyntaxToken varKeyword) => Update(varKeyword, this.Designation); - public VarPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.VarKeyword, designation); -} + public PositionalPatternClauseSyntax? PositionalPatternClause => GetRed(ref this.positionalPatternClause, 1); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class RecursivePatternSyntax : PatternSyntax -{ - private TypeSyntax? type; - private PositionalPatternClauseSyntax? positionalPatternClause; - private PropertyPatternClauseSyntax? propertyPatternClause; - private VariableDesignationSyntax? designation; + public PropertyPatternClauseSyntax? PropertyPatternClause => GetRed(ref this.propertyPatternClause, 2); - internal RecursivePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); - public TypeSyntax? Type => GetRedAtZero(ref this.type); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type), + 1 => GetRed(ref this.positionalPatternClause, 1), + 2 => GetRed(ref this.propertyPatternClause, 2), + 3 => GetRed(ref this.designation, 3), + _ => null, + }; - public PositionalPatternClauseSyntax? PositionalPatternClause => GetRed(ref this.positionalPatternClause, 1); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.positionalPatternClause, + 2 => this.propertyPatternClause, + 3 => this.designation, + _ => null, + }; - public PropertyPatternClauseSyntax? PropertyPatternClause => GetRed(ref this.propertyPatternClause, 2); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecursivePattern(this); + + public RecursivePatternSyntax Update(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) + { + if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation) + { + var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); + public RecursivePatternSyntax WithType(TypeSyntax? type) => Update(type, this.PositionalPatternClause, this.PropertyPatternClause, this.Designation); + public RecursivePatternSyntax WithPositionalPatternClause(PositionalPatternClauseSyntax? positionalPatternClause) => Update(this.Type, positionalPatternClause, this.PropertyPatternClause, this.Designation); + public RecursivePatternSyntax WithPropertyPatternClause(PropertyPatternClauseSyntax? propertyPatternClause) => Update(this.Type, this.PositionalPatternClause, propertyPatternClause, this.Designation); + public RecursivePatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.Type, this.PositionalPatternClause, this.PropertyPatternClause, designation); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public RecursivePatternSyntax AddPositionalPatternClauseSubpatterns(params SubpatternSyntax[] items) { - 0 => GetRedAtZero(ref this.type), - 1 => GetRed(ref this.positionalPatternClause, 1), - 2 => GetRed(ref this.propertyPatternClause, 2), - 3 => GetRed(ref this.designation, 3), - _ => null, - }; + var positionalPatternClause = this.PositionalPatternClause ?? SyntaxFactory.PositionalPatternClause(); + return WithPositionalPatternClause(positionalPatternClause.WithSubpatterns(positionalPatternClause.Subpatterns.AddRange(items))); + } + public RecursivePatternSyntax AddPropertyPatternClauseSubpatterns(params SubpatternSyntax[] items) + { + var propertyPatternClause = this.PropertyPatternClause ?? SyntaxFactory.PropertyPatternClause(); + return WithPropertyPatternClause(propertyPatternClause.WithSubpatterns(propertyPatternClause.Subpatterns.AddRange(items))); + } + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode + { + private SyntaxNode? subpatterns; + + internal PositionalPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.type, - 1 => this.positionalPatternClause, - 2 => this.propertyPatternClause, - 3 => this.designation, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecursivePattern(this); + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); - public RecursivePatternSyntax Update(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) - { - if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation) + public SeparatedSyntaxList Subpatterns { - var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var red = GetRed(ref this.subpatterns, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } } - return this; - } + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - public RecursivePatternSyntax WithType(TypeSyntax? type) => Update(type, this.PositionalPatternClause, this.PropertyPatternClause, this.Designation); - public RecursivePatternSyntax WithPositionalPatternClause(PositionalPatternClauseSyntax? positionalPatternClause) => Update(this.Type, positionalPatternClause, this.PropertyPatternClause, this.Designation); - public RecursivePatternSyntax WithPropertyPatternClause(PropertyPatternClauseSyntax? propertyPatternClause) => Update(this.Type, this.PositionalPatternClause, propertyPatternClause, this.Designation); - public RecursivePatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.Type, this.PositionalPatternClause, this.PropertyPatternClause, designation); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; - public RecursivePatternSyntax AddPositionalPatternClauseSubpatterns(params SubpatternSyntax[] items) - { - var positionalPatternClause = this.PositionalPatternClause ?? SyntaxFactory.PositionalPatternClause(); - return WithPositionalPatternClause(positionalPatternClause.WithSubpatterns(positionalPatternClause.Subpatterns.AddRange(items))); - } - public RecursivePatternSyntax AddPropertyPatternClauseSubpatterns(params SubpatternSyntax[] items) - { - var propertyPatternClause = this.PropertyPatternClause ?? SyntaxFactory.PropertyPatternClause(); - return WithPropertyPatternClause(propertyPatternClause.WithSubpatterns(propertyPatternClause.Subpatterns.AddRange(items))); - } -} + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode -{ - private SyntaxNode? subpatterns; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPositionalPatternClause(this); - internal PositionalPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); + return this; + } - public SeparatedSyntaxList Subpatterns => GetRed(ref this.subpatterns, 1) is { } red ? new(red, GetChildIndex(1)) : default; + public PositionalPatternClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Subpatterns, this.CloseParenToken); + public PositionalPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenParenToken, subpatterns, this.CloseParenToken); + public PositionalPatternClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Subpatterns, closeParenToken); - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public PositionalPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode + { + private SyntaxNode? subpatterns; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; + internal PropertyPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPositionalPatternClause(this); + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); - public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) + public SeparatedSyntaxList Subpatterns { - var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var red = GetRed(ref this.subpatterns, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } } - return this; - } + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); - public PositionalPatternClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Subpatterns, this.CloseParenToken); - public PositionalPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenParenToken, subpatterns, this.CloseParenToken); - public PositionalPatternClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Subpatterns, closeParenToken); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; - public PositionalPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); -} + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode -{ - private SyntaxNode? subpatterns; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyPatternClause(this); - internal PropertyPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public PropertyPatternClauseSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Subpatterns, this.CloseBraceToken); + public PropertyPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenBraceToken, subpatterns, this.CloseBraceToken); + public PropertyPatternClauseSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Subpatterns, closeBraceToken); + + public PropertyPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); } - public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SubpatternSyntax : CSharpSyntaxNode + { + private BaseExpressionColonSyntax? expressionColon; + private PatternSyntax? pattern; + + internal SubpatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SeparatedSyntaxList Subpatterns => GetRed(ref this.subpatterns, 1) is { } red ? new(red, GetChildIndex(1)) : default; + public BaseExpressionColonSyntax? ExpressionColon => GetRedAtZero(ref this.expressionColon); - public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expressionColon), + 1 => GetRed(ref this.pattern, 1)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expressionColon, + 1 => this.pattern, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyPatternClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSubpattern(this); - public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) - { - if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) + public SubpatternSyntax Update(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) { - var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (expressionColon != this.ExpressionColon || pattern != this.Pattern) + { + var newNode = SyntaxFactory.Subpattern(expressionColon, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public SubpatternSyntax WithExpressionColon(BaseExpressionColonSyntax? expressionColon) => Update(expressionColon, this.Pattern); + public SubpatternSyntax WithPattern(PatternSyntax pattern) => Update(this.ExpressionColon, pattern); } - public PropertyPatternClauseSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Subpatterns, this.CloseBraceToken); - public PropertyPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenBraceToken, subpatterns, this.CloseBraceToken); - public PropertyPatternClauseSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Subpatterns, closeBraceToken); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ConstantPatternSyntax : PatternSyntax + { + private ExpressionSyntax? expression; - public PropertyPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); -} + internal ConstantPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SubpatternSyntax : CSharpSyntaxNode -{ - private BaseExpressionColonSyntax? expressionColon; - private PatternSyntax? pattern; + /// ExpressionSyntax node representing the constant expression. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal SubpatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - public BaseExpressionColonSyntax? ExpressionColon => GetRedAtZero(ref this.expressionColon); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstantPattern(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public ConstantPatternSyntax Update(ExpressionSyntax expression) { - 0 => GetRedAtZero(ref this.expressionColon), - 1 => GetRed(ref this.pattern, 1)!, - _ => null, - }; + if (expression != this.Expression) + { + var newNode = SyntaxFactory.ConstantPattern(expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expressionColon, - 1 => this.pattern, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSubpattern(this); + public ConstantPatternSyntax WithExpression(ExpressionSyntax expression) => Update(expression); + } - public SubpatternSyntax Update(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ParenthesizedPatternSyntax : PatternSyntax { - if (expressionColon != this.ExpressionColon || pattern != this.Pattern) + private PatternSyntax? pattern; + + internal ParenthesizedPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.Subpattern(expressionColon, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public SubpatternSyntax WithExpressionColon(BaseExpressionColonSyntax? expressionColon) => Update(expressionColon, this.Pattern); - public SubpatternSyntax WithPattern(PatternSyntax pattern) => Update(this.ExpressionColon, pattern); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ConstantPatternSyntax : PatternSyntax -{ - private ExpressionSyntax? expression; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedPatternSyntax)this.Green).openParenToken, Position, 0); - internal ConstantPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - /// ExpressionSyntax node representing the constant expression. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedPatternSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstantPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedPattern(this); - public ConstantPatternSyntax Update(ExpressionSyntax expression) - { - if (expression != this.Expression) + public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) { - var newNode = SyntaxFactory.ConstantPattern(expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public ParenthesizedPatternSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Pattern, this.CloseParenToken); + public ParenthesizedPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OpenParenToken, pattern, this.CloseParenToken); + public ParenthesizedPatternSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Pattern, closeParenToken); } - public ConstantPatternSyntax WithExpression(ExpressionSyntax expression) => Update(expression); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ParenthesizedPatternSyntax : PatternSyntax -{ - private PatternSyntax? pattern; - - internal ParenthesizedPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class RelationalPatternSyntax : PatternSyntax { - } + private ExpressionSyntax? expression; - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ParenthesizedPatternSyntax)this.Green).openParenToken, Position, 0); + internal RelationalPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + /// SyntaxToken representing the operator of the relational pattern. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.RelationalPatternSyntax)this.Green).operatorToken, Position, 0); - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ParenthesizedPatternSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRelationalPattern(this); - public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken) + public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) { - var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (operatorToken != this.OperatorToken || expression != this.Expression) + { + var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public RelationalPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); + public RelationalPatternSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); } - public ParenthesizedPatternSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Pattern, this.CloseParenToken); - public ParenthesizedPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OpenParenToken, pattern, this.CloseParenToken); - public ParenthesizedPatternSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Pattern, closeParenToken); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class RelationalPatternSyntax : PatternSyntax -{ - private ExpressionSyntax? expression; - - internal RelationalPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TypePatternSyntax : PatternSyntax { - } + private TypeSyntax? type; - /// SyntaxToken representing the operator of the relational pattern. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.RelationalPatternSyntax)this.Green).operatorToken, Position, 0); + internal TypePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + /// The type for the type pattern. + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRelationalPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypePattern(this); - public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) - { - if (operatorToken != this.OperatorToken || expression != this.Expression) + public TypePatternSyntax Update(TypeSyntax type) { - var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (type != this.Type) + { + var newNode = SyntaxFactory.TypePattern(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public TypePatternSyntax WithType(TypeSyntax type) => Update(type); } - public RelationalPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); - public RelationalPatternSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); -} + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + public sealed partial class BinaryPatternSyntax : PatternSyntax + { + private PatternSyntax? left; + private PatternSyntax? right; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TypePatternSyntax : PatternSyntax -{ - private TypeSyntax? type; + internal BinaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal TypePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public PatternSyntax Left => GetRedAtZero(ref this.left)!; - /// The type for the type pattern. - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.BinaryPatternSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + public PatternSyntax Right => GetRed(ref this.right, 2)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypePattern(this); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.left, + 2 => this.right, + _ => null, + }; - public TypePatternSyntax Update(TypeSyntax type) - { - if (type != this.Type) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryPattern(this); + + public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) { - var newNode = SyntaxFactory.TypePattern(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + { + var newNode = SyntaxFactory.BinaryPattern(this.Kind(), left, operatorToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public BinaryPatternSyntax WithLeft(PatternSyntax left) => Update(left, this.OperatorToken, this.Right); + public BinaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); + public BinaryPatternSyntax WithRight(PatternSyntax right) => Update(this.Left, this.OperatorToken, right); } - public TypePatternSyntax WithType(TypeSyntax type) => Update(type); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -public sealed partial class BinaryPatternSyntax : PatternSyntax -{ - private PatternSyntax? left; - private PatternSyntax? right; - - internal BinaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class UnaryPatternSyntax : PatternSyntax { - } + private PatternSyntax? pattern; - public PatternSyntax Left => GetRedAtZero(ref this.left)!; + internal UnaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.BinaryPatternSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.UnaryPatternSyntax)this.Green).operatorToken, Position, 0); - public PatternSyntax Right => GetRed(ref this.right, 2)!; + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.left, - 2 => this.right, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnaryPattern(this); - public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) - { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern) { - var newNode = SyntaxFactory.BinaryPattern(this.Kind(), left, operatorToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (operatorToken != this.OperatorToken || pattern != this.Pattern) + { + var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public UnaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Pattern); + public UnaryPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OperatorToken, pattern); } - public BinaryPatternSyntax WithLeft(PatternSyntax left) => Update(left, this.OperatorToken, this.Right); - public BinaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); - public BinaryPatternSyntax WithRight(PatternSyntax right) => Update(this.Left, this.OperatorToken, right); -} + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ListPatternSyntax : PatternSyntax + { + private SyntaxNode? patterns; + private VariableDesignationSyntax? designation; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class UnaryPatternSyntax : PatternSyntax -{ - private PatternSyntax? pattern; + internal ListPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal UnaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.UnaryPatternSyntax)this.Green).operatorToken, Position, 0); + public SeparatedSyntaxList Patterns + { + get + { + var red = GetRed(ref this.patterns, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; + public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.patterns, 1)!, + 3 => GetRed(ref this.designation, 3), + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnaryPattern(this); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.patterns, + 3 => this.designation, + _ => null, + }; - public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern) - { - if (operatorToken != this.OperatorToken || pattern != this.Pattern) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitListPattern(this); + + public ListPatternSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) { - var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) + { + var newNode = SyntaxFactory.ListPattern(openBracketToken, patterns, closeBracketToken, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public ListPatternSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Patterns, this.CloseBracketToken, this.Designation); + public ListPatternSyntax WithPatterns(SeparatedSyntaxList patterns) => Update(this.OpenBracketToken, patterns, this.CloseBracketToken, this.Designation); + public ListPatternSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Patterns, closeBracketToken, this.Designation); + public ListPatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.OpenBracketToken, this.Patterns, this.CloseBracketToken, designation); + + public ListPatternSyntax AddPatterns(params PatternSyntax[] items) => WithPatterns(this.Patterns.AddRange(items)); } - public UnaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Pattern); - public UnaryPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OperatorToken, pattern); -} + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SlicePatternSyntax : PatternSyntax + { + private PatternSyntax? pattern; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ListPatternSyntax : PatternSyntax -{ - private SyntaxNode? patterns; - private VariableDesignationSyntax? designation; + internal SlicePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal ListPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken DotDotToken => new SyntaxToken(this, ((InternalSyntax.SlicePatternSyntax)this.Green).dotDotToken, Position, 0); - public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); + public PatternSyntax? Pattern => GetRed(ref this.pattern, 1); - public SeparatedSyntaxList Patterns => GetRed(ref this.patterns, 1) is { } red ? new(red, GetChildIndex(1)) : default; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1) : null; - public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; - public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSlicePattern(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax? pattern) { - 1 => GetRed(ref this.patterns, 1)!, - 3 => GetRed(ref this.designation, 3), - _ => null, - }; + if (dotDotToken != this.DotDotToken || pattern != this.Pattern) + { + var newNode = SyntaxFactory.SlicePattern(dotDotToken, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.patterns, - 3 => this.designation, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitListPattern(this); + public SlicePatternSyntax WithDotDotToken(SyntaxToken dotDotToken) => Update(dotDotToken, this.Pattern); + public SlicePatternSyntax WithPattern(PatternSyntax? pattern) => Update(this.DotDotToken, pattern); + } - public ListPatternSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + public abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode { - if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) + internal InterpolatedStringContentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ListPattern(openBracketToken, patterns, closeBracketToken, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - - return this; } - public ListPatternSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Patterns, this.CloseBracketToken, this.Designation); - public ListPatternSyntax WithPatterns(SeparatedSyntaxList patterns) => Update(this.OpenBracketToken, patterns, this.CloseBracketToken, this.Designation); - public ListPatternSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Patterns, closeBracketToken, this.Designation); - public ListPatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.OpenBracketToken, this.Patterns, this.CloseBracketToken, designation); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax + { - public ListPatternSyntax AddPatterns(params PatternSyntax[] items) => WithPatterns(this.Patterns.AddRange(items)); -} + internal InterpolatedStringTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SlicePatternSyntax : PatternSyntax -{ - private PatternSyntax? pattern; + /// The text contents of a part of the interpolated string. + public SyntaxToken TextToken => new SyntaxToken(this, ((InternalSyntax.InterpolatedStringTextSyntax)this.Green).textToken, Position, 0); - internal SlicePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - public SyntaxToken DotDotToken => new(this, ((InternalSyntax.SlicePatternSyntax)this.Green).dotDotToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public PatternSyntax? Pattern => GetRed(ref this.pattern, 1); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringText(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1) : null; + public InterpolatedStringTextSyntax Update(SyntaxToken textToken) + { + if (textToken != this.TextToken) + { + var newNode = SyntaxFactory.InterpolatedStringText(textToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSlicePattern(this); + public InterpolatedStringTextSyntax WithTextToken(SyntaxToken textToken) => Update(textToken); + } - public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax? pattern) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax { - if (dotDotToken != this.DotDotToken || pattern != this.Pattern) + private ExpressionSyntax? expression; + private InterpolationAlignmentClauseSyntax? alignmentClause; + private InterpolationFormatClauseSyntax? formatClause; + + internal InterpolationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.SlicePattern(dotDotToken, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public SlicePatternSyntax WithDotDotToken(SyntaxToken dotDotToken) => Update(dotDotToken, this.Pattern); - public SlicePatternSyntax WithPattern(PatternSyntax? pattern) => Update(this.DotDotToken, pattern); -} + /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.InterpolationSyntax)this.Green).openBraceToken, Position, 0); -public abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode -{ - internal InterpolatedStringContentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } -} + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax -{ + public InterpolationAlignmentClauseSyntax? AlignmentClause => GetRed(ref this.alignmentClause, 2); - internal InterpolatedStringTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public InterpolationFormatClauseSyntax? FormatClause => GetRed(ref this.formatClause, 3); - /// The text contents of a part of the interpolated string. - public SyntaxToken TextToken => new(this, ((InternalSyntax.InterpolatedStringTextSyntax)this.Green).textToken, Position, 0); + /// + /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). + /// + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.InterpolationSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.expression, 1)!, + 2 => GetRed(ref this.alignmentClause, 2), + 3 => GetRed(ref this.formatClause, 3), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.expression, + 2 => this.alignmentClause, + 3 => this.formatClause, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringText(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolation(this); - public InterpolatedStringTextSyntax Update(SyntaxToken textToken) - { - if (textToken != this.TextToken) + public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) { - var newNode = SyntaxFactory.InterpolatedStringText(textToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public InterpolationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); + public InterpolationSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenBraceToken, expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); + public InterpolationSyntax WithAlignmentClause(InterpolationAlignmentClauseSyntax? alignmentClause) => Update(this.OpenBraceToken, this.Expression, alignmentClause, this.FormatClause, this.CloseBraceToken); + public InterpolationSyntax WithFormatClause(InterpolationFormatClauseSyntax? formatClause) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, formatClause, this.CloseBraceToken); + public InterpolationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, closeBraceToken); } - public InterpolatedStringTextSyntax WithTextToken(SyntaxToken textToken) => Update(textToken); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax -{ - private ExpressionSyntax? expression; - private InterpolationAlignmentClauseSyntax? alignmentClause; - private InterpolationFormatClauseSyntax? formatClause; - - internal InterpolationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode { - } + private ExpressionSyntax? value; + + internal InterpolationAlignmentClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). - public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.InterpolationSyntax)this.Green).openBraceToken, Position, 0); + public SyntaxToken CommaToken => new SyntaxToken(this, ((InternalSyntax.InterpolationAlignmentClauseSyntax)this.Green).commaToken, Position, 0); - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - public InterpolationAlignmentClauseSyntax? AlignmentClause => GetRed(ref this.alignmentClause, 2); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; - public InterpolationFormatClauseSyntax? FormatClause => GetRed(ref this.formatClause, 3); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; - /// - /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). - /// - public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.InterpolationSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationAlignmentClause(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value) { - 1 => GetRed(ref this.expression, 1)!, - 2 => GetRed(ref this.alignmentClause, 2), - 3 => GetRed(ref this.formatClause, 3), - _ => null, - }; + if (commaToken != this.CommaToken || value != this.Value) + { + var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.expression, - 2 => this.alignmentClause, - 3 => this.formatClause, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolation(this); + public InterpolationAlignmentClauseSyntax WithCommaToken(SyntaxToken commaToken) => Update(commaToken, this.Value); + public InterpolationAlignmentClauseSyntax WithValue(ExpressionSyntax value) => Update(this.CommaToken, value); + } - public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode { - if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken) + + internal InterpolationFormatClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public InterpolationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); - public InterpolationSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenBraceToken, expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); - public InterpolationSyntax WithAlignmentClause(InterpolationAlignmentClauseSyntax? alignmentClause) => Update(this.OpenBraceToken, this.Expression, alignmentClause, this.FormatClause, this.CloseBraceToken); - public InterpolationSyntax WithFormatClause(InterpolationFormatClauseSyntax? formatClause) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, formatClause, this.CloseBraceToken); - public InterpolationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, closeBraceToken); -} + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.InterpolationFormatClauseSyntax)this.Green).colonToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode -{ - private ExpressionSyntax? value; + /// The text contents of the format specifier for an interpolation. + public SyntaxToken FormatStringToken => new SyntaxToken(this, ((InternalSyntax.InterpolationFormatClauseSyntax)this.Green).formatStringToken, GetChildPosition(1), GetChildIndex(1)); - internal InterpolationAlignmentClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - public SyntaxToken CommaToken => new(this, ((InternalSyntax.InterpolationAlignmentClauseSyntax)this.Green).commaToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public ExpressionSyntax Value => GetRed(ref this.value, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationFormatClause(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; + public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken) + { + if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken) + { + var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationAlignmentClause(this); + public InterpolationFormatClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.FormatStringToken); + public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken) => Update(this.ColonToken, formatStringToken); + } - public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax { - if (commaToken != this.CommaToken || value != this.Value) + private SyntaxNode? attributeLists; + private StatementSyntax? statement; + + internal GlobalStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public InterpolationAlignmentClauseSyntax WithCommaToken(SyntaxToken commaToken) => Update(commaToken, this.Value); - public InterpolationAlignmentClauseSyntax WithValue(ExpressionSyntax value) => Update(this.CommaToken, value); -} + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode -{ + public StatementSyntax Statement => GetRed(ref this.statement, 2)!; - internal InterpolationFormatClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.statement, 2)!, + _ => null, + }; - public SyntaxToken ColonToken => new(this, ((InternalSyntax.InterpolationFormatClauseSyntax)this.Green).colonToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.statement, + _ => null, + }; - /// The text contents of the format specifier for an interpolation. - public SyntaxToken FormatStringToken => new(this, ((InternalSyntax.InterpolationFormatClauseSyntax)this.Green).formatStringToken, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGlobalStatement(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public GlobalStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) + { + var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new GlobalStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Statement); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new GlobalStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Statement); + public GlobalStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Modifiers, statement); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationFormatClause(this); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new GlobalStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new GlobalStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + } - public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken) + /// Represents the base class for all statements syntax classes. + public abstract partial class StatementSyntax : CSharpSyntaxNode { - if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken) + internal StatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; + public abstract SyntaxList AttributeLists { get; } + public StatementSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract StatementSyntax WithAttributeListsCore(SyntaxList attributeLists); + + public StatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items); } - public InterpolationFormatClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.FormatStringToken); - public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken) => Update(this.ColonToken, formatStringToken); -} + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class BlockSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; + private SyntaxNode? statements; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private StatementSyntax? statement; + internal BlockSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal GlobalStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.BlockSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 2)); - public StatementSyntax Statement => GetRed(ref this.statement, 2)!; + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.BlockSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.statement, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.statements, 2)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.statement, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.statements, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGlobalStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBlock(this); - public GlobalStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) + public BlockSyntax Update(SyntaxList attributeLists, SyntaxToken openBraceToken, SyntaxList statements, SyntaxToken closeBraceToken) { - var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new GlobalStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Statement); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new GlobalStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Statement); - public GlobalStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Modifiers, statement); + return this; + } - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new GlobalStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new GlobalStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); -} + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new BlockSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.OpenBraceToken, this.Statements, this.CloseBraceToken); + public BlockSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, openBraceToken, this.Statements, this.CloseBraceToken); + public BlockSyntax WithStatements(SyntaxList statements) => Update(this.AttributeLists, this.OpenBraceToken, statements, this.CloseBraceToken); + public BlockSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.OpenBraceToken, this.Statements, closeBraceToken); -/// Represents the base class for all statements syntax classes. -public abstract partial class StatementSyntax : CSharpSyntaxNode -{ - internal StatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new BlockSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public BlockSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); } - public abstract SyntaxList AttributeLists { get; } - public StatementSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract StatementSyntax WithAttributeListsCore(SyntaxList attributeLists); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class LocalFunctionStatementSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private SyntaxNode? constraintClauses; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public StatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items); -} + internal LocalFunctionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class BlockSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private SyntaxNode? statements; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal BlockSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.BlockSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.LocalFunctionStatementSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - public SyntaxList Statements => new(GetRed(ref this.statements, 2)); + public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); - public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.BlockSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); + public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.statements, 2)!, - _ => null, - }; + public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 6)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.statements, - _ => null, - }; + public BlockSyntax? Body => GetRed(ref this.body, 7); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBlock(this); + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 8); - public BlockSyntax Update(SyntaxList attributeLists, SyntaxToken openBraceToken, SyntaxList statements, SyntaxToken closeBraceToken) - { - if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) + /// Gets the optional semicolon token. + public SyntaxToken SemicolonToken { - var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + } } - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5)!, + 6 => GetRed(ref this.constraintClauses, 6)!, + 7 => GetRed(ref this.body, 7), + 8 => GetRed(ref this.expressionBody, 8), + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new BlockSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.OpenBraceToken, this.Statements, this.CloseBraceToken); - public BlockSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, openBraceToken, this.Statements, this.CloseBraceToken); - public BlockSyntax WithStatements(SyntaxList statements) => Update(this.AttributeLists, this.OpenBraceToken, statements, this.CloseBraceToken); - public BlockSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.OpenBraceToken, this.Statements, closeBraceToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.returnType, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.constraintClauses, + 7 => this.body, + 8 => this.expressionBody, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new BlockSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public BlockSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); -} + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalFunctionStatement(this); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class LocalFunctionStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private SyntaxNode? constraintClauses; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + public LocalFunctionStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal LocalFunctionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + return this; + } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LocalFunctionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); - public SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LocalFunctionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public LocalFunctionStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public LocalFunctionStatementSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + public LocalFunctionStatementSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + public LocalFunctionStatementSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + public LocalFunctionStatementSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + public LocalFunctionStatementSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } + } - public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class LocalDeclarationStatementSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.LocalFunctionStatementSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + internal LocalDeclarationStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; + public SyntaxToken AwaitKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 6)); + public SyntaxToken UsingKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + } + } - public BlockSyntax? Body => GetRed(ref this.body, 7); + /// Gets the modifier list. + public SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(3); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 8); + public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 4)!; - /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken => ((InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).semicolonToken, GetChildPosition(5), GetChildIndex(5)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5)!, - 6 => GetRed(ref this.constraintClauses, 6)!, - 7 => GetRed(ref this.body, 7), - 8 => GetRed(ref this.expressionBody, 8), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.declaration, 4)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.returnType, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.constraintClauses, - 7 => this.body, - 8 => this.expressionBody, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.declaration, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalFunctionStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalDeclarationStatement(this); - public LocalFunctionStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + public LocalDeclarationStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { - var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - return this; - } + return this; + } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LocalFunctionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LocalDeclarationStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, semicolonToken); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LocalFunctionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public LocalFunctionStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public LocalFunctionStatementSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) - { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LocalDeclarationStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public LocalDeclarationStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public LocalDeclarationStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); } - public LocalFunctionStatementSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - public LocalFunctionStatementSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - public LocalFunctionStatementSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - public LocalFunctionStatementSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class LocalDeclarationStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - internal LocalDeclarationStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode { - } + private TypeSyntax? type; + private SyntaxNode? variables; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + internal VariableDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken AwaitKeyword => ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public SyntaxToken UsingKeyword => ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + public SeparatedSyntaxList Variables + { + get + { + var red = GetRed(ref this.variables, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - /// Gets the modifier list. - public SyntaxTokenList Modifiers => this.Green.GetSlot(3) is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.variables, 1)!, + _ => null, + }; - public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 4)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.variables, + _ => null, + }; - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).semicolonToken, GetChildPosition(5), GetChildIndex(5)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclaration(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public VariableDeclarationSyntax Update(TypeSyntax type, SeparatedSyntaxList variables) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.declaration, 4)!, - _ => null, - }; + if (type != this.Type || variables != this.Variables) + { + var newNode = SyntaxFactory.VariableDeclaration(type, variables); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.declaration, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalDeclarationStatement(this); + public VariableDeclarationSyntax WithType(TypeSyntax type) => Update(type, this.Variables); + public VariableDeclarationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.Type, variables); + + public VariableDeclarationSyntax AddVariables(params VariableDeclaratorSyntax[] items) => WithVariables(this.Variables.AddRange(items)); + } - public LocalDeclarationStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) + private BracketedArgumentListSyntax? argumentList; + private EqualsValueClauseSyntax? initializer; + + internal VariableDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LocalDeclarationStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, semicolonToken); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.VariableDeclaratorSyntax)this.Green).identifier, Position, 0); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LocalDeclarationStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public LocalDeclarationStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public LocalDeclarationStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); -} + public BracketedArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode -{ - private TypeSyntax? type; - private SyntaxNode? variables; + public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 2); - internal VariableDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.argumentList, 1), + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.argumentList, + 2 => this.initializer, + _ => null, + }; - public SeparatedSyntaxList Variables => GetRed(ref this.variables, 1) is { } red ? new(red, GetChildIndex(1)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclarator(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.variables, 1)!, - _ => null, - }; + if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer) + { + var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.variables, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclaration(this); + public VariableDeclaratorSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ArgumentList, this.Initializer); + public VariableDeclaratorSyntax WithArgumentList(BracketedArgumentListSyntax? argumentList) => Update(this.Identifier, argumentList, this.Initializer); + public VariableDeclaratorSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.Identifier, this.ArgumentList, initializer); - public VariableDeclarationSyntax Update(TypeSyntax type, SeparatedSyntaxList variables) - { - if (type != this.Type || variables != this.Variables) + public VariableDeclaratorSyntax AddArgumentListArguments(params ArgumentSyntax[] items) { - var newNode = SyntaxFactory.VariableDeclaration(type, variables); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var argumentList = this.ArgumentList ?? SyntaxFactory.BracketedArgumentList(); + return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); } - - return this; } - public VariableDeclarationSyntax WithType(TypeSyntax type) => Update(type, this.Variables); - public VariableDeclarationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.Type, variables); - - public VariableDeclarationSyntax AddVariables(params VariableDeclaratorSyntax[] items) => WithVariables(this.Variables.AddRange(items)); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode -{ - private BracketedArgumentListSyntax? argumentList; - private EqualsValueClauseSyntax? initializer; - - internal VariableDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode { - } + private ExpressionSyntax? value; - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.VariableDeclaratorSyntax)this.Green).identifier, Position, 0); + internal EqualsValueClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public BracketedArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); + public SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.EqualsValueClauseSyntax)this.Green).equalsToken, Position, 0); - public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 2); + public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.argumentList, 1), - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.argumentList, - 2 => this.initializer, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclarator(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEqualsValueClause(this); - public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) - { - if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer) + public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value) { - var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (equalsToken != this.EqualsToken || value != this.Value) + { + var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public EqualsValueClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(equalsToken, this.Value); + public EqualsValueClauseSyntax WithValue(ExpressionSyntax value) => Update(this.EqualsToken, value); } - public VariableDeclaratorSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ArgumentList, this.Initializer); - public VariableDeclaratorSyntax WithArgumentList(BracketedArgumentListSyntax? argumentList) => Update(this.Identifier, argumentList, this.Initializer); - public VariableDeclaratorSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.Identifier, this.ArgumentList, initializer); - - public VariableDeclaratorSyntax AddArgumentListArguments(params ArgumentSyntax[] items) + public abstract partial class VariableDesignationSyntax : CSharpSyntaxNode { - var argumentList = this.ArgumentList ?? SyntaxFactory.BracketedArgumentList(); - return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); + internal VariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } } -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode -{ - private ExpressionSyntax? value; - internal EqualsValueClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax { - } - public SyntaxToken EqualsToken => new(this, ((InternalSyntax.EqualsValueClauseSyntax)this.Green).equalsToken, Position, 0); + internal SingleVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Value => GetRed(ref this.value, 1)!; + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.SingleVariableDesignationSyntax)this.Green).identifier, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEqualsValueClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSingleVariableDesignation(this); - public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value) - { - if (equalsToken != this.EqualsToken || value != this.Value) + public SingleVariableDesignationSyntax Update(SyntaxToken identifier) { - var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (identifier != this.Identifier) + { + var newNode = SyntaxFactory.SingleVariableDesignation(identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public SingleVariableDesignationSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); } - public EqualsValueClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(equalsToken, this.Value); - public EqualsValueClauseSyntax WithValue(ExpressionSyntax value) => Update(this.EqualsToken, value); -} - -public abstract partial class VariableDesignationSyntax : CSharpSyntaxNode -{ - internal VariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax { - } -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax -{ - internal SingleVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal DiscardDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken Identifier => new(this, ((InternalSyntax.SingleVariableDesignationSyntax)this.Green).identifier, Position, 0); + public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((InternalSyntax.DiscardDesignationSyntax)this.Green).underscoreToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSingleVariableDesignation(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardDesignation(this); - public SingleVariableDesignationSyntax Update(SyntaxToken identifier) - { - if (identifier != this.Identifier) + public DiscardDesignationSyntax Update(SyntaxToken underscoreToken) { - var newNode = SyntaxFactory.SingleVariableDesignation(identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (underscoreToken != this.UnderscoreToken) + { + var newNode = SyntaxFactory.DiscardDesignation(underscoreToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public DiscardDesignationSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); } - public SingleVariableDesignationSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); -} + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax + { + private SyntaxNode? variables; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax -{ + internal ParenthesizedVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal DiscardDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); + + public SeparatedSyntaxList Variables + { + get + { + var red = GetRed(ref this.variables, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - public SyntaxToken UnderscoreToken => new(this, ((InternalSyntax.DiscardDesignationSyntax)this.Green).underscoreToken, Position, 0); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.variables, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.variables : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardDesignation(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedVariableDesignation(this); - public DiscardDesignationSyntax Update(SyntaxToken underscoreToken) - { - if (underscoreToken != this.UnderscoreToken) + public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList variables, SyntaxToken closeParenToken) { - var newNode = SyntaxFactory.DiscardDesignation(underscoreToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - return this; - } + return this; + } - public DiscardDesignationSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); -} + public ParenthesizedVariableDesignationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Variables, this.CloseParenToken); + public ParenthesizedVariableDesignationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.OpenParenToken, variables, this.CloseParenToken); + public ParenthesizedVariableDesignationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Variables, closeParenToken); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax -{ - private SyntaxNode? variables; + public ParenthesizedVariableDesignationSyntax AddVariables(params VariableDesignationSyntax[] items) => WithVariables(this.Variables.AddRange(items)); + } - internal ParenthesizedVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ExpressionStatementSyntax : StatementSyntax { - } + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); + internal ExpressionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SeparatedSyntaxList Variables => GetRed(ref this.variables, 1) is { } red ? new(red, GetChildIndex(1)) : default; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.variables, 1)! : null; + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ExpressionStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.variables : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 1 => GetRed(ref this.expression, 1)!, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedVariableDesignation(this); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.expression, + _ => null, + }; - public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList variables, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionStatement(this); + + public ExpressionStatementSyntax Update(SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) { - var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ExpressionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Expression, this.SemicolonToken); + public ExpressionStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, expression, this.SemicolonToken); + public ExpressionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Expression, semicolonToken); + + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ExpressionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); } - public ParenthesizedVariableDesignationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Variables, this.CloseParenToken); - public ParenthesizedVariableDesignationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.OpenParenToken, variables, this.CloseParenToken); - public ParenthesizedVariableDesignationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Variables, closeParenToken); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class EmptyStatementSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; - public ParenthesizedVariableDesignationSyntax AddVariables(params VariableDesignationSyntax[] items) => WithVariables(this.Variables.AddRange(items)); -} + internal EmptyStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ExpressionStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal ExpressionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.EmptyStatementSyntax)this.Green).semicolonToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.ExpressionStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEmptyStatement(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public EmptyStatementSyntax Update(SyntaxList attributeLists, SyntaxToken semicolonToken) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 1 => GetRed(ref this.expression, 1)!, - _ => null, - }; + if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.expression, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionStatement(this); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EmptyStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SemicolonToken); + public EmptyStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, semicolonToken); - public ExpressionStatementSyntax Update(SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EmptyStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } + + /// Represents a labeled statement syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class LabeledStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) + private SyntaxNode? attributeLists; + private StatementSyntax? statement; + + internal LabeledStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ExpressionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Expression, this.SemicolonToken); - public ExpressionStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, expression, this.SemicolonToken); - public ExpressionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Expression, semicolonToken); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.LabeledStatementSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ExpressionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + /// Gets a SyntaxToken that represents the colon following the statement's label. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.LabeledStatementSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class EmptyStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; + public StatementSyntax Statement => GetRed(ref this.statement, 3)!; - internal EmptyStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.statement, 3)!, + _ => null, + }; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.statement, + _ => null, + }; - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.EmptyStatementSyntax)this.Green).semicolonToken, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLabeledStatement(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + public LabeledStatementSyntax Update(SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) + { + var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LabeledStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Identifier, this.ColonToken, this.Statement); + public LabeledStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, identifier, this.ColonToken, this.Statement); + public LabeledStatementSyntax WithColonToken(SyntaxToken colonToken) => Update(this.AttributeLists, this.Identifier, colonToken, this.Statement); + public LabeledStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Identifier, this.ColonToken, statement); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEmptyStatement(this); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LabeledStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - public EmptyStatementSyntax Update(SyntaxList attributeLists, SyntaxToken semicolonToken) + /// + /// Represents a goto statement syntax + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + /// + public sealed partial class GotoStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; + + internal GotoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EmptyStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SemicolonToken); - public EmptyStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, semicolonToken); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EmptyStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + /// + /// Gets a SyntaxToken that represents the goto keyword. + /// + public SyntaxToken GotoKeyword => new SyntaxToken(this, ((InternalSyntax.GotoStatementSyntax)this.Green).gotoKeyword, GetChildPosition(1), GetChildIndex(1)); -/// Represents a labeled statement syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class LabeledStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private StatementSyntax? statement; + /// + /// Gets a SyntaxToken that represents the case or default keywords if any exists. + /// + public SyntaxToken CaseOrDefaultKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + } + } - internal LabeledStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// + /// Gets a constant expression for a goto case statement. + /// + public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + /// + /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. + /// + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.GotoStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.LabeledStatementSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3), + _ => null, + }; - /// Gets a SyntaxToken that represents the colon following the statement's label. - public SyntaxToken ColonToken => new(this, ((InternalSyntax.LabeledStatementSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + _ => null, + }; - public StatementSyntax Statement => GetRed(ref this.statement, 3)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGotoStatement(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public GotoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.statement, 3)!, - _ => null, - }; + if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.GotoStatement(this.Kind(), attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.statement, - _ => null, - }; + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new GotoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); + public GotoStatementSyntax WithGotoKeyword(SyntaxToken gotoKeyword) => Update(this.AttributeLists, gotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); + public GotoStatementSyntax WithCaseOrDefaultKeyword(SyntaxToken caseOrDefaultKeyword) => Update(this.AttributeLists, this.GotoKeyword, caseOrDefaultKeyword, this.Expression, this.SemicolonToken); + public GotoStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, expression, this.SemicolonToken); + public GotoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, semicolonToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLabeledStatement(this); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new GotoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - public LabeledStatementSyntax Update(SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class BreakStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) + private SyntaxNode? attributeLists; + + internal BreakStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LabeledStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Identifier, this.ColonToken, this.Statement); - public LabeledStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, identifier, this.ColonToken, this.Statement); - public LabeledStatementSyntax WithColonToken(SyntaxToken colonToken) => Update(this.AttributeLists, this.Identifier, colonToken, this.Statement); - public LabeledStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Identifier, this.ColonToken, statement); + public SyntaxToken BreakKeyword => new SyntaxToken(this, ((InternalSyntax.BreakStatementSyntax)this.Green).breakKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LabeledStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.BreakStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); -/// -/// Represents a goto statement syntax -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -/// -public sealed partial class GotoStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; - internal GotoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBreakStatement(this); - /// - /// Gets a SyntaxToken that represents the goto keyword. - /// - public SyntaxToken GotoKeyword => new(this, ((InternalSyntax.GotoStatementSyntax)this.Green).gotoKeyword, GetChildPosition(1), GetChildIndex(1)); + public BreakStatementSyntax Update(SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - /// - /// Gets a SyntaxToken that represents the case or default keywords if any exists. - /// - public SyntaxToken CaseOrDefaultKeyword => ((InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + return this; + } - /// - /// Gets a constant expression for a goto case statement. - /// - public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new BreakStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.BreakKeyword, this.SemicolonToken); + public BreakStatementSyntax WithBreakKeyword(SyntaxToken breakKeyword) => Update(this.AttributeLists, breakKeyword, this.SemicolonToken); + public BreakStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.BreakKeyword, semicolonToken); - /// - /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. - /// - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.GotoStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new BreakStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ContinueStatementSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; + + internal ContinueStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3), - _ => null, - }; + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public SyntaxToken ContinueKeyword => new SyntaxToken(this, ((InternalSyntax.ContinueStatementSyntax)this.Green).continueKeyword, GetChildPosition(1), GetChildIndex(1)); + + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ContinueStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitContinueStatement(this); + + public ContinueStatementSyntax Update(SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) { - 0 => this.attributeLists, - 3 => this.expression, - _ => null, - }; + if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ContinueStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ContinueKeyword, this.SemicolonToken); + public ContinueStatementSyntax WithContinueKeyword(SyntaxToken continueKeyword) => Update(this.AttributeLists, continueKeyword, this.SemicolonToken); + public ContinueStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ContinueKeyword, semicolonToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGotoStatement(this); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ContinueStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - public GotoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ReturnStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; + + internal ReturnStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.GotoStatement(this.Kind(), attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new GotoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); - public GotoStatementSyntax WithGotoKeyword(SyntaxToken gotoKeyword) => Update(this.AttributeLists, gotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); - public GotoStatementSyntax WithCaseOrDefaultKeyword(SyntaxToken caseOrDefaultKeyword) => Update(this.AttributeLists, this.GotoKeyword, caseOrDefaultKeyword, this.Expression, this.SemicolonToken); - public GotoStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, expression, this.SemicolonToken); - public GotoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, semicolonToken); + public SyntaxToken ReturnKeyword => new SyntaxToken(this, ((InternalSyntax.ReturnStatementSyntax)this.Green).returnKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new GotoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class BreakStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ReturnStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - internal BreakStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.expression, 2), + _ => null, + }; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.expression, + _ => null, + }; - public SyntaxToken BreakKeyword => new(this, ((InternalSyntax.BreakStatementSyntax)this.Green).breakKeyword, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReturnStatement(this); - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.BreakStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public ReturnStatementSyntax Update(SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ReturnStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ReturnKeyword, this.Expression, this.SemicolonToken); + public ReturnStatementSyntax WithReturnKeyword(SyntaxToken returnKeyword) => Update(this.AttributeLists, returnKeyword, this.Expression, this.SemicolonToken); + public ReturnStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ReturnKeyword, expression, this.SemicolonToken); + public ReturnStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ReturnKeyword, this.Expression, semicolonToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBreakStatement(this); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ReturnStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - public BreakStatementSyntax Update(SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ThrowStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; + + internal ThrowStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new BreakStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.BreakKeyword, this.SemicolonToken); - public BreakStatementSyntax WithBreakKeyword(SyntaxToken breakKeyword) => Update(this.AttributeLists, breakKeyword, this.SemicolonToken); - public BreakStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.BreakKeyword, semicolonToken); + public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((InternalSyntax.ThrowStatementSyntax)this.Green).throwKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new BreakStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ContinueStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ThrowStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - internal ContinueStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.expression, 2), + _ => null, + }; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.expression, + _ => null, + }; - public SyntaxToken ContinueKeyword => new(this, ((InternalSyntax.ContinueStatementSyntax)this.Green).continueKeyword, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowStatement(this); - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.ContinueStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public ThrowStatementSyntax Update(SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ThrowStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ThrowKeyword, this.Expression, this.SemicolonToken); + public ThrowStatementSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(this.AttributeLists, throwKeyword, this.Expression, this.SemicolonToken); + public ThrowStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ThrowKeyword, expression, this.SemicolonToken); + public ThrowStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ThrowKeyword, this.Expression, semicolonToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitContinueStatement(this); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ThrowStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - public ContinueStatementSyntax Update(SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + public sealed partial class YieldStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; + + internal YieldStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ContinueStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ContinueKeyword, this.SemicolonToken); - public ContinueStatementSyntax WithContinueKeyword(SyntaxToken continueKeyword) => Update(this.AttributeLists, continueKeyword, this.SemicolonToken); - public ContinueStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ContinueKeyword, semicolonToken); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ContinueStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public SyntaxToken YieldKeyword => new SyntaxToken(this, ((InternalSyntax.YieldStatementSyntax)this.Green).yieldKeyword, GetChildPosition(1), GetChildIndex(1)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ReturnStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; + public SyntaxToken ReturnOrBreakKeyword => new SyntaxToken(this, ((InternalSyntax.YieldStatementSyntax)this.Green).returnOrBreakKeyword, GetChildPosition(2), GetChildIndex(2)); - internal ReturnStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.YieldStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - public SyntaxToken ReturnKeyword => new(this, ((InternalSyntax.ReturnStatementSyntax)this.Green).returnKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3), + _ => null, + }; - public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + _ => null, + }; - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.ReturnStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitYieldStatement(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public YieldStatementSyntax Update(SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.expression, 2), - _ => null, - }; + if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.YieldStatement(this.Kind(), attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.expression, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReturnStatement(this); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new YieldStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); + public YieldStatementSyntax WithYieldKeyword(SyntaxToken yieldKeyword) => Update(this.AttributeLists, yieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); + public YieldStatementSyntax WithReturnOrBreakKeyword(SyntaxToken returnOrBreakKeyword) => Update(this.AttributeLists, this.YieldKeyword, returnOrBreakKeyword, this.Expression, this.SemicolonToken); + public YieldStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, expression, this.SemicolonToken); + public YieldStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, semicolonToken); - public ReturnStatementSyntax Update(SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new YieldStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } + + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class WhileStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) + private SyntaxNode? attributeLists; + private ExpressionSyntax? condition; + private StatementSyntax? statement; + + internal WhileStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ReturnStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ReturnKeyword, this.Expression, this.SemicolonToken); - public ReturnStatementSyntax WithReturnKeyword(SyntaxToken returnKeyword) => Update(this.AttributeLists, returnKeyword, this.Expression, this.SemicolonToken); - public ReturnStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ReturnKeyword, expression, this.SemicolonToken); - public ReturnStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ReturnKeyword, this.Expression, semicolonToken); + public SyntaxToken WhileKeyword => new SyntaxToken(this, ((InternalSyntax.WhileStatementSyntax)this.Green).whileKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ReturnStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.WhileStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ThrowStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; + public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; - internal ThrowStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.WhileStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - public SyntaxToken ThrowKeyword => new(this, ((InternalSyntax.ThrowStatementSyntax)this.Green).throwKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.condition, 3)!, + 5 => GetRed(ref this.statement, 5)!, + _ => null, + }; - public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.condition, + 5 => this.statement, + _ => null, + }; - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.ThrowStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhileStatement(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public WhileStatementSyntax Update(SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.expression, 2), - _ => null, - }; + if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.expression, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowStatement(this); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new WhileStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement); + public WhileStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement); + + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new WhileStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - public ThrowStatementSyntax Update(SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DoStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) + private SyntaxNode? attributeLists; + private StatementSyntax? statement; + private ExpressionSyntax? condition; + + internal DoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ThrowStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ThrowKeyword, this.Expression, this.SemicolonToken); - public ThrowStatementSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(this.AttributeLists, throwKeyword, this.Expression, this.SemicolonToken); - public ThrowStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ThrowKeyword, expression, this.SemicolonToken); - public ThrowStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ThrowKeyword, this.Expression, semicolonToken); + public SyntaxToken DoKeyword => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).doKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ThrowStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public StatementSyntax Statement => GetRed(ref this.statement, 2)!; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -public sealed partial class YieldStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; + public SyntaxToken WhileKeyword => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).whileKeyword, GetChildPosition(3), GetChildIndex(3)); - internal YieldStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).openParenToken, GetChildPosition(4), GetChildIndex(4)); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public ExpressionSyntax Condition => GetRed(ref this.condition, 5)!; - public SyntaxToken YieldKeyword => new(this, ((InternalSyntax.YieldStatementSyntax)this.Green).yieldKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); - public SyntaxToken ReturnOrBreakKeyword => new(this, ((InternalSyntax.YieldStatementSyntax)this.Green).returnOrBreakKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).semicolonToken, GetChildPosition(7), GetChildIndex(7)); - public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.statement, 2)!, + 5 => GetRed(ref this.condition, 5)!, + _ => null, + }; - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.YieldStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.statement, + 5 => this.condition, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3), - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDoStatement(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public DoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) { - 0 => this.attributeLists, - 3 => this.expression, - _ => null, - }; + if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitYieldStatement(this); + return this; + } - public YieldStatementSyntax Update(SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new DoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithDoKeyword(SyntaxToken doKeyword) => Update(this.AttributeLists, doKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.DoKeyword, statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, this.DoKeyword, this.Statement, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.SemicolonToken); + public DoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, semicolonToken); + + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new DoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } + + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ForStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + private SyntaxNode? initializers; + private ExpressionSyntax? condition; + private SyntaxNode? incrementors; + private StatementSyntax? statement; + + internal ForStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.YieldStatement(this.Kind(), attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new YieldStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); - public YieldStatementSyntax WithYieldKeyword(SyntaxToken yieldKeyword) => Update(this.AttributeLists, yieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); - public YieldStatementSyntax WithReturnOrBreakKeyword(SyntaxToken returnOrBreakKeyword) => Update(this.AttributeLists, this.YieldKeyword, returnOrBreakKeyword, this.Expression, this.SemicolonToken); - public YieldStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, expression, this.SemicolonToken); - public YieldStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, semicolonToken); + public SyntaxToken ForKeyword => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).forKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new YieldStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class WhileStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private ExpressionSyntax? condition; - private StatementSyntax? statement; + public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 3); - internal WhileStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SeparatedSyntaxList Initializers + { + get + { + var red = GetRed(ref this.initializers, 4); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; + } + } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public SyntaxToken FirstSemicolonToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); - public SyntaxToken WhileKeyword => new(this, ((InternalSyntax.WhileStatementSyntax)this.Green).whileKeyword, GetChildPosition(1), GetChildIndex(1)); + public ExpressionSyntax? Condition => GetRed(ref this.condition, 6); - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.WhileStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken SecondSemicolonToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); - public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; + public SeparatedSyntaxList Incrementors + { + get + { + var red = GetRed(ref this.incrementors, 8); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(8)) : default; + } + } - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.WhileStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + public StatementSyntax Statement => GetRed(ref this.statement, 10)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.condition, 3)!, - 5 => GetRed(ref this.statement, 5)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.declaration, 3), + 4 => GetRed(ref this.initializers, 4)!, + 6 => GetRed(ref this.condition, 6), + 8 => GetRed(ref this.incrementors, 8)!, + 10 => GetRed(ref this.statement, 10)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.condition, - 5 => this.statement, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.declaration, + 4 => this.initializers, + 6 => this.condition, + 8 => this.incrementors, + 10 => this.statement, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhileStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForStatement(this); - public WhileStatementSyntax Update(SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) + public ForStatementSyntax Update(SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) { - var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new WhileStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement); - public WhileStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement); + return this; + } - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new WhileStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ForStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithForKeyword(SyntaxToken forKeyword) => Update(this.AttributeLists, forKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.ForKeyword, openParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithFirstSemicolonToken(SyntaxToken firstSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, firstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithCondition(ExpressionSyntax? condition) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithSecondSemicolonToken(SyntaxToken secondSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, secondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithIncrementors(SeparatedSyntaxList incrementors) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, closeParenToken, this.Statement); + public ForStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, statement); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DoStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private StatementSyntax? statement; - private ExpressionSyntax? condition; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ForStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public ForStatementSyntax AddInitializers(params ExpressionSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); + public ForStatementSyntax AddIncrementors(params ExpressionSyntax[] items) => WithIncrementors(this.Incrementors.AddRange(items)); + } - internal DoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public abstract partial class CommonForEachStatementSyntax : StatementSyntax { - } + internal CommonForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public abstract SyntaxToken AwaitKeyword { get; } + public CommonForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => WithAwaitKeywordCore(awaitKeyword); + internal abstract CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword); - public SyntaxToken DoKeyword => new(this, ((InternalSyntax.DoStatementSyntax)this.Green).doKeyword, GetChildPosition(1), GetChildIndex(1)); + public abstract SyntaxToken ForEachKeyword { get; } + public CommonForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => WithForEachKeywordCore(forEachKeyword); + internal abstract CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword); - public StatementSyntax Statement => GetRed(ref this.statement, 2)!; + public abstract SyntaxToken OpenParenToken { get; } + public CommonForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => WithOpenParenTokenCore(openParenToken); + internal abstract CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken); - public SyntaxToken WhileKeyword => new(this, ((InternalSyntax.DoStatementSyntax)this.Green).whileKeyword, GetChildPosition(3), GetChildIndex(3)); + public abstract SyntaxToken InKeyword { get; } + public CommonForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => WithInKeywordCore(inKeyword); + internal abstract CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword); - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.DoStatementSyntax)this.Green).openParenToken, GetChildPosition(4), GetChildIndex(4)); + public abstract ExpressionSyntax Expression { get; } + public CommonForEachStatementSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); + internal abstract CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression); - public ExpressionSyntax Condition => GetRed(ref this.condition, 5)!; + public abstract SyntaxToken CloseParenToken { get; } + public CommonForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => WithCloseParenTokenCore(closeParenToken); + internal abstract CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken); - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.DoStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); + public abstract StatementSyntax Statement { get; } + public CommonForEachStatementSyntax WithStatement(StatementSyntax statement) => WithStatementCore(statement); + internal abstract CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement); - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.DoStatementSyntax)this.Green).semicolonToken, GetChildPosition(7), GetChildIndex(7)); + public new CommonForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => (CommonForEachStatementSyntax)WithAttributeListsCore(attributeLists); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.statement, 2)!, - 5 => GetRed(ref this.condition, 5)!, - _ => null, - }; + public new CommonForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => (CommonForEachStatementSyntax)AddAttributeListsCore(items); + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax + { + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExpressionSyntax? expression; + private StatementSyntax? statement; + + internal ForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.attributeLists, - 2 => this.statement, - 5 => this.condition, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDoStatement(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public DoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) + public override SyntaxToken AwaitKeyword { - var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } } - return this; - } + public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new DoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithDoKeyword(SyntaxToken doKeyword) => Update(this.AttributeLists, doKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.DoKeyword, statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, this.DoKeyword, this.Statement, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.SemicolonToken); - public DoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, semicolonToken); + public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new DoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public TypeSyntax Type => GetRed(ref this.type, 4)!; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ForStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - private SyntaxNode? initializers; - private ExpressionSyntax? condition; - private SyntaxNode? incrementors; - private StatementSyntax? statement; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); - internal ForStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).inKeyword, GetChildPosition(6), GetChildIndex(6)); + + public override ExpressionSyntax Expression => GetRed(ref this.expression, 7)!; + + public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).closeParenToken, GetChildPosition(8), GetChildIndex(8)); + + public override StatementSyntax Statement => GetRed(ref this.statement, 9)!; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.type, 4)!, + 7 => GetRed(ref this.expression, 7)!, + 9 => GetRed(ref this.statement, 9)!, + _ => null, + }; - public SyntaxToken ForKeyword => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).forKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.type, + 7 => this.expression, + 9 => this.statement, + _ => null, + }; - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachStatement(this); - public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 3); + public ForEachStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); + public new ForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); + public new ForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); + public new ForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + public ForEachStatementSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + public ForEachStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); + public new ForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, inKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); + public new ForEachStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); + public new ForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, closeParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); + public new ForEachStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, statement); - public SeparatedSyntaxList Initializers => GetRed(ref this.initializers, 4) is { } red ? new(red, GetChildIndex(4)) : default; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - public SyntaxToken FirstSemicolonToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax + { + private SyntaxNode? attributeLists; + private ExpressionSyntax? variable; + private ExpressionSyntax? expression; + private StatementSyntax? statement; - public ExpressionSyntax? Condition => GetRed(ref this.condition, 6); + internal ForEachVariableStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxToken AwaitKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public SyntaxToken SecondSemicolonToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); + public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); + + public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + + /// + /// The variable(s) of the loop. In correct code this is a tuple + /// literal, declaration expression with a tuple designator, or + /// a discard syntax in the form of a simple identifier. In broken + /// code it could be something else. + /// + public ExpressionSyntax Variable => GetRed(ref this.variable, 4)!; + + public override SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).inKeyword, GetChildPosition(5), GetChildIndex(5)); + + public override ExpressionSyntax Expression => GetRed(ref this.expression, 6)!; - public SeparatedSyntaxList Incrementors => GetRed(ref this.incrementors, 8) is { } red ? new(red, GetChildIndex(8)) : default; + public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).closeParenToken, GetChildPosition(7), GetChildIndex(7)); - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); + public override StatementSyntax Statement => GetRed(ref this.statement, 8)!; - public StatementSyntax Statement => GetRed(ref this.statement, 10)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.variable, 4)!, + 6 => GetRed(ref this.expression, 6)!, + 8 => GetRed(ref this.statement, 8)!, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.declaration, 3), - 4 => GetRed(ref this.initializers, 4)!, - 6 => GetRed(ref this.condition, 6), - 8 => GetRed(ref this.incrementors, 8)!, - 10 => GetRed(ref this.statement, 10)!, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.variable, + 6 => this.expression, + 8 => this.statement, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachVariableStatement(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public ForEachVariableStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { - 0 => this.attributeLists, - 3 => this.declaration, - 4 => this.initializers, - 6 => this.condition, - 8 => this.incrementors, - 10 => this.statement, - _ => null, - }; + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForStatement(this); + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ForEachVariableStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); + public new ForEachVariableStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); + public new ForEachVariableStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); + public new ForEachVariableStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + public ForEachVariableStatementSyntax WithVariable(ExpressionSyntax variable) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); + public new ForEachVariableStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, inKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); + public new ForEachVariableStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); + public new ForEachVariableStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, closeParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); + public new ForEachVariableStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, statement); + + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ForEachVariableStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - public ForStatementSyntax Update(SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class UsingStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + private ExpressionSyntax? expression; + private StatementSyntax? statement; + + internal UsingStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ForStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithForKeyword(SyntaxToken forKeyword) => Update(this.AttributeLists, forKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.ForKeyword, openParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithFirstSemicolonToken(SyntaxToken firstSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, firstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithCondition(ExpressionSyntax? condition) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithSecondSemicolonToken(SyntaxToken secondSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, secondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithIncrementors(SeparatedSyntaxList incrementors) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, closeParenToken, this.Statement); - public ForStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, statement); + public SyntaxToken AwaitKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ForStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public ForStatementSyntax AddInitializers(params ExpressionSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); - public ForStatementSyntax AddIncrementors(params ExpressionSyntax[] items) => WithIncrementors(this.Incrementors.AddRange(items)); -} + public SyntaxToken UsingKeyword => new SyntaxToken(this, ((InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); -public abstract partial class CommonForEachStatementSyntax : StatementSyntax -{ - internal CommonForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.UsingStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); - public abstract SyntaxToken AwaitKeyword { get; } - public CommonForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => WithAwaitKeywordCore(awaitKeyword); - internal abstract CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword); + public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 4); - public abstract SyntaxToken ForEachKeyword { get; } - public CommonForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => WithForEachKeywordCore(forEachKeyword); - internal abstract CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword); + public ExpressionSyntax? Expression => GetRed(ref this.expression, 5); - public abstract SyntaxToken OpenParenToken { get; } - public CommonForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => WithOpenParenTokenCore(openParenToken); - internal abstract CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.UsingStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); - public abstract SyntaxToken InKeyword { get; } - public CommonForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => WithInKeywordCore(inKeyword); - internal abstract CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword); + public StatementSyntax Statement => GetRed(ref this.statement, 7)!; - public abstract ExpressionSyntax Expression { get; } - public CommonForEachStatementSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); - internal abstract CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.declaration, 4), + 5 => GetRed(ref this.expression, 5), + 7 => GetRed(ref this.statement, 7)!, + _ => null, + }; - public abstract SyntaxToken CloseParenToken { get; } - public CommonForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => WithCloseParenTokenCore(closeParenToken); - internal abstract CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.declaration, + 5 => this.expression, + 7 => this.statement, + _ => null, + }; - public abstract StatementSyntax Statement { get; } - public CommonForEachStatementSyntax WithStatement(StatementSyntax statement) => WithStatementCore(statement); - internal abstract CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingStatement(this); - public new CommonForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => (CommonForEachStatementSyntax)WithAttributeListsCore(attributeLists); + public UsingStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public new CommonForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => (CommonForEachStatementSyntax)AddAttributeListsCore(items); -} + return this; + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExpressionSyntax? expression; - private StatementSyntax? statement; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new UsingStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, openParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, closeParenToken, this.Statement); + public UsingStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, statement); - internal ForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new UsingStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FixedStatementSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + private StatementSyntax? statement; - public override SyntaxToken AwaitKeyword => ((InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal FixedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken ForEachKeyword => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken FixedKeyword => new SyntaxToken(this, ((InternalSyntax.FixedStatementSyntax)this.Green).fixedKeyword, GetChildPosition(1), GetChildIndex(1)); - public TypeSyntax Type => GetRed(ref this.type, 4)!; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.FixedStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); + public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; - public override SyntaxToken InKeyword => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).inKeyword, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.FixedStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - public override ExpressionSyntax Expression => GetRed(ref this.expression, 7)!; + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - public override SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).closeParenToken, GetChildPosition(8), GetChildIndex(8)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.declaration, 3)!, + 5 => GetRed(ref this.statement, 5)!, + _ => null, + }; - public override StatementSyntax Statement => GetRed(ref this.statement, 9)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.declaration, + 5 => this.statement, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.type, 4)!, - 7 => GetRed(ref this.expression, 7)!, - 9 => GetRed(ref this.statement, 9)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFixedStatement(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public FixedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) { - 0 => this.attributeLists, - 4 => this.type, - 7 => this.expression, - 9 => this.statement, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachStatement(this); + if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public ForEachStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + return this; } - return this; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FixedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithFixedKeyword(SyntaxToken fixedKeyword) => Update(this.AttributeLists, fixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.FixedKeyword, openParenToken, this.Declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, closeParenToken, this.Statement); + public FixedStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, statement); + + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FixedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public FixedStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); - public new ForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); - public new ForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); - public new ForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - public ForEachStatementSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - public ForEachStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); - public new ForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, inKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); - public new ForEachStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); - public new ForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, closeParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); - public new ForEachStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, statement); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + public sealed partial class CheckedStatementSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; + private BlockSyntax? block; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + internal CheckedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax -{ - private SyntaxNode? attributeLists; - private ExpressionSyntax? variable; - private ExpressionSyntax? expression; - private StatementSyntax? statement; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal ForEachVariableStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CheckedStatementSyntax)this.Green).keyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public BlockSyntax Block => GetRed(ref this.block, 2)!; - public override SyntaxToken AwaitKeyword => ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.block, 2)!, + _ => null, + }; - public override SyntaxToken ForEachKeyword => new(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.block, + _ => null, + }; - public override SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedStatement(this); - /// - /// The variable(s) of the loop. In correct code this is a tuple - /// literal, declaration expression with a tuple designator, or - /// a discard syntax in the form of a simple identifier. In broken - /// code it could be something else. - /// - public ExpressionSyntax Variable => GetRed(ref this.variable, 4)!; + public CheckedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + { + if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) + { + var newNode = SyntaxFactory.CheckedStatement(this.Kind(), attributeLists, keyword, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override SyntaxToken InKeyword => new(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).inKeyword, GetChildPosition(5), GetChildIndex(5)); + return this; + } - public override ExpressionSyntax Expression => GetRed(ref this.expression, 6)!; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new CheckedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Keyword, this.Block); + public CheckedStatementSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, keyword, this.Block); + public CheckedStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.Keyword, block); - public override SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).closeParenToken, GetChildPosition(7), GetChildIndex(7)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new CheckedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public CheckedStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public CheckedStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); + } - public override StatementSyntax Statement => GetRed(ref this.statement, 8)!; + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class UnsafeStatementSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; + private BlockSyntax? block; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + internal UnsafeStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.variable, 4)!, - 6 => GetRed(ref this.expression, 6)!, - 8 => GetRed(ref this.statement, 8)!, - _ => null, - }; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.variable, - 6 => this.expression, - 8 => this.statement, - _ => null, - }; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachVariableStatement(this); + public SyntaxToken UnsafeKeyword => new SyntaxToken(this, ((InternalSyntax.UnsafeStatementSyntax)this.Green).unsafeKeyword, GetChildPosition(1), GetChildIndex(1)); - public ForEachVariableStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public BlockSyntax Block => GetRed(ref this.block, 2)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.block, 2)!, + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ForEachVariableStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); - public new ForEachVariableStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); - public new ForEachVariableStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); - public new ForEachVariableStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - public ForEachVariableStatementSyntax WithVariable(ExpressionSyntax variable) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); - public new ForEachVariableStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, inKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); - public new ForEachVariableStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); - public new ForEachVariableStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, closeParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); - public new ForEachVariableStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, statement); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.block, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ForEachVariableStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnsafeStatement(this); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class UsingStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - private ExpressionSyntax? expression; - private StatementSyntax? statement; + public UnsafeStatementSyntax Update(SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + { + if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) + { + var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal UsingStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new UnsafeStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.UnsafeKeyword, this.Block); + public UnsafeStatementSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.AttributeLists, unsafeKeyword, this.Block); + public UnsafeStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.UnsafeKeyword, block); + + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new UnsafeStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public UnsafeStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public UnsafeStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class LockStatementSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; + private StatementSyntax? statement; - public SyntaxToken AwaitKeyword => ((InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal LockStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken UsingKeyword => new(this, ((InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.UsingStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken LockKeyword => new SyntaxToken(this, ((InternalSyntax.LockStatementSyntax)this.Green).lockKeyword, GetChildPosition(1), GetChildIndex(1)); - public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 4); + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.LockStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - public ExpressionSyntax? Expression => GetRed(ref this.expression, 5); + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.UsingStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.LockStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - public StatementSyntax Statement => GetRed(ref this.statement, 7)!; + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.declaration, 4), - 5 => GetRed(ref this.expression, 5), - 7 => GetRed(ref this.statement, 7)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3)!, + 5 => GetRed(ref this.statement, 5)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.declaration, - 5 => this.expression, - 7 => this.statement, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + 5 => this.statement, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLockStatement(this); - public UsingStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + public LockStatementSyntax Update(SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { - var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; - } + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LockStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithLockKeyword(SyntaxToken lockKeyword) => Update(this.AttributeLists, lockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.LockKeyword, openParenToken, this.Expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.Statement); + public LockStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, statement); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new UsingStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, openParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, closeParenToken, this.Statement); - public UsingStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, statement); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LockStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new UsingStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + /// + /// Represents an if statement syntax. + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class IfStatementSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; + private ExpressionSyntax? condition; + private StatementSyntax? statement; + private ElseClauseSyntax? @else; + + internal IfStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + /// + /// Gets a SyntaxToken that represents the if keyword. + /// + public SyntaxToken IfKeyword => new SyntaxToken(this, ((InternalSyntax.IfStatementSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FixedStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - private StatementSyntax? statement; + /// + /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. + /// + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.IfStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - internal FixedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// + /// Gets an ExpressionSyntax that represents the condition of the if statement. + /// + public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + /// + /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. + /// + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.IfStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - public SyntaxToken FixedKeyword => new(this, ((InternalSyntax.FixedStatementSyntax)this.Green).fixedKeyword, GetChildPosition(1), GetChildIndex(1)); + /// + /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. + /// + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.FixedStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + /// + /// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. + /// + public ElseClauseSyntax? Else => GetRed(ref this.@else, 6); - public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.condition, 3)!, + 5 => GetRed(ref this.statement, 5)!, + 6 => GetRed(ref this.@else, 6), + _ => null, + }; - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.FixedStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.condition, + 5 => this.statement, + 6 => this.@else, + _ => null, + }; - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfStatement(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public IfStatementSyntax Update(SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.declaration, 3)!, - 5 => GetRed(ref this.statement, 5)!, - _ => null, - }; + if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) + { + var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.declaration, - 5 => this.statement, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFixedStatement(this); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new IfStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.AttributeLists, ifKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.IfKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement, this.Else); + public IfStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement, this.Else); + public IfStatementSyntax WithElse(ElseClauseSyntax? @else) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, @else); - public FixedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new IfStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } + + /// Represents an else statement syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ElseClauseSyntax : CSharpSyntaxNode { - if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) + private StatementSyntax? statement; + + internal ElseClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// + /// Gets a syntax token + /// + public SyntaxToken ElseKeyword => new SyntaxToken(this, ((InternalSyntax.ElseClauseSyntax)this.Green).elseKeyword, Position, 0); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FixedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithFixedKeyword(SyntaxToken fixedKeyword) => Update(this.AttributeLists, fixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.FixedKeyword, openParenToken, this.Declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, closeParenToken, this.Statement); - public FixedStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, statement); + public StatementSyntax Statement => GetRed(ref this.statement, 1)!; + + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.statement, 1)! : null; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FixedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public FixedStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); -} + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.statement : null; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -public sealed partial class CheckedStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private BlockSyntax? block; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseClause(this); + + public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement) + { + if (elseKeyword != this.ElseKeyword || statement != this.Statement) + { + var newNode = SyntaxFactory.ElseClause(elseKeyword, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal CheckedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + return this; + } + + public ElseClauseSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(elseKeyword, this.Statement); + public ElseClauseSyntax WithStatement(StatementSyntax statement) => Update(this.ElseKeyword, statement); } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + /// Represents a switch statement syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SwitchStatementSyntax : StatementSyntax + { + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; + private SyntaxNode? sections; - public SyntaxToken Keyword => new(this, ((InternalSyntax.CheckedStatementSyntax)this.Green).keyword, GetChildPosition(1), GetChildIndex(1)); + internal SwitchStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public BlockSyntax Block => GetRed(ref this.block, 2)!; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.block, 2)!, - _ => null, - }; + /// + /// Gets a SyntaxToken that represents the switch keyword. + /// + public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + /// + /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. + /// + public SyntaxToken OpenParenToken { - 0 => this.attributeLists, - 2 => this.block, - _ => null, - }; + get + { + var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + } + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedStatement(this); + /// + /// Gets an ExpressionSyntax representing the expression of the switch statement. + /// + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public CheckedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) - { - if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) + /// + /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. + /// + public SyntaxToken CloseParenToken { - var newNode = SyntaxFactory.CheckedStatement(this.Kind(), attributeLists, keyword, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; + } } - return this; - } + /// + /// Gets a SyntaxToken that represents the open braces preceding the switch sections. + /// + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).openBraceToken, GetChildPosition(5), GetChildIndex(5)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new CheckedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Keyword, this.Block); - public CheckedStatementSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, keyword, this.Block); - public CheckedStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.Keyword, block); + /// + /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. + /// + public SyntaxList Sections => new SyntaxList(GetRed(ref this.sections, 6)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new CheckedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public CheckedStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public CheckedStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); -} + /// + /// Gets a SyntaxToken that represents the open braces following the switch sections. + /// + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).closeBraceToken, GetChildPosition(7), GetChildIndex(7)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class UnsafeStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private BlockSyntax? block; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3)!, + 6 => GetRed(ref this.sections, 6)!, + _ => null, + }; - internal UnsafeStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + 6 => this.sections, + _ => null, + }; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchStatement(this); - public SyntaxToken UnsafeKeyword => new(this, ((InternalSyntax.UnsafeStatementSyntax)this.Green).unsafeKeyword, GetChildPosition(1), GetChildIndex(1)); + public SwitchStatementSyntax Update(SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, SyntaxList sections, SyntaxToken closeBraceToken) + { + if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public BlockSyntax Block => GetRed(ref this.block, 2)!; + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new SwitchStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.AttributeLists, switchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.SwitchKeyword, openParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, openBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithSections(SyntaxList sections) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, sections, this.CloseBraceToken); + public SwitchStatementSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, closeBraceToken); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.block, 2)!, - _ => null, - }; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new SwitchStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public SwitchStatementSyntax AddSections(params SwitchSectionSyntax[] items) => WithSections(this.Sections.AddRange(items)); + } + + /// Represents a switch section syntax of a switch statement. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SwitchSectionSyntax : CSharpSyntaxNode + { + private SyntaxNode? labels; + private SyntaxNode? statements; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + internal SwitchSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.attributeLists, - 2 => this.block, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnsafeStatement(this); + /// + /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. + /// + public SyntaxList Labels => new SyntaxList(GetRed(ref this.labels, 0)); - public UnsafeStatementSyntax Update(SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) - { - if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) + /// + /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. + /// + public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 1)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.labels)!, + 1 => GetRed(ref this.statements, 1)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.labels, + 1 => this.statements, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchSection(this); + + public SwitchSectionSyntax Update(SyntaxList labels, SyntaxList statements) { - var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (labels != this.Labels || statements != this.Statements) + { + var newNode = SyntaxFactory.SwitchSection(labels, statements); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public SwitchSectionSyntax WithLabels(SyntaxList labels) => Update(labels, this.Statements); + public SwitchSectionSyntax WithStatements(SyntaxList statements) => Update(this.Labels, statements); + + public SwitchSectionSyntax AddLabels(params SwitchLabelSyntax[] items) => WithLabels(this.Labels.AddRange(items)); + public SwitchSectionSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new UnsafeStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.UnsafeKeyword, this.Block); - public UnsafeStatementSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.AttributeLists, unsafeKeyword, this.Block); - public UnsafeStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.UnsafeKeyword, block); + /// Represents a switch label within a switch statement. + public abstract partial class SwitchLabelSyntax : CSharpSyntaxNode + { + internal SwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new UnsafeStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public UnsafeStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public UnsafeStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); -} + /// + /// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. + /// + public abstract SyntaxToken Keyword { get; } + public SwitchLabelSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); + internal abstract SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class LockStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - private StatementSyntax? statement; + /// + /// Gets a SyntaxToken that represents the colon that terminates the switch label. + /// + public abstract SyntaxToken ColonToken { get; } + public SwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); + internal abstract SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken); + } - internal LockStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Represents a case label within a switch statement. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax { - } + private PatternSyntax? pattern; + private WhenClauseSyntax? whenClause; + + internal CasePatternSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + /// Gets the case keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).keyword, Position, 0); - public SyntaxToken LockKeyword => new(this, ((InternalSyntax.LockStatementSyntax)this.Green).lockKeyword, GetChildPosition(1), GetChildIndex(1)); + /// + /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. + /// + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.LockStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 2); - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.LockStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.pattern, 1)!, + 2 => GetRed(ref this.whenClause, 2), + _ => null, + }; - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.pattern, + 2 => this.whenClause, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3)!, - 5 => GetRed(ref this.statement, 5)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCasePatternSwitchLabel(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) { - 0 => this.attributeLists, - 3 => this.expression, - 5 => this.statement, - _ => null, - }; + if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLockStatement(this); + internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new CasePatternSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Pattern, this.WhenClause, this.ColonToken); + public CasePatternSwitchLabelSyntax WithPattern(PatternSyntax pattern) => Update(this.Keyword, pattern, this.WhenClause, this.ColonToken); + public CasePatternSwitchLabelSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Keyword, this.Pattern, whenClause, this.ColonToken); + internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new CasePatternSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Pattern, this.WhenClause, colonToken); + } - public LockStatementSyntax Update(SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + /// Represents a case label within a switch statement. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax { - if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + private ExpressionSyntax? value; + + internal CaseSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// Gets the case keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CaseSwitchLabelSyntax)this.Green).keyword, Position, 0); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LockStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithLockKeyword(SyntaxToken lockKeyword) => Update(this.AttributeLists, lockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.LockKeyword, openParenToken, this.Expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.Statement); - public LockStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, statement); + /// + /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. + /// + public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LockStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.CaseSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); -/// -/// Represents an if statement syntax. -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class IfStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private ExpressionSyntax? condition; - private StatementSyntax? statement; - private ElseClauseSyntax? @else; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; - internal IfStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCaseSwitchLabel(this); - /// - /// Gets a SyntaxToken that represents the if keyword. - /// - public SyntaxToken IfKeyword => new(this, ((InternalSyntax.IfStatementSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); + public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + { + if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - /// - /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. - /// - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.IfStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + return this; + } - /// - /// Gets an ExpressionSyntax that represents the condition of the if statement. - /// - public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; + internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new CaseSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Value, this.ColonToken); + public CaseSwitchLabelSyntax WithValue(ExpressionSyntax value) => Update(this.Keyword, value, this.ColonToken); + internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new CaseSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Value, colonToken); + } - /// - /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. - /// - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.IfStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + /// Represents a default label within a switch statement. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax + { - /// - /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. - /// - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + internal DefaultSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// - /// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. - /// - public ElseClauseSyntax? Else => GetRed(ref this.@else, 6); + /// Gets the default keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.DefaultSwitchLabelSyntax)this.Green).keyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.condition, 3)!, - 5 => GetRed(ref this.statement, 5)!, - 6 => GetRed(ref this.@else, 6), - _ => null, - }; + public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.DefaultSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.condition, - 5 => this.statement, - 6 => this.@else, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfStatement(this); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public IfStatementSyntax Update(SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) - { - if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultSwitchLabel(this); + + public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken) { - var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (keyword != this.Keyword || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new DefaultSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.ColonToken); + internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new DefaultSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, colonToken); } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new IfStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.AttributeLists, ifKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.IfKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement, this.Else); - public IfStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement, this.Else); - public IfStatementSyntax WithElse(ElseClauseSyntax? @else) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, @else); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SwitchExpressionSyntax : ExpressionSyntax + { + private ExpressionSyntax? governingExpression; + private SyntaxNode? arms; + + internal SwitchExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new IfStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + public ExpressionSyntax GoverningExpression => GetRedAtZero(ref this.governingExpression)!; -/// Represents an else statement syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ElseClauseSyntax : CSharpSyntaxNode -{ - private StatementSyntax? statement; + public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); - internal ElseClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); - /// - /// Gets a syntax token - /// - public SyntaxToken ElseKeyword => new(this, ((InternalSyntax.ElseClauseSyntax)this.Green).elseKeyword, Position, 0); + public SeparatedSyntaxList Arms + { + get + { + var red = GetRed(ref this.arms, 3); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; + } + } - public StatementSyntax Statement => GetRed(ref this.statement, 1)!; + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.statement, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.governingExpression)!, + 3 => GetRed(ref this.arms, 3)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.statement : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.governingExpression, + 3 => this.arms, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpression(this); - public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement) - { - if (elseKeyword != this.ElseKeyword || statement != this.Statement) + public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList arms, SyntaxToken closeBraceToken) { - var newNode = SyntaxFactory.ElseClause(elseKeyword, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - return this; - } + return this; + } - public ElseClauseSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(elseKeyword, this.Statement); - public ElseClauseSyntax WithStatement(StatementSyntax statement) => Update(this.ElseKeyword, statement); -} + public SwitchExpressionSyntax WithGoverningExpression(ExpressionSyntax governingExpression) => Update(governingExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.GoverningExpression, switchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, openBraceToken, this.Arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithArms(SeparatedSyntaxList arms) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, closeBraceToken); -/// Represents a switch statement syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SwitchStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - private SyntaxNode? sections; + public SwitchExpressionSyntax AddArms(params SwitchExpressionArmSyntax[] items) => WithArms(this.Arms.AddRange(items)); + } - internal SwitchStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode { - } + private PatternSyntax? pattern; + private WhenClauseSyntax? whenClause; + private ExpressionSyntax? expression; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + internal SwitchExpressionArmSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// - /// Gets a SyntaxToken that represents the switch keyword. - /// - public SyntaxToken SwitchKeyword => new(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); + public PatternSyntax Pattern => GetRedAtZero(ref this.pattern)!; - /// - /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. - /// - public SyntaxToken OpenParenToken => ((InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 1); - /// - /// Gets an ExpressionSyntax representing the expression of the switch statement. - /// - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + public SyntaxToken EqualsGreaterThanToken => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionArmSyntax)this.Green).equalsGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); - /// - /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. - /// - public SyntaxToken CloseParenToken => ((InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken is { } slot ? new(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - /// - /// Gets a SyntaxToken that represents the open braces preceding the switch sections. - /// - public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).openBraceToken, GetChildPosition(5), GetChildIndex(5)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.pattern)!, + 1 => GetRed(ref this.whenClause, 1), + 3 => GetRed(ref this.expression, 3)!, + _ => null, + }; - /// - /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. - /// - public SyntaxList Sections => new(GetRed(ref this.sections, 6)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.pattern, + 1 => this.whenClause, + 3 => this.expression, + _ => null, + }; - /// - /// Gets a SyntaxToken that represents the open braces following the switch sections. - /// - public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).closeBraceToken, GetChildPosition(7), GetChildIndex(7)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpressionArm(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3)!, - 6 => GetRed(ref this.sections, 6)!, - _ => null, - }; + if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression) + { + var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.expression, - 6 => this.sections, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchStatement(this); + public SwitchExpressionArmSyntax WithPattern(PatternSyntax pattern) => Update(pattern, this.WhenClause, this.EqualsGreaterThanToken, this.Expression); + public SwitchExpressionArmSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Pattern, whenClause, this.EqualsGreaterThanToken, this.Expression); + public SwitchExpressionArmSyntax WithEqualsGreaterThanToken(SyntaxToken equalsGreaterThanToken) => Update(this.Pattern, this.WhenClause, equalsGreaterThanToken, this.Expression); + public SwitchExpressionArmSyntax WithExpression(ExpressionSyntax expression) => Update(this.Pattern, this.WhenClause, this.EqualsGreaterThanToken, expression); + } - public SwitchStatementSyntax Update(SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, SyntaxList sections, SyntaxToken closeBraceToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TryStatementSyntax : StatementSyntax { - if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) + private SyntaxNode? attributeLists; + private BlockSyntax? block; + private SyntaxNode? catches; + private FinallyClauseSyntax? @finally; + + internal TryStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new SwitchStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.AttributeLists, switchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.SwitchKeyword, openParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, openBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithSections(SyntaxList sections) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, sections, this.CloseBraceToken); - public SwitchStatementSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, closeBraceToken); + public SyntaxToken TryKeyword => new SyntaxToken(this, ((InternalSyntax.TryStatementSyntax)this.Green).tryKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new SwitchStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public SwitchStatementSyntax AddSections(params SwitchSectionSyntax[] items) => WithSections(this.Sections.AddRange(items)); -} + public BlockSyntax Block => GetRed(ref this.block, 2)!; -/// Represents a switch section syntax of a switch statement. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SwitchSectionSyntax : CSharpSyntaxNode -{ - private SyntaxNode? labels; - private SyntaxNode? statements; + public SyntaxList Catches => new SyntaxList(GetRed(ref this.catches, 3)); - internal SwitchSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public FinallyClauseSyntax? Finally => GetRed(ref this.@finally, 4); - /// - /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. - /// - public SyntaxList Labels => new(GetRed(ref this.labels, 0)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.block, 2)!, + 3 => GetRed(ref this.catches, 3)!, + 4 => GetRed(ref this.@finally, 4), + _ => null, + }; - /// - /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. - /// - public SyntaxList Statements => new(GetRed(ref this.statements, 1)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.block, + 3 => this.catches, + 4 => this.@finally, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.labels)!, - 1 => GetRed(ref this.statements, 1)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTryStatement(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public TryStatementSyntax Update(SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, SyntaxList catches, FinallyClauseSyntax? @finally) { - 0 => this.labels, - 1 => this.statements, - _ => null, - }; + if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) + { + var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new TryStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.TryKeyword, this.Block, this.Catches, this.Finally); + public TryStatementSyntax WithTryKeyword(SyntaxToken tryKeyword) => Update(this.AttributeLists, tryKeyword, this.Block, this.Catches, this.Finally); + public TryStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.TryKeyword, block, this.Catches, this.Finally); + public TryStatementSyntax WithCatches(SyntaxList catches) => Update(this.AttributeLists, this.TryKeyword, this.Block, catches, this.Finally); + public TryStatementSyntax WithFinally(FinallyClauseSyntax? @finally) => Update(this.AttributeLists, this.TryKeyword, this.Block, this.Catches, @finally); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchSection(this); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new TryStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public TryStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public TryStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); + public TryStatementSyntax AddCatches(params CatchClauseSyntax[] items) => WithCatches(this.Catches.AddRange(items)); + } - public SwitchSectionSyntax Update(SyntaxList labels, SyntaxList statements) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CatchClauseSyntax : CSharpSyntaxNode { - if (labels != this.Labels || statements != this.Statements) + private CatchDeclarationSyntax? declaration; + private CatchFilterClauseSyntax? filter; + private BlockSyntax? block; + + internal CatchClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.SwitchSection(labels, statements); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public SyntaxToken CatchKeyword => new SyntaxToken(this, ((InternalSyntax.CatchClauseSyntax)this.Green).catchKeyword, Position, 0); - public SwitchSectionSyntax WithLabels(SyntaxList labels) => Update(labels, this.Statements); - public SwitchSectionSyntax WithStatements(SyntaxList statements) => Update(this.Labels, statements); + public CatchDeclarationSyntax? Declaration => GetRed(ref this.declaration, 1); - public SwitchSectionSyntax AddLabels(params SwitchLabelSyntax[] items) => WithLabels(this.Labels.AddRange(items)); - public SwitchSectionSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); -} + public CatchFilterClauseSyntax? Filter => GetRed(ref this.filter, 2); -/// Represents a switch label within a switch statement. -public abstract partial class SwitchLabelSyntax : CSharpSyntaxNode -{ - internal SwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public BlockSyntax Block => GetRed(ref this.block, 3)!; - /// - /// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. - /// - public abstract SyntaxToken Keyword { get; } - public SwitchLabelSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); - internal abstract SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.declaration, 1), + 2 => GetRed(ref this.filter, 2), + 3 => GetRed(ref this.block, 3)!, + _ => null, + }; - /// - /// Gets a SyntaxToken that represents the colon that terminates the switch label. - /// - public abstract SyntaxToken ColonToken { get; } - public SwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); - internal abstract SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken); -} + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.declaration, + 2 => this.filter, + 3 => this.block, + _ => null, + }; -/// Represents a case label within a switch statement. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax -{ - private PatternSyntax? pattern; - private WhenClauseSyntax? whenClause; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchClause(this); - internal CasePatternSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) + { + if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block) + { + var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - /// Gets the case keyword token. - public override SyntaxToken Keyword => new(this, ((InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).keyword, Position, 0); + return this; + } - /// - /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. - /// - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + public CatchClauseSyntax WithCatchKeyword(SyntaxToken catchKeyword) => Update(catchKeyword, this.Declaration, this.Filter, this.Block); + public CatchClauseSyntax WithDeclaration(CatchDeclarationSyntax? declaration) => Update(this.CatchKeyword, declaration, this.Filter, this.Block); + public CatchClauseSyntax WithFilter(CatchFilterClauseSyntax? filter) => Update(this.CatchKeyword, this.Declaration, filter, this.Block); + public CatchClauseSyntax WithBlock(BlockSyntax block) => Update(this.CatchKeyword, this.Declaration, this.Filter, block); - public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 2); + public CatchClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public CatchClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); + } - public override SyntaxToken ColonToken => new(this, ((InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode + { + private TypeSyntax? type; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + internal CatchDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 1 => GetRed(ref this.pattern, 1)!, - 2 => GetRed(ref this.whenClause, 2), - _ => null, - }; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.pattern, - 2 => this.whenClause, - _ => null, - }; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).openParenToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCasePatternSwitchLabel(this); + public TypeSyntax Type => GetRed(ref this.type, 1)!; - public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) - { - if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken) + public SyntaxToken Identifier { - var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).identifier; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + } } - return this; - } - - internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new CasePatternSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Pattern, this.WhenClause, this.ColonToken); - public CasePatternSwitchLabelSyntax WithPattern(PatternSyntax pattern) => Update(this.Keyword, pattern, this.WhenClause, this.ColonToken); - public CasePatternSwitchLabelSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Keyword, this.Pattern, whenClause, this.ColonToken); - internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new CasePatternSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Pattern, this.WhenClause, colonToken); -} - -/// Represents a case label within a switch statement. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax -{ - private ExpressionSyntax? value; - - internal CaseSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - /// Gets the case keyword token. - public override SyntaxToken Keyword => new(this, ((InternalSyntax.CaseSwitchLabelSyntax)this.Green).keyword, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; - /// - /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. - /// - public ExpressionSyntax Value => GetRed(ref this.value, 1)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; - public override SyntaxToken ColonToken => new(this, ((InternalSyntax.CaseSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchDeclaration(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; + public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCaseSwitchLabel(this); + public CatchDeclarationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.Identifier, this.CloseParenToken); + public CatchDeclarationSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.Identifier, this.CloseParenToken); + public CatchDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.OpenParenToken, this.Type, identifier, this.CloseParenToken); + public CatchDeclarationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, this.Identifier, closeParenToken); + } - public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode { - if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken) + private ExpressionSyntax? filterExpression; + + internal CatchFilterClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new CaseSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Value, this.ColonToken); - public CaseSwitchLabelSyntax WithValue(ExpressionSyntax value) => Update(this.Keyword, value, this.ColonToken); - internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new CaseSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Value, colonToken); -} - -/// Represents a default label within a switch statement. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax -{ + public SyntaxToken WhenKeyword => new SyntaxToken(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).whenKeyword, Position, 0); - internal DefaultSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - /// Gets the default keyword token. - public override SyntaxToken Keyword => new(this, ((InternalSyntax.DefaultSwitchLabelSyntax)this.Green).keyword, Position, 0); + public ExpressionSyntax FilterExpression => GetRed(ref this.filterExpression, 2)!; - public override SyntaxToken ColonToken => new(this, ((InternalSyntax.DefaultSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.filterExpression, 2)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.filterExpression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultSwitchLabel(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchFilterClause(this); - public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken) - { - if (keyword != this.Keyword || colonToken != this.ColonToken) + public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) { - var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public CatchFilterClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.OpenParenToken, this.FilterExpression, this.CloseParenToken); + public CatchFilterClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.WhenKeyword, openParenToken, this.FilterExpression, this.CloseParenToken); + public CatchFilterClauseSyntax WithFilterExpression(ExpressionSyntax filterExpression) => Update(this.WhenKeyword, this.OpenParenToken, filterExpression, this.CloseParenToken); + public CatchFilterClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.WhenKeyword, this.OpenParenToken, this.FilterExpression, closeParenToken); } - internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new DefaultSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.ColonToken); - internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new DefaultSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, colonToken); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SwitchExpressionSyntax : ExpressionSyntax -{ - private ExpressionSyntax? governingExpression; - private SyntaxNode? arms; - - internal SwitchExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FinallyClauseSyntax : CSharpSyntaxNode { - } + private BlockSyntax? block; - public ExpressionSyntax GoverningExpression => GetRedAtZero(ref this.governingExpression)!; + internal FinallyClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken SwitchKeyword => new(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken FinallyKeyword => new SyntaxToken(this, ((InternalSyntax.FinallyClauseSyntax)this.Green).finallyKeyword, Position, 0); - public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); + public BlockSyntax Block => GetRed(ref this.block, 1)!; - public SeparatedSyntaxList Arms => GetRed(ref this.arms, 3) is { } red ? new(red, GetChildIndex(3)) : default; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.block, 1)! : null; - public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.block : null; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.governingExpression)!, - 3 => GetRed(ref this.arms, 3)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFinallyClause(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block) { - 0 => this.governingExpression, - 3 => this.arms, - _ => null, - }; + if (finallyKeyword != this.FinallyKeyword || block != this.Block) + { + var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public FinallyClauseSyntax WithFinallyKeyword(SyntaxToken finallyKeyword) => Update(finallyKeyword, this.Block); + public FinallyClauseSyntax WithBlock(BlockSyntax block) => Update(this.FinallyKeyword, block); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpression(this); + public FinallyClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public FinallyClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); + } - public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CompilationUnitSyntax : CSharpSyntaxNode { - if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) + private SyntaxNode? externs; + private SyntaxNode? usings; + private SyntaxNode? attributeLists; + private SyntaxNode? members; + + internal CompilationUnitSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public SwitchExpressionSyntax WithGoverningExpression(ExpressionSyntax governingExpression) => Update(governingExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.GoverningExpression, switchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, openBraceToken, this.Arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithArms(SeparatedSyntaxList arms) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, closeBraceToken); + public SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 0)); - public SwitchExpressionSyntax AddArms(params SwitchExpressionArmSyntax[] items) => WithArms(this.Arms.AddRange(items)); -} + public SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 1)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode -{ - private PatternSyntax? pattern; - private WhenClauseSyntax? whenClause; - private ExpressionSyntax? expression; + /// Gets the attribute declaration list. + public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 2)); - internal SwitchExpressionArmSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxList Members => new SyntaxList(GetRed(ref this.members, 3)); - public PatternSyntax Pattern => GetRedAtZero(ref this.pattern)!; + public SyntaxToken EndOfFileToken => new SyntaxToken(this, ((InternalSyntax.CompilationUnitSyntax)this.Green).endOfFileToken, GetChildPosition(4), GetChildIndex(4)); - public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 1); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.externs)!, + 1 => GetRed(ref this.usings, 1)!, + 2 => GetRed(ref this.attributeLists, 2)!, + 3 => GetRed(ref this.members, 3)!, + _ => null, + }; - public SyntaxToken EqualsGreaterThanToken => new(this, ((InternalSyntax.SwitchExpressionArmSyntax)this.Green).equalsGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.externs, + 1 => this.usings, + 2 => this.attributeLists, + 3 => this.members, + _ => null, + }; - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCompilationUnit(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public CompilationUnitSyntax Update(SyntaxList externs, SyntaxList usings, SyntaxList attributeLists, SyntaxList members, SyntaxToken endOfFileToken) { - 0 => GetRedAtZero(ref this.pattern)!, - 1 => GetRed(ref this.whenClause, 1), - 3 => GetRed(ref this.expression, 3)!, - _ => null, - }; + if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) + { + var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.pattern, - 1 => this.whenClause, - 3 => this.expression, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpressionArm(this); + public CompilationUnitSyntax WithExterns(SyntaxList externs) => Update(externs, this.Usings, this.AttributeLists, this.Members, this.EndOfFileToken); + public CompilationUnitSyntax WithUsings(SyntaxList usings) => Update(this.Externs, usings, this.AttributeLists, this.Members, this.EndOfFileToken); + public CompilationUnitSyntax WithAttributeLists(SyntaxList attributeLists) => Update(this.Externs, this.Usings, attributeLists, this.Members, this.EndOfFileToken); + public CompilationUnitSyntax WithMembers(SyntaxList members) => Update(this.Externs, this.Usings, this.AttributeLists, members, this.EndOfFileToken); + public CompilationUnitSyntax WithEndOfFileToken(SyntaxToken endOfFileToken) => Update(this.Externs, this.Usings, this.AttributeLists, this.Members, endOfFileToken); - public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + public CompilationUnitSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); + public CompilationUnitSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); + public CompilationUnitSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public CompilationUnitSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); + } + + /// + /// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode { - if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression) + + internal ExternAliasDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public SwitchExpressionArmSyntax WithPattern(PatternSyntax pattern) => Update(pattern, this.WhenClause, this.EqualsGreaterThanToken, this.Expression); - public SwitchExpressionArmSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Pattern, whenClause, this.EqualsGreaterThanToken, this.Expression); - public SwitchExpressionArmSyntax WithEqualsGreaterThanToken(SyntaxToken equalsGreaterThanToken) => Update(this.Pattern, this.WhenClause, equalsGreaterThanToken, this.Expression); - public SwitchExpressionArmSyntax WithExpression(ExpressionSyntax expression) => Update(this.Pattern, this.WhenClause, this.EqualsGreaterThanToken, expression); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TryStatementSyntax : StatementSyntax -{ - private SyntaxNode? attributeLists; - private BlockSyntax? block; - private SyntaxNode? catches; - private FinallyClauseSyntax? @finally; + /// SyntaxToken representing the extern keyword. + public SyntaxToken ExternKeyword => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).externKeyword, Position, 0); - internal TryStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the alias keyword. + public SyntaxToken AliasKeyword => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).aliasKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken TryKeyword => new(this, ((InternalSyntax.TryStatementSyntax)this.Green).tryKeyword, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the semicolon token. + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - public BlockSyntax Block => GetRed(ref this.block, 2)!; + internal override SyntaxNode? GetNodeSlot(int index) => null; - public SyntaxList Catches => new(GetRed(ref this.catches, 3)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public FinallyClauseSyntax? Finally => GetRed(ref this.@finally, 4); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExternAliasDirective(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.block, 2)!, - 3 => GetRed(ref this.catches, 3)!, - 4 => GetRed(ref this.@finally, 4), - _ => null, - }; + if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.block, - 3 => this.catches, - 4 => this.@finally, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTryStatement(this); + public ExternAliasDirectiveSyntax WithExternKeyword(SyntaxToken externKeyword) => Update(externKeyword, this.AliasKeyword, this.Identifier, this.SemicolonToken); + public ExternAliasDirectiveSyntax WithAliasKeyword(SyntaxToken aliasKeyword) => Update(this.ExternKeyword, aliasKeyword, this.Identifier, this.SemicolonToken); + public ExternAliasDirectiveSyntax WithIdentifier(SyntaxToken identifier) => Update(this.ExternKeyword, this.AliasKeyword, identifier, this.SemicolonToken); + public ExternAliasDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.ExternKeyword, this.AliasKeyword, this.Identifier, semicolonToken); + } - public TryStatementSyntax Update(SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, SyntaxList catches, FinallyClauseSyntax? @finally) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode { - if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) + private NameEqualsSyntax? alias; + private TypeSyntax? namespaceOrType; + + internal UsingDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public SyntaxToken GlobalKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword; + return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; + } + } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new TryStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.TryKeyword, this.Block, this.Catches, this.Finally); - public TryStatementSyntax WithTryKeyword(SyntaxToken tryKeyword) => Update(this.AttributeLists, tryKeyword, this.Block, this.Catches, this.Finally); - public TryStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.TryKeyword, block, this.Catches, this.Finally); - public TryStatementSyntax WithCatches(SyntaxList catches) => Update(this.AttributeLists, this.TryKeyword, this.Block, catches, this.Finally); - public TryStatementSyntax WithFinally(FinallyClauseSyntax? @finally) => Update(this.AttributeLists, this.TryKeyword, this.Block, this.Catches, @finally); + public SyntaxToken UsingKeyword => new SyntaxToken(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new TryStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public TryStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public TryStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); - public TryStatementSyntax AddCatches(params CatchClauseSyntax[] items) => WithCatches(this.Catches.AddRange(items)); -} + public SyntaxToken StaticKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + } + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CatchClauseSyntax : CSharpSyntaxNode -{ - private CatchDeclarationSyntax? declaration; - private CatchFilterClauseSyntax? filter; - private BlockSyntax? block; + public SyntaxToken UnsafeKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } - internal CatchClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public NameEqualsSyntax? Alias => GetRed(ref this.alias, 4); - public SyntaxToken CatchKeyword => new(this, ((InternalSyntax.CatchClauseSyntax)this.Green).catchKeyword, Position, 0); + public TypeSyntax NamespaceOrType => GetRed(ref this.namespaceOrType, 5)!; - public CatchDeclarationSyntax? Declaration => GetRed(ref this.declaration, 1); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(6), GetChildIndex(6)); - public CatchFilterClauseSyntax? Filter => GetRed(ref this.filter, 2); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 4 => GetRed(ref this.alias, 4), + 5 => GetRed(ref this.namespaceOrType, 5)!, + _ => null, + }; - public BlockSyntax Block => GetRed(ref this.block, 3)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 4 => this.alias, + 5 => this.namespaceOrType, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.declaration, 1), - 2 => GetRed(ref this.filter, 2), - 3 => GetRed(ref this.block, 3)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingDirective(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) { - 1 => this.declaration, - 2 => this.filter, - 3 => this.block, - _ => null, - }; + if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || unsafeKeyword != this.UnsafeKeyword || alias != this.Alias || namespaceOrType != this.NamespaceOrType || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchClause(this); - - public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - { - if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block) - { - var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + return this; } - return this; + public UsingDirectiveSyntax WithGlobalKeyword(SyntaxToken globalKeyword) => Update(globalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.GlobalKeyword, usingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithStaticKeyword(SyntaxToken staticKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, staticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, unsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithAlias(NameEqualsSyntax? alias) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithNamespaceOrType(TypeSyntax namespaceOrType) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, namespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, semicolonToken); } - public CatchClauseSyntax WithCatchKeyword(SyntaxToken catchKeyword) => Update(catchKeyword, this.Declaration, this.Filter, this.Block); - public CatchClauseSyntax WithDeclaration(CatchDeclarationSyntax? declaration) => Update(this.CatchKeyword, declaration, this.Filter, this.Block); - public CatchClauseSyntax WithFilter(CatchFilterClauseSyntax? filter) => Update(this.CatchKeyword, this.Declaration, filter, this.Block); - public CatchClauseSyntax WithBlock(BlockSyntax block) => Update(this.CatchKeyword, this.Declaration, this.Filter, block); - - public CatchClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public CatchClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode -{ - private TypeSyntax? type; - - internal CatchDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Member declaration syntax. + public abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode { - } - - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).openParenToken, Position, 0); - - public TypeSyntax Type => GetRed(ref this.type, 1)!; - - public SyntaxToken Identifier => ((InternalSyntax.CatchDeclarationSyntax)this.Green).identifier is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + internal MemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// Gets the attribute declaration list. + public abstract SyntaxList AttributeLists { get; } + public MemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; + public MemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; + /// Gets the modifier list. + public abstract SyntaxTokenList Modifiers { get; } + public MemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); + internal abstract MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchDeclaration(this); + public MemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); + internal abstract MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items); + } - public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) + public abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax { - if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken) + internal BaseNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public abstract SyntaxToken NamespaceKeyword { get; } + public BaseNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => WithNamespaceKeywordCore(namespaceKeyword); + internal abstract BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword); - public CatchDeclarationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.Identifier, this.CloseParenToken); - public CatchDeclarationSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.Identifier, this.CloseParenToken); - public CatchDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.OpenParenToken, this.Type, identifier, this.CloseParenToken); - public CatchDeclarationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, this.Identifier, closeParenToken); -} + public abstract NameSyntax Name { get; } + public BaseNamespaceDeclarationSyntax WithName(NameSyntax name) => WithNameCore(name); + internal abstract BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode -{ - private ExpressionSyntax? filterExpression; + public abstract SyntaxList Externs { get; } + public BaseNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => WithExternsCore(externs); + internal abstract BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs); - internal CatchFilterClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public BaseNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => AddExternsCore(items); + internal abstract BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items); - public SyntaxToken WhenKeyword => new(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).whenKeyword, Position, 0); + public abstract SyntaxList Usings { get; } + public BaseNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => WithUsingsCore(usings); + internal abstract BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings); - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public BaseNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => AddUsingsCore(items); + internal abstract BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items); - public ExpressionSyntax FilterExpression => GetRed(ref this.filterExpression, 2)!; + public abstract SyntaxList Members { get; } + public BaseNamespaceDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); + internal abstract BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members); - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public BaseNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); + internal abstract BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.filterExpression, 2)! : null; + public new BaseNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseNamespaceDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseNamespaceDeclarationSyntax)WithModifiersCore(modifiers); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.filterExpression : null; + public new BaseNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseNamespaceDeclarationSyntax)AddAttributeListsCore(items); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchFilterClause(this); + public new BaseNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseNamespaceDeclarationSyntax)AddModifiersCore(items); + } - public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax { - if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken) + private SyntaxNode? attributeLists; + private NameSyntax? name; + private SyntaxNode? externs; + private SyntaxNode? usings; + private SyntaxNode? members; + + internal NamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public CatchFilterClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.OpenParenToken, this.FilterExpression, this.CloseParenToken); - public CatchFilterClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.WhenKeyword, openParenToken, this.FilterExpression, this.CloseParenToken); - public CatchFilterClauseSyntax WithFilterExpression(ExpressionSyntax filterExpression) => Update(this.WhenKeyword, this.OpenParenToken, filterExpression, this.CloseParenToken); - public CatchFilterClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.WhenKeyword, this.OpenParenToken, this.FilterExpression, closeParenToken); -} + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FinallyClauseSyntax : CSharpSyntaxNode -{ - private BlockSyntax? block; + public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); - internal FinallyClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override NameSyntax Name => GetRed(ref this.name, 3)!; - public SyntaxToken FinallyKeyword => new(this, ((InternalSyntax.FinallyClauseSyntax)this.Green).finallyKeyword, Position, 0); + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).openBraceToken, GetChildPosition(4), GetChildIndex(4)); - public BlockSyntax Block => GetRed(ref this.block, 1)!; + public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.block, 1)! : null; + public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.block : null; + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFinallyClause(this); + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); - public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block) - { - if (finallyKeyword != this.FinallyKeyword || block != this.Block) + /// Gets the optional semicolon token. + public SyntaxToken SemicolonToken { - var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + } } - return this; - } - - public FinallyClauseSyntax WithFinallyKeyword(SyntaxToken finallyKeyword) => Update(finallyKeyword, this.Block); - public FinallyClauseSyntax WithBlock(BlockSyntax block) => Update(this.FinallyKeyword, block); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.name, 3)!, + 5 => GetRed(ref this.externs, 5)!, + 6 => GetRed(ref this.usings, 6)!, + 7 => GetRed(ref this.members, 7)!, + _ => null, + }; - public FinallyClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public FinallyClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); -} + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.name, + 5 => this.externs, + 6 => this.usings, + 7 => this.members, + _ => null, + }; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CompilationUnitSyntax : CSharpSyntaxNode -{ - private SyntaxNode? externs; - private SyntaxNode? usings; - private SyntaxNode? attributeLists; - private SyntaxNode? members; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNamespaceDeclaration(this); - internal CompilationUnitSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public NamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, SyntaxList externs, SyntaxList usings, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public SyntaxList Externs => new(GetRed(ref this.externs, 0)); + return this; + } - public SyntaxList Usings => new(GetRed(ref this.usings, 1)); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new NamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new NamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); + public new NamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); + public new NamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + public NamespaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, openBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); + public new NamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); + public new NamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new NamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, members, this.CloseBraceToken, this.SemicolonToken); + public NamespaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, closeBraceToken, this.SemicolonToken); + public NamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, semicolonToken); - /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 2)); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new NamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new NamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); + public new NamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); + public new NamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new NamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); + } + + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax + { + private SyntaxNode? attributeLists; + private NameSyntax? name; + private SyntaxNode? externs; + private SyntaxNode? usings; + private SyntaxNode? members; + + internal FileScopedNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + + public override NameSyntax Name => GetRed(ref this.name, 3)!; + + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + + public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); + + public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.name, 3)!, + 5 => GetRed(ref this.externs, 5)!, + 6 => GetRed(ref this.usings, 6)!, + 7 => GetRed(ref this.members, 7)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.name, + 5 => this.externs, + 6 => this.usings, + 7 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFileScopedNamespaceDeclaration(this); + + public FileScopedNamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, SyntaxList externs, SyntaxList usings, SyntaxList members) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) + { + var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FileScopedNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new FileScopedNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); + public new FileScopedNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); + public new FileScopedNamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + public FileScopedNamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, semicolonToken, this.Externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); + public new FileScopedNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); + public new FileScopedNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new FileScopedNamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, members); - public SyntaxList Members => new(GetRed(ref this.members, 3)); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FileScopedNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new FileScopedNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); + public new FileScopedNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); + public new FileScopedNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new FileScopedNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); + } - public SyntaxToken EndOfFileToken => new(this, ((InternalSyntax.CompilationUnitSyntax)this.Green).endOfFileToken, GetChildPosition(4), GetChildIndex(4)); + /// Class representing one or more attributes applied to a language construct. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AttributeListSyntax : CSharpSyntaxNode + { + private AttributeTargetSpecifierSyntax? target; + private SyntaxNode? attributes; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + internal AttributeListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => GetRedAtZero(ref this.externs)!, - 1 => GetRed(ref this.usings, 1)!, - 2 => GetRed(ref this.attributeLists, 2)!, - 3 => GetRed(ref this.members, 3)!, - _ => null, - }; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.externs, - 1 => this.usings, - 2 => this.attributeLists, - 3 => this.members, - _ => null, - }; + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.AttributeListSyntax)this.Green).openBracketToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCompilationUnit(this); + /// Gets the optional construct targeted by the attribute. + public AttributeTargetSpecifierSyntax? Target => GetRed(ref this.target, 1); - public CompilationUnitSyntax Update(SyntaxList externs, SyntaxList usings, SyntaxList attributeLists, SyntaxList members, SyntaxToken endOfFileToken) - { - if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) + /// Gets the attribute declaration list. + public SeparatedSyntaxList Attributes { - var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var red = GetRed(ref this.attributes, 2); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; + } } - return this; - } + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); - public CompilationUnitSyntax WithExterns(SyntaxList externs) => Update(externs, this.Usings, this.AttributeLists, this.Members, this.EndOfFileToken); - public CompilationUnitSyntax WithUsings(SyntaxList usings) => Update(this.Externs, usings, this.AttributeLists, this.Members, this.EndOfFileToken); - public CompilationUnitSyntax WithAttributeLists(SyntaxList attributeLists) => Update(this.Externs, this.Usings, attributeLists, this.Members, this.EndOfFileToken); - public CompilationUnitSyntax WithMembers(SyntaxList members) => Update(this.Externs, this.Usings, this.AttributeLists, members, this.EndOfFileToken); - public CompilationUnitSyntax WithEndOfFileToken(SyntaxToken endOfFileToken) => Update(this.Externs, this.Usings, this.AttributeLists, this.Members, endOfFileToken); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.target, 1), + 2 => GetRed(ref this.attributes, 2)!, + _ => null, + }; - public CompilationUnitSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); - public CompilationUnitSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); - public CompilationUnitSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public CompilationUnitSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); -} + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.target, + 2 => this.attributes, + _ => null, + }; -/// -/// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode -{ + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeList(this); - internal ExternAliasDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) + { + var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Target, this.Attributes, this.CloseBracketToken); + public AttributeListSyntax WithTarget(AttributeTargetSpecifierSyntax? target) => Update(this.OpenBracketToken, target, this.Attributes, this.CloseBracketToken); + public AttributeListSyntax WithAttributes(SeparatedSyntaxList attributes) => Update(this.OpenBracketToken, this.Target, attributes, this.CloseBracketToken); + public AttributeListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Target, this.Attributes, closeBracketToken); + + public AttributeListSyntax AddAttributes(params AttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); } - /// SyntaxToken representing the extern keyword. - public SyntaxToken ExternKeyword => new(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).externKeyword, Position, 0); + /// Class representing what language construct an attribute targets. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode + { - /// SyntaxToken representing the alias keyword. - public SyntaxToken AliasKeyword => new(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).aliasKeyword, GetChildPosition(1), GetChildIndex(1)); + internal AttributeTargetSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).identifier, Position, 0); - /// SyntaxToken representing the semicolon token. - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExternAliasDirective(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeTargetSpecifier(this); - public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) - { - if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken) + public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken) { - var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (identifier != this.Identifier || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public AttributeTargetSpecifierSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ColonToken); + public AttributeTargetSpecifierSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Identifier, colonToken); } - public ExternAliasDirectiveSyntax WithExternKeyword(SyntaxToken externKeyword) => Update(externKeyword, this.AliasKeyword, this.Identifier, this.SemicolonToken); - public ExternAliasDirectiveSyntax WithAliasKeyword(SyntaxToken aliasKeyword) => Update(this.ExternKeyword, aliasKeyword, this.Identifier, this.SemicolonToken); - public ExternAliasDirectiveSyntax WithIdentifier(SyntaxToken identifier) => Update(this.ExternKeyword, this.AliasKeyword, identifier, this.SemicolonToken); - public ExternAliasDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.ExternKeyword, this.AliasKeyword, this.Identifier, semicolonToken); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode -{ - private NameEqualsSyntax? alias; - private TypeSyntax? namespaceOrType; - - internal UsingDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Attribute syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AttributeSyntax : CSharpSyntaxNode { - } + private NameSyntax? name; + private AttributeArgumentListSyntax? argumentList; - public SyntaxToken GlobalKeyword => ((InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword is { } slot ? new(this, slot, Position, 0) : default; - - public SyntaxToken UsingKeyword => new(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); + internal AttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken StaticKeyword => ((InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + /// Gets the name. + public NameSyntax Name => GetRedAtZero(ref this.name)!; - public SyntaxToken UnsafeKeyword => ((InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + public AttributeArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); - public NameEqualsSyntax? Alias => GetRed(ref this.alias, 4); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.name)!, + 1 => GetRed(ref this.argumentList, 1), + _ => null, + }; - public TypeSyntax NamespaceOrType => GetRed(ref this.namespaceOrType, 5)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.argumentList, + _ => null, + }; - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(6), GetChildIndex(6)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttribute(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax? argumentList) { - 4 => GetRed(ref this.alias, 4), - 5 => GetRed(ref this.namespaceOrType, 5)!, - _ => null, - }; + if (name != this.Name || argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.Attribute(name, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 4 => this.alias, - 5 => this.namespaceOrType, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingDirective(this); + public AttributeSyntax WithName(NameSyntax name) => Update(name, this.ArgumentList); + public AttributeSyntax WithArgumentList(AttributeArgumentListSyntax? argumentList) => Update(this.Name, argumentList); - public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) - { - if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || unsafeKeyword != this.UnsafeKeyword || alias != this.Alias || namespaceOrType != this.NamespaceOrType || semicolonToken != this.SemicolonToken) + public AttributeSyntax AddArgumentListArguments(params AttributeArgumentSyntax[] items) { - var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var argumentList = this.ArgumentList ?? SyntaxFactory.AttributeArgumentList(); + return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); } - - return this; } - public UsingDirectiveSyntax WithGlobalKeyword(SyntaxToken globalKeyword) => Update(globalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.GlobalKeyword, usingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithStaticKeyword(SyntaxToken staticKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, staticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, unsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithAlias(NameEqualsSyntax? alias) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithNamespaceOrType(TypeSyntax namespaceOrType) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, namespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, semicolonToken); -} - -/// Member declaration syntax. -public abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode -{ - internal MemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Attribute argument list syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode { - } + private SyntaxNode? arguments; - /// Gets the attribute declaration list. - public abstract SyntaxList AttributeLists { get; } - public MemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists); + internal AttributeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public MemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + /// Gets the open paren token. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); - /// Gets the modifier list. - public abstract SyntaxTokenList Modifiers { get; } - public MemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); - internal abstract MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers); + /// Gets the arguments syntax list. + public SeparatedSyntaxList Arguments + { + get + { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - public MemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); - internal abstract MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items); -} + /// Gets the close paren token. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); -public abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax -{ - internal BaseNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - public abstract SyntaxToken NamespaceKeyword { get; } - public BaseNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => WithNamespaceKeywordCore(namespaceKeyword); - internal abstract BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - public abstract NameSyntax Name { get; } - public BaseNamespaceDeclarationSyntax WithName(NameSyntax name) => WithNameCore(name); - internal abstract BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgumentList(this); - public abstract SyntaxList Externs { get; } - public BaseNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => WithExternsCore(externs); - internal abstract BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs); + public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public BaseNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => AddExternsCore(items); - internal abstract BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items); + return this; + } - public abstract SyntaxList Usings { get; } - public BaseNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => WithUsingsCore(usings); - internal abstract BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings); + public AttributeArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); + public AttributeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); + public AttributeArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); - public BaseNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => AddUsingsCore(items); - internal abstract BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items); + public AttributeArgumentListSyntax AddArguments(params AttributeArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); + } - public abstract SyntaxList Members { get; } - public BaseNamespaceDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); - internal abstract BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members); + /// Attribute argument syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode + { + private NameEqualsSyntax? nameEquals; + private NameColonSyntax? nameColon; + private ExpressionSyntax? expression; - public BaseNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); - internal abstract BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); + internal AttributeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public new BaseNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseNamespaceDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseNamespaceDeclarationSyntax)WithModifiersCore(modifiers); + public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); - public new BaseNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseNamespaceDeclarationSyntax)AddAttributeListsCore(items); + public NameColonSyntax? NameColon => GetRed(ref this.nameColon, 1); - public new BaseNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseNamespaceDeclarationSyntax)AddModifiersCore(items); -} + /// Gets the expression. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private NameSyntax? name; - private SyntaxNode? externs; - private SyntaxNode? usings; - private SyntaxNode? members; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.nameEquals), + 1 => GetRed(ref this.nameColon, 1), + 2 => GetRed(ref this.expression, 2)!, + _ => null, + }; - internal NamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.nameEquals, + 1 => this.nameColon, + 2 => this.expression, + _ => null, + }; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgument(this); - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + public AttributeArgumentSyntax Update(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + { + if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression) + { + var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override SyntaxToken NamespaceKeyword => new(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public override NameSyntax Name => GetRed(ref this.name, 3)!; + public AttributeArgumentSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.NameColon, this.Expression); + public AttributeArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(this.NameEquals, nameColon, this.Expression); + public AttributeArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, this.NameColon, expression); + } - public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).openBraceToken, GetChildPosition(4), GetChildIndex(4)); + /// Class representing an identifier name followed by an equals token. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class NameEqualsSyntax : CSharpSyntaxNode + { + private IdentifierNameSyntax? name; - public override SyntaxList Externs => new(GetRed(ref this.externs, 5)); + internal NameEqualsSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxList Usings => new(GetRed(ref this.usings, 6)); + /// Gets the identifier name. + public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxList Members => new(GetRed(ref this.members, 7)); + public SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.NameEqualsSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken => ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.name, 3)!, - 5 => GetRed(ref this.externs, 5)!, - 6 => GetRed(ref this.usings, 6)!, - 7 => GetRed(ref this.members, 7)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameEquals(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken) { - 0 => this.attributeLists, - 3 => this.name, - 5 => this.externs, - 6 => this.usings, - 7 => this.members, - _ => null, - }; + if (name != this.Name || equalsToken != this.EqualsToken) + { + var newNode = SyntaxFactory.NameEquals(name, equalsToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNamespaceDeclaration(this); - - public NamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, SyntaxList externs, SyntaxList usings, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + return this; } - return this; + public NameEqualsSyntax WithName(IdentifierNameSyntax name) => Update(name, this.EqualsToken); + public NameEqualsSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken); } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new NamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new NamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); - public new NamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); - public new NamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - public NamespaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, openBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); - public new NamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); - public new NamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new NamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, members, this.CloseBraceToken, this.SemicolonToken); - public NamespaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, closeBraceToken, this.SemicolonToken); - public NamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new NamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new NamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); - public new NamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); - public new NamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new NamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private NameSyntax? name; - private SyntaxNode? externs; - private SyntaxNode? usings; - private SyntaxNode? members; - - internal FileScopedNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Type parameter list syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TypeParameterListSyntax : CSharpSyntaxNode { - } - - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + private SyntaxNode? parameters; - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - - public override SyntaxToken NamespaceKeyword => new(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + internal TypeParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override NameSyntax Name => GetRed(ref this.name, 3)!; + /// Gets the < token. + public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + /// Gets the parameter list. + public SeparatedSyntaxList Parameters + { + get + { + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - public override SyntaxList Externs => new(GetRed(ref this.externs, 5)); + /// Gets the > token. + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxList Usings => new(GetRed(ref this.usings, 6)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - public override SyntaxList Members => new(GetRed(ref this.members, 7)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.name, 3)!, - 5 => GetRed(ref this.externs, 5)!, - 6 => GetRed(ref this.usings, 6)!, - 7 => GetRed(ref this.members, 7)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterList(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public TypeParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) { - 0 => this.attributeLists, - 3 => this.name, - 5 => this.externs, - 6 => this.usings, - 7 => this.members, - _ => null, - }; + if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) + { + var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFileScopedNamespaceDeclaration(this); - - public FileScopedNamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, SyntaxList externs, SyntaxList usings, SyntaxList members) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) - { - var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + return this; } - return this; + public TypeParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); + public TypeParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); + public TypeParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); + + public TypeParameterListSyntax AddParameters(params TypeParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FileScopedNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new FileScopedNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); - public new FileScopedNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); - public new FileScopedNamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - public FileScopedNamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, semicolonToken, this.Externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); - public new FileScopedNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); - public new FileScopedNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new FileScopedNamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, members); + /// Type parameter syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TypeParameterSyntax : CSharpSyntaxNode + { + private SyntaxNode? attributeLists; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FileScopedNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new FileScopedNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); - public new FileScopedNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); - public new FileScopedNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new FileScopedNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); -} + internal TypeParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// Class representing one or more attributes applied to a language construct. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AttributeListSyntax : CSharpSyntaxNode -{ - private AttributeTargetSpecifierSyntax? target; - private SyntaxNode? attributes; + /// Gets the attribute declaration list. + public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal AttributeListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken VarianceKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.AttributeListSyntax)this.Green).openBracketToken, Position, 0); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - /// Gets the optional construct targeted by the attribute. - public AttributeTargetSpecifierSyntax? Target => GetRed(ref this.target, 1); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; - /// Gets the attribute declaration list. - public SeparatedSyntaxList Attributes => GetRed(ref this.attributes, 2) is { } red ? new(red, GetChildIndex(2)) : default; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameter(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public TypeParameterSyntax Update(SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) { - 1 => GetRed(ref this.target, 1), - 2 => GetRed(ref this.attributes, 2)!, - _ => null, - }; + if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) + { + var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.target, - 2 => this.attributes, - _ => null, - }; + return this; + } + + public TypeParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.VarianceKeyword, this.Identifier); + public TypeParameterSyntax WithVarianceKeyword(SyntaxToken varianceKeyword) => Update(this.AttributeLists, varianceKeyword, this.Identifier); + public TypeParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.VarianceKeyword, identifier); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeList(this); + public TypeParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + } - public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + /// Base class for type declaration syntax. + public abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax { - if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) + internal BaseTypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public AttributeListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Target, this.Attributes, this.CloseBracketToken); - public AttributeListSyntax WithTarget(AttributeTargetSpecifierSyntax? target) => Update(this.OpenBracketToken, target, this.Attributes, this.CloseBracketToken); - public AttributeListSyntax WithAttributes(SeparatedSyntaxList attributes) => Update(this.OpenBracketToken, this.Target, attributes, this.CloseBracketToken); - public AttributeListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Target, this.Attributes, closeBracketToken); + /// Gets the identifier. + public abstract SyntaxToken Identifier { get; } + public BaseTypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); + internal abstract BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier); - public AttributeListSyntax AddAttributes(params AttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); -} + /// Gets the base type list. + public abstract BaseListSyntax? BaseList { get; } + public BaseTypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => WithBaseListCore(baseList); + internal abstract BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList); -/// Class representing what language construct an attribute targets. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode -{ + public BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); + internal abstract BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items); - internal AttributeTargetSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the open brace token. + public abstract SyntaxToken OpenBraceToken { get; } + public BaseTypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => WithOpenBraceTokenCore(openBraceToken); + internal abstract BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken); - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).identifier, Position, 0); + /// Gets the close brace token. + public abstract SyntaxToken CloseBraceToken { get; } + public BaseTypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => WithCloseBraceTokenCore(closeBraceToken); + internal abstract BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken); - /// Gets the colon token. - public SyntaxToken ColonToken => new(this, ((InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + /// Gets the optional semicolon token. + public abstract SyntaxToken SemicolonToken { get; } + public BaseTypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); + internal abstract BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public new BaseTypeDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseTypeDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseTypeDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseTypeDeclarationSyntax)WithModifiersCore(modifiers); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public new BaseTypeDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseTypeDeclarationSyntax)AddAttributeListsCore(items); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeTargetSpecifier(this); + public new BaseTypeDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseTypeDeclarationSyntax)AddModifiersCore(items); + } - public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken) + /// Base class for type declaration syntax (class, struct, interface, record). + public abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax { - if (identifier != this.Identifier || colonToken != this.ColonToken) + internal TypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// Gets the type keyword token ("class", "struct", "interface", "record"). + public abstract SyntaxToken Keyword { get; } + public TypeDeclarationSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); + internal abstract TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword); - public AttributeTargetSpecifierSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ColonToken); - public AttributeTargetSpecifierSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Identifier, colonToken); -} + public abstract TypeParameterListSyntax? TypeParameterList { get; } + public TypeDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => WithTypeParameterListCore(typeParameterList); + internal abstract TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList); -/// Attribute syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AttributeSyntax : CSharpSyntaxNode -{ - private NameSyntax? name; - private AttributeArgumentListSyntax? argumentList; + public TypeDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) => AddTypeParameterListParametersCore(items); + internal abstract TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items); - internal AttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public abstract ParameterListSyntax? ParameterList { get; } + public TypeDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => WithParameterListCore(parameterList); + internal abstract TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList); - /// Gets the name. - public NameSyntax Name => GetRedAtZero(ref this.name)!; + public TypeDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); + internal abstract TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); - public AttributeArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); + /// Gets the type constraint list. + public abstract SyntaxList ConstraintClauses { get; } + public TypeDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => WithConstraintClausesCore(constraintClauses); + internal abstract TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 1 => GetRed(ref this.argumentList, 1), - _ => null, - }; + public TypeDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClausesCore(items); + internal abstract TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.argumentList, - _ => null, - }; + /// Gets the member declarations. + public abstract SyntaxList Members { get; } + public TypeDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); + internal abstract TypeDeclarationSyntax WithMembersCore(SyntaxList members); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttribute(this); + public TypeDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); + internal abstract TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); - public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax? argumentList) - { - if (name != this.Name || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.Attribute(name, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public new TypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => (TypeDeclarationSyntax)WithIdentifierCore(identifier); + public new TypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => (TypeDeclarationSyntax)WithBaseListCore(baseList); + public new TypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => (TypeDeclarationSyntax)WithOpenBraceTokenCore(openBraceToken); + public new TypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => (TypeDeclarationSyntax)WithCloseBraceTokenCore(closeBraceToken); + public new TypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => (TypeDeclarationSyntax)WithSemicolonTokenCore(semicolonToken); - return this; + public new BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); } - public AttributeSyntax WithName(NameSyntax name) => Update(name, this.ArgumentList); - public AttributeSyntax WithArgumentList(AttributeArgumentListSyntax? argumentList) => Update(this.Name, argumentList); - - public AttributeSyntax AddArgumentListArguments(params AttributeArgumentSyntax[] items) + /// Class type declaration syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax { - var argumentList = this.ArgumentList ?? SyntaxFactory.AttributeArgumentList(); - return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); - } -} + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; -/// Attribute argument list syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode -{ - private SyntaxNode? arguments; + internal ClassDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal AttributeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - /// Gets the open paren token. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - /// Gets the arguments syntax list. - public SeparatedSyntaxList Arguments => GetRed(ref this.arguments, 1) is { } red ? new(red, GetChildIndex(1)) : default; + /// Gets the class keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - /// Gets the close paren token. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgumentList(this); + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); - public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + public override SyntaxToken OpenBraceToken { - var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } } - return this; - } + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); - public AttributeArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); - public AttributeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); - public AttributeArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } - public AttributeArgumentListSyntax AddArguments(params AttributeArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); -} + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5), + 6 => GetRed(ref this.baseList, 6), + 7 => GetRed(ref this.constraintClauses, 7)!, + 9 => GetRed(ref this.members, 9)!, + _ => null, + }; -/// Attribute argument syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode -{ - private NameEqualsSyntax? nameEquals; - private NameColonSyntax? nameColon; - private ExpressionSyntax? expression; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 9 => this.members, + _ => null, + }; - internal AttributeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassDeclaration(this); - public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); + public ClassDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public NameColonSyntax? NameColon => GetRed(ref this.nameColon, 1); + return this; + } - /// Gets the expression. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ClassDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ClassDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new ClassDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new ClassDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new ClassDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new ClassDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new ClassDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new ClassDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new ClassDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new ClassDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new ClassDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new ClassDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ClassDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ClassDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new ClassDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) { - 0 => GetRedAtZero(ref this.nameEquals), - 1 => GetRed(ref this.nameColon, 1), - 2 => GetRed(ref this.expression, 2)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new ClassDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) { - 0 => this.nameEquals, - 1 => this.nameColon, - 2 => this.expression, - _ => null, - }; + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new ClassDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new ClassDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new ClassDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); + } + + /// Struct type declaration syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax + { + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal StructDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the struct keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } + + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5), + 6 => GetRed(ref this.baseList, 6), + 7 => GetRed(ref this.constraintClauses, 7)!, + 9 => GetRed(ref this.members, 9)!, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgument(this); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 9 => this.members, + _ => null, + }; - public AttributeArgumentSyntax Update(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) - { - if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression) - { - var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStructDeclaration(this); - return this; - } + public StructDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public AttributeArgumentSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.NameColon, this.Expression); - public AttributeArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(this.NameEquals, nameColon, this.Expression); - public AttributeArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, this.NameColon, expression); -} + return this; + } -/// Class representing an identifier name followed by an equals token. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class NameEqualsSyntax : CSharpSyntaxNode -{ - private IdentifierNameSyntax? name; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new StructDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new StructDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new StructDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new StructDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new StructDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new StructDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new StructDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new StructDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new StructDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new StructDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new StructDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new StructDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); - internal NameEqualsSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new StructDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new StructDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new StructDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new StructDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + { + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new StructDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new StructDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new StructDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); + } + + /// Interface type declaration syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax + { + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal InterfaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the interface keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } + + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5), + 6 => GetRed(ref this.baseList, 6), + 7 => GetRed(ref this.constraintClauses, 7)!, + 9 => GetRed(ref this.members, 9)!, + _ => null, + }; - /// Gets the identifier name. - public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 9 => this.members, + _ => null, + }; - public SyntaxToken EqualsToken => new(this, ((InternalSyntax.NameEqualsSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterfaceDeclaration(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + public InterfaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameEquals(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new InterfaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new InterfaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new InterfaceDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new InterfaceDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new InterfaceDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new InterfaceDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new InterfaceDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new InterfaceDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new InterfaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new InterfaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new InterfaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new InterfaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); - public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken) - { - if (name != this.Name || equalsToken != this.EqualsToken) + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new InterfaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new InterfaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new InterfaceDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new InterfaceDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + { + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new InterfaceDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new InterfaceDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new InterfaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); + } + + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + public sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax + { + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal RecordDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.NameEquals(name, equalsToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public NameEqualsSyntax WithName(IdentifierNameSyntax name) => Update(name, this.EqualsToken); - public NameEqualsSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken); -} + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } -/// Type parameter list syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TypeParameterListSyntax : CSharpSyntaxNode -{ - private SyntaxNode? parameters; + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public SyntaxToken ClassOrStructKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } + + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 6); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 7); + + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 8)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 10)); + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } - internal TypeParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; + } + } - /// Gets the < token. - public SyntaxToken LessThanToken => new(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 5 => GetRed(ref this.typeParameterList, 5), + 6 => GetRed(ref this.parameterList, 6), + 7 => GetRed(ref this.baseList, 7), + 8 => GetRed(ref this.constraintClauses, 8)!, + 10 => GetRed(ref this.members, 10)!, + _ => null, + }; - /// Gets the parameter list. - public SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.baseList, + 8 => this.constraintClauses, + 10 => this.members, + _ => null, + }; - /// Gets the > token. - public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecordDeclaration(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + public RecordDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.RecordDeclaration(this.Kind(), attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterList(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new RecordDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new RecordDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new RecordDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + public RecordDeclarationSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(this.AttributeLists, this.Modifiers, this.Keyword, classOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new RecordDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new RecordDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new RecordDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new RecordDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new RecordDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new RecordDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new RecordDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new RecordDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new RecordDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); - public TypeParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { - if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new RecordDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new RecordDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new RecordDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new RecordDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) { - var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new RecordDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new RecordDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new RecordDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); + } + + /// Enum type declaration syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax + { + private SyntaxNode? attributeLists; + private BaseListSyntax? baseList; + private SyntaxNode? members; + + internal EnumDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the enum keyword token. + public SyntaxToken EnumKeyword => new SyntaxToken(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); + + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 4); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + } + } + + /// Gets the members declaration list. + public SeparatedSyntaxList Members + { + get + { + var red = GetRed(ref this.members, 6); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(6)) : default; + } + } + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + } } - return this; - } + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } - public TypeParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); - public TypeParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); - public TypeParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.baseList, 4), + 6 => GetRed(ref this.members, 6)!, + _ => null, + }; - public TypeParameterListSyntax AddParameters(params TypeParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); -} + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.baseList, + 6 => this.members, + _ => null, + }; -/// Type parameter syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TypeParameterSyntax : CSharpSyntaxNode -{ - private SyntaxNode? attributeLists; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumDeclaration(this); - internal TypeParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public EnumDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken VarianceKeyword => ((InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EnumDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EnumDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + public EnumDeclarationSyntax WithEnumKeyword(SyntaxToken enumKeyword) => Update(this.AttributeLists, this.Modifiers, enumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new EnumDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new EnumDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, baseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new EnumDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + public EnumDeclarationSyntax WithMembers(SeparatedSyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new EnumDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new EnumDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EnumDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EnumDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new EnumDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + public EnumDeclarationSyntax AddMembers(params EnumMemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); + } + + /// Delegate declaration syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax + { + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private SyntaxNode? constraintClauses; + + internal DelegateDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the "delegate" keyword. + public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); + + /// Gets the return type. + public TypeSyntax ReturnType => GetRed(ref this.returnType, 3)!; + + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + + public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); + + /// Gets the parameter list. + public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + /// Gets the constraint clause list. + public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + /// Gets the semicolon token. + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(8), GetChildIndex(8)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameter(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.returnType, 3)!, + 5 => GetRed(ref this.typeParameterList, 5), + 6 => GetRed(ref this.parameterList, 6)!, + 7 => GetRed(ref this.constraintClauses, 7)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.returnType, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.constraintClauses, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDelegateDeclaration(this); - public TypeParameterSyntax Update(SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) - { - if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) + public DelegateDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, SyntaxToken semicolonToken) { - var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - return this; - } + return this; + } - public TypeParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.VarianceKeyword, this.Identifier); - public TypeParameterSyntax WithVarianceKeyword(SyntaxToken varianceKeyword) => Update(this.AttributeLists, varianceKeyword, this.Identifier); - public TypeParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.VarianceKeyword, identifier); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new DelegateDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new DelegateDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.AttributeLists, this.Modifiers, delegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, semicolonToken); - public TypeParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); -} + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new DelegateDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new DelegateDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public DelegateDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + public DelegateDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + public DelegateDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + } -/// Base class for type declaration syntax. -public abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax -{ - internal BaseTypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax { - } + private SyntaxNode? attributeLists; + private EqualsValueClauseSyntax? equalsValue; - /// Gets the identifier. - public abstract SyntaxToken Identifier { get; } - public BaseTypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); - internal abstract BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier); + internal EnumMemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the base type list. - public abstract BaseListSyntax? BaseList { get; } - public BaseTypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => WithBaseListCore(baseList); - internal abstract BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); - internal abstract BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items); + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - /// Gets the open brace token. - public abstract SyntaxToken OpenBraceToken { get; } - public BaseTypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => WithOpenBraceTokenCore(openBraceToken); - internal abstract BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - /// Gets the close brace token. - public abstract SyntaxToken CloseBraceToken { get; } - public BaseTypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => WithCloseBraceTokenCore(closeBraceToken); - internal abstract BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken); + public EqualsValueClauseSyntax? EqualsValue => GetRed(ref this.equalsValue, 3); - /// Gets the optional semicolon token. - public abstract SyntaxToken SemicolonToken { get; } - public BaseTypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); - internal abstract BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.equalsValue, 3), + _ => null, + }; - public new BaseTypeDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseTypeDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseTypeDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseTypeDeclarationSyntax)WithModifiersCore(modifiers); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.equalsValue, + _ => null, + }; - public new BaseTypeDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseTypeDeclarationSyntax)AddAttributeListsCore(items); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumMemberDeclaration(this); - public new BaseTypeDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseTypeDeclarationSyntax)AddModifiersCore(items); -} + public EnumMemberDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) + { + var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } -/// Base class for type declaration syntax (class, struct, interface, record). -public abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax -{ - internal TypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + return this; + } - /// Gets the type keyword token ("class", "struct", "interface", "record"). - public abstract SyntaxToken Keyword { get; } - public TypeDeclarationSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); - internal abstract TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EnumMemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.EqualsValue); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EnumMemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.EqualsValue); + public EnumMemberDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.EqualsValue); + public EnumMemberDeclarationSyntax WithEqualsValue(EqualsValueClauseSyntax? equalsValue) => Update(this.AttributeLists, this.Modifiers, this.Identifier, equalsValue); - public abstract TypeParameterListSyntax? TypeParameterList { get; } - public TypeDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => WithTypeParameterListCore(typeParameterList); - internal abstract TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EnumMemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EnumMemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + } - public TypeDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) => AddTypeParameterListParametersCore(items); - internal abstract TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items); + /// Base list syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class BaseListSyntax : CSharpSyntaxNode + { + private SyntaxNode? types; - public abstract ParameterListSyntax? ParameterList { get; } - public TypeDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => WithParameterListCore(parameterList); - internal abstract TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList); + internal BaseListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public TypeDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); - internal abstract TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); - /// Gets the type constraint list. - public abstract SyntaxList ConstraintClauses { get; } - public TypeDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => WithConstraintClausesCore(constraintClauses); - internal abstract TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses); + /// Gets the base type references. + public SeparatedSyntaxList Types + { + get + { + var red = GetRed(ref this.types, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - public TypeDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClausesCore(items); - internal abstract TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.types, 1)! : null; - /// Gets the member declarations. - public abstract SyntaxList Members { get; } - public TypeDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); - internal abstract TypeDeclarationSyntax WithMembersCore(SyntaxList members); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.types : null; - public TypeDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); - internal abstract TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseList(this); - public new TypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => (TypeDeclarationSyntax)WithIdentifierCore(identifier); - public new TypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => (TypeDeclarationSyntax)WithBaseListCore(baseList); - public new TypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => (TypeDeclarationSyntax)WithOpenBraceTokenCore(openBraceToken); - public new TypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => (TypeDeclarationSyntax)WithCloseBraceTokenCore(closeBraceToken); - public new TypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => (TypeDeclarationSyntax)WithSemicolonTokenCore(semicolonToken); + public BaseListSyntax Update(SyntaxToken colonToken, SeparatedSyntaxList types) + { + if (colonToken != this.ColonToken || types != this.Types) + { + var newNode = SyntaxFactory.BaseList(colonToken, types); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public new BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); -} + return this; + } -/// Class type declaration syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; + public BaseListSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.Types); + public BaseListSyntax WithTypes(SeparatedSyntaxList types) => Update(this.ColonToken, types); - internal ClassDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + public BaseListSyntax AddTypes(params BaseTypeSyntax[] items) => WithTypes(this.Types.AddRange(items)); } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - - /// Gets the class keyword token. - public override SyntaxToken Keyword => new(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - - public override SyntaxToken Identifier => new(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + /// Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. + public abstract partial class BaseTypeSyntax : CSharpSyntaxNode + { + internal BaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + public abstract TypeSyntax Type { get; } + public BaseTypeSyntax WithType(TypeSyntax type) => WithTypeCore(type); + internal abstract BaseTypeSyntax WithTypeCore(TypeSyntax type); + } - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax + { + private TypeSyntax? type; - public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); + internal SimpleBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken OpenBraceToken => ((InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + public override TypeSyntax Type => GetRedAtZero(ref this.type)!; - public override SyntaxList Members => new(GetRed(ref this.members, 9)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - public override SyntaxToken CloseBraceToken => ((InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - public override SyntaxToken SemicolonToken => ((InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleBaseType(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public SimpleBaseTypeSyntax Update(TypeSyntax type) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5), - 6 => GetRed(ref this.baseList, 6), - 7 => GetRed(ref this.constraintClauses, 7)!, - 9 => GetRed(ref this.members, 9)!, - _ => null, - }; + if (type != this.Type) + { + var newNode = SyntaxFactory.SimpleBaseType(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 9 => this.members, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassDeclaration(this); + internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new SimpleBaseTypeSyntax WithType(TypeSyntax type) => Update(type); + } - public ClassDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + private TypeSyntax? type; + private ArgumentListSyntax? argumentList; + + internal PrimaryConstructorBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override TypeSyntax Type => GetRedAtZero(ref this.type)!; - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ClassDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ClassDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new ClassDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new ClassDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new ClassDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new ClassDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new ClassDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new ClassDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new ClassDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new ClassDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new ClassDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new ClassDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ClassDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ClassDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new ClassDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) - { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new ClassDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) - { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); - } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new ClassDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new ClassDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new ClassDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); -} + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.argumentList, 1)!, + _ => null, + }; -/// Struct type declaration syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.argumentList, + _ => null, + }; - internal StructDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrimaryConstructorBaseType(this); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) + { + if (type != this.Type || argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + return this; + } - /// Gets the struct keyword token. - public override SyntaxToken Keyword => new(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new PrimaryConstructorBaseTypeSyntax WithType(TypeSyntax type) => Update(type, this.ArgumentList); + public PrimaryConstructorBaseTypeSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Type, argumentList); - public override SyntaxToken Identifier => new(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public PrimaryConstructorBaseTypeSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); + } - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + /// Type parameter constraint clause. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode + { + private IdentifierNameSyntax? name; + private SyntaxNode? constraints; - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + internal TypeParameterConstraintClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + public SyntaxToken WhereKeyword => new SyntaxToken(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).whereKeyword, Position, 0); - public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); + /// Gets the identifier. + public IdentifierNameSyntax Name => GetRed(ref this.name, 1)!; - public override SyntaxToken OpenBraceToken => ((InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxList Members => new(GetRed(ref this.members, 9)); + /// Gets the constraints list. + public SeparatedSyntaxList Constraints + { + get + { + var red = GetRed(ref this.constraints, 3); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; + } + } - public override SyntaxToken CloseBraceToken => ((InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.name, 1)!, + 3 => GetRed(ref this.constraints, 3)!, + _ => null, + }; - public override SyntaxToken SemicolonToken => ((InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.name, + 3 => this.constraints, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5), - 6 => GetRed(ref this.baseList, 6), - 7 => GetRed(ref this.constraintClauses, 7)!, - 9 => GetRed(ref this.members, 9)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterConstraintClause(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, SeparatedSyntaxList constraints) { - 0 => this.attributeLists, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 9 => this.members, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStructDeclaration(this); + if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) + { + var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public StructDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + return this; } - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new StructDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new StructDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new StructDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new StructDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new StructDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new StructDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new StructDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new StructDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new StructDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new StructDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new StructDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new StructDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + public TypeParameterConstraintClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Name, this.ColonToken, this.Constraints); + public TypeParameterConstraintClauseSyntax WithName(IdentifierNameSyntax name) => Update(this.WhereKeyword, name, this.ColonToken, this.Constraints); + public TypeParameterConstraintClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(this.WhereKeyword, this.Name, colonToken, this.Constraints); + public TypeParameterConstraintClauseSyntax WithConstraints(SeparatedSyntaxList constraints) => Update(this.WhereKeyword, this.Name, this.ColonToken, constraints); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new StructDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new StructDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new StructDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) - { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new StructDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) - { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); - } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new StructDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + public TypeParameterConstraintClauseSyntax AddConstraints(params TypeParameterConstraintSyntax[] items) => WithConstraints(this.Constraints.AddRange(items)); } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new StructDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new StructDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); -} -/// Interface type declaration syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; - - internal InterfaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Base type for type parameter constraint syntax. + public abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode { + internal TypeParameterConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + /// Constructor constraint syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax + { - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal ConstructorConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the interface keyword token. - public override SyntaxToken Keyword => new(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + /// Gets the "new" keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).newKeyword, Position, 0); - public override SyntaxToken Identifier => new(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + /// Gets the open paren keyword. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + /// Gets the close paren keyword. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorConstraint(this); - public override SyntaxToken OpenBraceToken => ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + { + if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override SyntaxList Members => new(GetRed(ref this.members, 9)); + return this; + } - public override SyntaxToken CloseBraceToken => ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + public ConstructorConstraintSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenParenToken, this.CloseParenToken); + public ConstructorConstraintSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.NewKeyword, openParenToken, this.CloseParenToken); + public ConstructorConstraintSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.NewKeyword, this.OpenParenToken, closeParenToken); + } - public override SyntaxToken SemicolonToken => ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + /// Class or struct constraint syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + public sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax + { - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + internal ClassOrStructConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5), - 6 => GetRed(ref this.baseList, 6), - 7 => GetRed(ref this.constraintClauses, 7)!, - 9 => GetRed(ref this.members, 9)!, - _ => null, - }; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + /// Gets the constraint keyword ("class" or "struct"). + public SyntaxToken ClassOrStructKeyword => new SyntaxToken(this, ((InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); + + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken { - 0 => this.attributeLists, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 9 => this.members, - _ => null, - }; + get + { + var slot = ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterfaceDeclaration(this); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public InterfaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassOrStructConstraint(this); + + public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken) { - var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken) + { + var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind(), classOrStructKeyword, questionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public ClassOrStructConstraintSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(classOrStructKeyword, this.QuestionToken); + public ClassOrStructConstraintSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ClassOrStructKeyword, questionToken); } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new InterfaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new InterfaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new InterfaceDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new InterfaceDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new InterfaceDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new InterfaceDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new InterfaceDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new InterfaceDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new InterfaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new InterfaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new InterfaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new InterfaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new InterfaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new InterfaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new InterfaceDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) - { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new InterfaceDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) - { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); - } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new InterfaceDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + /// Type constraint syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new InterfaceDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new InterfaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -public sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; + private TypeSyntax? type; - internal RecordDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal TypeConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + /// Gets the type syntax. + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - public override SyntaxToken Keyword => new(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - public SyntaxToken ClassOrStructKeyword => ((InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeConstraint(this); - public override SyntaxToken Identifier => new(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public TypeConstraintSyntax Update(TypeSyntax type) + { + if (type != this.Type) + { + var newNode = SyntaxFactory.TypeConstraint(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); + return this; + } - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 6); + public TypeConstraintSyntax WithType(TypeSyntax type) => Update(type); + } - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 7); + /// Default constraint syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax + { - public override SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 8)); + internal DefaultConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken OpenBraceToken => ((InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken is { } slot ? new(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + /// Gets the "default" keyword. + public SyntaxToken DefaultKeyword => new SyntaxToken(this, ((InternalSyntax.DefaultConstraintSyntax)this.Green).defaultKeyword, Position, 0); - public override SyntaxList Members => new(GetRed(ref this.members, 10)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxToken CloseBraceToken => ((InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken is { } slot ? new(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override SyntaxToken SemicolonToken => ((InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultConstraint(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 5 => GetRed(ref this.typeParameterList, 5), - 6 => GetRed(ref this.parameterList, 6), - 7 => GetRed(ref this.baseList, 7), - 8 => GetRed(ref this.constraintClauses, 8)!, - 10 => GetRed(ref this.members, 10)!, - _ => null, - }; + if (defaultKeyword != this.DefaultKeyword) + { + var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.baseList, - 8 => this.constraintClauses, - 10 => this.members, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecordDeclaration(this); + public DefaultConstraintSyntax WithDefaultKeyword(SyntaxToken defaultKeyword) => Update(defaultKeyword); + } - public RecordDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + internal BaseFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.RecordDeclaration(this.Kind(), attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public abstract VariableDeclarationSyntax Declaration { get; } + public BaseFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => WithDeclarationCore(declaration); + internal abstract BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new RecordDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new RecordDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new RecordDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - public RecordDeclarationSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(this.AttributeLists, this.Modifiers, this.Keyword, classOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new RecordDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new RecordDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new RecordDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new RecordDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new RecordDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new RecordDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new RecordDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new RecordDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new RecordDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + public BaseFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => AddDeclarationVariablesCore(items); + internal abstract BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new RecordDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new RecordDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new RecordDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) - { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new RecordDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) - { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); - } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new RecordDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new RecordDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new RecordDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); -} + public abstract SyntaxToken SemicolonToken { get; } + public BaseFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); + internal abstract BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); -/// Enum type declaration syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private BaseListSyntax? baseList; - private SyntaxNode? members; + public new BaseFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseFieldDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseFieldDeclarationSyntax)WithModifiersCore(modifiers); - internal EnumDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public new BaseFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseFieldDeclarationSyntax)AddAttributeListsCore(items); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public new BaseFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseFieldDeclarationSyntax)AddModifiersCore(items); + } - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax + { + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; - /// Gets the enum keyword token. - public SyntaxToken EnumKeyword => new(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); + internal FieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken Identifier => new(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 4); + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public override SyntaxToken OpenBraceToken => ((InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken is { } slot ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 2)!; - /// Gets the members declaration list. - public SeparatedSyntaxList Members => GetRed(ref this.members, 6) is { } red ? new(red, GetChildIndex(6)) : default; + public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.FieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - public override SyntaxToken CloseBraceToken => ((InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken is { } slot ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.declaration, 2)!, + _ => null, + }; - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken => ((InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.declaration, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.baseList, 4), - 6 => GetRed(ref this.members, 6)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFieldDeclaration(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public FieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { - 0 => this.attributeLists, - 4 => this.baseList, - 6 => this.members, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumDeclaration(this); + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public EnumDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + return this; } - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EnumDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EnumDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - public EnumDeclarationSyntax WithEnumKeyword(SyntaxToken enumKeyword) => Update(this.AttributeLists, this.Modifiers, enumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new EnumDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new EnumDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, baseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new EnumDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - public EnumDeclarationSyntax WithMembers(SeparatedSyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new EnumDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new EnumDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Declaration, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new FieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); + public new FieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new FieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Declaration, semicolonToken); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EnumDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EnumDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new EnumDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new FieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); + public new FieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); } - public EnumDeclarationSyntax AddMembers(params EnumMemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); -} -/// Delegate declaration syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private SyntaxNode? constraintClauses; - - internal DelegateDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax { - } - - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal EventFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the "delegate" keyword. - public SyntaxToken DelegateKeyword => new(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - /// Gets the return type. - public TypeSyntax ReturnType => GetRed(ref this.returnType, 3)!; + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken EventKeyword => new SyntaxToken(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); - public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); + public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; - /// Gets the parameter list. - public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; + public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - /// Gets the constraint clause list. - public SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.declaration, 3)!, + _ => null, + }; - /// Gets the semicolon token. - public SyntaxToken SemicolonToken => new(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(8), GetChildIndex(8)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.declaration, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.returnType, 3)!, - 5 => GetRed(ref this.typeParameterList, 5), - 6 => GetRed(ref this.parameterList, 6)!, - 7 => GetRed(ref this.constraintClauses, 7)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventFieldDeclaration(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public EventFieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { - 0 => this.attributeLists, - 3 => this.returnType, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.constraintClauses, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDelegateDeclaration(this); + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public DelegateDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + return this; } - return this; - } + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EventFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EventFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); + public EventFieldDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); + public new EventFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new EventFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Declaration, semicolonToken); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new DelegateDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new DelegateDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.AttributeLists, this.Modifiers, delegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, semicolonToken); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EventFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EventFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); + public new EventFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); + } - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new DelegateDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new DelegateDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public DelegateDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - public DelegateDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - public DelegateDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); -} + private NameSyntax? name; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private EqualsValueClauseSyntax? equalsValue; + internal ExplicitInterfaceSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal EnumMemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public NameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public SyntaxToken DotToken => new SyntaxToken(this, ((InternalSyntax.ExplicitInterfaceSpecifierSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - public EqualsValueClauseSyntax? EqualsValue => GetRed(ref this.equalsValue, 3); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExplicitInterfaceSpecifier(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.equalsValue, 3), - _ => null, - }; + if (name != this.Name || dotToken != this.DotToken) + { + var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.equalsValue, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumMemberDeclaration(this); + public ExplicitInterfaceSpecifierSyntax WithName(NameSyntax name) => Update(name, this.DotToken); + public ExplicitInterfaceSpecifierSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Name, dotToken); + } - public EnumMemberDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + /// Base type for method declaration syntax. + public abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) + internal BaseMethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// Gets the parameter list. + public abstract ParameterListSyntax ParameterList { get; } + public BaseMethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => WithParameterListCore(parameterList); + internal abstract BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EnumMemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.EqualsValue); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EnumMemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.EqualsValue); - public EnumMemberDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.EqualsValue); - public EnumMemberDeclarationSyntax WithEqualsValue(EqualsValueClauseSyntax? equalsValue) => Update(this.AttributeLists, this.Modifiers, this.Identifier, equalsValue); + public BaseMethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); + internal abstract BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EnumMemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EnumMemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); -} + public abstract BlockSyntax? Body { get; } + public BaseMethodDeclarationSyntax WithBody(BlockSyntax? body) => WithBodyCore(body); + internal abstract BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body); -/// Base list syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class BaseListSyntax : CSharpSyntaxNode -{ - private SyntaxNode? types; + public BaseMethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) => AddBodyAttributeListsCore(items); + internal abstract BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items); - internal BaseListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public BaseMethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) => AddBodyStatementsCore(items); + internal abstract BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items); - /// Gets the colon token. - public SyntaxToken ColonToken => new(this, ((InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); + public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; } + public BaseMethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); + internal abstract BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody); - /// Gets the base type references. - public SeparatedSyntaxList Types => GetRed(ref this.types, 1) is { } red ? new(red, GetChildIndex(1)) : default; + /// Gets the optional semicolon token. + public abstract SyntaxToken SemicolonToken { get; } + public BaseMethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); + internal abstract BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.types, 1)! : null; + public new BaseMethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseMethodDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseMethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseMethodDeclarationSyntax)WithModifiersCore(modifiers); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.types : null; + public new BaseMethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseMethodDeclarationSyntax)AddAttributeListsCore(items); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseList(this); + public new BaseMethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseMethodDeclarationSyntax)AddModifiersCore(items); + } - public BaseListSyntax Update(SyntaxToken colonToken, SeparatedSyntaxList types) + /// Method declaration syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax { - if (colonToken != this.ColonToken || types != this.Types) + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private SyntaxNode? constraintClauses; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; + + internal MethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.BaseList(colonToken, types); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public BaseListSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.Types); - public BaseListSyntax WithTypes(SeparatedSyntaxList types) => Update(this.ColonToken, types); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public BaseListSyntax AddTypes(params BaseTypeSyntax[] items) => WithTypes(this.Types.AddRange(items)); -} + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } -/// Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. -public abstract partial class BaseTypeSyntax : CSharpSyntaxNode -{ - internal BaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the return type syntax. + public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - public abstract TypeSyntax Type { get; } - public BaseTypeSyntax WithType(TypeSyntax type) => WithTypeCore(type); - internal abstract BaseTypeSyntax WithTypeCore(TypeSyntax type); -} + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax -{ - private TypeSyntax? type; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.MethodDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - internal SimpleBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); - public override TypeSyntax Type => GetRedAtZero(ref this.type)!; + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + /// Gets the constraint clause list. + public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + public override BlockSyntax? Body => GetRed(ref this.body, 8); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleBaseType(this); + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - public SimpleBaseTypeSyntax Update(TypeSyntax type) - { - if (type != this.Type) + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken { - var newNode = SyntaxFactory.SimpleBaseType(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } } - return this; - } - - internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new SimpleBaseTypeSyntax WithType(TypeSyntax type) => Update(type); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax -{ - private TypeSyntax? type; - private ArgumentListSyntax? argumentList; - - internal PrimaryConstructorBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 5 => GetRed(ref this.typeParameterList, 5), + 6 => GetRed(ref this.parameterList, 6)!, + 7 => GetRed(ref this.constraintClauses, 7)!, + 8 => GetRed(ref this.body, 8), + 9 => GetRed(ref this.expressionBody, 9), + _ => null, + }; - public override TypeSyntax Type => GetRedAtZero(ref this.type)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.returnType, + 3 => this.explicitInterfaceSpecifier, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.constraintClauses, + 8 => this.body, + 9 => this.expressionBody, + _ => null, + }; - public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMethodDeclaration(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public MethodDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.argumentList, 1)!, - _ => null, - }; + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.argumentList, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrimaryConstructorBaseType(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new MethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new MethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new MethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new MethodDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new MethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new MethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); - public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) - { - if (type != this.Type || argumentList != this.ArgumentList) + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new MethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new MethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public MethodDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) { - var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new MethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + public MethodDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new MethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new MethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } + } + + /// Operator declaration syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax + { + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private ParameterListSyntax? parameterList; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; + + internal OperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the return type. + public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; + + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); + + /// Gets the "operator" keyword. + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); + + /// Gets the "checked" keyword. + public SyntaxToken CheckedKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + } + } + + /// Gets the operator token. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); + + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; + + public override BlockSyntax? Body => GetRed(ref this.body, 8); + + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); + + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } } - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 7 => GetRed(ref this.parameterList, 7)!, + 8 => GetRed(ref this.body, 8), + 9 => GetRed(ref this.expressionBody, 9), + _ => null, + }; - internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new PrimaryConstructorBaseTypeSyntax WithType(TypeSyntax type) => Update(type, this.ArgumentList); - public PrimaryConstructorBaseTypeSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Type, argumentList); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.returnType, + 3 => this.explicitInterfaceSpecifier, + 7 => this.parameterList, + 8 => this.body, + 9 => this.expressionBody, + _ => null, + }; - public PrimaryConstructorBaseTypeSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); -} + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorDeclaration(this); -/// Type parameter constraint clause. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode -{ - private IdentifierNameSyntax? name; - private SyntaxNode? constraints; + public OperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal TypeParameterConstraintClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + return this; + } - public SyntaxToken WhereKeyword => new(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).whereKeyword, Position, 0); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new OperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new OperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new OperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new OperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new OperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new OperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - /// Gets the identifier. - public IdentifierNameSyntax Name => GetRed(ref this.name, 1)!; + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new OperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new OperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new OperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new OperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new OperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } + } + + /// Conversion operator declaration syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax + { + private SyntaxNode? attributeLists; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private TypeSyntax? type; + private ParameterListSyntax? parameterList; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; + + internal ConversionOperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the "implicit" or "explicit" token. + public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); + + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); + + /// Gets the "operator" token. + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); + + /// Gets the "checked" keyword. + public SyntaxToken CheckedKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + } + } + + /// Gets the type. + public TypeSyntax Type => GetRed(ref this.type, 6)!; + + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; + + public override BlockSyntax? Body => GetRed(ref this.body, 8); + + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); + + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 6 => GetRed(ref this.type, 6)!, + 7 => GetRed(ref this.parameterList, 7)!, + 8 => GetRed(ref this.body, 8), + 9 => GetRed(ref this.expressionBody, 9), + _ => null, + }; - /// Gets the colon token. - public SyntaxToken ColonToken => new(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.explicitInterfaceSpecifier, + 6 => this.type, + 7 => this.parameterList, + 8 => this.body, + 9 => this.expressionBody, + _ => null, + }; - /// Gets the constraints list. - public SeparatedSyntaxList Constraints => GetRed(ref this.constraints, 3) is { } red ? new(red, GetChildIndex(3)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorDeclaration(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public ConversionOperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) { - 1 => GetRed(ref this.name, 1)!, - 3 => GetRed(ref this.constraints, 3)!, - _ => null, - }; + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.name, - 3 => this.constraints, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterConstraintClause(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ConversionOperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ConversionOperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(this.AttributeLists, this.Modifiers, implicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new ConversionOperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new ConversionOperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new ConversionOperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new ConversionOperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, SeparatedSyntaxList constraints) - { - if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ConversionOperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ConversionOperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new ConversionOperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new ConversionOperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new ConversionOperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } + } + + /// Constructor declaration syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax + { + private SyntaxNode? attributeLists; + private ParameterListSyntax? parameterList; + private ConstructorInitializerSyntax? initializer; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; + + internal ConstructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; + + public ConstructorInitializerSyntax? Initializer => GetRed(ref this.initializer, 4); + + public override BlockSyntax? Body => GetRed(ref this.body, 5); + + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); + + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken { - var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + } } - return this; - } - - public TypeParameterConstraintClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Name, this.ColonToken, this.Constraints); - public TypeParameterConstraintClauseSyntax WithName(IdentifierNameSyntax name) => Update(this.WhereKeyword, name, this.ColonToken, this.Constraints); - public TypeParameterConstraintClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(this.WhereKeyword, this.Name, colonToken, this.Constraints); - public TypeParameterConstraintClauseSyntax WithConstraints(SeparatedSyntaxList constraints) => Update(this.WhereKeyword, this.Name, this.ColonToken, constraints); - - public TypeParameterConstraintClauseSyntax AddConstraints(params TypeParameterConstraintSyntax[] items) => WithConstraints(this.Constraints.AddRange(items)); -} - -/// Base type for type parameter constraint syntax. -public abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode -{ - internal TypeParameterConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } -} + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.parameterList, 3)!, + 4 => GetRed(ref this.initializer, 4), + 5 => GetRed(ref this.body, 5), + 6 => GetRed(ref this.expressionBody, 6), + _ => null, + }; -/// Constructor constraint syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax -{ + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.parameterList, + 4 => this.initializer, + 5 => this.body, + 6 => this.expressionBody, + _ => null, + }; - internal ConstructorConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorDeclaration(this); - /// Gets the "new" keyword. - public SyntaxToken NewKeyword => new(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).newKeyword, Position, 0); - - /// Gets the open paren keyword. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - - /// Gets the close paren keyword. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => null; + public ConstructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorConstraint(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ConstructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ConstructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConstructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new ConstructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Identifier, parameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConstructorDeclarationSyntax WithInitializer(ConstructorInitializerSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new ConstructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new ConstructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new ConstructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, semicolonToken); - public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) - { - if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken) + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ConstructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ConstructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new ConstructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new ConstructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) { - var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); } - - return this; - } - - public ConstructorConstraintSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenParenToken, this.CloseParenToken); - public ConstructorConstraintSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.NewKeyword, openParenToken, this.CloseParenToken); - public ConstructorConstraintSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.NewKeyword, this.OpenParenToken, closeParenToken); -} - -/// Class or struct constraint syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -public sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax -{ - - internal ClassOrStructConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// Gets the constraint keyword ("class" or "struct"). - public SyntaxToken ClassOrStructKeyword => new(this, ((InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); - - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => ((InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - - internal override SyntaxNode? GetNodeSlot(int index) => null; - - internal override SyntaxNode? GetCachedSlot(int index) => null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassOrStructConstraint(this); - - public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken) - { - if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken) + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new ConstructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) { - var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind(), classOrStructKeyword, questionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); } - - return this; } - public ClassOrStructConstraintSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(classOrStructKeyword, this.QuestionToken); - public ClassOrStructConstraintSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ClassOrStructKeyword, questionToken); -} - -/// Type constraint syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax -{ - private TypeSyntax? type; - - internal TypeConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Constructor initializer syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + public sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode { - } - - /// Gets the type syntax. - public TypeSyntax Type => GetRedAtZero(ref this.type)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + private ArgumentListSyntax? argumentList; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeConstraint(this); - - public TypeConstraintSyntax Update(TypeSyntax type) - { - if (type != this.Type) + internal ConstructorInitializerSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.TypeConstraint(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public TypeConstraintSyntax WithType(TypeSyntax type) => Update(type); -} + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.ConstructorInitializerSyntax)this.Green).colonToken, Position, 0); -/// Default constraint syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax -{ + /// Gets the "this" or "base" keyword. + public SyntaxToken ThisOrBaseKeyword => new SyntaxToken(this, ((InternalSyntax.ConstructorInitializerSyntax)this.Green).thisOrBaseKeyword, GetChildPosition(1), GetChildIndex(1)); - internal DefaultConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 2)!; - /// Gets the "default" keyword. - public SyntaxToken DefaultKeyword => new(this, ((InternalSyntax.DefaultConstraintSyntax)this.Green).defaultKeyword, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.argumentList, 2)! : null; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.argumentList : null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorInitializer(this); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultConstraint(this); - - public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword) - { - if (defaultKeyword != this.DefaultKeyword) + public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) { - var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.ConstructorInitializer(this.Kind(), colonToken, thisOrBaseKeyword, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - return this; - } + return this; + } - public DefaultConstraintSyntax WithDefaultKeyword(SyntaxToken defaultKeyword) => Update(defaultKeyword); -} + public ConstructorInitializerSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.ThisOrBaseKeyword, this.ArgumentList); + public ConstructorInitializerSyntax WithThisOrBaseKeyword(SyntaxToken thisOrBaseKeyword) => Update(this.ColonToken, thisOrBaseKeyword, this.ArgumentList); + public ConstructorInitializerSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.ColonToken, this.ThisOrBaseKeyword, argumentList); -public abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax -{ - internal BaseFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + public ConstructorInitializerSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); } - public abstract VariableDeclarationSyntax Declaration { get; } - public BaseFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => WithDeclarationCore(declaration); - internal abstract BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration); - - public BaseFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => AddDeclarationVariablesCore(items); - internal abstract BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items); - - public abstract SyntaxToken SemicolonToken { get; } - public BaseFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); - internal abstract BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); - - public new BaseFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseFieldDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseFieldDeclarationSyntax)WithModifiersCore(modifiers); - - public new BaseFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseFieldDeclarationSyntax)AddAttributeListsCore(items); - - public new BaseFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseFieldDeclarationSyntax)AddModifiersCore(items); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - - internal FieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Destructor declaration syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax { - } - - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + private SyntaxNode? attributeLists; + private ParameterListSyntax? parameterList; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - - public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 2)!; - - public override SyntaxToken SemicolonToken => new(this, ((InternalSyntax.FieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + internal DestructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.declaration, 2)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.declaration, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFieldDeclaration(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public FieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) + public override SyntaxTokenList Modifiers { - var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } } - return this; - } + /// Gets the tilde token. + public SyntaxToken TildeToken => new SyntaxToken(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Declaration, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new FieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); - public new FieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new FieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Declaration, semicolonToken); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new FieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); - public new FieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); -} + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 4)!; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; + public override BlockSyntax? Body => GetRed(ref this.body, 5); - internal EventFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + } + } - public SyntaxToken EventKeyword => new(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.parameterList, 4)!, + 5 => GetRed(ref this.body, 5), + 6 => GetRed(ref this.expressionBody, 6), + _ => null, + }; - public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.parameterList, + 5 => this.body, + 6 => this.expressionBody, + _ => null, + }; - public override SyntaxToken SemicolonToken => new(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDestructorDeclaration(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public DestructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.declaration, 3)!, - _ => null, - }; + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.declaration, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventFieldDeclaration(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new DestructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new DestructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public DestructorDeclarationSyntax WithTildeToken(SyntaxToken tildeToken) => Update(this.AttributeLists, this.Modifiers, tildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public DestructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new DestructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new DestructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new DestructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new DestructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - public EventFieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new DestructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new DestructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new DestructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new DestructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) { - var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); } - - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EventFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EventFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); - public EventFieldDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); - public new EventFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new EventFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Declaration, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EventFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EventFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); - public new EventFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode -{ - private NameSyntax? name; - - internal ExplicitInterfaceSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public NameSyntax Name => GetRedAtZero(ref this.name)!; - - public SyntaxToken DotToken => new(this, ((InternalSyntax.ExplicitInterfaceSpecifierSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExplicitInterfaceSpecifier(this); - - public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken) - { - if (name != this.Name || dotToken != this.DotToken) + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new DestructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) { - var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); } - - return this; } - public ExplicitInterfaceSpecifierSyntax WithName(NameSyntax name) => Update(name, this.DotToken); - public ExplicitInterfaceSpecifierSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Name, dotToken); -} - -/// Base type for method declaration syntax. -public abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax -{ - internal BaseMethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Base type for property declaration syntax. + public abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax { - } - - /// Gets the parameter list. - public abstract ParameterListSyntax ParameterList { get; } - public BaseMethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => WithParameterListCore(parameterList); - internal abstract BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList); - - public BaseMethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); - internal abstract BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); - - public abstract BlockSyntax? Body { get; } - public BaseMethodDeclarationSyntax WithBody(BlockSyntax? body) => WithBodyCore(body); - internal abstract BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body); - - public BaseMethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) => AddBodyAttributeListsCore(items); - internal abstract BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items); - - public BaseMethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) => AddBodyStatementsCore(items); - internal abstract BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items); + internal BasePropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; } - public BaseMethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); - internal abstract BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody); + /// Gets the type syntax. + public abstract TypeSyntax Type { get; } + public BasePropertyDeclarationSyntax WithType(TypeSyntax type) => WithTypeCore(type); + internal abstract BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type); - /// Gets the optional semicolon token. - public abstract SyntaxToken SemicolonToken { get; } - public BaseMethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); - internal abstract BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); + /// Gets the optional explicit interface specifier. + public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; } + public BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifierCore(explicitInterfaceSpecifier); + internal abstract BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier); - public new BaseMethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseMethodDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseMethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseMethodDeclarationSyntax)WithModifiersCore(modifiers); + public abstract AccessorListSyntax? AccessorList { get; } + public BasePropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => WithAccessorListCore(accessorList); + internal abstract BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList); - public new BaseMethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseMethodDeclarationSyntax)AddAttributeListsCore(items); + public BasePropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessorsCore(items); + internal abstract BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items); - public new BaseMethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseMethodDeclarationSyntax)AddModifiersCore(items); -} + public new BasePropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BasePropertyDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BasePropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BasePropertyDeclarationSyntax)WithModifiersCore(modifiers); -/// Method declaration syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private SyntaxNode? constraintClauses; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + public new BasePropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BasePropertyDeclarationSyntax)AddAttributeListsCore(items); - internal MethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + public new BasePropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BasePropertyDeclarationSyntax)AddModifiersCore(items); } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - - /// Gets the return type syntax. - public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.MethodDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - - public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); - - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; - - /// Gets the constraint clause list. - public SyntaxList ConstraintClauses => new(GetRed(ref this.constraintClauses, 7)); - - public override BlockSyntax? Body => GetRed(ref this.body, 8); - - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken => ((InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 5 => GetRed(ref this.typeParameterList, 5), - 6 => GetRed(ref this.parameterList, 6)!, - 7 => GetRed(ref this.constraintClauses, 7)!, - 8 => GetRed(ref this.body, 8), - 9 => GetRed(ref this.expressionBody, 9), - _ => null, - }; + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax + { + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private AccessorListSyntax? accessorList; + private ArrowExpressionClauseSyntax? expressionBody; + private EqualsValueClauseSyntax? initializer; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + internal PropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.attributeLists, - 2 => this.returnType, - 3 => this.explicitInterfaceSpecifier, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.constraintClauses, - 8 => this.body, - 9 => this.expressionBody, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMethodDeclaration(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public MethodDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + public override SyntaxTokenList Modifiers { - var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } } - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new MethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new MethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new MethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new MethodDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new MethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new MethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new MethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new MethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public MethodDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) - { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new MethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - public MethodDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new MethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new MethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } -} - -/// Operator declaration syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private ParameterListSyntax? parameterList; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; - - internal OperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override TypeSyntax Type => GetRed(ref this.type, 2)!; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.PropertyDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - /// Gets the return type. - public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; + public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 5); - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - /// Gets the "operator" keyword. - public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); + public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 7); - /// Gets the "checked" keyword. - public SyntaxToken CheckedKeyword => ((InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword is { } slot ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - - /// Gets the operator token. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); - - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } - public override BlockSyntax? Body => GetRed(ref this.body, 8); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 5 => GetRed(ref this.accessorList, 5), + 6 => GetRed(ref this.expressionBody, 6), + 7 => GetRed(ref this.initializer, 7), + _ => null, + }; - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + 3 => this.explicitInterfaceSpecifier, + 5 => this.accessorList, + 6 => this.expressionBody, + 7 => this.initializer, + _ => null, + }; - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken => ((InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyDeclaration(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public PropertyDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 7 => GetRed(ref this.parameterList, 7)!, - 8 => GetRed(ref this.body, 8), - 9 => GetRed(ref this.expressionBody, 9), - _ => null, - }; + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.returnType, - 3 => this.explicitInterfaceSpecifier, - 7 => this.parameterList, - 8 => this.body, - 9 => this.expressionBody, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorDeclaration(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new PropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new PropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new PropertyDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); + public new PropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); + public new PropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, expressionBody, this.Initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, semicolonToken); - public OperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new PropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new PropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); + public new PropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) { - var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); + return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); } - - return this; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new OperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new OperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new OperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new OperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new OperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new OperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new OperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new OperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new OperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new OperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new OperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } -} - -/// Conversion operator declaration syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private TypeSyntax? type; - private ParameterListSyntax? parameterList; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; - - internal ConversionOperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// The syntax for the expression body of an expression-bodied member. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode { - } - - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - - /// Gets the "implicit" or "explicit" token. - public SyntaxToken ImplicitOrExplicitKeyword => new(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); - - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - - /// Gets the "operator" token. - public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); + private ExpressionSyntax? expression; - /// Gets the "checked" keyword. - public SyntaxToken CheckedKeyword => ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword is { } slot ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - - /// Gets the type. - public TypeSyntax Type => GetRed(ref this.type, 6)!; + internal ArrowExpressionClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; + public SyntaxToken ArrowToken => new SyntaxToken(this, ((InternalSyntax.ArrowExpressionClauseSyntax)this.Green).arrowToken, Position, 0); - public override BlockSyntax? Body => GetRed(ref this.body, 8); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken => ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 6 => GetRed(ref this.type, 6)!, - 7 => GetRed(ref this.parameterList, 7)!, - 8 => GetRed(ref this.body, 8), - 9 => GetRed(ref this.expressionBody, 9), - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrowExpressionClause(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression) { - 0 => this.attributeLists, - 3 => this.explicitInterfaceSpecifier, - 6 => this.type, - 7 => this.parameterList, - 8 => this.body, - 9 => this.expressionBody, - _ => null, - }; + if (arrowToken != this.ArrowToken || expression != this.Expression) + { + var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorDeclaration(this); - - public ConversionOperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + return this; } - return this; + public ArrowExpressionClauseSyntax WithArrowToken(SyntaxToken arrowToken) => Update(arrowToken, this.Expression); + public ArrowExpressionClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.ArrowToken, expression); } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ConversionOperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ConversionOperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(this.AttributeLists, this.Modifiers, implicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new ConversionOperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new ConversionOperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new ConversionOperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new ConversionOperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ConversionOperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ConversionOperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new ConversionOperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new ConversionOperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new ConversionOperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } -} - -/// Constructor declaration syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private ParameterListSyntax? parameterList; - private ConstructorInitializerSyntax? initializer; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; - - internal ConstructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax { - } - - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - - public ConstructorInitializerSyntax? Initializer => GetRed(ref this.initializer, 4); - - public override BlockSyntax? Body => GetRed(ref this.body, 5); + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private AccessorListSyntax? accessorList; - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken => ((InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.parameterList, 3)!, - 4 => GetRed(ref this.initializer, 4), - 5 => GetRed(ref this.body, 5), - 6 => GetRed(ref this.expressionBody, 6), - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + internal EventDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.attributeLists, - 3 => this.parameterList, - 4 => this.initializer, - 5 => this.body, - 6 => this.expressionBody, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorDeclaration(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public ConstructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + public override SyntaxTokenList Modifiers { - var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } } - return this; - } + public SyntaxToken EventKeyword => new SyntaxToken(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ConstructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ConstructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConstructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new ConstructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Identifier, parameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConstructorDeclarationSyntax WithInitializer(ConstructorInitializerSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new ConstructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new ConstructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new ConstructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, semicolonToken); + public override TypeSyntax Type => GetRed(ref this.type, 3)!; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ConstructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ConstructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new ConstructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new ConstructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new ConstructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } -} + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 4); -/// Constructor initializer syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -public sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode -{ - private ArgumentListSyntax? argumentList; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); - internal ConstructorInitializerSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); - /// Gets the colon token. - public SyntaxToken ColonToken => new(this, ((InternalSyntax.ConstructorInitializerSyntax)this.Green).colonToken, Position, 0); - - /// Gets the "this" or "base" keyword. - public SyntaxToken ThisOrBaseKeyword => new(this, ((InternalSyntax.ConstructorInitializerSyntax)this.Green).thisOrBaseKeyword, GetChildPosition(1), GetChildIndex(1)); - - public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.argumentList, 2)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.argumentList : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorInitializer(this); - - public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) - { - if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList) + public SyntaxToken SemicolonToken { - var newNode = SyntaxFactory.ConstructorInitializer(this.Kind(), colonToken, thisOrBaseKeyword, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + } } - return this; - } - - public ConstructorInitializerSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.ThisOrBaseKeyword, this.ArgumentList); - public ConstructorInitializerSyntax WithThisOrBaseKeyword(SyntaxToken thisOrBaseKeyword) => Update(this.ColonToken, thisOrBaseKeyword, this.ArgumentList); - public ConstructorInitializerSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.ColonToken, this.ThisOrBaseKeyword, argumentList); - - public ConstructorInitializerSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); -} - -/// Destructor declaration syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private ParameterListSyntax? parameterList; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; - - internal DestructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - - /// Gets the tilde token. - public SyntaxToken TildeToken => new(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.type, 3)!, + 4 => GetRed(ref this.explicitInterfaceSpecifier, 4), + 6 => GetRed(ref this.accessorList, 6), + _ => null, + }; - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.type, + 4 => this.explicitInterfaceSpecifier, + 6 => this.accessorList, + _ => null, + }; - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 4)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventDeclaration(this); - public override BlockSyntax? Body => GetRed(ref this.body, 5); - - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken => ((InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public EventDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken semicolonToken) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.parameterList, 4)!, - 5 => GetRed(ref this.body, 5), - 6 => GetRed(ref this.expressionBody, 6), - _ => null, - }; + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.parameterList, - 5 => this.body, - 6 => this.expressionBody, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDestructorDeclaration(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EventDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EventDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + public EventDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new EventDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); + public new EventDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + public EventDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); + public new EventDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.SemicolonToken); + public EventDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, semicolonToken); - public DestructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EventDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EventDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); + public new EventDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) { - var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); + return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); } - - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new DestructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new DestructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public DestructorDeclarationSyntax WithTildeToken(SyntaxToken tildeToken) => Update(this.AttributeLists, this.Modifiers, tildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public DestructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new DestructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new DestructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new DestructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new DestructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new DestructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new DestructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new DestructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new DestructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new DestructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } -} -/// Base type for property declaration syntax. -public abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax -{ - internal BasePropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax { - } - - /// Gets the type syntax. - public abstract TypeSyntax Type { get; } - public BasePropertyDeclarationSyntax WithType(TypeSyntax type) => WithTypeCore(type); - internal abstract BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type); - - /// Gets the optional explicit interface specifier. - public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; } - public BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifierCore(explicitInterfaceSpecifier); - internal abstract BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier); - - public abstract AccessorListSyntax? AccessorList { get; } - public BasePropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => WithAccessorListCore(accessorList); - internal abstract BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList); - - public BasePropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessorsCore(items); - internal abstract BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items); - - public new BasePropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BasePropertyDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BasePropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BasePropertyDeclarationSyntax)WithModifiersCore(modifiers); - - public new BasePropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BasePropertyDeclarationSyntax)AddAttributeListsCore(items); - - public new BasePropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BasePropertyDeclarationSyntax)AddModifiersCore(items); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private AccessorListSyntax? accessorList; - private ArrowExpressionClauseSyntax? expressionBody; - private EqualsValueClauseSyntax? initializer; - - internal PropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private BracketedParameterListSyntax? parameterList; + private AccessorListSyntax? accessorList; + private ArrowExpressionClauseSyntax? expressionBody; + + internal IndexerDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override TypeSyntax Type => GetRed(ref this.type, 2)!; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + public override TypeSyntax Type => GetRed(ref this.type, 2)!; + + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); + + public SyntaxToken ThisKeyword => new SyntaxToken(this, ((InternalSyntax.IndexerDeclarationSyntax)this.Green).thisKeyword, GetChildPosition(4), GetChildIndex(4)); - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); + /// Gets the parameter list. + public BracketedParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; + + public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.PropertyDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 7); - public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 5); + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 5 => GetRed(ref this.parameterList, 5)!, + 6 => GetRed(ref this.accessorList, 6), + 7 => GetRed(ref this.expressionBody, 7), + _ => null, + }; - public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 7); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + 3 => this.explicitInterfaceSpecifier, + 5 => this.parameterList, + 6 => this.accessorList, + 7 => this.expressionBody, + _ => null, + }; - public SyntaxToken SemicolonToken => ((InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerDeclaration(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public IndexerDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 5 => GetRed(ref this.accessorList, 5), - 6 => GetRed(ref this.expressionBody, 6), - 7 => GetRed(ref this.initializer, 7), - _ => null, - }; + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - 3 => this.explicitInterfaceSpecifier, - 5 => this.accessorList, - 6 => this.expressionBody, - 7 => this.initializer, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyDeclaration(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new IndexerDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new IndexerDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new IndexerDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); + public new IndexerDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, thisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithParameterList(BracketedParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, parameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); + public new IndexerDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, accessorList, this.ExpressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, expressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, semicolonToken); - public PropertyDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new IndexerDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new IndexerDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public IndexerDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); + public new IndexerDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) { - var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); + return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); } - - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new PropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new PropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new PropertyDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); - public new PropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); - public new PropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, expressionBody, this.Initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new PropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new PropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); - public new PropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) - { - var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); - return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); } -} - -/// The syntax for the expression body of an expression-bodied member. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode -{ - private ExpressionSyntax? expression; - internal ArrowExpressionClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class AccessorListSyntax : CSharpSyntaxNode { - } - - public SyntaxToken ArrowToken => new(this, ((InternalSyntax.ArrowExpressionClauseSyntax)this.Green).arrowToken, Position, 0); - - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + private SyntaxNode? accessors; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrowExpressionClause(this); - - public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression) - { - if (arrowToken != this.ArrowToken || expression != this.Expression) + internal AccessorListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.AccessorListSyntax)this.Green).openBraceToken, Position, 0); - public ArrowExpressionClauseSyntax WithArrowToken(SyntaxToken arrowToken) => Update(arrowToken, this.Expression); - public ArrowExpressionClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.ArrowToken, expression); -} + public SyntaxList Accessors => new SyntaxList(GetRed(ref this.accessors, 1)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private AccessorListSyntax? accessorList; + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.AccessorListSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); - internal EventDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.accessors, 1)! : null; - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.accessors : null; - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorList(this); - public SyntaxToken EventKeyword => new(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); - - public override TypeSyntax Type => GetRed(ref this.type, 3)!; - - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 4); + public AccessorListSyntax Update(SyntaxToken openBraceToken, SyntaxList accessors, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); + return this; + } - public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); + public AccessorListSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Accessors, this.CloseBraceToken); + public AccessorListSyntax WithAccessors(SyntaxList accessors) => Update(this.OpenBraceToken, accessors, this.CloseBraceToken); + public AccessorListSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Accessors, closeBraceToken); - public SyntaxToken SemicolonToken => ((InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + public AccessorListSyntax AddAccessors(params AccessorDeclarationSyntax[] items) => WithAccessors(this.Accessors.AddRange(items)); + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.type, 3)!, - 4 => GetRed(ref this.explicitInterfaceSpecifier, 4), - 6 => GetRed(ref this.accessorList, 6), - _ => null, - }; + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + /// + /// + /// + /// + public sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode + { + private SyntaxNode? attributeLists; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + internal AccessorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.attributeLists, - 3 => this.type, - 4 => this.explicitInterfaceSpecifier, - 6 => this.accessorList, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventDeclaration(this); + /// Gets the attribute declaration list. + public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public EventDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) + /// Gets the modifier list. + public SyntaxTokenList Modifiers { - var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } } - return this; - } + /// Gets the keyword token, or identifier if an erroneous accessor declaration. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EventDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EventDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - public EventDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new EventDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); - public new EventDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - public EventDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); - public new EventDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.SemicolonToken); - public EventDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, semicolonToken); + /// Gets the optional body block which may be empty, but it is null if there are no braces. + public BlockSyntax? Body => GetRed(ref this.body, 3); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EventDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EventDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); - public new EventDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) - { - var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); - return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); - } -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private BracketedParameterListSyntax? parameterList; - private AccessorListSyntax? accessorList; - private ArrowExpressionClauseSyntax? expressionBody; + /// Gets the optional expression body. + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); - internal IndexerDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - - public override TypeSyntax Type => GetRed(ref this.type, 2)!; + /// Gets the optional semicolon token. + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + } + } - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.body, 3), + 4 => GetRed(ref this.expressionBody, 4), + _ => null, + }; - public SyntaxToken ThisKeyword => new(this, ((InternalSyntax.IndexerDeclarationSyntax)this.Green).thisKeyword, GetChildPosition(4), GetChildIndex(4)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.body, + 4 => this.expressionBody, + _ => null, + }; - /// Gets the parameter list. - public BracketedParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorDeclaration(this); - public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); + public AccessorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.AccessorDeclaration(this.Kind(), attributeLists, modifiers, keyword, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 7); + return this; + } - public SyntaxToken SemicolonToken => ((InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + public AccessorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Keyword, body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, expressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, semicolonToken); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public AccessorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public AccessorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public AccessorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 5 => GetRed(ref this.parameterList, 5)!, - 6 => GetRed(ref this.accessorList, 6), - 7 => GetRed(ref this.expressionBody, 7), - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + public AccessorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) { - 0 => this.attributeLists, - 2 => this.type, - 3 => this.explicitInterfaceSpecifier, - 5 => this.parameterList, - 6 => this.accessorList, - 7 => this.expressionBody, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerDeclaration(this); + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } + } - public IndexerDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + /// Base type for parameter list syntax. + public abstract partial class BaseParameterListSyntax : CSharpSyntaxNode { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + internal BaseParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new IndexerDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new IndexerDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new IndexerDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); - public new IndexerDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, thisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithParameterList(BracketedParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, parameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); - public new IndexerDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, accessorList, this.ExpressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, expressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, semicolonToken); + /// Gets the parameter list. + public abstract SeparatedSyntaxList Parameters { get; } + public BaseParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); + internal abstract BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new IndexerDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new IndexerDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public IndexerDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); - public new IndexerDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) - { - var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); - return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); + public BaseParameterListSyntax AddParameters(params ParameterSyntax[] items) => AddParametersCore(items); + internal abstract BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items); } -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class AccessorListSyntax : CSharpSyntaxNode -{ - private SyntaxNode? accessors; - internal AccessorListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Parameter list syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ParameterListSyntax : BaseParameterListSyntax { - } - - public SyntaxToken OpenBraceToken => new(this, ((InternalSyntax.AccessorListSyntax)this.Green).openBraceToken, Position, 0); - - public SyntaxList Accessors => new(GetRed(ref this.accessors, 1)); - - public SyntaxToken CloseBraceToken => new(this, ((InternalSyntax.AccessorListSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + private SyntaxNode? parameters; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.accessors, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.accessors : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorList(this); - - public AccessorListSyntax Update(SyntaxToken openBraceToken, SyntaxList accessors, SyntaxToken closeBraceToken) - { - if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) + internal ParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public AccessorListSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Accessors, this.CloseBraceToken); - public AccessorListSyntax WithAccessors(SyntaxList accessors) => Update(this.OpenBraceToken, accessors, this.CloseBraceToken); - public AccessorListSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Accessors, closeBraceToken); + /// Gets the open paren token. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); - public AccessorListSyntax AddAccessors(params AccessorDeclarationSyntax[] items) => WithAccessors(this.Accessors.AddRange(items)); -} + public override SeparatedSyntaxList Parameters + { + get + { + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -/// -/// -/// -/// -public sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode -{ - private SyntaxNode? attributeLists; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + /// Gets the close paren token. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal AccessorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - /// Gets the modifier list. - public SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameterList(this); - /// Gets the keyword token, or identifier if an erroneous accessor declaration. - public SyntaxToken Keyword => new(this, ((InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + public ParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - /// Gets the optional body block which may be empty, but it is null if there are no braces. - public BlockSyntax? Body => GetRed(ref this.body, 3); + return this; + } - /// Gets the optional expression body. - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); + public ParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); + internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new ParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); + public ParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); - /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken => ((InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken is { } slot ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); + public new ParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.body, 3), - 4 => GetRed(ref this.expressionBody, 4), - _ => null, - }; + /// Parameter list syntax with surrounding brackets. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax + { + private SyntaxNode? parameters; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + internal BracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.attributeLists, - 3 => this.body, - 4 => this.expressionBody, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorDeclaration(this); + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); - public AccessorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + public override SeparatedSyntaxList Parameters { - var newNode = SyntaxFactory.AccessorDeclaration(this.Kind(), attributeLists, modifiers, keyword, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } } - return this; - } + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - public AccessorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Keyword, body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, expressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, semicolonToken); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - public AccessorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public AccessorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public AccessorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - public AccessorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } -} + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; -/// Base type for parameter list syntax. -public abstract partial class BaseParameterListSyntax : CSharpSyntaxNode -{ - internal BaseParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedParameterList(this); - /// Gets the parameter list. - public abstract SeparatedSyntaxList Parameters { get; } - public BaseParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); - internal abstract BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); + public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) + { + var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public BaseParameterListSyntax AddParameters(params ParameterSyntax[] items) => AddParametersCore(items); - internal abstract BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items); -} + return this; + } -/// Parameter list syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ParameterListSyntax : BaseParameterListSyntax -{ - private SyntaxNode? parameters; + public BracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); + internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new BracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); + public BracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); - internal ParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); + public new BracketedParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); } - /// Gets the open paren token. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); - - public override SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; - - /// Gets the close paren token. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameterList(this); - - public ParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + /// Base parameter syntax. + public abstract partial class BaseParameterSyntax : CSharpSyntaxNode { - if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) + internal BaseParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + /// Gets the attribute declaration list. + public abstract SyntaxList AttributeLists { get; } + public BaseParameterSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists); - public ParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); - internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new ParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); - public ParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); + public BaseParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items); - internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); - public new ParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); -} + /// Gets the modifier list. + public abstract SyntaxTokenList Modifiers { get; } + public BaseParameterSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); + internal abstract BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers); -/// Parameter list syntax with surrounding brackets. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax -{ - private SyntaxNode? parameters; + public BaseParameterSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); + internal abstract BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items); - internal BracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + public abstract TypeSyntax? Type { get; } + public BaseParameterSyntax WithType(TypeSyntax? type) => WithTypeCore(type); + internal abstract BaseParameterSyntax WithTypeCore(TypeSyntax? type); } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); - - public override SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; - - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + /// Parameter syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ParameterSyntax : BaseParameterSyntax + { + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private EqualsValueClauseSyntax? @default; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal ParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedParameterList(this); + /// Gets the attribute declaration list. + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) + /// Gets the modifier list. + public override SyntaxTokenList Modifiers { - var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } } - return this; - } + public override TypeSyntax? Type => GetRed(ref this.type, 2); - public BracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); - internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new BracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); - public BracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ParameterSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); - public new BracketedParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); -} + public EqualsValueClauseSyntax? Default => GetRed(ref this.@default, 4); -/// Base parameter syntax. -public abstract partial class BaseParameterSyntax : CSharpSyntaxNode -{ - internal BaseParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2), + 4 => GetRed(ref this.@default, 4), + _ => null, + }; - /// Gets the attribute declaration list. - public abstract SyntaxList AttributeLists { get; } - public BaseParameterSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + 4 => this.@default, + _ => null, + }; - public BaseParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameter(this); - /// Gets the modifier list. - public abstract SyntaxTokenList Modifiers { get; } - public BaseParameterSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); - internal abstract BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers); - - public BaseParameterSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); - internal abstract BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items); + public ParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) + { + var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public abstract TypeSyntax? Type { get; } - public BaseParameterSyntax WithType(TypeSyntax? type) => WithTypeCore(type); - internal abstract BaseParameterSyntax WithTypeCore(TypeSyntax? type); -} + return this; + } -/// Parameter syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ParameterSyntax : BaseParameterSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private EqualsValueClauseSyntax? @default; + internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.Identifier, this.Default); + internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.Identifier, this.Default); + internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type); + public new ParameterSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type, this.Identifier, this.Default); + public ParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, identifier, this.Default); + public ParameterSyntax WithDefault(EqualsValueClauseSyntax? @default) => Update(this.AttributeLists, this.Modifiers, this.Type, this.Identifier, @default); - internal ParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); } - /// Gets the attribute declaration list. - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); - - /// Gets the modifier list. - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - - public override TypeSyntax? Type => GetRed(ref this.type, 2); - - /// Gets the identifier. - public SyntaxToken Identifier => new(this, ((InternalSyntax.ParameterSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - - public EqualsValueClauseSyntax? Default => GetRed(ref this.@default, 4); - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2), - 4 => GetRed(ref this.@default, 4), - _ => null, - }; + /// Parameter syntax. + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax + { + private SyntaxNode? attributeLists; + private TypeSyntax? type; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + internal FunctionPointerParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.attributeLists, - 2 => this.type, - 4 => this.@default, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameter(this); + /// Gets the attribute declaration list. + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public ParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) + /// Gets the modifier list. + public override SyntaxTokenList Modifiers { - var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } } - return this; - } + public override TypeSyntax Type => GetRed(ref this.type, 2)!; - internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.Identifier, this.Default); - internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.Identifier, this.Default); - internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type); - public new ParameterSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type, this.Identifier, this.Default); - public ParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, identifier, this.Default); - public ParameterSyntax WithDefault(EqualsValueClauseSyntax? @default) => Update(this.AttributeLists, this.Modifiers, this.Type, this.Identifier, @default); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2)!, + _ => null, + }; - internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); -} + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + _ => null, + }; -/// Parameter syntax. -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? type; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameter(this); - internal FunctionPointerParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public FunctionPointerParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) + { + var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - /// Gets the attribute declaration list. - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + return this; + } - /// Gets the modifier list. - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FunctionPointerParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); + internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new FunctionPointerParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); + internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type ?? throw new ArgumentNullException(nameof(type))); + public new FunctionPointerParameterSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type); - public override TypeSyntax Type => GetRed(ref this.type, 2)!; + internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FunctionPointerParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new FunctionPointerParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2)!, - _ => null, - }; + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax + { + private SyntaxNode? attributeLists; + private TypeSyntax? type; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + internal IncompleteMemberSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.attributeLists, - 2 => this.type, - _ => null, - }; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameter(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public FunctionPointerParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) + public override SyntaxTokenList Modifiers { - var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } } - return this; - } + public TypeSyntax? Type => GetRed(ref this.type, 2); - internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FunctionPointerParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); - internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new FunctionPointerParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); - internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type ?? throw new ArgumentNullException(nameof(type))); - public new FunctionPointerParameterSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2), + _ => null, + }; - internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FunctionPointerParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new FunctionPointerParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); -} + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + _ => null, + }; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax -{ - private SyntaxNode? attributeLists; - private TypeSyntax? type; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIncompleteMember(this); - internal IncompleteMemberSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public IncompleteMemberSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) + { + var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override SyntaxList AttributeLists => new(GetRed(ref this.attributeLists, 0)); + return this; + } - public override SyntaxTokenList Modifiers => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new IncompleteMemberSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new IncompleteMemberSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); + public IncompleteMemberSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type); - public TypeSyntax? Type => GetRed(ref this.type, 2); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new IncompleteMemberSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new IncompleteMemberSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2), - _ => null, - }; + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax + { - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + internal SkippedTokensTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - 0 => this.attributeLists, - 2 => this.type, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIncompleteMember(this); + } - public IncompleteMemberSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) + public SyntaxTokenList Tokens { - var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + get + { + var slot = this.Green.GetSlot(0); + return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; + } } - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new IncompleteMemberSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new IncompleteMemberSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); - public IncompleteMemberSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new IncompleteMemberSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new IncompleteMemberSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); -} + internal override SyntaxNode? GetNodeSlot(int index) => null; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax -{ + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal SkippedTokensTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSkippedTokensTrivia(this); - public SyntaxTokenList Tokens => this.Green.GetSlot(0) is { } slot ? new(this, slot, Position, 0) : default; + public SkippedTokensTriviaSyntax Update(SyntaxTokenList tokens) + { + if (tokens != this.Tokens) + { + var newNode = SyntaxFactory.SkippedTokensTrivia(tokens); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SkippedTokensTriviaSyntax WithTokens(SyntaxTokenList tokens) => Update(tokens); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSkippedTokensTrivia(this); + public SkippedTokensTriviaSyntax AddTokens(params SyntaxToken[] items) => WithTokens(this.Tokens.AddRange(items)); + } - public SkippedTokensTriviaSyntax Update(SyntaxTokenList tokens) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + /// + public sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax { - if (tokens != this.Tokens) + private SyntaxNode? content; + + internal DocumentationCommentTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.SkippedTokensTrivia(tokens); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public SkippedTokensTriviaSyntax WithTokens(SyntaxTokenList tokens) => Update(tokens); + public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 0)); - public SkippedTokensTriviaSyntax AddTokens(params SyntaxToken[] items) => WithTokens(this.Tokens.AddRange(items)); -} + public SyntaxToken EndOfComment => new SyntaxToken(this, ((InternalSyntax.DocumentationCommentTriviaSyntax)this.Green).endOfComment, GetChildPosition(1), GetChildIndex(1)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -/// -public sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax -{ - private SyntaxNode? content; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.content)! : null; - internal DocumentationCommentTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.content : null; - public SyntaxList Content => new(GetRed(ref this.content, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDocumentationCommentTrivia(this); - public SyntaxToken EndOfComment => new(this, ((InternalSyntax.DocumentationCommentTriviaSyntax)this.Green).endOfComment, GetChildPosition(1), GetChildIndex(1)); + public DocumentationCommentTriviaSyntax Update(SyntaxList content, SyntaxToken endOfComment) + { + if (content != this.Content || endOfComment != this.EndOfComment) + { + var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind(), content, endOfComment); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.content)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.content : null; + public DocumentationCommentTriviaSyntax WithContent(SyntaxList content) => Update(content, this.EndOfComment); + public DocumentationCommentTriviaSyntax WithEndOfComment(SyntaxToken endOfComment) => Update(this.Content, endOfComment); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDocumentationCommentTrivia(this); + public DocumentationCommentTriviaSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); + } - public DocumentationCommentTriviaSyntax Update(SyntaxList content, SyntaxToken endOfComment) + /// + /// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). + /// For example, the M in <see cref="M" />. + /// + public abstract partial class CrefSyntax : CSharpSyntaxNode { - if (content != this.Content || endOfComment != this.EndOfComment) + internal CrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind(), content, endOfComment); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - - return this; } - public DocumentationCommentTriviaSyntax WithContent(SyntaxList content) => Update(content, this.EndOfComment); - public DocumentationCommentTriviaSyntax WithEndOfComment(SyntaxToken endOfComment) => Update(this.Content, endOfComment); - - public DocumentationCommentTriviaSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); -} - -/// -/// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). -/// For example, the M in <see cref="M" />. -/// -public abstract partial class CrefSyntax : CSharpSyntaxNode -{ - internal CrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } -} - -/// -/// A symbol reference that definitely refers to a type. -/// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). -/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax -/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol -/// might be a non-type member. -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class TypeCrefSyntax : CrefSyntax -{ - private TypeSyntax? type; - - internal TypeCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// A symbol reference that definitely refers to a type. + /// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). + /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax + /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol + /// might be a non-type member. + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class TypeCrefSyntax : CrefSyntax { - } - - public TypeSyntax Type => GetRedAtZero(ref this.type)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + private TypeSyntax? type; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeCref(this); - - public TypeCrefSyntax Update(TypeSyntax type) - { - if (type != this.Type) + internal TypeCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.TypeCref(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public TypeCrefSyntax WithType(TypeSyntax type) => Update(type); -} - -/// -/// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. -/// For example, cref="System.String.ToString()". -/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax -/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol -/// might be a non-type member. -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class QualifiedCrefSyntax : CrefSyntax -{ - private TypeSyntax? container; - private MemberCrefSyntax? member; - - internal QualifiedCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public TypeSyntax Container => GetRedAtZero(ref this.container)!; + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public SyntaxToken DotToken => new(this, ((InternalSyntax.QualifiedCrefSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - public MemberCrefSyntax Member => GetRed(ref this.member, 2)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.container)!, - 2 => GetRed(ref this.member, 2)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeCref(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public TypeCrefSyntax Update(TypeSyntax type) { - 0 => this.container, - 2 => this.member, - _ => null, - }; + if (type != this.Type) + { + var newNode = SyntaxFactory.TypeCref(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedCref(this); - - public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) - { - if (container != this.Container || dotToken != this.DotToken || member != this.Member) - { - var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + return this; } - return this; + public TypeCrefSyntax WithType(TypeSyntax type) => Update(type); } - public QualifiedCrefSyntax WithContainer(TypeSyntax container) => Update(container, this.DotToken, this.Member); - public QualifiedCrefSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Container, dotToken, this.Member); - public QualifiedCrefSyntax WithMember(MemberCrefSyntax member) => Update(this.Container, this.DotToken, member); -} - -/// -/// The unqualified part of a CrefSyntax. -/// For example, "ToString()" in "object.ToString()". -/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax -/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol -/// might be a non-type member. -/// -public abstract partial class MemberCrefSyntax : CrefSyntax -{ - internal MemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. + /// For example, cref="System.String.ToString()". + /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax + /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol + /// might be a non-type member. + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class QualifiedCrefSyntax : CrefSyntax { - } -} + private TypeSyntax? container; + private MemberCrefSyntax? member; -/// -/// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, -/// with an optional type parameter list) and an optional parameter list. -/// For example, "M", "M<T>" or "M(int)". -/// Also, "A::B()" or "string()". -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class NameMemberCrefSyntax : MemberCrefSyntax -{ - private TypeSyntax? name; - private CrefParameterListSyntax? parameters; + internal QualifiedCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal NameMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TypeSyntax Container => GetRedAtZero(ref this.container)!; - public TypeSyntax Name => GetRedAtZero(ref this.name)!; + public SyntaxToken DotToken => new SyntaxToken(this, ((InternalSyntax.QualifiedCrefSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); - public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); + public MemberCrefSyntax Member => GetRed(ref this.member, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 1 => GetRed(ref this.parameters, 1), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.container)!, + 2 => GetRed(ref this.member, 2)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.parameters, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.container, + 2 => this.member, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedCref(this); - public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax? parameters) - { - if (name != this.Name || parameters != this.Parameters) + public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) { - var newNode = SyntaxFactory.NameMemberCref(name, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (container != this.Container || dotToken != this.DotToken || member != this.Member) + { + var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + public QualifiedCrefSyntax WithContainer(TypeSyntax container) => Update(container, this.DotToken, this.Member); + public QualifiedCrefSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Container, dotToken, this.Member); + public QualifiedCrefSyntax WithMember(MemberCrefSyntax member) => Update(this.Container, this.DotToken, member); } - public NameMemberCrefSyntax WithName(TypeSyntax name) => Update(name, this.Parameters); - public NameMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.Name, parameters); - - public NameMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + /// + /// The unqualified part of a CrefSyntax. + /// For example, "ToString()" in "object.ToString()". + /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax + /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol + /// might be a non-type member. + /// + public abstract partial class MemberCrefSyntax : CrefSyntax { - var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); + internal MemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } } -} -/// -/// A MemberCrefSyntax specified by a this keyword and an optional parameter list. -/// For example, "this" or "this[int]". -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax -{ - private CrefBracketedParameterListSyntax? parameters; - - internal IndexerMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, + /// with an optional type parameter list) and an optional parameter list. + /// For example, "M", "M<T>" or "M(int)". + /// Also, "A::B()" or "string()". + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class NameMemberCrefSyntax : MemberCrefSyntax { - } + private TypeSyntax? name; + private CrefParameterListSyntax? parameters; - public SyntaxToken ThisKeyword => new(this, ((InternalSyntax.IndexerMemberCrefSyntax)this.Green).thisKeyword, Position, 0); + internal NameMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public CrefBracketedParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); + public TypeSyntax Name => GetRedAtZero(ref this.name)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1) : null; + public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.name)!, + 1 => GetRed(ref this.parameters, 1), + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerMemberCref(this); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.parameters, + _ => null, + }; - public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) - { - if (thisKeyword != this.ThisKeyword || parameters != this.Parameters) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameMemberCref(this); + + public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax? parameters) { - var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (name != this.Name || parameters != this.Parameters) + { + var newNode = SyntaxFactory.NameMemberCref(name, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; - } + public NameMemberCrefSyntax WithName(TypeSyntax name) => Update(name, this.Parameters); + public NameMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.Name, parameters); - public IndexerMemberCrefSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(thisKeyword, this.Parameters); - public IndexerMemberCrefSyntax WithParameters(CrefBracketedParameterListSyntax? parameters) => Update(this.ThisKeyword, parameters); + public NameMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + { + var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); + } + } - public IndexerMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + /// + /// A MemberCrefSyntax specified by a this keyword and an optional parameter list. + /// For example, "this" or "this[int]". + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax { - var parameters = this.Parameters ?? SyntaxFactory.CrefBracketedParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } -} + private CrefBracketedParameterListSyntax? parameters; -/// -/// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. -/// For example, "operator +" or "operator -[int]". -/// NOTE: the operator must be overloadable. -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax -{ - private CrefParameterListSyntax? parameters; + internal IndexerMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal OperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken ThisKeyword => new SyntaxToken(this, ((InternalSyntax.IndexerMemberCrefSyntax)this.Green).thisKeyword, Position, 0); - public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); + public CrefBracketedParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); - public SyntaxToken CheckedKeyword => ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1) : null; - /// Gets the operator token. - public SyntaxToken OperatorToken => new(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 3); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerMemberCref(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.parameters, 3) : null; + public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + { + if (thisKeyword != this.ThisKeyword || parameters != this.Parameters) + { + var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.parameters : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorMemberCref(this); + public IndexerMemberCrefSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(thisKeyword, this.Parameters); + public IndexerMemberCrefSyntax WithParameters(CrefBracketedParameterListSyntax? parameters) => Update(this.ThisKeyword, parameters); - public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) - { - if (operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters) + public IndexerMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) { - var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, operatorToken, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var parameters = this.Parameters ?? SyntaxFactory.CrefBracketedParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); } - - return this; } - public OperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.Parameters); - public OperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.Parameters); - public OperatorMemberCrefSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.Parameters); - public OperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameters); - - public OperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + /// + /// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. + /// For example, "operator +" or "operator -[int]". + /// NOTE: the operator must be overloadable. + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax { - var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } -} + private CrefParameterListSyntax? parameters; -/// -/// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. -/// For example, "implicit operator int" or "explicit operator MyType(int)". -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax -{ - private TypeSyntax? type; - private CrefParameterListSyntax? parameters; + internal OperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal ConversionOperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); - public SyntaxToken ImplicitOrExplicitKeyword => new(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).implicitOrExplicitKeyword, Position, 0); + public SyntaxToken CheckedKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public SyntaxToken OperatorKeyword => new(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); + /// Gets the operator token. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken CheckedKeyword => ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 3); - public TypeSyntax Type => GetRed(ref this.type, 3)!; + internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.parameters, 3) : null; - public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 4); + internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.parameters : null; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 3 => GetRed(ref this.type, 3)!, - 4 => GetRed(ref this.parameters, 4), - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorMemberCref(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) { - 3 => this.type, - 4 => this.parameters, - _ => null, - }; + if (operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters) + { + var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, operatorToken, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorMemberCref(this); + return this; + } - public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) - { - if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameters != this.Parameters) + public OperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.Parameters); + public OperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.Parameters); + public OperatorMemberCrefSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.Parameters); + public OperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameters); + + public OperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) { - var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); } - - return this; } - public ConversionOperatorMemberCrefSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(implicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.ImplicitOrExplicitKeyword, operatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, checkedKeyword, this.Type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithType(TypeSyntax type) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameters); - - public ConversionOperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + /// + /// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. + /// For example, "implicit operator int" or "explicit operator MyType(int)". + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax { - var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } -} + private TypeSyntax? type; + private CrefParameterListSyntax? parameters; -/// -/// A list of cref parameters with surrounding punctuation. -/// Unlike regular parameters, cref parameters do not have names. -/// -public abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode -{ - internal BaseCrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal ConversionOperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the parameter list. - public abstract SeparatedSyntaxList Parameters { get; } - public BaseCrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); - internal abstract BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); + public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).implicitOrExplicitKeyword, Position, 0); - public BaseCrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => AddParametersCore(items); - internal abstract BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items); -} + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); -/// -/// A parenthesized list of cref parameters. -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax -{ - private SyntaxNode? parameters; + public SyntaxToken CheckedKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + } + } - internal CrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TypeSyntax Type => GetRed(ref this.type, 3)!; - /// Gets the open paren token. - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); + public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 4); - public override SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 3 => GetRed(ref this.type, 3)!, + 4 => GetRed(ref this.parameters, 4), + _ => null, + }; - /// Gets the close paren token. - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 3 => this.type, + 4 => this.parameters, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorMemberCref(this); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + { + if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameters != this.Parameters) + { + var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameterList(this); + public ConversionOperatorMemberCrefSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(implicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.ImplicitOrExplicitKeyword, operatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, checkedKeyword, this.Type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithType(TypeSyntax type) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameters); - public CrefParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) + public ConversionOperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) { - var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); } - - return this; } - public CrefParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); - internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new CrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); - public CrefParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); + /// + /// A list of cref parameters with surrounding punctuation. + /// Unlike regular parameters, cref parameters do not have names. + /// + public abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode + { + internal BaseCrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); - public new CrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); -} + /// Gets the parameter list. + public abstract SeparatedSyntaxList Parameters { get; } + public BaseCrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); + internal abstract BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); -/// -/// A bracketed list of cref parameters. -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax -{ - private SyntaxNode? parameters; + public BaseCrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => AddParametersCore(items); + internal abstract BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items); + } - internal CrefBracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// A parenthesized list of cref parameters. + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax { - } + private SyntaxNode? parameters; - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); + internal CrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SeparatedSyntaxList Parameters => GetRed(ref this.parameters, 1) is { } red ? new(red, GetChildIndex(1)) : default; + /// Gets the open paren token. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public override SeparatedSyntaxList Parameters + { + get + { + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + /// Gets the close paren token. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefBracketedParameterList(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameterList(this); - return this; - } + public CrefParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public CrefBracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); - internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new CrefBracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); - public CrefBracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); + return this; + } - internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); - public new CrefBracketedParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); -} + public CrefParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); + internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new CrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); + public CrefParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); -/// -/// An element of a BaseCrefParameterListSyntax. -/// Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, -/// an optional readonly keyword, and a type - -/// there is no name and there are no attributes or other modifiers. -/// -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class CrefParameterSyntax : CSharpSyntaxNode -{ - private TypeSyntax? type; + internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); + public new CrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); + } - internal CrefParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// A bracketed list of cref parameters. + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax { - } + private SyntaxNode? parameters; - public SyntaxToken RefKindKeyword => ((InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword is { } slot ? new(this, slot, Position, 0) : default; + internal CrefBracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken ReadOnlyKeyword => ((InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); + + public override SeparatedSyntaxList Parameters + { + get + { + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - public TypeSyntax Type => GetRed(ref this.type, 2)!; + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameter(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefBracketedParameterList(this); - public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) - { - if (refKindKeyword != this.RefKindKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) + public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) { - var newNode = SyntaxFactory.CrefParameter(refKindKeyword, readOnlyKeyword, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) + { + var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; - } + public CrefBracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); + internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new CrefBracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); + public CrefBracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); - public CrefParameterSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(refKindKeyword, this.ReadOnlyKeyword, this.Type); - public CrefParameterSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKindKeyword, readOnlyKeyword, this.Type); - public CrefParameterSyntax WithType(TypeSyntax type) => Update(this.RefKindKeyword, this.ReadOnlyKeyword, type); -} + internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); + public new CrefBracketedParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); + } -public abstract partial class XmlNodeSyntax : CSharpSyntaxNode -{ - internal XmlNodeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// An element of a BaseCrefParameterListSyntax. + /// Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, + /// an optional readonly keyword, and a type - + /// there is no name and there are no attributes or other modifiers. + /// + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class CrefParameterSyntax : CSharpSyntaxNode { - } -} + private TypeSyntax? type; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlElementSyntax : XmlNodeSyntax -{ - private XmlElementStartTagSyntax? startTag; - private SyntaxNode? content; - private XmlElementEndTagSyntax? endTag; + internal CrefParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal XmlElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken RefKindKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword; + return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; + } + } + + public SyntaxToken ReadOnlyKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public XmlElementStartTagSyntax StartTag => GetRedAtZero(ref this.startTag)!; + public TypeSyntax Type => GetRed(ref this.type, 2)!; - public SyntaxList Content => new(GetRed(ref this.content, 1)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - public XmlElementEndTagSyntax EndTag => GetRed(ref this.endTag, 2)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.startTag)!, - 1 => GetRed(ref this.content, 1)!, - 2 => GetRed(ref this.endTag, 2)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameter(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) { - 0 => this.startTag, - 1 => this.content, - 2 => this.endTag, - _ => null, - }; + if (refKindKeyword != this.RefKindKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) + { + var newNode = SyntaxFactory.CrefParameter(refKindKeyword, readOnlyKeyword, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElement(this); + public CrefParameterSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(refKindKeyword, this.ReadOnlyKeyword, this.Type); + public CrefParameterSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKindKeyword, readOnlyKeyword, this.Type); + public CrefParameterSyntax WithType(TypeSyntax type) => Update(this.RefKindKeyword, this.ReadOnlyKeyword, type); + } - public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, SyntaxList content, XmlElementEndTagSyntax endTag) + public abstract partial class XmlNodeSyntax : CSharpSyntaxNode { - if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) + internal XmlNodeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlElement(startTag, content, endTag); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - - return this; } - public XmlElementSyntax WithStartTag(XmlElementStartTagSyntax startTag) => Update(startTag, this.Content, this.EndTag); - public XmlElementSyntax WithContent(SyntaxList content) => Update(this.StartTag, content, this.EndTag); - public XmlElementSyntax WithEndTag(XmlElementEndTagSyntax endTag) => Update(this.StartTag, this.Content, endTag); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlElementSyntax : XmlNodeSyntax + { + private XmlElementStartTagSyntax? startTag; + private SyntaxNode? content; + private XmlElementEndTagSyntax? endTag; - public XmlElementSyntax AddStartTagAttributes(params XmlAttributeSyntax[] items) => WithStartTag(this.StartTag.WithAttributes(this.StartTag.Attributes.AddRange(items))); - public XmlElementSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); -} + internal XmlElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode -{ - private XmlNameSyntax? name; - private SyntaxNode? attributes; + public XmlElementStartTagSyntax StartTag => GetRedAtZero(ref this.startTag)!; - internal XmlElementStartTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 1)); - public SyntaxToken LessThanToken => new(this, ((InternalSyntax.XmlElementStartTagSyntax)this.Green).lessThanToken, Position, 0); + public XmlElementEndTagSyntax EndTag => GetRed(ref this.endTag, 2)!; - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.startTag)!, + 1 => GetRed(ref this.content, 1)!, + 2 => GetRed(ref this.endTag, 2)!, + _ => null, + }; - public SyntaxList Attributes => new(GetRed(ref this.attributes, 2)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.startTag, + 1 => this.content, + 2 => this.endTag, + _ => null, + }; - public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.XmlElementStartTagSyntax)this.Green).greaterThanToken, GetChildPosition(3), GetChildIndex(3)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElement(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, SyntaxList content, XmlElementEndTagSyntax endTag) { - 1 => GetRed(ref this.name, 1)!, - 2 => GetRed(ref this.attributes, 2)!, - _ => null, - }; + if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) + { + var newNode = SyntaxFactory.XmlElement(startTag, content, endTag); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.name, - 2 => this.attributes, - _ => null, - }; + return this; + } + + public XmlElementSyntax WithStartTag(XmlElementStartTagSyntax startTag) => Update(startTag, this.Content, this.EndTag); + public XmlElementSyntax WithContent(SyntaxList content) => Update(this.StartTag, content, this.EndTag); + public XmlElementSyntax WithEndTag(XmlElementEndTagSyntax endTag) => Update(this.StartTag, this.Content, endTag); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementStartTag(this); + public XmlElementSyntax AddStartTagAttributes(params XmlAttributeSyntax[] items) => WithStartTag(this.StartTag.WithAttributes(this.StartTag.Attributes.AddRange(items))); + public XmlElementSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); + } - public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken greaterThanToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode { - if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) + private XmlNameSyntax? name; + private SyntaxNode? attributes; + + internal XmlElementStartTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.XmlElementStartTagSyntax)this.Green).lessThanToken, Position, 0); - public XmlElementStartTagSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.GreaterThanToken); - public XmlElementStartTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.GreaterThanToken); - public XmlElementStartTagSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.GreaterThanToken); - public XmlElementStartTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, greaterThanToken); + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public XmlElementStartTagSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); -} + public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode -{ - private XmlNameSyntax? name; + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlElementStartTagSyntax)this.Green).greaterThanToken, GetChildPosition(3), GetChildIndex(3)); - internal XmlElementEndTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.name, 1)!, + 2 => GetRed(ref this.attributes, 2)!, + _ => null, + }; - public SyntaxToken LessThanSlashToken => new(this, ((InternalSyntax.XmlElementEndTagSyntax)this.Green).lessThanSlashToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.name, + 2 => this.attributes, + _ => null, + }; - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementStartTag(this); - public SyntaxToken GreaterThanToken => new(this, ((InternalSyntax.XmlElementEndTagSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) + { + var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + public XmlElementStartTagSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.GreaterThanToken); + public XmlElementStartTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.GreaterThanToken); + public XmlElementStartTagSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.GreaterThanToken); + public XmlElementStartTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, greaterThanToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementEndTag(this); + public XmlElementStartTagSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); + } - public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode { - if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken) + private XmlNameSyntax? name; + + internal XmlElementEndTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public XmlElementEndTagSyntax WithLessThanSlashToken(SyntaxToken lessThanSlashToken) => Update(lessThanSlashToken, this.Name, this.GreaterThanToken); - public XmlElementEndTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanSlashToken, name, this.GreaterThanToken); - public XmlElementEndTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanSlashToken, this.Name, greaterThanToken); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax -{ - private XmlNameSyntax? name; - private SyntaxNode? attributes; + public SyntaxToken LessThanSlashToken => new SyntaxToken(this, ((InternalSyntax.XmlElementEndTagSyntax)this.Green).lessThanSlashToken, Position, 0); - internal XmlEmptyElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public SyntaxToken LessThanToken => new(this, ((InternalSyntax.XmlEmptyElementSyntax)this.Green).lessThanToken, Position, 0); + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlElementEndTagSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; - public SyntaxList Attributes => new(GetRed(ref this.attributes, 2)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; - public SyntaxToken SlashGreaterThanToken => new(this, ((InternalSyntax.XmlEmptyElementSyntax)this.Green).slashGreaterThanToken, GetChildPosition(3), GetChildIndex(3)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementEndTag(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) { - 1 => GetRed(ref this.name, 1)!, - 2 => GetRed(ref this.attributes, 2)!, - _ => null, - }; + if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken) + { + var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.name, - 2 => this.attributes, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlEmptyElement(this); + public XmlElementEndTagSyntax WithLessThanSlashToken(SyntaxToken lessThanSlashToken) => Update(lessThanSlashToken, this.Name, this.GreaterThanToken); + public XmlElementEndTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanSlashToken, name, this.GreaterThanToken); + public XmlElementEndTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanSlashToken, this.Name, greaterThanToken); + } - public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken slashGreaterThanToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax { - if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) + private XmlNameSyntax? name; + private SyntaxNode? attributes; + + internal XmlEmptyElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.XmlEmptyElementSyntax)this.Green).lessThanToken, Position, 0); - public XmlEmptyElementSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.SlashGreaterThanToken); - public XmlEmptyElementSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.SlashGreaterThanToken); - public XmlEmptyElementSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.SlashGreaterThanToken); - public XmlEmptyElementSyntax WithSlashGreaterThanToken(SyntaxToken slashGreaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, slashGreaterThanToken); + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public XmlEmptyElementSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); -} + public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlNameSyntax : CSharpSyntaxNode -{ - private XmlPrefixSyntax? prefix; + public SyntaxToken SlashGreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlEmptyElementSyntax)this.Green).slashGreaterThanToken, GetChildPosition(3), GetChildIndex(3)); - internal XmlNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.name, 1)!, + 2 => GetRed(ref this.attributes, 2)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.name, + 2 => this.attributes, + _ => null, + }; - public XmlPrefixSyntax? Prefix => GetRedAtZero(ref this.prefix); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlEmptyElement(this); - public SyntaxToken LocalName => new(this, ((InternalSyntax.XmlNameSyntax)this.Green).localName, GetChildPosition(1), GetChildIndex(1)); + public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken slashGreaterThanToken) + { + if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) + { + var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.prefix) : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.prefix : null; + public XmlEmptyElementSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.SlashGreaterThanToken); + public XmlEmptyElementSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.SlashGreaterThanToken); + public XmlEmptyElementSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.SlashGreaterThanToken); + public XmlEmptyElementSyntax WithSlashGreaterThanToken(SyntaxToken slashGreaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, slashGreaterThanToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlName(this); + public XmlEmptyElementSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); + } - public XmlNameSyntax Update(XmlPrefixSyntax? prefix, SyntaxToken localName) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlNameSyntax : CSharpSyntaxNode { - if (prefix != this.Prefix || localName != this.LocalName) + private XmlPrefixSyntax? prefix; + + internal XmlNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlName(prefix, localName); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public XmlNameSyntax WithPrefix(XmlPrefixSyntax? prefix) => Update(prefix, this.LocalName); - public XmlNameSyntax WithLocalName(SyntaxToken localName) => Update(this.Prefix, localName); -} + public XmlPrefixSyntax? Prefix => GetRedAtZero(ref this.prefix); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlPrefixSyntax : CSharpSyntaxNode -{ + public SyntaxToken LocalName => new SyntaxToken(this, ((InternalSyntax.XmlNameSyntax)this.Green).localName, GetChildPosition(1), GetChildIndex(1)); - internal XmlPrefixSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.prefix) : null; - public SyntaxToken Prefix => new(this, ((InternalSyntax.XmlPrefixSyntax)this.Green).prefix, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.prefix : null; - public SyntaxToken ColonToken => new(this, ((InternalSyntax.XmlPrefixSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlName(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public XmlNameSyntax Update(XmlPrefixSyntax? prefix, SyntaxToken localName) + { + if (prefix != this.Prefix || localName != this.LocalName) + { + var newNode = SyntaxFactory.XmlName(prefix, localName); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlPrefix(this); + public XmlNameSyntax WithPrefix(XmlPrefixSyntax? prefix) => Update(prefix, this.LocalName); + public XmlNameSyntax WithLocalName(SyntaxToken localName) => Update(this.Prefix, localName); + } - public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlPrefixSyntax : CSharpSyntaxNode { - if (prefix != this.Prefix || colonToken != this.ColonToken) + + internal XmlPrefixSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public SyntaxToken Prefix => new SyntaxToken(this, ((InternalSyntax.XmlPrefixSyntax)this.Green).prefix, Position, 0); - public XmlPrefixSyntax WithPrefix(SyntaxToken prefix) => Update(prefix, this.ColonToken); - public XmlPrefixSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Prefix, colonToken); -} + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.XmlPrefixSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); -public abstract partial class XmlAttributeSyntax : CSharpSyntaxNode -{ - internal XmlAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - public abstract XmlNameSyntax Name { get; } - public XmlAttributeSyntax WithName(XmlNameSyntax name) => WithNameCore(name); - internal abstract XmlAttributeSyntax WithNameCore(XmlNameSyntax name); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public abstract SyntaxToken EqualsToken { get; } - public XmlAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => WithEqualsTokenCore(equalsToken); - internal abstract XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlPrefix(this); - public abstract SyntaxToken StartQuoteToken { get; } - public XmlAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => WithStartQuoteTokenCore(startQuoteToken); - internal abstract XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken); + public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken) + { + if (prefix != this.Prefix || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public abstract SyntaxToken EndQuoteToken { get; } - public XmlAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => WithEndQuoteTokenCore(endQuoteToken); - internal abstract XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken); -} + return this; + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax -{ - private XmlNameSyntax? name; + public XmlPrefixSyntax WithPrefix(SyntaxToken prefix) => Update(prefix, this.ColonToken); + public XmlPrefixSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Prefix, colonToken); + } - internal XmlTextAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public abstract partial class XmlAttributeSyntax : CSharpSyntaxNode { + internal XmlAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public abstract XmlNameSyntax Name { get; } + public XmlAttributeSyntax WithName(XmlNameSyntax name) => WithNameCore(name); + internal abstract XmlAttributeSyntax WithNameCore(XmlNameSyntax name); + + public abstract SyntaxToken EqualsToken { get; } + public XmlAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => WithEqualsTokenCore(equalsToken); + internal abstract XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken); + + public abstract SyntaxToken StartQuoteToken { get; } + public XmlAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => WithStartQuoteTokenCore(startQuoteToken); + internal abstract XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken); + + public abstract SyntaxToken EndQuoteToken { get; } + public XmlAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => WithEndQuoteTokenCore(endQuoteToken); + internal abstract XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken); } - public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax + { + private XmlNameSyntax? name; - public override SyntaxToken EqualsToken => new(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + internal XmlTextAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken StartQuoteToken => new(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public SyntaxTokenList TextTokens => this.Green.GetSlot(3) is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + public override SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndQuoteToken => new(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + public SyntaxTokenList TextTokens + { + get + { + var slot = this.Green.GetSlot(3); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlTextAttribute(this); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, SyntaxTokenList textTokens, SyntaxToken endQuoteToken) - { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlTextAttribute(this); + + public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, SyntaxTokenList textTokens, SyntaxToken endQuoteToken) { - var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) + { + var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); + public new XmlTextAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); + public new XmlTextAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); + internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); + public new XmlTextAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.TextTokens, this.EndQuoteToken); + public XmlTextAttributeSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, textTokens, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); + public new XmlTextAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, endQuoteToken); + + public XmlTextAttributeSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); } - internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); - public new XmlTextAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); - public new XmlTextAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); - internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); - public new XmlTextAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.TextTokens, this.EndQuoteToken); - public XmlTextAttributeSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, textTokens, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); - public new XmlTextAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, endQuoteToken); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax + { + private XmlNameSyntax? name; + private CrefSyntax? cref; - public XmlTextAttributeSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); -} + internal XmlCrefAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax -{ - private XmlNameSyntax? name; - private CrefSyntax? cref; + public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - internal XmlCrefAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; + public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EqualsToken => new(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public CrefSyntax Cref => GetRed(ref this.cref, 3)!; - public override SyntaxToken StartQuoteToken => new(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); - public CrefSyntax Cref => GetRed(ref this.cref, 3)!; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.name)!, + 3 => GetRed(ref this.cref, 3)!, + _ => null, + }; - public override SyntaxToken EndQuoteToken => new(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 3 => this.cref, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 3 => GetRed(ref this.cref, 3)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCrefAttribute(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch + public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) { - 0 => this.name, - 3 => this.cref, - _ => null, - }; + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken) + { + var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCrefAttribute(this); + return this; + } + + internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); + public new XmlCrefAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); + public new XmlCrefAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); + internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); + public new XmlCrefAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Cref, this.EndQuoteToken); + public XmlCrefAttributeSyntax WithCref(CrefSyntax cref) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, cref, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); + public new XmlCrefAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Cref, endQuoteToken); + } - public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken) + private XmlNameSyntax? name; + private IdentifierNameSyntax? identifier; + + internal XmlNameAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); - public new XmlCrefAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); - public new XmlCrefAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); - internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); - public new XmlCrefAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Cref, this.EndQuoteToken); - public XmlCrefAttributeSyntax WithCref(CrefSyntax cref) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, cref, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); - public new XmlCrefAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Cref, endQuoteToken); -} + public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax -{ - private XmlNameSyntax? name; - private IdentifierNameSyntax? identifier; + public override SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - internal XmlNameAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); - public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; + public IdentifierNameSyntax Identifier => GetRed(ref this.identifier, 3)!; - public override SyntaxToken EqualsToken => new(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); - public override SyntaxToken StartQuoteToken => new(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.name)!, + 3 => GetRed(ref this.identifier, 3)!, + _ => null, + }; - public IdentifierNameSyntax Identifier => GetRed(ref this.identifier, 3)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 3 => this.identifier, + _ => null, + }; - public override SyntaxToken EndQuoteToken => new(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlNameAttribute(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) { - 0 => GetRedAtZero(ref this.name)!, - 3 => GetRed(ref this.identifier, 3)!, - _ => null, - }; + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken) + { + var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 3 => this.identifier, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlNameAttribute(this); + internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); + public new XmlNameAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); + public new XmlNameAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); + internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); + public new XmlNameAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Identifier, this.EndQuoteToken); + public XmlNameAttributeSyntax WithIdentifier(IdentifierNameSyntax identifier) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, identifier, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); + public new XmlNameAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Identifier, endQuoteToken); + } - public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlTextSyntax : XmlNodeSyntax { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken) + + internal XmlTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public SyntaxTokenList TextTokens + { + get + { + var slot = this.Green.GetSlot(0); + return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; + } + } - internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); - public new XmlNameAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); - public new XmlNameAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); - internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); - public new XmlNameAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Identifier, this.EndQuoteToken); - public XmlNameAttributeSyntax WithIdentifier(IdentifierNameSyntax identifier) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, identifier, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); - public new XmlNameAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Identifier, endQuoteToken); -} + internal override SyntaxNode? GetNodeSlot(int index) => null; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlTextSyntax : XmlNodeSyntax -{ + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal XmlTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlText(this); - public SyntaxTokenList TextTokens => this.Green.GetSlot(0) is { } slot ? new(this, slot, Position, 0) : default; + public XmlTextSyntax Update(SyntaxTokenList textTokens) + { + if (textTokens != this.TextTokens) + { + var newNode = SyntaxFactory.XmlText(textTokens); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + public XmlTextSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(textTokens); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlText(this); + public XmlTextSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); + } - public XmlTextSyntax Update(SyntaxTokenList textTokens) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax { - if (textTokens != this.TextTokens) + + internal XmlCDataSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlText(textTokens); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public XmlTextSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(textTokens); + public SyntaxToken StartCDataToken => new SyntaxToken(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); - public XmlTextSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); -} + public SyntaxTokenList TextTokens + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax -{ + public SyntaxToken EndCDataToken => new SyntaxToken(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); - internal XmlCDataSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - public SyntaxToken StartCDataToken => new(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public SyntaxTokenList TextTokens => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCDataSection(this); - public SyntaxToken EndCDataToken => new(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); + public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, SyntaxTokenList textTokens, SyntaxToken endCDataToken) + { + if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) + { + var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + public XmlCDataSectionSyntax WithStartCDataToken(SyntaxToken startCDataToken) => Update(startCDataToken, this.TextTokens, this.EndCDataToken); + public XmlCDataSectionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartCDataToken, textTokens, this.EndCDataToken); + public XmlCDataSectionSyntax WithEndCDataToken(SyntaxToken endCDataToken) => Update(this.StartCDataToken, this.TextTokens, endCDataToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCDataSection(this); + public XmlCDataSectionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); + } - public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, SyntaxTokenList textTokens, SyntaxToken endCDataToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax { - if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) + private XmlNameSyntax? name; + + internal XmlProcessingInstructionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public XmlCDataSectionSyntax WithStartCDataToken(SyntaxToken startCDataToken) => Update(startCDataToken, this.TextTokens, this.EndCDataToken); - public XmlCDataSectionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartCDataToken, textTokens, this.EndCDataToken); - public XmlCDataSectionSyntax WithEndCDataToken(SyntaxToken endCDataToken) => Update(this.StartCDataToken, this.TextTokens, endCDataToken); + public SyntaxToken StartProcessingInstructionToken => new SyntaxToken(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).startProcessingInstructionToken, Position, 0); - public XmlCDataSectionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); -} + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax -{ - private XmlNameSyntax? name; + public SyntaxTokenList TextTokens + { + get + { + var slot = this.Green.GetSlot(2); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + } + } - internal XmlProcessingInstructionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken EndProcessingInstructionToken => new SyntaxToken(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken StartProcessingInstructionToken => new(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).startProcessingInstructionToken, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; - public SyntaxTokenList TextTokens => this.Green.GetSlot(2) is { } slot ? new(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlProcessingInstruction(this); - public SyntaxToken EndProcessingInstructionToken => new(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); + public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, SyntaxTokenList textTokens, SyntaxToken endProcessingInstructionToken) + { + if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) + { + var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + public XmlProcessingInstructionSyntax WithStartProcessingInstructionToken(SyntaxToken startProcessingInstructionToken) => Update(startProcessingInstructionToken, this.Name, this.TextTokens, this.EndProcessingInstructionToken); + public XmlProcessingInstructionSyntax WithName(XmlNameSyntax name) => Update(this.StartProcessingInstructionToken, name, this.TextTokens, this.EndProcessingInstructionToken); + public XmlProcessingInstructionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartProcessingInstructionToken, this.Name, textTokens, this.EndProcessingInstructionToken); + public XmlProcessingInstructionSyntax WithEndProcessingInstructionToken(SyntaxToken endProcessingInstructionToken) => Update(this.StartProcessingInstructionToken, this.Name, this.TextTokens, endProcessingInstructionToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlProcessingInstruction(this); + public XmlProcessingInstructionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); + } - public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, SyntaxTokenList textTokens, SyntaxToken endProcessingInstructionToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class XmlCommentSyntax : XmlNodeSyntax { - if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) + + internal XmlCommentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public XmlProcessingInstructionSyntax WithStartProcessingInstructionToken(SyntaxToken startProcessingInstructionToken) => Update(startProcessingInstructionToken, this.Name, this.TextTokens, this.EndProcessingInstructionToken); - public XmlProcessingInstructionSyntax WithName(XmlNameSyntax name) => Update(this.StartProcessingInstructionToken, name, this.TextTokens, this.EndProcessingInstructionToken); - public XmlProcessingInstructionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartProcessingInstructionToken, this.Name, textTokens, this.EndProcessingInstructionToken); - public XmlProcessingInstructionSyntax WithEndProcessingInstructionToken(SyntaxToken endProcessingInstructionToken) => Update(this.StartProcessingInstructionToken, this.Name, this.TextTokens, endProcessingInstructionToken); + public SyntaxToken LessThanExclamationMinusMinusToken => new SyntaxToken(this, ((InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); - public XmlProcessingInstructionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); -} + public SyntaxTokenList TextTokens + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class XmlCommentSyntax : XmlNodeSyntax -{ + public SyntaxToken MinusMinusGreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); - internal XmlCommentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - public SyntaxToken LessThanExclamationMinusMinusToken => new(this, ((InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public SyntaxTokenList TextTokens => this.Green.GetSlot(1) is { } slot ? new(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlComment(this); - public SyntaxToken MinusMinusGreaterThanToken => new(this, ((InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, SyntaxTokenList textTokens, SyntaxToken minusMinusGreaterThanToken) + { + if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) + { + var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + public XmlCommentSyntax WithLessThanExclamationMinusMinusToken(SyntaxToken lessThanExclamationMinusMinusToken) => Update(lessThanExclamationMinusMinusToken, this.TextTokens, this.MinusMinusGreaterThanToken); + public XmlCommentSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.LessThanExclamationMinusMinusToken, textTokens, this.MinusMinusGreaterThanToken); + public XmlCommentSyntax WithMinusMinusGreaterThanToken(SyntaxToken minusMinusGreaterThanToken) => Update(this.LessThanExclamationMinusMinusToken, this.TextTokens, minusMinusGreaterThanToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlComment(this); + public XmlCommentSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); + } - public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, SyntaxTokenList textTokens, SyntaxToken minusMinusGreaterThanToken) + public abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax { - if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) + internal DirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public XmlCommentSyntax WithLessThanExclamationMinusMinusToken(SyntaxToken lessThanExclamationMinusMinusToken) => Update(lessThanExclamationMinusMinusToken, this.TextTokens, this.MinusMinusGreaterThanToken); - public XmlCommentSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.LessThanExclamationMinusMinusToken, textTokens, this.MinusMinusGreaterThanToken); - public XmlCommentSyntax WithMinusMinusGreaterThanToken(SyntaxToken minusMinusGreaterThanToken) => Update(this.LessThanExclamationMinusMinusToken, this.TextTokens, minusMinusGreaterThanToken); + public abstract SyntaxToken HashToken { get; } + public DirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => WithHashTokenCore(hashToken); + internal abstract DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken); - public XmlCommentSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); -} + public abstract SyntaxToken EndOfDirectiveToken { get; } + public DirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveTokenCore(endOfDirectiveToken); + internal abstract DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken); -public abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax -{ - internal DirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + public abstract bool IsActive { get; } } - public abstract SyntaxToken HashToken { get; } - public DirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => WithHashTokenCore(hashToken); - internal abstract DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken); + public abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax + { + internal BranchingDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public abstract SyntaxToken EndOfDirectiveToken { get; } - public DirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveTokenCore(endOfDirectiveToken); - internal abstract DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken); + public abstract bool BranchTaken { get; } - public abstract bool IsActive { get; } -} + public new BranchingDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (BranchingDirectiveTriviaSyntax)WithHashTokenCore(hashToken); + public new BranchingDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (BranchingDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); + } -public abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ - internal BranchingDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax { - } + internal ConditionalDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public abstract bool BranchTaken { get; } + public abstract ExpressionSyntax Condition { get; } + public ConditionalDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => WithConditionCore(condition); + internal abstract ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition); - public new BranchingDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (BranchingDirectiveTriviaSyntax)WithHashTokenCore(hashToken); - public new BranchingDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (BranchingDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); -} + public abstract bool ConditionValue { get; } + } -public abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax -{ - internal ConditionalDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax { - } + private ExpressionSyntax? condition; - public abstract ExpressionSyntax Condition { get; } - public ConditionalDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => WithConditionCore(condition); - internal abstract ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition); + internal IfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public abstract bool ConditionValue { get; } -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax -{ - private ExpressionSyntax? condition; + public SyntaxToken IfKeyword => new SyntaxToken(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); - internal IfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; - public override SyntaxToken HashToken => new(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken IfKeyword => new(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); + public override bool IsActive => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).IsActive; - public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; + public override bool BranchTaken => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).BranchTaken; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override bool ConditionValue => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ConditionValue; - public override bool IsActive => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).IsActive; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; - public override bool BranchTaken => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).BranchTaken; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; - public override bool ConditionValue => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ConditionValue; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; + public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { + if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new IfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.HashToken, ifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); + public new IfDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.IfKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new IfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.IfKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); + } - public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax { - if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) + private ExpressionSyntax? condition; + + internal ElifDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new IfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.HashToken, ifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); - public new IfDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.IfKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new IfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.IfKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax -{ - private ExpressionSyntax? condition; + public SyntaxToken ElifKeyword => new SyntaxToken(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).elifKeyword, GetChildPosition(1), GetChildIndex(1)); - internal ElifDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; - public override SyntaxToken HashToken => new(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken ElifKeyword => new(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).elifKeyword, GetChildPosition(1), GetChildIndex(1)); + public override bool IsActive => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).IsActive; - public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; + public override bool BranchTaken => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).BranchTaken; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override bool ConditionValue => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).ConditionValue; - public override bool IsActive => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).IsActive; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; - public override bool BranchTaken => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).BranchTaken; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; - public override bool ConditionValue => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).ConditionValue; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElifDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; + public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { + if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElifDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ElifDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithElifKeyword(SyntaxToken elifKeyword) => Update(this.HashToken, elifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); + public new ElifDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.ElifKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ElifDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElifKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); + } - public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax { - if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal ElseDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ElifDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithElifKeyword(SyntaxToken elifKeyword) => Update(this.HashToken, elifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); - public new ElifDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.ElifKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ElifDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElifKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax -{ + public SyntaxToken ElseKeyword => new SyntaxToken(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).elseKeyword, GetChildPosition(1), GetChildIndex(1)); - internal ElseDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override bool IsActive => ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).IsActive; - public SyntaxToken ElseKeyword => new(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).elseKeyword, GetChildPosition(1), GetChildIndex(1)); + public override bool BranchTaken => ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).BranchTaken; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override bool IsActive => ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).IsActive; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override bool BranchTaken => ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).BranchTaken; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + { + if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ElseDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); + public ElseDirectiveTriviaSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(this.HashToken, elseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ElseDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElseKeyword, endOfDirectiveToken, this.IsActive, this.BranchTaken); + public ElseDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, isActive, this.BranchTaken); + public ElseDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, branchTaken); + } - public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal EndIfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ElseDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); - public ElseDirectiveTriviaSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(this.HashToken, elseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ElseDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElseKeyword, endOfDirectiveToken, this.IsActive, this.BranchTaken); - public ElseDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, isActive, this.BranchTaken); - public ElseDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, branchTaken); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ + public SyntaxToken EndIfKeyword => new SyntaxToken(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endIfKeyword, GetChildPosition(1), GetChildIndex(1)); - internal EndIfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override bool IsActive => ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).IsActive; - public SyntaxToken EndIfKeyword => new(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endIfKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override bool IsActive => ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).IsActive; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndIfDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndIfDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new EndIfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndIfKeyword, this.EndOfDirectiveToken, this.IsActive); + public EndIfDirectiveTriviaSyntax WithEndIfKeyword(SyntaxToken endIfKeyword) => Update(this.HashToken, endIfKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new EndIfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndIfKeyword, endOfDirectiveToken, this.IsActive); + public EndIfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndIfKeyword, this.EndOfDirectiveToken, isActive); + } - public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal RegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new EndIfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndIfKeyword, this.EndOfDirectiveToken, this.IsActive); - public EndIfDirectiveTriviaSyntax WithEndIfKeyword(SyntaxToken endIfKeyword) => Update(this.HashToken, endIfKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new EndIfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndIfKeyword, endOfDirectiveToken, this.IsActive); - public EndIfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndIfKeyword, this.EndOfDirectiveToken, isActive); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ + public SyntaxToken RegionKeyword => new SyntaxToken(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).regionKeyword, GetChildPosition(1), GetChildIndex(1)); - internal RegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override bool IsActive => ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).IsActive; - public SyntaxToken RegionKeyword => new(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).regionKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override bool IsActive => ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).IsActive; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRegionDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRegionDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new RegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.RegionKeyword, this.EndOfDirectiveToken, this.IsActive); + public RegionDirectiveTriviaSyntax WithRegionKeyword(SyntaxToken regionKeyword) => Update(this.HashToken, regionKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new RegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.RegionKeyword, endOfDirectiveToken, this.IsActive); + public RegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.RegionKeyword, this.EndOfDirectiveToken, isActive); + } - public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal EndRegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new RegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.RegionKeyword, this.EndOfDirectiveToken, this.IsActive); - public RegionDirectiveTriviaSyntax WithRegionKeyword(SyntaxToken regionKeyword) => Update(this.HashToken, regionKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new RegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.RegionKeyword, endOfDirectiveToken, this.IsActive); - public RegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.RegionKeyword, this.EndOfDirectiveToken, isActive); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ + public SyntaxToken EndRegionKeyword => new SyntaxToken(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endRegionKeyword, GetChildPosition(1), GetChildIndex(1)); - internal EndRegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override bool IsActive => ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).IsActive; - public SyntaxToken EndRegionKeyword => new(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endRegionKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override bool IsActive => ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).IsActive; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndRegionDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndRegionDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new EndRegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, this.IsActive); + public EndRegionDirectiveTriviaSyntax WithEndRegionKeyword(SyntaxToken endRegionKeyword) => Update(this.HashToken, endRegionKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new EndRegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndRegionKeyword, endOfDirectiveToken, this.IsActive); + public EndRegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, isActive); + } - public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal ErrorDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new EndRegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, this.IsActive); - public EndRegionDirectiveTriviaSyntax WithEndRegionKeyword(SyntaxToken endRegionKeyword) => Update(this.HashToken, endRegionKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new EndRegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndRegionKeyword, endOfDirectiveToken, this.IsActive); - public EndRegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, isActive); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ + public SyntaxToken ErrorKeyword => new SyntaxToken(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).errorKeyword, GetChildPosition(1), GetChildIndex(1)); - internal ErrorDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override bool IsActive => ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).IsActive; - public SyntaxToken ErrorKeyword => new(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).errorKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override bool IsActive => ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).IsActive; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitErrorDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitErrorDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ErrorDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ErrorKeyword, this.EndOfDirectiveToken, this.IsActive); + public ErrorDirectiveTriviaSyntax WithErrorKeyword(SyntaxToken errorKeyword) => Update(this.HashToken, errorKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ErrorDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ErrorKeyword, endOfDirectiveToken, this.IsActive); + public ErrorDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ErrorKeyword, this.EndOfDirectiveToken, isActive); + } - public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal WarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ErrorDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ErrorKeyword, this.EndOfDirectiveToken, this.IsActive); - public ErrorDirectiveTriviaSyntax WithErrorKeyword(SyntaxToken errorKeyword) => Update(this.HashToken, errorKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ErrorDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ErrorKeyword, endOfDirectiveToken, this.IsActive); - public ErrorDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ErrorKeyword, this.EndOfDirectiveToken, isActive); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ + public SyntaxToken WarningKeyword => new SyntaxToken(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(1), GetChildIndex(1)); - internal WarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override bool IsActive => ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).IsActive; - public SyntaxToken WarningKeyword => new(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override bool IsActive => ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).IsActive; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWarningDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWarningDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new WarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.WarningKeyword, this.EndOfDirectiveToken, this.IsActive); + public WarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, warningKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new WarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.WarningKeyword, endOfDirectiveToken, this.IsActive); + public WarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.WarningKeyword, this.EndOfDirectiveToken, isActive); + } - public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal BadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new WarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.WarningKeyword, this.EndOfDirectiveToken, this.IsActive); - public WarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, warningKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new WarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.WarningKeyword, endOfDirectiveToken, this.IsActive); - public WarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.WarningKeyword, this.EndOfDirectiveToken, isActive); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal BadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override bool IsActive => ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).IsActive; - public SyntaxToken Identifier => new(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override bool IsActive => ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).IsActive; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBadDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBadDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new BadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.Identifier, this.EndOfDirectiveToken, this.IsActive); + public BadDirectiveTriviaSyntax WithIdentifier(SyntaxToken identifier) => Update(this.HashToken, identifier, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new BadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.Identifier, endOfDirectiveToken, this.IsActive); + public BadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.Identifier, this.EndOfDirectiveToken, isActive); + } - public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal DefineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new BadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.Identifier, this.EndOfDirectiveToken, this.IsActive); - public BadDirectiveTriviaSyntax WithIdentifier(SyntaxToken identifier) => Update(this.HashToken, identifier, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new BadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.Identifier, endOfDirectiveToken, this.IsActive); - public BadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.Identifier, this.EndOfDirectiveToken, isActive); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ + public SyntaxToken DefineKeyword => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).defineKeyword, GetChildPosition(1), GetChildIndex(1)); - internal DefineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken Name => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken DefineKeyword => new(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).defineKeyword, GetChildPosition(1), GetChildIndex(1)); + public override bool IsActive => ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).IsActive; - public SyntaxToken Name => new(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override bool IsActive => ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).IsActive; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefineDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefineDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new DefineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public DefineDirectiveTriviaSyntax WithDefineKeyword(SyntaxToken defineKeyword) => Update(this.HashToken, defineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public DefineDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.DefineKeyword, name, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new DefineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.DefineKeyword, this.Name, endOfDirectiveToken, this.IsActive); + public DefineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, isActive); + } - public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal UndefDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new DefineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public DefineDirectiveTriviaSyntax WithDefineKeyword(SyntaxToken defineKeyword) => Update(this.HashToken, defineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public DefineDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.DefineKeyword, name, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new DefineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.DefineKeyword, this.Name, endOfDirectiveToken, this.IsActive); - public DefineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, isActive); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ + public SyntaxToken UndefKeyword => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).undefKeyword, GetChildPosition(1), GetChildIndex(1)); - internal UndefDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken Name => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken UndefKeyword => new(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).undefKeyword, GetChildPosition(1), GetChildIndex(1)); + public override bool IsActive => ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).IsActive; - public SyntaxToken Name => new(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override bool IsActive => ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).IsActive; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUndefDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUndefDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new UndefDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public UndefDirectiveTriviaSyntax WithUndefKeyword(SyntaxToken undefKeyword) => Update(this.HashToken, undefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public UndefDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.UndefKeyword, name, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new UndefDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.UndefKeyword, this.Name, endOfDirectiveToken, this.IsActive); + public UndefDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, isActive); + } - public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + public abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) + internal LineOrSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public abstract SyntaxToken LineKeyword { get; } + public LineOrSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => WithLineKeywordCore(lineKeyword); + internal abstract LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword); - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new UndefDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public UndefDirectiveTriviaSyntax WithUndefKeyword(SyntaxToken undefKeyword) => Update(this.HashToken, undefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public UndefDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.UndefKeyword, name, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new UndefDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.UndefKeyword, this.Name, endOfDirectiveToken, this.IsActive); - public UndefDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, isActive); -} + public abstract SyntaxToken File { get; } + public LineOrSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => WithFileCore(file); + internal abstract LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file); -public abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ - internal LineOrSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + public new LineOrSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (LineOrSpanDirectiveTriviaSyntax)WithHashTokenCore(hashToken); + public new LineOrSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (LineOrSpanDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); } - public abstract SyntaxToken LineKeyword { get; } - public LineOrSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => WithLineKeywordCore(lineKeyword); - internal abstract LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword); + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax + { - public abstract SyntaxToken File { get; } - public LineOrSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => WithFileCore(file); - internal abstract LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file); + internal LineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public new LineOrSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (LineOrSpanDirectiveTriviaSyntax)WithHashTokenCore(hashToken); - public new LineOrSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (LineOrSpanDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax -{ + public override SyntaxToken LineKeyword => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); - internal LineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken Line => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken File + { + get + { + var slot = ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } - public override SyntaxToken LineKeyword => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); - public SyntaxToken Line => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); + public override bool IsActive => ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).IsActive; - public override SyntaxToken File => ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override bool IsActive => ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).IsActive; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new LineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); + public new LineDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineDirectiveTriviaSyntax WithLine(SyntaxToken line) => Update(this.HashToken, this.LineKeyword, line, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); + public new LineDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Line, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new LineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, endOfDirectiveToken, this.IsActive); + public LineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, isActive); + } - public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode { - if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal LineDirectivePositionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new LineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); - public new LineDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineDirectiveTriviaSyntax WithLine(SyntaxToken line) => Update(this.HashToken, this.LineKeyword, line, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); - public new LineDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Line, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new LineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, endOfDirectiveToken, this.IsActive); - public LineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, isActive); -} + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).openParenToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode -{ + public SyntaxToken Line => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).line, GetChildPosition(1), GetChildIndex(1)); - internal LineDirectivePositionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken CommaToken => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).commaToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken OpenParenToken => new(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken Character => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).character, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken Line => new(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).line, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - public SyntaxToken CommaToken => new(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).commaToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public SyntaxToken Character => new(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).character, GetChildPosition(3), GetChildIndex(3)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public SyntaxToken CloseParenToken => new(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectivePosition(this); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectivePosition(this); + public LineDirectivePositionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Line, this.CommaToken, this.Character, this.CloseParenToken); + public LineDirectivePositionSyntax WithLine(SyntaxToken line) => Update(this.OpenParenToken, line, this.CommaToken, this.Character, this.CloseParenToken); + public LineDirectivePositionSyntax WithCommaToken(SyntaxToken commaToken) => Update(this.OpenParenToken, this.Line, commaToken, this.Character, this.CloseParenToken); + public LineDirectivePositionSyntax WithCharacter(SyntaxToken character) => Update(this.OpenParenToken, this.Line, this.CommaToken, character, this.CloseParenToken); + public LineDirectivePositionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Line, this.CommaToken, this.Character, closeParenToken); + } - public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax { - if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken) + private LineDirectivePositionSyntax? start; + private LineDirectivePositionSyntax? end; + + internal LineSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - public LineDirectivePositionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Line, this.CommaToken, this.Character, this.CloseParenToken); - public LineDirectivePositionSyntax WithLine(SyntaxToken line) => Update(this.OpenParenToken, line, this.CommaToken, this.Character, this.CloseParenToken); - public LineDirectivePositionSyntax WithCommaToken(SyntaxToken commaToken) => Update(this.OpenParenToken, this.Line, commaToken, this.Character, this.CloseParenToken); - public LineDirectivePositionSyntax WithCharacter(SyntaxToken character) => Update(this.OpenParenToken, this.Line, this.CommaToken, character, this.CloseParenToken); - public LineDirectivePositionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Line, this.CommaToken, this.Character, closeParenToken); -} + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax -{ - private LineDirectivePositionSyntax? start; - private LineDirectivePositionSyntax? end; + public override SyntaxToken LineKeyword => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); - internal LineSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public LineDirectivePositionSyntax Start => GetRed(ref this.start, 2)!; - public override SyntaxToken HashToken => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public SyntaxToken MinusToken => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).minusToken, GetChildPosition(3), GetChildIndex(3)); - public override SyntaxToken LineKeyword => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); + public LineDirectivePositionSyntax End => GetRed(ref this.end, 4)!; - public LineDirectivePositionSyntax Start => GetRed(ref this.start, 2)!; + public SyntaxToken CharacterOffset + { + get + { + var slot = ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + } + } - public SyntaxToken MinusToken => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).minusToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); - public LineDirectivePositionSyntax End => GetRed(ref this.end, 4)!; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); - public SyntaxToken CharacterOffset => ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset is { } slot ? new(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; + public override bool IsActive => ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).IsActive; - public override SyntaxToken File => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 2 => GetRed(ref this.start, 2)!, + 4 => GetRed(ref this.end, 4)!, + _ => null, + }; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 2 => this.start, + 4 => this.end, + _ => null, + }; - public override bool IsActive => ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).IsActive; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineSpanDirectiveTrivia(this); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch + public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) { - 2 => GetRed(ref this.start, 2)!, - 4 => GetRed(ref this.end, 4)!, - _ => null, - }; + if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.start, - 4 => this.end, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineSpanDirectiveTrivia(this); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new LineSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); + public new LineSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithStart(LineDirectivePositionSyntax start) => Update(this.HashToken, this.LineKeyword, start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithMinusToken(SyntaxToken minusToken) => Update(this.HashToken, this.LineKeyword, this.Start, minusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithEnd(LineDirectivePositionSyntax end) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, end, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithCharacterOffset(SyntaxToken characterOffset) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, characterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); + public new LineSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new LineSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, endOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, isActive); + } - public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + private SyntaxNode? errorCodes; + + internal PragmaWarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new LineSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); - public new LineSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithStart(LineDirectivePositionSyntax start) => Update(this.HashToken, this.LineKeyword, start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithMinusToken(SyntaxToken minusToken) => Update(this.HashToken, this.LineKeyword, this.Start, minusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithEnd(LineDirectivePositionSyntax end) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, end, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithCharacterOffset(SyntaxToken characterOffset) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, characterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); - public new LineSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new LineSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, endOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, isActive); -} + public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ - private SyntaxNode? errorCodes; + public SyntaxToken WarningKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(2), GetChildIndex(2)); - internal PragmaWarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken DisableOrRestoreKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public SeparatedSyntaxList ErrorCodes + { + get + { + var red = GetRed(ref this.errorCodes, 4); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; + } + } - public SyntaxToken PragmaKeyword => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); - public SyntaxToken WarningKeyword => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(2), GetChildIndex(2)); + public override bool IsActive => ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).IsActive; - public SyntaxToken DisableOrRestoreKeyword => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.errorCodes, 4)! : null; - public SeparatedSyntaxList ErrorCodes => GetRed(ref this.errorCodes, 4) is { } red ? new(red, GetChildIndex(4)) : default; + internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.errorCodes : null; - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaWarningDirectiveTrivia(this); - public override bool IsActive => ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).IsActive; + public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.errorCodes, 4)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.errorCodes : null; + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new PragmaWarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, this.PragmaKeyword, warningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithDisableOrRestoreKeyword(SyntaxToken disableOrRestoreKeyword) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, disableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithErrorCodes(SeparatedSyntaxList errorCodes) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, errorCodes, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new PragmaWarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, endOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, isActive); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaWarningDirectiveTrivia(this); + public PragmaWarningDirectiveTriviaSyntax AddErrorCodes(params ExpressionSyntax[] items) => WithErrorCodes(this.ErrorCodes.AddRange(items)); + } - public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax { - if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) + + internal PragmaChecksumDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - return this; - } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new PragmaWarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, this.PragmaKeyword, warningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithDisableOrRestoreKeyword(SyntaxToken disableOrRestoreKeyword) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, disableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithErrorCodes(SeparatedSyntaxList errorCodes) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, errorCodes, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new PragmaWarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, endOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, isActive); - - public PragmaWarningDirectiveTriviaSyntax AddErrorCodes(params ExpressionSyntax[] items) => WithErrorCodes(this.ErrorCodes.AddRange(items)); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ - - internal PragmaChecksumDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override SyntaxToken HashToken => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken PragmaKeyword => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ChecksumKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).checksumKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken ChecksumKeyword => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).checksumKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).file, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken File => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).file, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Guid => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).guid, GetChildPosition(4), GetChildIndex(4)); - public SyntaxToken Guid => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).guid, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken Bytes => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).bytes, GetChildPosition(5), GetChildIndex(5)); - public SyntaxToken Bytes => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).bytes, GetChildPosition(5), GetChildIndex(5)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); + public override bool IsActive => ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).IsActive; - public override bool IsActive => ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).IsActive; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaChecksumDirectiveTrivia(this); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaChecksumDirectiveTrivia(this); - - public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken) + public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) { - var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new PragmaChecksumDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithChecksumKeyword(SyntaxToken checksumKeyword) => Update(this.HashToken, this.PragmaKeyword, checksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, file, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithGuid(SyntaxToken guid) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithBytes(SyntaxToken bytes) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, bytes, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new PragmaChecksumDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, endOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, isActive); } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new PragmaChecksumDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithChecksumKeyword(SyntaxToken checksumKeyword) => Update(this.HashToken, this.PragmaKeyword, checksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, file, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithGuid(SyntaxToken guid) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithBytes(SyntaxToken bytes) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, bytes, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new PragmaChecksumDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, endOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, isActive); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ - - internal ReferenceDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax { - } - public override SyntaxToken HashToken => new(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal ReferenceDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ReferenceKeyword => new(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).referenceKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ReferenceKeyword => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).referenceKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken File => new(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public override bool IsActive => ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReferenceDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReferenceDirectiveTrivia(this); - public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) { - var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ReferenceDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public ReferenceDirectiveTriviaSyntax WithReferenceKeyword(SyntaxToken referenceKeyword) => Update(this.HashToken, referenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public ReferenceDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.ReferenceKeyword, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ReferenceDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ReferenceKeyword, this.File, endOfDirectiveToken, this.IsActive); + public ReferenceDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, isActive); } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ReferenceDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public ReferenceDirectiveTriviaSyntax WithReferenceKeyword(SyntaxToken referenceKeyword) => Update(this.HashToken, referenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public ReferenceDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.ReferenceKeyword, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ReferenceDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ReferenceKeyword, this.File, endOfDirectiveToken, this.IsActive); - public ReferenceDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, isActive); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ - - internal LoadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax { - } - public override SyntaxToken HashToken => new(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal LoadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken LoadKeyword => new(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).loadKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken File => new(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken LoadKeyword => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).loadKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override bool IsActive => ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLoadDirectiveTrivia(this); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLoadDirectiveTrivia(this); + + public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) { - var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new LoadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public LoadDirectiveTriviaSyntax WithLoadKeyword(SyntaxToken loadKeyword) => Update(this.HashToken, loadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public LoadDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LoadKeyword, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new LoadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LoadKeyword, this.File, endOfDirectiveToken, this.IsActive); + public LoadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, isActive); } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new LoadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public LoadDirectiveTriviaSyntax WithLoadKeyword(SyntaxToken loadKeyword) => Update(this.HashToken, loadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public LoadDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LoadKeyword, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new LoadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LoadKeyword, this.File, endOfDirectiveToken, this.IsActive); - public LoadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, isActive); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ - - internal ShebangDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax { - } - public override SyntaxToken HashToken => new(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal ShebangDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ExclamationToken => new(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).exclamationToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ExclamationToken => new SyntaxToken(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).exclamationToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitShebangDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitShebangDirectiveTrivia(this); - public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken) + public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) { - var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ShebangDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ExclamationToken, this.EndOfDirectiveToken, this.IsActive); + public ShebangDirectiveTriviaSyntax WithExclamationToken(SyntaxToken exclamationToken) => Update(this.HashToken, exclamationToken, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ShebangDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ExclamationToken, endOfDirectiveToken, this.IsActive); + public ShebangDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ExclamationToken, this.EndOfDirectiveToken, isActive); } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ShebangDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ExclamationToken, this.EndOfDirectiveToken, this.IsActive); - public ShebangDirectiveTriviaSyntax WithExclamationToken(SyntaxToken exclamationToken) => Update(this.HashToken, exclamationToken, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ShebangDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ExclamationToken, endOfDirectiveToken, this.IsActive); - public ShebangDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ExclamationToken, this.EndOfDirectiveToken, isActive); -} - -/// -/// This node is associated with the following syntax kinds: -/// -/// -/// -/// -public sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax -{ - - internal NullableDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// This node is associated with the following syntax kinds: + /// + /// + /// + /// + public sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax { - } - public override SyntaxToken HashToken => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal NullableDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken NullableKeyword => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).nullableKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken SettingToken => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken NullableKeyword => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).nullableKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken TargetToken => ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken is { } slot ? new(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + public SyntaxToken SettingToken => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); + + public SyntaxToken TargetToken + { + get + { + var slot = ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } - public override SyntaxToken EndOfDirectiveToken => new(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); - public override bool IsActive => ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableDirectiveTrivia(this); - public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken) + public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) { - var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; } - return this; + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new NullableDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithNullableKeyword(SyntaxToken nullableKeyword) => Update(this.HashToken, nullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithSettingToken(SyntaxToken settingToken) => Update(this.HashToken, this.NullableKeyword, settingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithTargetToken(SyntaxToken targetToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, targetToken, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new NullableDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, endOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, isActive); } - - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new NullableDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithNullableKeyword(SyntaxToken nullableKeyword) => Update(this.HashToken, nullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithSettingToken(SyntaxToken settingToken) => Update(this.HashToken, this.NullableKeyword, settingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithTargetToken(SyntaxToken targetToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, targetToken, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new NullableDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, endOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, isActive); } diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index 519912bd8ab8b..7f7d806fd4ad5 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -218,15 +218,18 @@ private void WriteGreenType(TreeType node) WriteComment(field.PropertyComment, ""); if (IsNodeList(field.Type)) { - WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.{field.Type} {field.Name} => new(this.{CamelCase(field.Name)});"); + var type = $"CoreSyntax.{field.Type}"; + WriteLine($"public {OverrideOrNewModifier(field)}{type} {field.Name} => new {type}(this.{CamelCase(field.Name)});"); } else if (IsSeparatedNodeList(field.Type)) { - WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.{field.Type} {field.Name} => new(new(this.{CamelCase(field.Name)}));"); + var type = $"CoreSyntax.{field.Type}"; + WriteLine($"public {OverrideOrNewModifier(field)}{type} {field.Name} => new {type}(new CoreSyntax.SyntaxList(this.{CamelCase(field.Name)}));"); } else if (field.Type == "SyntaxNodeOrTokenList") { - WriteLine($"public {OverrideOrNewModifier(field)}CoreSyntax.SyntaxList {field.Name} => new(this.{CamelCase(field.Name)});"); + var type = $"CoreSyntax.SyntaxList"; + WriteLine($"public {OverrideOrNewModifier(field)}{type} {field.Name} => new {type}(this.{CamelCase(field.Name)});"); } else { From 488290fcf1f094e1f9f9306017e592ddcbef6624 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:11:19 -0800 Subject: [PATCH 074/141] Feedback --- .../Syntax.xml.Internal.Generated.cs | 306 +++++++++--------- 1 file changed, 153 insertions(+), 153 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs index a071658bfaf1a..702f4bad1a7c5 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs @@ -333,7 +333,7 @@ internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Gree /// SyntaxToken representing less than. public SyntaxToken LessThanToken => this.lessThanToken; /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. - public CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); + public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); /// SyntaxToken representing greater than. public SyntaxToken GreaterThanToken => this.greaterThanToken; @@ -592,7 +592,7 @@ internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? ran /// TypeSyntax node representing the type of the element of the array. public TypeSyntax ElementType => this.elementType; /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. - public CoreSyntax.SyntaxList RankSpecifiers => new(this.rankSpecifiers); + public CoreSyntax.SyntaxList RankSpecifiers => new CoreSyntax.SyntaxList(this.rankSpecifiers); internal override GreenNode? GetSlot(int index) => index switch @@ -684,7 +684,7 @@ internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, } public SyntaxToken OpenBracketToken => this.openBracketToken; - public CoreSyntax.SeparatedSyntaxList Sizes => new(new(this.sizes)); + public CoreSyntax.SeparatedSyntaxList Sizes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.sizes)); public SyntaxToken CloseBracketToken => this.closeBracketToken; internal override GreenNode? GetSlot(int index) @@ -967,7 +967,7 @@ internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessTha /// SyntaxToken representing the less than token. public SyntaxToken LessThanToken => this.lessThanToken; /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. - public CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); + public CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); /// SyntaxToken representing the greater than token. public SyntaxToken GreaterThanToken => this.greaterThanToken; @@ -1153,7 +1153,7 @@ internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, Sy /// SyntaxToken representing open bracket. public SyntaxToken OpenBracketToken => this.openBracketToken; /// SeparatedSyntaxList of calling convention identifiers. - public CoreSyntax.SeparatedSyntaxList CallingConventions => new(new(this.callingConventions)); + public CoreSyntax.SeparatedSyntaxList CallingConventions => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.callingConventions)); /// SyntaxToken representing close bracket. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -1394,7 +1394,7 @@ internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? /// SyntaxToken representing the open parenthesis. public SyntaxToken OpenParenToken => this.openParenToken; - public CoreSyntax.SeparatedSyntaxList Elements => new(new(this.elements)); + public CoreSyntax.SeparatedSyntaxList Elements => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.elements)); /// SyntaxToken representing the close parenthesis. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -1934,7 +1934,7 @@ internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, Gree /// SyntaxToken representing the open parenthesis. public SyntaxToken OpenParenToken => this.openParenToken; /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); + public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); /// SyntaxToken representing the close parenthesis. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -4147,7 +4147,7 @@ internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNo /// SyntaxToken representing open parenthesis. public SyntaxToken OpenParenToken => this.openParenToken; /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); + public override CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); /// SyntaxToken representing close parenthesis. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -4245,7 +4245,7 @@ internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketTok /// SyntaxToken representing open bracket. public SyntaxToken OpenBracketToken => this.openBracketToken; /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); + public override CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); /// SyntaxToken representing close bracket. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -4856,7 +4856,7 @@ internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, } } - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// SyntaxToken representing the delegate keyword. public SyntaxToken DelegateKeyword => this.delegateKeyword; /// List of parameters of the anonymous method expression, or null if there no parameters are specified. @@ -5032,8 +5032,8 @@ internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// ParameterSyntax node representing the parameter of the lambda expression. public ParameterSyntax Parameter => this.parameter; /// SyntaxToken representing equals greater than. @@ -5283,8 +5283,8 @@ internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attribu } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public TypeSyntax? ReturnType => this.returnType; /// ParameterListSyntax node representing the list of parameters for the lambda expression. public ParameterListSyntax ParameterList => this.parameterList; @@ -5399,7 +5399,7 @@ internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken /// SyntaxToken representing the open brace. public SyntaxToken OpenBraceToken => this.openBraceToken; /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. - public CoreSyntax.SeparatedSyntaxList Expressions => new(new(this.expressions)); + public CoreSyntax.SeparatedSyntaxList Expressions => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.expressions)); /// SyntaxToken representing the close brace. public SyntaxToken CloseBraceToken => this.closeBraceToken; @@ -5916,7 +5916,7 @@ internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken ne /// SyntaxToken representing the open brace. public SyntaxToken OpenBraceToken => this.openBraceToken; /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. - public CoreSyntax.SeparatedSyntaxList Initializers => new(new(this.initializers)); + public CoreSyntax.SeparatedSyntaxList Initializers => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.initializers)); /// SyntaxToken representing the close brace. public SyntaxToken CloseBraceToken => this.closeBraceToken; @@ -6129,7 +6129,7 @@ internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newK /// SyntaxToken representing the open bracket. public SyntaxToken OpenBracketToken => this.openBracketToken; /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. - public CoreSyntax.SyntaxList Commas => new(this.commas); + public CoreSyntax.SyntaxList Commas => new CoreSyntax.SyntaxList(this.commas); /// SyntaxToken representing the close bracket. public SyntaxToken CloseBracketToken => this.closeBracketToken; /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. @@ -6426,7 +6426,7 @@ internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToke public SyntaxToken OpenBracketToken => this.openBracketToken; /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. - public CoreSyntax.SeparatedSyntaxList Elements => new(new(this.elements)); + public CoreSyntax.SeparatedSyntaxList Elements => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.elements)); public SyntaxToken CloseBracketToken => this.closeBracketToken; internal override GreenNode? GetSlot(int index) @@ -6782,7 +6782,7 @@ internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClaus } } - public CoreSyntax.SyntaxList Clauses => new(this.clauses); + public CoreSyntax.SyntaxList Clauses => new CoreSyntax.SyntaxList(this.clauses); public SelectOrGroupClauseSyntax SelectOrGroup => this.selectOrGroup; public QueryContinuationSyntax? Continuation => this.continuation; @@ -7398,7 +7398,7 @@ internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenN } public SyntaxToken OrderByKeyword => this.orderByKeyword; - public CoreSyntax.SeparatedSyntaxList Orderings => new(new(this.orderings)); + public CoreSyntax.SeparatedSyntaxList Orderings => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.orderings)); internal override GreenNode? GetSlot(int index) => index switch @@ -7898,7 +7898,7 @@ internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringS /// The first part of an interpolated string, $" or $@" or $""" public SyntaxToken StringStartToken => this.stringStartToken; /// List of parts of the interpolated string, each one is either a literal part or an interpolation. - public CoreSyntax.SyntaxList Contents => new(this.contents); + public CoreSyntax.SyntaxList Contents => new CoreSyntax.SyntaxList(this.contents); /// The closing quote of the interpolated string. public SyntaxToken StringEndToken => this.stringEndToken; @@ -8591,7 +8591,7 @@ internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenTok } public SyntaxToken OpenParenToken => this.openParenToken; - public CoreSyntax.SeparatedSyntaxList Subpatterns => new(new(this.subpatterns)); + public CoreSyntax.SeparatedSyntaxList Subpatterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.subpatterns)); public SyntaxToken CloseParenToken => this.closeParenToken; internal override GreenNode? GetSlot(int index) @@ -8685,7 +8685,7 @@ internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken } public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SeparatedSyntaxList Subpatterns => new(new(this.subpatterns)); + public CoreSyntax.SeparatedSyntaxList Subpatterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.subpatterns)); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -9331,7 +9331,7 @@ internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenN } public SyntaxToken OpenBracketToken => this.openBracketToken; - public CoreSyntax.SeparatedSyntaxList Patterns => new(new(this.patterns)); + public CoreSyntax.SeparatedSyntaxList Patterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.patterns)); public SyntaxToken CloseBracketToken => this.closeBracketToken; public VariableDesignationSyntax? Designation => this.designation; @@ -9875,8 +9875,8 @@ internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Green this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public StatementSyntax Statement => this.statement; internal override GreenNode? GetSlot(int index) @@ -10001,9 +10001,9 @@ internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ope this.closeBraceToken = closeBraceToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SyntaxList Statements => new(this.statements); + public CoreSyntax.SyntaxList Statements => new CoreSyntax.SyntaxList(this.statements); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -10200,14 +10200,14 @@ internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public TypeSyntax ReturnType => this.returnType; /// Gets the identifier. public SyntaxToken Identifier => this.identifier; public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public ParameterListSyntax ParameterList => this.parameterList; - public CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); + public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); public BlockSyntax? Body => this.body; public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; /// Gets the optional semicolon token. @@ -10358,11 +10358,11 @@ internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLi this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken? AwaitKeyword => this.awaitKeyword; public SyntaxToken? UsingKeyword => this.usingKeyword; /// Gets the modifier list. - public CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public VariableDeclarationSyntax Declaration => this.declaration; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -10453,7 +10453,7 @@ internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? } public TypeSyntax Type => this.type; - public CoreSyntax.SeparatedSyntaxList Variables => new(new(this.variables)); + public CoreSyntax.SeparatedSyntaxList Variables => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.variables)); internal override GreenNode? GetSlot(int index) => index switch @@ -10864,7 +10864,7 @@ internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken ope } public SyntaxToken OpenParenToken => this.openParenToken; - public CoreSyntax.SeparatedSyntaxList Variables => new(new(this.variables)); + public CoreSyntax.SeparatedSyntaxList Variables => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.variables)); public SyntaxToken CloseParenToken => this.closeParenToken; internal override GreenNode? GetSlot(int index) @@ -10957,7 +10957,7 @@ internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, E this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public ExpressionSyntax Expression => this.expression; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -11044,7 +11044,7 @@ internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken SemicolonToken => this.semicolonToken; internal override GreenNode? GetSlot(int index) @@ -11144,7 +11144,7 @@ internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); /// Gets the identifier. public SyntaxToken Identifier => this.identifier; /// Gets a SyntaxToken that represents the colon following the statement's label. @@ -11277,7 +11277,7 @@ internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); /// /// Gets a SyntaxToken that represents the goto keyword. /// @@ -11387,7 +11387,7 @@ internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken BreakKeyword => this.breakKeyword; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -11481,7 +11481,7 @@ internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syn this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken ContinueKeyword => this.continueKeyword; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -11591,7 +11591,7 @@ internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken ReturnKeyword => this.returnKeyword; public ExpressionSyntax? Expression => this.expression; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -11703,7 +11703,7 @@ internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken ThrowKeyword => this.throwKeyword; public ExpressionSyntax? Expression => this.expression; public SyntaxToken SemicolonToken => this.semicolonToken; @@ -11822,7 +11822,7 @@ internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken YieldKeyword => this.yieldKeyword; public SyntaxToken ReturnOrBreakKeyword => this.returnOrBreakKeyword; public ExpressionSyntax? Expression => this.expression; @@ -11941,7 +11941,7 @@ internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken WhileKeyword => this.whileKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public ExpressionSyntax Condition => this.condition; @@ -12076,7 +12076,7 @@ internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTok this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken DoKeyword => this.doKeyword; public StatementSyntax Statement => this.statement; public SyntaxToken WhileKeyword => this.whileKeyword; @@ -12272,15 +12272,15 @@ internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTo this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken ForKeyword => this.forKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public VariableDeclarationSyntax? Declaration => this.declaration; - public CoreSyntax.SeparatedSyntaxList Initializers => new(new(this.initializers)); + public CoreSyntax.SeparatedSyntaxList Initializers => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.initializers)); public SyntaxToken FirstSemicolonToken => this.firstSemicolonToken; public ExpressionSyntax? Condition => this.condition; public SyntaxToken SecondSemicolonToken => this.secondSemicolonToken; - public CoreSyntax.SeparatedSyntaxList Incrementors => new(new(this.incrementors)); + public CoreSyntax.SeparatedSyntaxList Incrementors => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.incrementors)); public SyntaxToken CloseParenToken => this.closeParenToken; public StatementSyntax Statement => this.statement; @@ -12467,7 +12467,7 @@ internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public override SyntaxToken? AwaitKeyword => this.awaitKeyword; public override SyntaxToken ForEachKeyword => this.forEachKeyword; public override SyntaxToken OpenParenToken => this.openParenToken; @@ -12627,7 +12627,7 @@ internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLis this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public override SyntaxToken? AwaitKeyword => this.awaitKeyword; public override SyntaxToken ForEachKeyword => this.forEachKeyword; public override SyntaxToken OpenParenToken => this.openParenToken; @@ -12801,7 +12801,7 @@ internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken? AwaitKeyword => this.awaitKeyword; public SyntaxToken UsingKeyword => this.usingKeyword; public SyntaxToken OpenParenToken => this.openParenToken; @@ -12926,7 +12926,7 @@ internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Syntax this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken FixedKeyword => this.fixedKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public VariableDeclarationSyntax Declaration => this.declaration; @@ -13026,7 +13026,7 @@ internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synt this.block = block; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken Keyword => this.keyword; public BlockSyntax Block => this.block; @@ -13120,7 +13120,7 @@ internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta this.block = block; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken UnsafeKeyword => this.unsafeKeyword; public BlockSyntax Block => this.block; @@ -13235,7 +13235,7 @@ internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT this.statement = statement; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken LockKeyword => this.lockKeyword; public SyntaxToken OpenParenToken => this.openParenToken; public ExpressionSyntax Expression => this.expression; @@ -13375,7 +13375,7 @@ internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTok } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); /// /// Gets a SyntaxToken that represents the if keyword. /// @@ -13638,7 +13638,7 @@ internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta this.closeBraceToken = closeBraceToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); /// /// Gets a SyntaxToken that represents the switch keyword. /// @@ -13662,7 +13662,7 @@ internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, Synta /// /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. /// - public CoreSyntax.SyntaxList Sections => new(this.sections); + public CoreSyntax.SyntaxList Sections => new CoreSyntax.SyntaxList(this.sections); /// /// Gets a SyntaxToken that represents the open braces following the switch sections. /// @@ -13769,11 +13769,11 @@ internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? stat /// /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. /// - public CoreSyntax.SyntaxList Labels => new(this.labels); + public CoreSyntax.SyntaxList Labels => new CoreSyntax.SyntaxList(this.labels); /// /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. /// - public CoreSyntax.SyntaxList Statements => new(this.statements); + public CoreSyntax.SyntaxList Statements => new CoreSyntax.SyntaxList(this.statements); internal override GreenNode? GetSlot(int index) => index switch @@ -14181,7 +14181,7 @@ internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpre public ExpressionSyntax GoverningExpression => this.governingExpression; public SyntaxToken SwitchKeyword => this.switchKeyword; public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SeparatedSyntaxList Arms => new(new(this.arms)); + public CoreSyntax.SeparatedSyntaxList Arms => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arms)); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -14411,10 +14411,10 @@ internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxTo } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken TryKeyword => this.tryKeyword; public BlockSyntax Block => this.block; - public CoreSyntax.SyntaxList Catches => new(this.catches); + public CoreSyntax.SyntaxList Catches => new CoreSyntax.SyntaxList(this.catches); public FinallyClauseSyntax? Finally => this.@finally; internal override GreenNode? GetSlot(int index) @@ -14935,11 +14935,11 @@ internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? u this.endOfFileToken = endOfFileToken; } - public CoreSyntax.SyntaxList Externs => new(this.externs); - public CoreSyntax.SyntaxList Usings => new(this.usings); + public CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); + public CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); /// Gets the attribute declaration list. - public CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public CoreSyntax.SyntaxList Members => new(this.members); + public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); public SyntaxToken EndOfFileToken => this.endOfFileToken; internal override GreenNode? GetSlot(int index) @@ -15429,14 +15429,14 @@ internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; public override NameSyntax Name => this.name; public SyntaxToken OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Externs => new(this.externs); - public override CoreSyntax.SyntaxList Usings => new(this.usings); - public override CoreSyntax.SyntaxList Members => new(this.members); + public override CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); + public override CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); public SyntaxToken CloseBraceToken => this.closeBraceToken; /// Gets the optional semicolon token. public SyntaxToken? SemicolonToken => this.semicolonToken; @@ -15609,14 +15609,14 @@ internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attrib } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; public override NameSyntax Name => this.name; public SyntaxToken SemicolonToken => this.semicolonToken; - public override CoreSyntax.SyntaxList Externs => new(this.externs); - public override CoreSyntax.SyntaxList Usings => new(this.usings); - public override CoreSyntax.SyntaxList Members => new(this.members); + public override CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); + public override CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); internal override GreenNode? GetSlot(int index) => index switch @@ -15735,7 +15735,7 @@ internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, Attr /// Gets the optional construct targeted by the attribute. public AttributeTargetSpecifierSyntax? Target => this.target; /// Gets the attribute declaration list. - public CoreSyntax.SeparatedSyntaxList Attributes => new(new(this.attributes)); + public CoreSyntax.SeparatedSyntaxList Attributes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.attributes)); /// Gets the close bracket token. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -16000,7 +16000,7 @@ internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken /// Gets the open paren token. public SyntaxToken OpenParenToken => this.openParenToken; /// Gets the arguments syntax list. - public CoreSyntax.SeparatedSyntaxList Arguments => new(new(this.arguments)); + public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); /// Gets the close paren token. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -16281,7 +16281,7 @@ internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Gre /// Gets the < token. public SyntaxToken LessThanToken => this.lessThanToken; /// Gets the parameter list. - public CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); + public CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); /// Gets the > token. public SyntaxToken GreaterThanToken => this.greaterThanToken; @@ -16386,7 +16386,7 @@ internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxT } /// Gets the attribute declaration list. - public CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); public SyntaxToken? VarianceKeyword => this.varianceKeyword; /// Gets the identifier. public SyntaxToken Identifier => this.identifier; @@ -16682,17 +16682,17 @@ internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the class keyword token. public override SyntaxToken Keyword => this.keyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new(this.members); + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -16940,17 +16940,17 @@ internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the struct keyword token. public override SyntaxToken Keyword => this.keyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new(this.members); + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -17198,17 +17198,17 @@ internal InterfaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the interface keyword token. public override SyntaxToken Keyword => this.keyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new(this.members); + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -17471,17 +17471,17 @@ internal RecordDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public override SyntaxToken Keyword => this.keyword; public SyntaxToken? ClassOrStructKeyword => this.classOrStructKeyword; public override SyntaxToken Identifier => this.identifier; public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax? ParameterList => this.parameterList; public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new(this.members); + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -17682,15 +17682,15 @@ internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Green } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the enum keyword token. public SyntaxToken EnumKeyword => this.enumKeyword; public override SyntaxToken Identifier => this.identifier; public override BaseListSyntax? BaseList => this.baseList; public override SyntaxToken? OpenBraceToken => this.openBraceToken; /// Gets the members declaration list. - public CoreSyntax.SeparatedSyntaxList Members => new(new(this.members)); + public CoreSyntax.SeparatedSyntaxList Members => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.members)); public override SyntaxToken? CloseBraceToken => this.closeBraceToken; /// Gets the optional semicolon token. public override SyntaxToken? SemicolonToken => this.semicolonToken; @@ -17861,8 +17861,8 @@ internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the "delegate" keyword. public SyntaxToken DelegateKeyword => this.delegateKeyword; /// Gets the return type. @@ -17873,7 +17873,7 @@ internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G /// Gets the parameter list. public ParameterListSyntax ParameterList => this.parameterList; /// Gets the constraint clause list. - public CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); + public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); /// Gets the semicolon token. public SyntaxToken SemicolonToken => this.semicolonToken; @@ -17998,8 +17998,8 @@ internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the identifier. public SyntaxToken Identifier => this.identifier; public EqualsValueClauseSyntax? EqualsValue => this.equalsValue; @@ -18092,7 +18092,7 @@ internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? type /// Gets the colon token. public SyntaxToken ColonToken => this.colonToken; /// Gets the base type references. - public CoreSyntax.SeparatedSyntaxList Types => new(new(this.types)); + public CoreSyntax.SeparatedSyntaxList Types => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.types)); internal override GreenNode? GetSlot(int index) => index switch @@ -18352,7 +18352,7 @@ internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereK /// Gets the colon token. public SyntaxToken ColonToken => this.colonToken; /// Gets the constraints list. - public CoreSyntax.SeparatedSyntaxList Constraints => new(new(this.constraints)); + public CoreSyntax.SeparatedSyntaxList Constraints => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.constraints)); internal override GreenNode? GetSlot(int index) => index switch @@ -18799,8 +18799,8 @@ internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public override VariableDeclarationSyntax Declaration => this.declaration; public override SyntaxToken SemicolonToken => this.semicolonToken; @@ -18918,8 +18918,8 @@ internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, this.semicolonToken = semicolonToken; } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public SyntaxToken EventKeyword => this.eventKeyword; public override VariableDeclarationSyntax Declaration => this.declaration; public override SyntaxToken SemicolonToken => this.semicolonToken; @@ -19236,8 +19236,8 @@ internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the return type syntax. public TypeSyntax ReturnType => this.returnType; public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -19246,7 +19246,7 @@ internal MethodDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gre public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; public override ParameterListSyntax ParameterList => this.parameterList; /// Gets the constraint clause list. - public CoreSyntax.SyntaxList ConstraintClauses => new(this.constraintClauses); + public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); public override BlockSyntax? Body => this.body; public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; /// Gets the optional semicolon token. @@ -19461,8 +19461,8 @@ internal OperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the return type. public TypeSyntax ReturnType => this.returnType; public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -19687,8 +19687,8 @@ internal ConversionOperatorDeclarationSyntax(SyntaxKind kind, GreenNode? attribu } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the "implicit" or "explicit" token. public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -19883,8 +19883,8 @@ internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the identifier. public SyntaxToken Identifier => this.identifier; public override ParameterListSyntax ParameterList => this.parameterList; @@ -20149,8 +20149,8 @@ internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the tilde token. public SyntaxToken TildeToken => this.tildeToken; /// Gets the identifier. @@ -20374,8 +20374,8 @@ internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public override TypeSyntax Type => this.type; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; /// Gets the identifier. @@ -20629,8 +20629,8 @@ internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public SyntaxToken EventKeyword => this.eventKeyword; public override TypeSyntax Type => this.type; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; @@ -20821,8 +20821,8 @@ internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, Gr } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public override TypeSyntax Type => this.type; public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; public SyntaxToken ThisKeyword => this.thisKeyword; @@ -20929,7 +20929,7 @@ internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNo } public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SyntaxList Accessors => new(this.accessors); + public CoreSyntax.SyntaxList Accessors => new CoreSyntax.SyntaxList(this.accessors); public SyntaxToken CloseBraceToken => this.closeBraceToken; internal override GreenNode? GetSlot(int index) @@ -21080,9 +21080,9 @@ internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, G } /// Gets the attribute declaration list. - public CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); /// Gets the modifier list. - public CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); /// Gets the keyword token, or identifier if an erroneous accessor declaration. public SyntaxToken Keyword => this.keyword; /// Gets the optional body block which may be empty, but it is null if there are no braces. @@ -21205,7 +21205,7 @@ internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenN /// Gets the open paren token. public SyntaxToken OpenParenToken => this.openParenToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); /// Gets the close paren token. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -21302,7 +21302,7 @@ internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketTo /// Gets the open bracket token. public SyntaxToken OpenBracketToken => this.openBracketToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); /// Gets the close bracket token. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -21461,9 +21461,9 @@ internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? } /// Gets the attribute declaration list. - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); /// Gets the modifier list. - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public override TypeSyntax? Type => this.type; /// Gets the identifier. public SyntaxToken Identifier => this.identifier; @@ -21572,9 +21572,9 @@ internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLis } /// Gets the attribute declaration list. - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); /// Gets the modifier list. - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public override TypeSyntax Type => this.type; internal override GreenNode? GetSlot(int index) @@ -21685,8 +21685,8 @@ internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, Gree } } - public override CoreSyntax.SyntaxList AttributeLists => new(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new(this.modifiers); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); public TypeSyntax? Type => this.type; internal override GreenNode? GetSlot(int index) @@ -21765,7 +21765,7 @@ internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) } } - public CoreSyntax.SyntaxList Tokens => new(this.tokens); + public CoreSyntax.SyntaxList Tokens => new CoreSyntax.SyntaxList(this.tokens); internal override GreenNode? GetSlot(int index) => index == 0 ? this.tokens : null; @@ -21844,7 +21844,7 @@ internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, S this.endOfComment = endOfComment; } - public CoreSyntax.SyntaxList Content => new(this.content); + public CoreSyntax.SyntaxList Content => new CoreSyntax.SyntaxList(this.content); public SyntaxToken EndOfComment => this.endOfComment; internal override GreenNode? GetSlot(int index) @@ -22583,7 +22583,7 @@ internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, Gr /// Gets the open paren token. public SyntaxToken OpenParenToken => this.openParenToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); /// Gets the close paren token. public SyntaxToken CloseParenToken => this.closeParenToken; @@ -22682,7 +22682,7 @@ internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBrack /// Gets the open bracket token. public SyntaxToken OpenBracketToken => this.openBracketToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new(new(this.parameters)); + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); /// Gets the close bracket token. public SyntaxToken CloseBracketToken => this.closeBracketToken; @@ -22899,7 +22899,7 @@ internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, Gr } public XmlElementStartTagSyntax StartTag => this.startTag; - public CoreSyntax.SyntaxList Content => new(this.content); + public CoreSyntax.SyntaxList Content => new CoreSyntax.SyntaxList(this.content); public XmlElementEndTagSyntax EndTag => this.endTag; internal override GreenNode? GetSlot(int index) @@ -23001,7 +23001,7 @@ internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, Xm public SyntaxToken LessThanToken => this.lessThanToken; public XmlNameSyntax Name => this.name; - public CoreSyntax.SyntaxList Attributes => new(this.attributes); + public CoreSyntax.SyntaxList Attributes => new CoreSyntax.SyntaxList(this.attributes); public SyntaxToken GreaterThanToken => this.greaterThanToken; internal override GreenNode? GetSlot(int index) @@ -23189,7 +23189,7 @@ internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNa public SyntaxToken LessThanToken => this.lessThanToken; public XmlNameSyntax Name => this.name; - public CoreSyntax.SyntaxList Attributes => new(this.attributes); + public CoreSyntax.SyntaxList Attributes => new CoreSyntax.SyntaxList(this.attributes); public SyntaxToken SlashGreaterThanToken => this.slashGreaterThanToken; internal override GreenNode? GetSlot(int index) @@ -23482,7 +23482,7 @@ internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken public override XmlNameSyntax Name => this.name; public override SyntaxToken EqualsToken => this.equalsToken; public override SyntaxToken StartQuoteToken => this.startQuoteToken; - public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); public override SyntaxToken EndQuoteToken => this.endQuoteToken; internal override GreenNode? GetSlot(int index) @@ -23769,7 +23769,7 @@ internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) } } - public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); internal override GreenNode? GetSlot(int index) => index == 0 ? this.textTokens : null; @@ -23856,7 +23856,7 @@ internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, Gre } public SyntaxToken StartCDataToken => this.startCDataToken; - public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); public SyntaxToken EndCDataToken => this.endCDataToken; internal override GreenNode? GetSlot(int index) @@ -23958,7 +23958,7 @@ internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProces public SyntaxToken StartProcessingInstructionToken => this.startProcessingInstructionToken; public XmlNameSyntax Name => this.name; - public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); public SyntaxToken EndProcessingInstructionToken => this.endProcessingInstructionToken; internal override GreenNode? GetSlot(int index) @@ -24053,7 +24053,7 @@ internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusM } public SyntaxToken LessThanExclamationMinusMinusToken => this.lessThanExclamationMinusMinusToken; - public CoreSyntax.SyntaxList TextTokens => new(this.textTokens); + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); public SyntaxToken MinusMinusGreaterThanToken => this.minusMinusGreaterThanToken; internal override GreenNode? GetSlot(int index) @@ -25660,7 +25660,7 @@ internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashTok public SyntaxToken PragmaKeyword => this.pragmaKeyword; public SyntaxToken WarningKeyword => this.warningKeyword; public SyntaxToken DisableOrRestoreKeyword => this.disableOrRestoreKeyword; - public CoreSyntax.SeparatedSyntaxList ErrorCodes => new(new(this.errorCodes)); + public CoreSyntax.SeparatedSyntaxList ErrorCodes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.errorCodes)); public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; public override bool IsActive => this.isActive; From b4a47c219600b15f1db7e946bacad98b522aa423 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:13:40 -0800 Subject: [PATCH 075/141] lint --- .../SolutionCrawler/UnitTestingSolutionCrawlerTimeSpan.cs | 1 - ...WorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs | 4 ---- .../UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs | 2 -- 3 files changed, 7 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerTimeSpan.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerTimeSpan.cs index c533057f1567f..4cc87969b7b3c 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerTimeSpan.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerTimeSpan.cs @@ -8,7 +8,6 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler { internal static class UnitTestingSolutionCrawlerTimeSpan { - public static readonly TimeSpan ActiveFileWorkerBackOff = TimeSpan.FromMilliseconds(100); public static readonly TimeSpan AllFilesWorkerBackOff = TimeSpan.FromMilliseconds(1500); public static readonly TimeSpan EntireProjectWorkerBackOff = TimeSpan.FromMilliseconds(5000); public static readonly TimeSpan SemanticChangeBackOff = TimeSpan.FromMilliseconds(100); diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs index 9b67fb3ccc9a5..e24fa53807cfb 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs @@ -5,18 +5,15 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.LanguageService; using Microsoft.CodeAnalysis.Notification; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Roslyn.Utilities; @@ -48,7 +45,6 @@ public UnitTestingIncrementalAnalyzerProcessor( IAsynchronousOperationListener listener, IEnumerable> analyzerProviders, UnitTestingRegistration registration, - TimeSpan highBackOffTimeSpan, TimeSpan normalBackOffTimeSpan, TimeSpan lowBackOffTimeSpan, CancellationToken shutdownToken) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs index f7ffc6b99a74c..82dc540ca8853 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.cs @@ -51,7 +51,6 @@ public UnitTestingWorkCoordinator( _eventProcessingQueue = new TaskQueue(listener, TaskScheduler.Default); - var activeFileBackOffTimeSpan = UnitTestingSolutionCrawlerTimeSpan.ActiveFileWorkerBackOff; var allFilesWorkerBackOffTimeSpan = UnitTestingSolutionCrawlerTimeSpan.AllFilesWorkerBackOff; var entireProjectWorkerBackOffTimeSpan = UnitTestingSolutionCrawlerTimeSpan.EntireProjectWorkerBackOff; @@ -59,7 +58,6 @@ public UnitTestingWorkCoordinator( listener, analyzerProviders, _registration, - activeFileBackOffTimeSpan, allFilesWorkerBackOffTimeSpan, entireProjectWorkerBackOffTimeSpan, _shutdownToken); From 09c467ece2bb700a1de473ca93d39d4016efad33 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:15:07 -0800 Subject: [PATCH 076/141] lint --- .../API/NewUnitTestingIncrementalAnalyzerProvider.cs | 2 +- .../SolutionCrawler/IUnitTestingSolutionCrawlerService.cs | 2 +- .../UnitTestingSolutionCrawlerRegistrationService.cs | 2 +- .../SolutionCrawler/UnitTestingSolutionCrawlerService.cs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs index 0684e55d240bb..5f7c354402ad6 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/NewUnitTestingIncrementalAnalyzerProvider.cs @@ -37,7 +37,7 @@ public void Reanalyze() { var solutionCrawlerService = _services.GetService(); solutionCrawlerService?.Reanalyze( - _workspaceKind, _services, this.CreateIncrementalAnalyzer(), projectIds: null, documentIds: null, highPriority: false); + _workspaceKind, _services, this.CreateIncrementalAnalyzer(), projectIds: null, documentIds: null); } public static NewUnitTestingIncrementalAnalyzerProvider? TryRegister(string? workspaceKind, SolutionServices services, string analyzerName, INewUnitTestingIncrementalAnalyzerProviderImplementation provider) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingSolutionCrawlerService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingSolutionCrawlerService.cs index 4166e76b4612a..ea6c0ca6fb669 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingSolutionCrawlerService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/IUnitTestingSolutionCrawlerService.cs @@ -16,7 +16,7 @@ internal interface IUnitTestingSolutionCrawlerService : IWorkspaceService /// Ask solution crawler to re-analyze given s or/and s /// in given with given . /// - void Reanalyze(string? workspaceKind, SolutionServices services, IUnitTestingIncrementalAnalyzer analyzer, IEnumerable? projectIds = null, IEnumerable? documentIds = null, bool highPriority = false); + void Reanalyze(string? workspaceKind, SolutionServices services, IUnitTestingIncrementalAnalyzer analyzer, IEnumerable? projectIds = null, IEnumerable? documentIds = null); /// /// Get for the given diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs index 5ff0bfba29467..1af762c1230ee 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerRegistrationService.cs @@ -125,7 +125,7 @@ public void AddAnalyzerProvider(IUnitTestingIncrementalAnalyzerProvider provider } } - public void Reanalyze(string? workspaceKind, SolutionServices services, IUnitTestingIncrementalAnalyzer analyzer, IEnumerable? projectIds, IEnumerable? documentIds, bool highPriority) + public void Reanalyze(string? workspaceKind, SolutionServices services, IUnitTestingIncrementalAnalyzer analyzer, IEnumerable? projectIds, IEnumerable? documentIds) { Contract.ThrowIfNull(workspaceKind); diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerService.cs index 58f8e4c4896c0..9013b7a3df22c 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerService.cs @@ -28,12 +28,12 @@ public UnitTestingSolutionCrawlerService() { } - public void Reanalyze(string? workspaceKind, SolutionServices services, IUnitTestingIncrementalAnalyzer analyzer, IEnumerable? projectIds = null, IEnumerable? documentIds = null, bool highPriority = false) + public void Reanalyze(string? workspaceKind, SolutionServices services, IUnitTestingIncrementalAnalyzer analyzer, IEnumerable? projectIds = null, IEnumerable? documentIds = null) { // if solution crawler doesn't exist for the given workspace. don't do anything if (services.GetService() is UnitTestingSolutionCrawlerRegistrationService registration) { - registration.Reanalyze(workspaceKind, services, analyzer, projectIds, documentIds, highPriority); + registration.Reanalyze(workspaceKind, services, analyzer, projectIds, documentIds); } } From 24d62984a73b6062fe6d12f076dbffdd53388bae Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:15:48 -0800 Subject: [PATCH 077/141] lint --- .../SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs | 2 +- ...TestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs index bf682e4f7f563..63493a290eb1f 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingSolutionCrawlerLogger.cs @@ -183,7 +183,7 @@ public static void LogHigherPriority(CountLogAggregator logAggregator, G public static void LogResetStates(CountLogAggregator logAggregator) => logAggregator.IncreaseCount(ResetStates); - public static void LogIncrementalAnalyzerProcessorStatistics(int correlationId, Solution solution, CountLogAggregator logAggregator, ImmutableArray analyzers) + public static void LogIncrementalAnalyzerProcessorStatistics(int correlationId, Solution solution, CountLogAggregator logAggregator) { Logger.Log(FunctionId.IncrementalAnalyzerProcessor_Shutdown, KeyValueLogMessage.Create(m => { diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs index 8ac4ec060ef2e..3d60315a4a5c7 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs @@ -425,7 +425,7 @@ void ResetLogAggregatorIfNeeded(Solution currentSolution, Solution? oldSolution) // all accumultation is done in VS side and we only send statistics to VS telemetry otherwise, it is too much // data to send UnitTestingSolutionCrawlerLogger.LogIncrementalAnalyzerProcessorStatistics( - Processor._registration.CorrelationId, oldSolution, Processor._logAggregator, Analyzers); + Processor._registration.CorrelationId, oldSolution, Processor._logAggregator); Processor.ResetLogAggregator(); } From 7d4c37e819f7adfa34af97aed32a129f2151b54b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:21:25 -0800 Subject: [PATCH 078/141] lint --- .../MockDocumentNavigationServiceFactory.cs | 48 ++++++++----------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/src/VisualStudio/LiveShare/Test/MockDocumentNavigationServiceFactory.cs b/src/VisualStudio/LiveShare/Test/MockDocumentNavigationServiceFactory.cs index 99a8f8107fb06..0e4a8e44e5ce8 100644 --- a/src/VisualStudio/LiveShare/Test/MockDocumentNavigationServiceFactory.cs +++ b/src/VisualStudio/LiveShare/Test/MockDocumentNavigationServiceFactory.cs @@ -13,40 +13,30 @@ using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; -namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests -{ - using Workspace = CodeAnalysis.Workspace; - - [ExportWorkspaceServiceFactory(typeof(IDocumentNavigationService), ServiceLayer.Test), Shared, PartNotDiscoverable] - internal class MockDocumentNavigationServiceFactory : IWorkspaceServiceFactory - { - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public MockDocumentNavigationServiceFactory() - { - } - - public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) - { - return new MockDocumentNavigationService(); - } +namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests; - private class MockDocumentNavigationService : IDocumentNavigationService - { - public Task CanNavigateToLineAndOffsetAsync(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) => SpecializedTasks.True; +using Workspace = CodeAnalysis.Workspace; - public Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) => SpecializedTasks.True; +[ExportWorkspaceServiceFactory(typeof(IDocumentNavigationService), ServiceLayer.Test), Shared, PartNotDiscoverable] +[method: ImportingConstructor] +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] +internal sealed class MockDocumentNavigationServiceFactory() : IWorkspaceServiceFactory +{ + public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) + { + return new MockDocumentNavigationService(); + } - public Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) => SpecializedTasks.True; + private class MockDocumentNavigationService : IDocumentNavigationService + { + public Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) => SpecializedTasks.True; - public Task GetLocationForLineAndOffsetAsync(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) - => NavigableLocation.TestAccessor.Create(true); + public Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) => SpecializedTasks.True; - public Task GetLocationForPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) - => NavigableLocation.TestAccessor.Create(true); + public Task GetLocationForPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) + => NavigableLocation.TestAccessor.Create(true); - public Task GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) - => NavigableLocation.TestAccessor.Create(true); - } + public Task GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) + => NavigableLocation.TestAccessor.Create(true); } } From 4454018600879ac06f066be6bdf3155924bea4d0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:22:29 -0800 Subject: [PATCH 079/141] Simplify --- .../MockDocumentNavigationServiceFactory.cs | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/VisualStudio/LiveShare/Test/MockDocumentNavigationServiceFactory.cs b/src/VisualStudio/LiveShare/Test/MockDocumentNavigationServiceFactory.cs index 0e4a8e44e5ce8..bc55ce15d78de 100644 --- a/src/VisualStudio/LiveShare/Test/MockDocumentNavigationServiceFactory.cs +++ b/src/VisualStudio/LiveShare/Test/MockDocumentNavigationServiceFactory.cs @@ -7,7 +7,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Navigation; using Microsoft.CodeAnalysis.Text; @@ -17,26 +16,20 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests; using Workspace = CodeAnalysis.Workspace; -[ExportWorkspaceServiceFactory(typeof(IDocumentNavigationService), ServiceLayer.Test), Shared, PartNotDiscoverable] +[ExportWorkspaceService(typeof(IDocumentNavigationService), ServiceLayer.Test), Shared, PartNotDiscoverable] [method: ImportingConstructor] [method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] -internal sealed class MockDocumentNavigationServiceFactory() : IWorkspaceServiceFactory +internal sealed class MockDocumentNavigationService() : IDocumentNavigationService { - public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) - { - return new MockDocumentNavigationService(); - } + public Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) + => SpecializedTasks.True; - private class MockDocumentNavigationService : IDocumentNavigationService - { - public Task CanNavigateToPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) => SpecializedTasks.True; + public Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) + => SpecializedTasks.True; - public Task CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) => SpecializedTasks.True; + public Task GetLocationForPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) + => NavigableLocation.TestAccessor.Create(true); - public Task GetLocationForPositionAsync(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) - => NavigableLocation.TestAccessor.Create(true); - - public Task GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) - => NavigableLocation.TestAccessor.Create(true); - } + public Task GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) + => NavigableLocation.TestAccessor.Create(true); } From 2af6671fe1a9c1f74a211b587c359f866a18ef45 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 8 Dec 2023 13:23:22 -0800 Subject: [PATCH 080/141] Simplify --- .../AbstractLiveShareRequestHandlerTests.cs | 86 +++++++++---------- 1 file changed, 41 insertions(+), 45 deletions(-) diff --git a/src/VisualStudio/LiveShare/Test/AbstractLiveShareRequestHandlerTests.cs b/src/VisualStudio/LiveShare/Test/AbstractLiveShareRequestHandlerTests.cs index 38d45f556eea8..eff2a8e380986 100644 --- a/src/VisualStudio/LiveShare/Test/AbstractLiveShareRequestHandlerTests.cs +++ b/src/VisualStudio/LiveShare/Test/AbstractLiveShareRequestHandlerTests.cs @@ -17,67 +17,63 @@ using Roslyn.Test.Utilities; using Xunit.Abstractions; -namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests +namespace Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests; + +public abstract class AbstractLiveShareRequestHandlerTests(ITestOutputHelper testOutputHelper) + : AbstractLanguageServerProtocolTests(testOutputHelper) { - public abstract class AbstractLiveShareRequestHandlerTests : AbstractLanguageServerProtocolTests + private static readonly TestComposition s_composition = LiveShareTestCompositions.Features + .AddParts(typeof(MockDocumentNavigationService)) + .AddParts(typeof(TestWorkspaceRegistrationService)) + .AddParts(typeof(TestWorkspaceConfigurationService)); + + private class MockHostProtocolConverter : IHostProtocolConverter { - private static readonly TestComposition s_composition = LiveShareTestCompositions.Features - .AddParts(typeof(MockDocumentNavigationServiceFactory)) - .AddParts(typeof(TestWorkspaceRegistrationService)) - .AddParts(typeof(TestWorkspaceConfigurationService)); + private readonly Func _uriConversionFunction; - protected AbstractLiveShareRequestHandlerTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) - { - } + public MockHostProtocolConverter() => _uriConversionFunction = uri => uri; - private class MockHostProtocolConverter : IHostProtocolConverter - { - private readonly Func _uriConversionFunction; + public MockHostProtocolConverter(Func uriConversionFunction) => _uriConversionFunction = uriConversionFunction; - public MockHostProtocolConverter() => _uriConversionFunction = uri => uri; + public Uri FromProtocolUri(Uri uri) => _uriConversionFunction(uri); - public MockHostProtocolConverter(Func uriConversionFunction) => _uriConversionFunction = uriConversionFunction; + public bool IsContainedInRootFolders(Uri uriToCheck) => true; - public Uri FromProtocolUri(Uri uri) => _uriConversionFunction(uri); + public bool IsKnownWorkspaceFile(Uri uriToCheck) => throw new NotImplementedException(); - public bool IsContainedInRootFolders(Uri uriToCheck) => true; + public Task RegisterExternalFilesAsync(Uri[] filePaths) => Task.CompletedTask; - public bool IsKnownWorkspaceFile(Uri uriToCheck) => throw new NotImplementedException(); + public Uri ToProtocolUri(Uri uri) => uri; - public Task RegisterExternalFilesAsync(Uri[] filePaths) => Task.CompletedTask; - - public Uri ToProtocolUri(Uri uri) => uri; + public bool TryGetExternalUris(string exernalUri, out Uri uri) => throw new NotImplementedException(); + } - public bool TryGetExternalUris(string exernalUri, out Uri uri) => throw new NotImplementedException(); - } + protected override TestComposition Composition => s_composition; - protected override TestComposition Composition => s_composition; + protected static async Task TestHandleAsync(Solution solution, RequestType request, string methodName) + { + var requestContext = new RequestContext(solution, new MockHostProtocolConverter(), JObject.FromObject(new ClientCapabilities())); + return await GetHandler(solution, methodName).HandleAsync(request, requestContext, CancellationToken.None); + } - protected static async Task TestHandleAsync(Solution solution, RequestType request, string methodName) - { - var requestContext = new RequestContext(solution, new MockHostProtocolConverter(), JObject.FromObject(new ClientCapabilities())); - return await GetHandler(solution, methodName).HandleAsync(request, requestContext, CancellationToken.None); - } + protected static async Task TestHandleAsync(Solution solution, RequestType request, string methodName, Func uriMappingFunc) + { + var requestContext = new RequestContext(solution, new MockHostProtocolConverter(uriMappingFunc), JObject.FromObject(new ClientCapabilities())); + return await GetHandler(solution, methodName).HandleAsync(request, requestContext, CancellationToken.None); + } - protected static async Task TestHandleAsync(Solution solution, RequestType request, string methodName, Func uriMappingFunc) - { - var requestContext = new RequestContext(solution, new MockHostProtocolConverter(uriMappingFunc), JObject.FromObject(new ClientCapabilities())); - return await GetHandler(solution, methodName).HandleAsync(request, requestContext, CancellationToken.None); - } + protected static ILspRequestHandler GetHandler(Solution solution, string methodName) + { + var workspace = (TestWorkspace)solution.Workspace; + var handlers = workspace.ExportProvider.GetExportedValues(LiveShareConstants.RoslynContractName); + return (ILspRequestHandler)handlers.Single(handler => handler is ILspRequestHandler && IsMatchingMethod(handler, methodName)); - protected static ILspRequestHandler GetHandler(Solution solution, string methodName) + // Since request handlers can have the same input and output types (especially with object), we need to also + // check that the LSP method the handler is exported for matches the one we're requesting. + static bool IsMatchingMethod(ILspRequestHandler handler, string methodName) { - var workspace = (TestWorkspace)solution.Workspace; - var handlers = workspace.ExportProvider.GetExportedValues(LiveShareConstants.RoslynContractName); - return (ILspRequestHandler)handlers.Single(handler => handler is ILspRequestHandler && IsMatchingMethod(handler, methodName)); - - // Since request handlers can have the same input and output types (especially with object), we need to also - // check that the LSP method the handler is exported for matches the one we're requesting. - static bool IsMatchingMethod(ILspRequestHandler handler, string methodName) - { - var attribute = (ExportLspRequestHandlerAttribute)Attribute.GetCustomAttribute(handler.GetType(), typeof(ExportLspRequestHandlerAttribute)); - return attribute?.MethodName == methodName; - } + var attribute = (ExportLspRequestHandlerAttribute)Attribute.GetCustomAttribute(handler.GetType(), typeof(ExportLspRequestHandlerAttribute)); + return attribute?.MethodName == methodName; } } } From 8c3c4a9278d2ef36492bfb2ec38385e3d557a7f9 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Sun, 10 Dec 2023 15:06:44 +1100 Subject: [PATCH 081/141] Put types in their own files --- ...stractRazorCohostDocumentRequestHandler.cs | 43 ++++++++++++++++ .../Cohost/AbstractRazorRequestHandler.cs | 51 ------------------- .../Razor/Cohost/RazorCohostRequestContext.cs | 23 +++++++++ 3 files changed, 66 insertions(+), 51 deletions(-) create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorCohostDocumentRequestHandler.cs create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/RazorCohostRequestContext.cs diff --git a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorCohostDocumentRequestHandler.cs b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorCohostDocumentRequestHandler.cs new file mode 100644 index 0000000000000..e0fa705ee48b1 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorCohostDocumentRequestHandler.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Microsoft.CommonLanguageServerProtocol.Framework; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +internal abstract class AbstractRazorCohostDocumentRequestHandler : AbstractRazorCohostRequestHandler, ITextDocumentIdentifierHandler +{ + TextDocumentIdentifier? ITextDocumentIdentifierHandler.GetTextDocumentIdentifier(TRequestType request) + { + var razorIdentifier = GetRazorTextDocumentIdentifier(request); + if (razorIdentifier == null) + { + return null; + } + + var textDocumentIdentifier = new VSTextDocumentIdentifier + { + Uri = razorIdentifier.Value.Uri, + }; + + if (razorIdentifier.Value.ProjectContextId != null) + { + textDocumentIdentifier.ProjectContext = new VSProjectContext + { + Id = razorIdentifier.Value.ProjectContextId + }; + } + + return textDocumentIdentifier; + } + + protected abstract RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(TRequestType request); +} + +/// +/// Custom type containing information in a to avoid coupling LSP protocol versions. +/// +internal record struct RazorTextDocumentIdentifier(Uri Uri, string? ProjectContextId); diff --git a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs index 89fcfe5f4fd4e..33492c7b05fa7 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorRequestHandler.cs @@ -2,13 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer.Handler; using Microsoft.CommonLanguageServerProtocol.Framework; -using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; @@ -36,51 +33,3 @@ Task IRequestHandler protected abstract Task HandleRequestAsync(TRequestType request, RazorCohostRequestContext context, CancellationToken cancellationToken); } - -internal abstract class AbstractRazorCohostDocumentRequestHandler : AbstractRazorCohostRequestHandler, ITextDocumentIdentifierHandler -{ - TextDocumentIdentifier? ITextDocumentIdentifierHandler.GetTextDocumentIdentifier(TRequestType request) - { - var razorIdentifier = GetRazorTextDocumentIdentifier(request); - if (razorIdentifier == null) - { - return null; - } - - var textDocumentIdentifier = new VSTextDocumentIdentifier - { - Uri = razorIdentifier.Value.Uri, - }; - - if (razorIdentifier.Value.ProjectContextId != null) - { - textDocumentIdentifier.ProjectContext = new VSProjectContext - { - Id = razorIdentifier.Value.ProjectContextId - }; - } - - return textDocumentIdentifier; - } - - protected abstract RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(TRequestType request); -} - -internal readonly struct RazorCohostRequestContext(RequestContext context) -{ - internal string Method => context.Method; - internal Uri? Uri => context.TextDocument?.GetURI(); - /// - internal Workspace? Workspace => context.Workspace; - /// - internal Solution? Solution => context.Solution; - /// - internal TextDocument? TextDocument => context.TextDocument; - - internal T GetRequiredService() where T : class => context.GetRequiredService(); -} - -/// -/// Custom type containing information in a to avoid coupling LSP protocol versions. -/// -internal record struct RazorTextDocumentIdentifier(Uri Uri, string? ProjectContextId); diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostRequestContext.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostRequestContext.cs new file mode 100644 index 0000000000000..8f39d61464558 --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostRequestContext.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Microsoft.CodeAnalysis.LanguageServer; +using Microsoft.CodeAnalysis.LanguageServer.Handler; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +internal readonly struct RazorCohostRequestContext(RequestContext context) +{ + internal string Method => context.Method; + internal Uri? Uri => context.TextDocument?.GetURI(); + /// + internal Workspace? Workspace => context.Workspace; + /// + internal Solution? Solution => context.Solution; + /// + internal TextDocument? TextDocument => context.TextDocument; + + internal T GetRequiredService() where T : class => context.GetRequiredService(); +} From 0cc3ac88696b9dbca9434577fd6721c6a2ea96fa Mon Sep 17 00:00:00 2001 From: David Wengier Date: Sun, 10 Dec 2023 15:06:56 +1100 Subject: [PATCH 082/141] Add more data to extension points, and allow async --- .../Razor/Cohost/RazorCohostDidChangeEndpoint.cs | 12 +++++++----- .../Razor/Cohost/RazorCohostDidCloseEndpoint.cs | 7 +++++-- .../Razor/Cohost/RazorCohostDidOpenEndpoint.cs | 7 +++++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs index 33a460c927e19..1a7d0d17ca431 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidChangeEndpoint.cs @@ -12,7 +12,6 @@ using Microsoft.CodeAnalysis.Text; using Microsoft.CommonLanguageServerProtocol.Framework; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; @@ -28,7 +27,7 @@ internal sealed class RazorCohostDidChangeEndpoint([Import(AllowDefault = true)] public TextDocumentIdentifier GetTextDocumentIdentifier(DidChangeTextDocumentParams request) => request.TextDocument; - public Task HandleRequestAsync(DidChangeTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) + public async Task HandleRequestAsync(DidChangeTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) { var text = context.GetTrackedDocumentSourceText(request.TextDocument.Uri); @@ -42,13 +41,16 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DidChangeTextDocumentPar context.UpdateTrackedDocument(request.TextDocument.Uri, text); // Razor can't handle this request because they don't have access to the RequestContext, but they might want to do something with it - didChangeHandler?.Handle(request.TextDocument.Uri, request.TextDocument.Version, text); + if (didChangeHandler is not null) + { + await didChangeHandler.HandleAsync(request.TextDocument.Uri, request.TextDocument.Version, text, cancellationToken).ConfigureAwait(false); + } - return SpecializedTasks.Default(); + return null; } } internal interface IRazorCohostDidChangeHandler { - void Handle(Uri uri, int version, SourceText text); + Task HandleAsync(Uri uri, int version, SourceText sourceText, CancellationToken cancellationToken); } diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidCloseEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidCloseEndpoint.cs index c7a827b2eb25d..fccc2a100a2b5 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidCloseEndpoint.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidCloseEndpoint.cs @@ -32,11 +32,14 @@ public async Task HandleNotificationAsync(DidCloseTextDocumentParams request, Re await context.StopTrackingAsync(request.TextDocument.Uri, cancellationToken).ConfigureAwait(false); // Razor can't handle this request because they don't have access to the RequestContext, but they might want to do something with it - didCloseHandler?.Handle(request.TextDocument.Uri); + if (didCloseHandler is not null) + { + await didCloseHandler.HandleAsync(request.TextDocument.Uri, cancellationToken).ConfigureAwait(false); + } } } internal interface IRazorCohostDidCloseHandler { - void Handle(Uri uri); + Task HandleAsync(Uri uri, CancellationToken cancellationToken); } diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs index 76f19336fb0ab..faa9b6eeedfd9 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs @@ -35,11 +35,14 @@ public async Task HandleNotificationAsync(DidOpenTextDocumentParams request, Req await context.StartTrackingAsync(request.TextDocument.Uri, sourceText, request.TextDocument.LanguageId, cancellationToken).ConfigureAwait(false); // Razor can't handle this request because they don't have access to the RequestContext, but they might want to do something with it - didOpenHandler?.Handle(request.TextDocument.Uri, sourceText); + if (didOpenHandler is not null) + { + await didOpenHandler.HandleAsync(request.TextDocument.Uri, request.TextDocument.Version, sourceText, cancellationToken).ConfigureAwait(false); + } } } internal interface IRazorCohostDidOpenHandler { - void Handle(Uri uri, SourceText text); + Task HandleAsync(Uri uri, int version, SourceText sourceText, CancellationToken cancellationToken); } From ad0302f2385979c6972fb09a81a680ae330c5324 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Sun, 10 Dec 2023 15:08:59 +1100 Subject: [PATCH 083/141] Add empty base class for service exports, just in case --- .../Razor/Cohost/AbstractRazorLspService.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorLspService.cs diff --git a/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorLspService.cs b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorLspService.cs new file mode 100644 index 0000000000000..fe2161116ec4b --- /dev/null +++ b/src/Tools/ExternalAccess/Razor/Cohost/AbstractRazorLspService.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.CodeAnalysis.LanguageServer; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; + +/// +/// Base class for services that need to live in Razor but be exported using +/// since those services must implement but the Razor code doesn't have IVT to it. +/// +internal abstract class AbstractRazorLspService : ILspService +{ +} From 789c5cc1388965e609d02a52c8d1046d8c7ad130 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 11 Dec 2023 11:56:13 +1100 Subject: [PATCH 084/141] Make sure we do no work if the Razor cohost server isn't active --- .../Razor/Cohost/RazorCohostDidOpenEndpoint.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs index faa9b6eeedfd9..db88f4102f2da 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs @@ -18,7 +18,10 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; [ExportRazorStatelessLspService(typeof(RazorCohostDidOpenEndpoint)), Shared] [method: ImportingConstructor] [method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] -internal sealed class RazorCohostDidOpenEndpoint([Import(AllowDefault = true)] IRazorCohostDidOpenHandler? didOpenHandler) : ILspServiceNotificationHandler, ITextDocumentIdentifierHandler +internal sealed class RazorCohostDidOpenEndpoint( + [Import(AllowDefault = true)] IRazorCohostDidOpenHandler? didOpenHandler, + [Import(AllowDefault = true)] IRazorCohostLanguageClientActivationService? razorCohostLanguageClientActivationService) + : ILspServiceNotificationHandler, ITextDocumentIdentifierHandler { public bool MutatesSolutionState => true; public bool RequiresLSPSolution => false; @@ -28,6 +31,13 @@ public Uri GetTextDocumentIdentifier(DidOpenTextDocumentParams request) public async Task HandleNotificationAsync(DidOpenTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) { + // VS platform doesn't seem to honour the fact that we don't want to receive didOpen notifications if the Cohost server is disabled + // so we have to check again here to avoid doing unnecessary work. + if (razorCohostLanguageClientActivationService?.ShouldActivateCohostServer() != true) + { + return; + } + context.TraceInformation($"didOpen for {request.TextDocument.Uri}"); var sourceText = SourceText.From(request.TextDocument.Text, System.Text.Encoding.UTF8, SourceHashAlgorithms.OpenDocumentChecksumAlgorithm); From 65ca1555c5b80b23497736dff5eecd4e59ec61c2 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Mon, 11 Dec 2023 10:38:29 +0530 Subject: [PATCH 085/141] Add unit test for #71149 Verified that the test fails for `separateFiles = true` and passes for `separateFiles = false`, confirming that SymbolEnd action is not being called when the type has a partial definition in a separate file with partial member implementation part. --- .../Diagnostics/DiagnosticAnalyzerTests.cs | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/Compilers/CSharp/Test/Emit2/Diagnostics/DiagnosticAnalyzerTests.cs b/src/Compilers/CSharp/Test/Emit2/Diagnostics/DiagnosticAnalyzerTests.cs index 98b54e55e78c5..bd0984e9a1354 100644 --- a/src/Compilers/CSharp/Test/Emit2/Diagnostics/DiagnosticAnalyzerTests.cs +++ b/src/Compilers/CSharp/Test/Emit2/Diagnostics/DiagnosticAnalyzerTests.cs @@ -3229,6 +3229,52 @@ static partial void PartialMethod() compilation.VerifyAnalyzerDiagnostics(analyzers, expected: expected); } + [Theory, CombinatorialData, WorkItem(32702, "https://github.com/dotnet/roslyn/issues/71149")] + public async Task TestPartialFileSymbolEndDiagnosticsAsync(bool separateFiles) + { + string definition1 = @" +internal partial class Test +{ + private partial object Method(); + public Test(object _) { } +}"; + string definition2 = @" +internal partial class Test +{ + private partial object Method() => new(); +}"; + + string source1, source2; + if (separateFiles) + { + source1 = definition1; + source2 = definition2; + } + else + { + source1 = definition1 + definition2; + source2 = string.Empty; + } + + var compilation = CreateCompilationWithMscorlib45([source1, source2]); + compilation.VerifyDiagnostics(); + + var tree1 = compilation.SyntaxTrees[0]; + var semanticModel1 = compilation.GetSemanticModel(tree1); + var analyzers = ImmutableArray.Create(new SymbolStartAnalyzer(topLevelAction: false, SymbolKind.NamedType)); + var compilationWithAnalyzers = compilation.WithAnalyzers(analyzers); + + // Requesting diagnostics on a single tree should run the SymbolStart/End actions on all the partials across the compilation + // and the analysis result should contain the diagnostics reported at SymbolEnd action. + var analysisResult = await compilationWithAnalyzers.GetAnalysisResultAsync(semanticModel1, filterSpan: null, analyzers, CancellationToken.None); + Assert.Empty(analysisResult.SyntaxDiagnostics); + Assert.Empty(analysisResult.SemanticDiagnostics); + var compilationDiagnostics = analysisResult.CompilationDiagnostics[analyzers[0]]; + compilationDiagnostics.Verify( + Diagnostic("SymbolStartRuleId").WithArguments("Test", "Analyzer1").WithLocation(1, 1) + ); + } + [Fact, WorkItem(922802, "https://dev.azure.com/devdiv/DevDiv/_workitems/edit/922802")] public async Task TestAnalysisScopeForGetAnalyzerSemanticDiagnosticsAsync() { From ff009c6f42c3f0ca8839dfef40254c12f711ca7f Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Mon, 11 Dec 2023 11:56:24 +0530 Subject: [PATCH 086/141] Ensure that we include both parts of partial methods for single file analysis, regardless of whether one or both of them are defined in the same file Fixes #71149 --- .../CompilationWithAnalyzers.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs index 421dbe30abcbe..2f8d1fa1fd9f7 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/CompilationWithAnalyzers.cs @@ -14,6 +14,7 @@ using Microsoft.CodeAnalysis.Diagnostics.Telemetry; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Symbols; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; using static Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver; @@ -1083,7 +1084,7 @@ static ImmutableArray dequeueAndFilterCompilationEvents( break; case SymbolDeclaredCompilationEvent symbolDeclaredCompilationEvent: - if (!symbolDeclaredCompilationEvent.SymbolInternal.IsDefinedInSourceTree(tree, definedWithinSpan: null, cancellationToken)) + if (!shouldIncludeSymbol(symbolDeclaredCompilationEvent.SymbolInternal, tree, cancellationToken)) continue; break; @@ -1101,6 +1102,24 @@ static ImmutableArray dequeueAndFilterCompilationEvents( } return builder.ToImmutableAndFree(); + + static bool shouldIncludeSymbol(ISymbolInternal symbol, SyntaxTree tree, CancellationToken cancellationToken) + { + if (symbol.IsDefinedInSourceTree(tree, definedWithinSpan: null, cancellationToken)) + return true; + + // Always include both parts of partial in analysis if any one part is defined in the tree. + if (symbol is IMethodSymbolInternal methodSymbol) + { + if (methodSymbol.PartialDefinitionPart?.IsDefinedInSourceTree(tree, definedWithinSpan: null, cancellationToken) == true + || methodSymbol.PartialImplementationPart?.IsDefinedInSourceTree(tree, definedWithinSpan: null, cancellationToken) == true) + { + return true; + } + } + + return false; + } } } From 77ffd3f4ae507fb222aad7fdeedcc2b9e111dce5 Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Mon, 11 Dec 2023 10:38:20 +0300 Subject: [PATCH 087/141] Generate protected constructors in abstract types --- ...nstructorSnippetCompletionProviderTests.cs | 68 +++++++++++++++++-- .../AbstractConstructorSnippetProvider.cs | 5 +- 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/Snippets/CSharpConstructorSnippetCompletionProviderTests.cs b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/Snippets/CSharpConstructorSnippetCompletionProviderTests.cs index ac94c251a460a..11e7c74a1de5d 100644 --- a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/Snippets/CSharpConstructorSnippetCompletionProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/Snippets/CSharpConstructorSnippetCompletionProviderTests.cs @@ -2,10 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; @@ -96,12 +92,74 @@ abstract class MyClass """ abstract class MyClass { - public MyClass() + protected MyClass() + { + $$ + } + } + """; + await VerifyCustomCommitProviderAsync(markupBeforeCommit, ItemToCommit, expectedCodeAfterCommit); + } + + [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task InsertConstructorSnippetInAbstractClassTest_AbstractModifierInOtherPartialDeclaration() + { + var markupBeforeCommit = + """ + partial class MyClass + { + $$ + } + + abstract partial class MyClass + { + } + """; + + var expectedCodeAfterCommit = + """ + partial class MyClass + { + protected MyClass() + { + $$ + } + } + + abstract partial class MyClass + { + } + """; + await VerifyCustomCommitProviderAsync(markupBeforeCommit, ItemToCommit, expectedCodeAfterCommit); + } + + [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task InsertConstructorSnippetInNestedAbstractClassTest() + { + var markupBeforeCommit = + """ + class MyClass + { + abstract class NestedClass { $$ } } """; + + var expectedCodeAfterCommit = + """ + class MyClass + { + abstract class NestedClass + { + protected NestedClass() + { + $$ + } + } + } + """; await VerifyCustomCommitProviderAsync(markupBeforeCommit, ItemToCommit, expectedCodeAfterCommit); } diff --git a/src/Features/Core/Portable/Snippets/SnippetProviders/AbstractConstructorSnippetProvider.cs b/src/Features/Core/Portable/Snippets/SnippetProviders/AbstractConstructorSnippetProvider.cs index 672480c230b92..535c928dc271d 100644 --- a/src/Features/Core/Portable/Snippets/SnippetProviders/AbstractConstructorSnippetProvider.cs +++ b/src/Features/Core/Portable/Snippets/SnippetProviders/AbstractConstructorSnippetProvider.cs @@ -34,9 +34,12 @@ protected override async Task GenerateSnippetTextChangeAsync(Documen var nodeAtPosition = root.FindNode(TextSpan.FromBounds(position, position)); var containingType = nodeAtPosition.FirstAncestorOrSelf(syntaxFacts.IsTypeDeclaration); Contract.ThrowIfNull(containingType); + var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); + var containingTypeSymbol = semanticModel.GetDeclaredSymbol(containingType, cancellationToken); + Contract.ThrowIfNull(containingTypeSymbol); var constructorDeclaration = generator.ConstructorDeclaration( containingTypeName: syntaxFacts.GetIdentifierOfTypeDeclaration(containingType).ToString(), - accessibility: Accessibility.Public); + accessibility: containingTypeSymbol.IsAbstract ? Accessibility.Protected : Accessibility.Public); return new TextChange(TextSpan.FromBounds(position, position), constructorDeclaration.NormalizeWhitespace().ToFullString()); } } From f839763f9998fa876aaccfcb6e630d7c772a6e1c Mon Sep 17 00:00:00 2001 From: joegoldman674 <147369450+joegoldman2@users.noreply.github.com> Date: Mon, 11 Dec 2023 10:58:22 +0200 Subject: [PATCH 088/141] Revert old behavior and apply the new one if >= .NET 9 --- src/CodeStyle/Tools/Program.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/CodeStyle/Tools/Program.cs b/src/CodeStyle/Tools/Program.cs index aa9b658682416..69f9fcb8be55e 100644 --- a/src/CodeStyle/Tools/Program.cs +++ b/src/CodeStyle/Tools/Program.cs @@ -258,9 +258,10 @@ and an implied numerical option (such as '4') --> <_GlobalAnalyzerConfigFile_MicrosoftCodeAnalysis{language}CodeStyle Condition="'$(_GlobalAnalyzerConfigFileName_MicrosoftCodeAnalysis{language}CodeStyle)' != ''">$(_GlobalAnalyzerConfigDir_MicrosoftCodeAnalysis{language}CodeStyle)\$(_GlobalAnalyzerConfigFileName_MicrosoftCodeAnalysis{language}CodeStyle) - - - + + + From 147b18bcba6a5d62a7d839be746ad8c9e56940ad Mon Sep 17 00:00:00 2001 From: joegoldman674 <147369450+joegoldman2@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:00:07 +0200 Subject: [PATCH 089/141] Fix spacing --- src/CodeStyle/Tools/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CodeStyle/Tools/Program.cs b/src/CodeStyle/Tools/Program.cs index 69f9fcb8be55e..1d2a721062c2c 100644 --- a/src/CodeStyle/Tools/Program.cs +++ b/src/CodeStyle/Tools/Program.cs @@ -260,7 +260,7 @@ and an implied numerical option (such as '4') --> + ('$(AnalysisLevelStyle)' != '$(AnalysisLevel)' or '$(AnalysisModeStyle)' != '$(AnalysisMode)' or $([MSBuild]::VersionGreaterThanOrEquals('$(EffectiveAnalysisLevelStyle)', '9.0')))"> From 0a6da1df90c30bcb97bfd649dd9c979bf5a99c79 Mon Sep 17 00:00:00 2001 From: joegoldman674 <147369450+joegoldman2@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:02:13 +0200 Subject: [PATCH 090/141] Fix spacing --- src/CodeStyle/Tools/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CodeStyle/Tools/Program.cs b/src/CodeStyle/Tools/Program.cs index 1d2a721062c2c..789e1df5c7d80 100644 --- a/src/CodeStyle/Tools/Program.cs +++ b/src/CodeStyle/Tools/Program.cs @@ -261,7 +261,7 @@ and an implied numerical option (such as '4') --> - + From faf76fee454ed22357a6be64e1ee5afc8a18deb3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 11 Dec 2023 08:29:00 -0800 Subject: [PATCH 091/141] Make parameter non-optional --- .../CSharp/Portable/Lowering/SynthesizedMethodBaseSymbol.cs | 3 ++- .../Portable/Symbols/Source/SourceDelegateMethodSymbol.cs | 2 +- .../CSharp/Portable/Symbols/Source/SourceDestructorSymbol.cs | 2 +- .../Portable/Symbols/Source/SourceEventAccessorSymbol.cs | 3 ++- .../Portable/Symbols/Source/SourceMemberMethodSymbol.cs | 2 +- .../Portable/Symbols/Source/SourcePropertyAccessorSymbol.cs | 4 ++-- .../Symbols/Source/SourceUserDefinedOperatorSymbolBase.cs | 3 ++- .../Synthesized/Records/SynthesizedPrimaryConstructor.cs | 3 ++- .../Synthesized/Records/SynthesizedRecordOrdinaryMethod.cs | 2 +- .../Synthesized/SynthesizedSimpleProgramEntryPointSymbol.cs | 3 ++- 10 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Lowering/SynthesizedMethodBaseSymbol.cs b/src/Compilers/CSharp/Portable/Lowering/SynthesizedMethodBaseSymbol.cs index b12f2c3f6a915..84656a69b0073 100644 --- a/src/Compilers/CSharp/Portable/Lowering/SynthesizedMethodBaseSymbol.cs +++ b/src/Compilers/CSharp/Portable/Lowering/SynthesizedMethodBaseSymbol.cs @@ -47,7 +47,8 @@ protected SynthesizedMethodBaseSymbol(NamedTypeSymbol containingType, isNullableAnalysisEnabled: false, isVarArg: baseMethod.IsVararg, isExpressionBodied: false, - isExplicitInterfaceImplementation: false))) + isExplicitInterfaceImplementation: false, + hasThisInitializer: false))) { Debug.Assert((object)containingType != null); Debug.Assert((object)baseMethod != null); diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceDelegateMethodSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceDelegateMethodSymbol.cs index e5eaa1b2e3467..9c07d921e95f1 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceDelegateMethodSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceDelegateMethodSymbol.cs @@ -29,7 +29,7 @@ protected SourceDelegateMethodSymbol( : base(delegateType, syntax.GetReference(), location: syntax.Identifier.GetLocation(), isIterator: false, (declarationModifiers, MakeFlags( methodKind, refKind, declarationModifiers, returnType.IsVoidType(), returnsVoidIsSet: true, isExpressionBodied: false, - isExtensionMethod: false, isVarArg: false, isNullableAnalysisEnabled: false, isExplicitInterfaceImplementation: false))) + isExtensionMethod: false, isVarArg: false, isNullableAnalysisEnabled: false, isExplicitInterfaceImplementation: false, hasThisInitializer: false))) { _returnType = returnType; } diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceDestructorSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceDestructorSymbol.cs index ebc9ea0c0fdd6..4140bb68ca6df 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceDestructorSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceDestructorSymbol.cs @@ -67,7 +67,7 @@ private static (DeclarationModifiers, Flags) MakeModifiersAndFlags(NamedTypeSymb Flags flags = MakeFlags( MethodKind.Destructor, RefKind.None, declarationModifiers, returnsVoid: true, returnsVoidIsSet: true, isExpressionBodied: syntax.IsExpressionBodied(), isExtensionMethod: false, - isVarArg: false, isNullableAnalysisEnabled: isNullableAnalysisEnabled, isExplicitInterfaceImplementation: false); + isVarArg: false, isNullableAnalysisEnabled: isNullableAnalysisEnabled, isExplicitInterfaceImplementation: false, hasThisInitializer: false); return (declarationModifiers, flags); } diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventAccessorSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventAccessorSymbol.cs index 971e1f70dec38..b88f984160d64 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventAccessorSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventAccessorSymbol.cs @@ -42,7 +42,8 @@ public SourceEventAccessorSymbol( isExtensionMethod: false, isNullableAnalysisEnabled: isNullableAnalysisEnabled, isVarArg: false, - isExplicitInterfaceImplementation: @event.IsExplicitInterfaceImplementation))) + isExplicitInterfaceImplementation: @event.IsExplicitInterfaceImplementation, + hasThisInitializer: false))) { _event = @event; diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs index ec7a97ee994b9..d9fbaab736cbb 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs @@ -401,7 +401,7 @@ protected static Flags MakeFlags( bool isNullableAnalysisEnabled, bool isVarArg, bool isExplicitInterfaceImplementation, - bool hasThisInitializer = false) + bool hasThisInitializer) { return new Flags(methodKind, refKind, declarationModifiers, returnsVoid, returnsVoidIsSet, isExpressionBodied, isExtensionMethod, isNullableAnalysisEnabled, isVarArg, isExplicitInterfaceImplementation, hasThisInitializer); } diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertyAccessorSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertyAccessorSymbol.cs index c53c5c20a7484..fdf920ff6b7ea 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertyAccessorSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertyAccessorSymbol.cs @@ -168,7 +168,7 @@ private static (DeclarationModifiers, Flags) MakeModifiersAndFlags(SourcePropert // returnsVoid argument to MakeFlags is ignored. Flags flags = MakeFlags(MethodKind.PropertyGet, property.RefKind, declarationModifiers, returnsVoid: false, returnsVoidIsSet: false, isExpressionBodied: true, isExtensionMethod: false, isNullableAnalysisEnabled: isNullableAnalysisEnabled, - isVarArg: false, isExplicitInterfaceImplementation: property.IsExplicitInterfaceImplementation); + isVarArg: false, isExplicitInterfaceImplementation: property.IsExplicitInterfaceImplementation, hasThisInitializer: false); return (declarationModifiers, flags); } @@ -246,7 +246,7 @@ private static (DeclarationModifiers, Flags) MakeModifiersAndFlags( // returnsVoid argument to MakeFlags is ignored. Flags flags = MakeFlags(methodKind, property.RefKind, declarationModifiers, returnsVoid: false, returnsVoidIsSet: false, isExpressionBodied: isExpressionBodied, isExtensionMethod: false, isNullableAnalysisEnabled: isNullableAnalysisEnabled, - isVarArg: false, isExplicitInterfaceImplementation: isExplicitInterfaceImplementation); + isVarArg: false, isExplicitInterfaceImplementation: isExplicitInterfaceImplementation, hasThisInitializer: false); return (declarationModifiers, flags); } diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceUserDefinedOperatorSymbolBase.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceUserDefinedOperatorSymbolBase.cs index 9a162d1109a21..b1c4daff40be3 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceUserDefinedOperatorSymbolBase.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceUserDefinedOperatorSymbolBase.cs @@ -44,7 +44,8 @@ protected SourceUserDefinedOperatorSymbolBase( returnsVoidIsSet: false, isExpressionBodied: isExpressionBodied, isExtensionMethod: false, isVarArg: false, isNullableAnalysisEnabled: isNullableAnalysisEnabled, - isExplicitInterfaceImplementation: methodKind == MethodKind.ExplicitInterfaceImplementation))) + isExplicitInterfaceImplementation: methodKind == MethodKind.ExplicitInterfaceImplementation, + hasThisInitializer: false))) { _explicitInterfaceType = explicitInterfaceType; _name = name; diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedPrimaryConstructor.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedPrimaryConstructor.cs index 496c60a5510cc..965d2db9659e7 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedPrimaryConstructor.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedPrimaryConstructor.cs @@ -48,7 +48,8 @@ private static (DeclarationModifiers, Flags) MakeModifiersAndFlags(SourceMemberC isExtensionMethod: false, isVarArg: syntax.ParameterList.IsVarArg(), isNullableAnalysisEnabled: false, // IsNullableAnalysisEnabled uses containing type instead. - isExplicitInterfaceImplementation: false); + isExplicitInterfaceImplementation: false, + hasThisInitializer: false); return (declarationModifiers, flags); } diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordOrdinaryMethod.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordOrdinaryMethod.cs index f253e41197304..3bcc164df94a6 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordOrdinaryMethod.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordOrdinaryMethod.cs @@ -26,7 +26,7 @@ protected SynthesizedRecordOrdinaryMethod(SourceMemberContainerTypeSymbol contai (declarationModifiers, MakeFlags( MethodKind.Ordinary, RefKind.None, declarationModifiers, returnsVoid: false, returnsVoidIsSet: false, isExpressionBodied: false, isExtensionMethod: false, isNullableAnalysisEnabled: false, isVarArg: false, - isExplicitInterfaceImplementation: false))) + isExplicitInterfaceImplementation: false, hasThisInitializer: false))) { _memberOffset = memberOffset; } diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedSimpleProgramEntryPointSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedSimpleProgramEntryPointSymbol.cs index 6c6db518b6b80..4e5c035c50d1f 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedSimpleProgramEntryPointSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedSimpleProgramEntryPointSymbol.cs @@ -78,7 +78,8 @@ private static (DeclarationModifiers, Flags) MakeModifiersAndFlags(SourceMemberC isExtensionMethod: false, isNullableAnalysisEnabled: isNullableAnalysisEnabled, isVarArg: false, - isExplicitInterfaceImplementation: false); + isExplicitInterfaceImplementation: false, + hasThisInitializer: false); return (declarationModifiers, flags); } From c6f2f3fc5f7fa46479d465f8a5a8bc5de3649299 Mon Sep 17 00:00:00 2001 From: Ella Hathaway <67609881+ellahathaway@users.noreply.github.com> Date: Mon, 11 Dec 2023 08:49:04 -0800 Subject: [PATCH 092/141] Remove Microsoft.SourceBuild.Intermediate from prebuilt baseline (#71175) --- eng/SourceBuildPrebuiltBaseline.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index 3507b6391117c..8c7ed433692b5 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -3,8 +3,6 @@ - - + From 231c3bfa392d8a50632b28bb94c32c7f087b0da8 Mon Sep 17 00:00:00 2001 From: Shen Chen Date: Mon, 11 Dec 2023 14:57:57 -0800 Subject: [PATCH 096/141] Enable skipped tests --- .../New.IntegrationTests/CSharp/CSharpExtractMethod.cs | 2 +- .../IntegrationTest/New.IntegrationTests/CSharp/CSharpRename.cs | 2 +- .../New.IntegrationTests/VisualBasic/BasicExtractMethod.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpExtractMethod.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpExtractMethod.cs index d453dc4e9dbce..6bb800879e817 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpExtractMethod.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpExtractMethod.cs @@ -126,7 +126,7 @@ await TestServices.EditorVerifier.TextContainsAsync(@"private static int SayHell }", cancellationToken: HangMitigatingCancellationToken); } - [IdeFact(Skip = "https://github.com/dotnet/roslyn/issues/71088")] + [IdeFact] public async Task ExtractViaCodeAction() { await TestServices.Editor.SetTextAsync(TestSource, HangMitigatingCancellationToken); diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpRename.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpRename.cs index 60b8e2b1259de..3b0c78c162059 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpRename.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpRename.cs @@ -644,7 +644,7 @@ static void Main(string[] args) }", HangMitigatingCancellationToken); } - [IdeFact(Skip = "https://github.com/dotnet/roslyn/issues/71088")] + [IdeFact] public async Task VerifyTextSync() { var globalOptions = await TestServices.Shell.GetComponentModelServiceAsync(HangMitigatingCancellationToken); diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicExtractMethod.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicExtractMethod.cs index 43add9b937281..21cb08246c72b 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicExtractMethod.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicExtractMethod.cs @@ -91,7 +91,7 @@ await TestServices.EditorVerifier.TextContainsAsync(@" Private Sub SayHello() End Sub", cancellationToken: HangMitigatingCancellationToken); } - [IdeFact(Skip = "https://github.com/dotnet/roslyn/issues/71088")] + [IdeFact] public async Task ExtractViaCodeAction() { await TestServices.Editor.SetTextAsync(TestSource, HangMitigatingCancellationToken); From c8d587bcee92c26eb858d0327907644f539877e1 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Mon, 11 Dec 2023 15:16:27 -0800 Subject: [PATCH 097/141] Update Roslyn's consumption of Microsoft.Extensions.Logging This adds the SourceBuild metadata so we'll use the latest version during source builds rather than picking up an older reference assembly. This also upgrades us to 7.0 while we're here, which brings along nullable annotation changes. --- eng/Version.Details.xml | 15 +++++++++++++++ eng/Versions.props | 6 +++--- .../Utilities/TestOutputLogger.cs | 2 +- .../Logging/LspLogMessageLogger.cs | 2 +- .../Lsif/Generator/Logging/LsifFormatLogger.cs | 2 +- .../Lsif/Generator/Logging/PlainTextLogger.cs | 2 +- src/Tools/BuildValidator/DemoLogger.cs | 4 ++-- 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2177209cfbc7e..7fceac086699d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -25,6 +25,21 @@ https://github.com/dotnet/runtime d099f075e45d2aa6007a22b71b45a08758559f80 + + https://github.com/dotnet/runtime + d099f075e45d2aa6007a22b71b45a08758559f80 + + + + https://github.com/dotnet/runtime + d099f075e45d2aa6007a22b71b45a08758559f80 + + + + https://github.com/dotnet/runtime + d099f075e45d2aa6007a22b71b45a08758559f80 + + diff --git a/eng/Versions.props b/eng/Versions.props index ed07c21dd35be..89f47dede0d32 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -114,9 +114,9 @@ 1.1.0-beta2-22302-02 17.0.0-beta1.21524.1 1.7.0-beta-21528-01 - 6.0.0 - 6.0.0 - 6.0.0 + 7.0.0 + 7.0.0 + 7.0.0 3.13.8 15.8.27812-alpha 17.8.36711 diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/TestOutputLogger.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/TestOutputLogger.cs index f26d1f89b9ee6..ed0a188850c3a 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/TestOutputLogger.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/TestOutputLogger.cs @@ -18,7 +18,7 @@ public TestOutputLogger(ITestOutputHelper testOutputHelper) Factory = new LoggerFactory(new[] { new TestLoggerProvider(this) }); } - public IDisposable BeginScope(TState state) + public IDisposable BeginScope(TState state) where TState : notnull { return new NoOpDisposable(); } diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs index 6605b60f3332f..24437f41ce921 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLogger.cs @@ -25,7 +25,7 @@ public LspLogMessageLogger(string categoryName, ILoggerFactory fallbackLoggerFac _fallbackLogger = fallbackLoggerFactory.CreateLogger(categoryName); } - public IDisposable BeginScope(TState state) + public IDisposable BeginScope(TState state) where TState : notnull { throw new NotImplementedException(); } diff --git a/src/Features/Lsif/Generator/Logging/LsifFormatLogger.cs b/src/Features/Lsif/Generator/Logging/LsifFormatLogger.cs index f320c41d69b1a..190dc336a9015 100644 --- a/src/Features/Lsif/Generator/Logging/LsifFormatLogger.cs +++ b/src/Features/Lsif/Generator/Logging/LsifFormatLogger.cs @@ -21,7 +21,7 @@ public LsifFormatLogger(TextWriter writer) _writer = writer; } - public IDisposable BeginScope(TState state) + public IDisposable BeginScope(TState state) where TState : notnull { throw new NotImplementedException(); } diff --git a/src/Features/Lsif/Generator/Logging/PlainTextLogger.cs b/src/Features/Lsif/Generator/Logging/PlainTextLogger.cs index c250270946991..aae823049739e 100644 --- a/src/Features/Lsif/Generator/Logging/PlainTextLogger.cs +++ b/src/Features/Lsif/Generator/Logging/PlainTextLogger.cs @@ -18,7 +18,7 @@ public PlainTextLogger(TextWriter writer) _writer = writer; } - public IDisposable BeginScope(TState state) + public IDisposable BeginScope(TState state) where TState : notnull { throw new NotImplementedException(); } diff --git a/src/Tools/BuildValidator/DemoLogger.cs b/src/Tools/BuildValidator/DemoLogger.cs index 577099e743c6d..bd8c617eb6995 100644 --- a/src/Tools/BuildValidator/DemoLogger.cs +++ b/src/Tools/BuildValidator/DemoLogger.cs @@ -31,7 +31,7 @@ public void Dispose() private int _indent; - public IDisposable BeginScope(TState state) + public IDisposable BeginScope(TState state) where TState : notnull { LogCore(state?.ToString()); return new Scope(this); @@ -66,7 +66,7 @@ public void Dispose() { } - public IDisposable BeginScope(TState state) => this; + public IDisposable BeginScope(TState state) where TState : notnull => this; public bool IsEnabled(LogLevel logLevel) => false; From 93f3c99bd605f2b2740cc932b0cfb82904de72fa Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 11 Dec 2023 17:38:12 -0800 Subject: [PATCH 098/141] Fix option code --- .../Compiler/Core/CodeStyle/IdeCodeStyleOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/IdeCodeStyleOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/IdeCodeStyleOptions.cs index 0bed64f72227b..a316dd1c6d977 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/IdeCodeStyleOptions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/IdeCodeStyleOptions.cs @@ -66,7 +66,7 @@ private protected IdeCodeStyleOptions() private protected IdeCodeStyleOptions(IOptionsReader options, IdeCodeStyleOptions fallbackOptions, string language) { PreferObjectInitializer = options.GetOption(CodeStyleOptions2.PreferObjectInitializer, language, fallbackOptions.PreferObjectInitializer); - PreferCollectionExpression = options.GetOption(CodeStyleOptions2.PreferCollectionExpression, language, fallbackOptions.PreferCollectionInitializer); + PreferCollectionExpression = options.GetOption(CodeStyleOptions2.PreferCollectionExpression, language, fallbackOptions.PreferCollectionExpression); PreferCollectionInitializer = options.GetOption(CodeStyleOptions2.PreferCollectionInitializer, language, fallbackOptions.PreferCollectionInitializer); PreferSimplifiedBooleanExpressions = options.GetOption(CodeStyleOptions2.PreferSimplifiedBooleanExpressions, language, fallbackOptions.PreferSimplifiedBooleanExpressions); OperatorPlacementWhenWrapping = options.GetOption(CodeStyleOptions2.OperatorPlacementWhenWrapping, fallbackOptions.OperatorPlacementWhenWrapping); From da42b86c3d0906f524a8a06b429870b3a1ee8bc2 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 12 Dec 2023 15:12:32 +1100 Subject: [PATCH 099/141] PR feedback --- src/Features/LanguageServer/Protocol/Extensions/Extensions.cs | 1 - src/Features/LanguageServer/Protocol/ProtocolConstants.cs | 2 ++ .../LanguageServer/Protocol/WellKnownLspServerKinds.cs | 2 +- src/Tools/ExternalAccess/Razor/Cohost/Constants.cs | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs b/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs index 28247e32e51ce..31e88ccc68d83 100644 --- a/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs +++ b/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs @@ -83,7 +83,6 @@ public static ImmutableArray GetTextDocuments(this Solution soluti { var documentIds = GetDocumentIds(solution, documentUri); - // We don't call GetRequiredDocument here as the id could be referring to an additional document. var documents = documentIds .Select(solution.GetDocument) .Concat(documentIds.Select(solution.GetAdditionalDocument)) diff --git a/src/Features/LanguageServer/Protocol/ProtocolConstants.cs b/src/Features/LanguageServer/Protocol/ProtocolConstants.cs index cd072452be53e..04e1a666c9f0f 100644 --- a/src/Features/LanguageServer/Protocol/ProtocolConstants.cs +++ b/src/Features/LanguageServer/Protocol/ProtocolConstants.cs @@ -15,5 +15,7 @@ internal class ProtocolConstants public const string RoslynLspLanguagesContract = "RoslynLspLanguages"; public const string TypeScriptLanguageContract = "TypeScriptLspLanguage"; + + public const string RazorCohostContract = "RazorLanguageServer"; } } diff --git a/src/Features/LanguageServer/Protocol/WellKnownLspServerKinds.cs b/src/Features/LanguageServer/Protocol/WellKnownLspServerKinds.cs index 60a418301f69a..da3f8390d0ac8 100644 --- a/src/Features/LanguageServer/Protocol/WellKnownLspServerKinds.cs +++ b/src/Features/LanguageServer/Protocol/WellKnownLspServerKinds.cs @@ -104,7 +104,7 @@ public static string GetContractName(this WellKnownLspServerKinds server) { return server switch { - WellKnownLspServerKinds.RazorCohostServer => "RazorLanguageServer", + WellKnownLspServerKinds.RazorCohostServer => ProtocolConstants.RazorCohostContract, WellKnownLspServerKinds.RazorLspServer => ProtocolConstants.RoslynLspLanguagesContract, WellKnownLspServerKinds.LiveShareLspServer => ProtocolConstants.RoslynLspLanguagesContract, WellKnownLspServerKinds.AlwaysActiveVSLspServer => ProtocolConstants.RoslynLspLanguagesContract, diff --git a/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs b/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs index bbcb0e23397f8..520faed5e9018 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/Constants.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Immutable; +using Microsoft.CodeAnalysis.LanguageServer; namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; @@ -10,7 +11,7 @@ internal static class Constants { public const string RazorLSPContentType = "Razor"; - public const string RazorLanguageContract = "RazorLanguageServer"; + public const string RazorLanguageContract = ProtocolConstants.RazorCohostContract; public static readonly ImmutableArray RazorLanguage = ImmutableArray.Create("Razor"); } From b9f96c7ae4ec32e742dd35de984c76f3d43fec2d Mon Sep 17 00:00:00 2001 From: Joseph Musser Date: Tue, 12 Dec 2023 00:54:00 -0500 Subject: [PATCH 100/141] Loosen compiler restriction which was not required by the spec (#71110) * The compiler isn't required by the spec to implement IReadOnly interfaces when targeting IEnumerable --- .../SynthesizedReadOnlyListTypeSymbol.cs | 97 ++++++++++++++----- .../Semantics/CollectionExpressionTests.cs | 88 +++++++++++++++-- 2 files changed, 150 insertions(+), 35 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Symbols/Synthesized/ReadOnlyListType/SynthesizedReadOnlyListTypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Synthesized/ReadOnlyListType/SynthesizedReadOnlyListTypeSymbol.cs index 3c05db15f7c2d..d95a736e0405d 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Synthesized/ReadOnlyListType/SynthesizedReadOnlyListTypeSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Synthesized/ReadOnlyListType/SynthesizedReadOnlyListTypeSymbol.cs @@ -29,12 +29,16 @@ internal sealed class SynthesizedReadOnlyListTypeSymbol : NamedTypeSymbol { SpecialType.System_Collections_IEnumerable, SpecialType.System_Collections_Generic_IEnumerable_T, - SpecialType.System_Collections_Generic_IReadOnlyCollection_T, - SpecialType.System_Collections_Generic_IReadOnlyList_T, SpecialType.System_Collections_Generic_ICollection_T, SpecialType.System_Collections_Generic_IList_T, }; + private static readonly SpecialType[] s_readOnlyInterfacesSpecialTypes = new[] + { + SpecialType.System_Collections_Generic_IReadOnlyCollection_T, + SpecialType.System_Collections_Generic_IReadOnlyList_T, + }; + private static readonly WellKnownType[] s_requiredWellKnownTypes = new[] { WellKnownType.System_Collections_ICollection, @@ -63,8 +67,6 @@ internal sealed class SynthesizedReadOnlyListTypeSymbol : NamedTypeSymbol WellKnownMember.System_Collections_IList__Insert, WellKnownMember.System_Collections_IList__Remove, WellKnownMember.System_Collections_IList__RemoveAt, - WellKnownMember.System_Collections_Generic_IReadOnlyCollection_T__Count, - WellKnownMember.System_Collections_Generic_IReadOnlyList_T__get_Item, WellKnownMember.System_Collections_Generic_ICollection_T__Count, WellKnownMember.System_Collections_Generic_ICollection_T__IsReadOnly, WellKnownMember.System_Collections_Generic_ICollection_T__Add, @@ -79,6 +81,12 @@ internal sealed class SynthesizedReadOnlyListTypeSymbol : NamedTypeSymbol WellKnownMember.System_NotSupportedException__ctor, }; + private static readonly WellKnownMember[] s_readOnlyInterfacesWellKnownMembers = new[] + { + WellKnownMember.System_Collections_Generic_IReadOnlyCollection_T__Count, + WellKnownMember.System_Collections_Generic_IReadOnlyList_T__get_Item, + }; + private static readonly WellKnownMember[] s_requiredWellKnownMembersUnknownLength = new[] { WellKnownMember.System_Collections_Generic_List_T__Count, @@ -93,6 +101,10 @@ internal static NamedTypeSymbol Create(SourceModuleSymbol containingModule, stri var compilation = containingModule.DeclaringCompilation; DiagnosticInfo? diagnosticInfo = null; + var hasReadOnlyInterfaces = + !compilation.IsTypeMissing(SpecialType.System_Collections_Generic_IReadOnlyCollection_T) + && !compilation.IsTypeMissing(SpecialType.System_Collections_Generic_IReadOnlyList_T); + foreach (var type in s_requiredSpecialTypes) { diagnosticInfo = compilation.GetSpecialType(type).GetUseSiteInfo().DiagnosticInfo; @@ -102,6 +114,18 @@ internal static NamedTypeSymbol Create(SourceModuleSymbol containingModule, stri } } + if (hasReadOnlyInterfaces && diagnosticInfo is null) + { + foreach (var type in s_readOnlyInterfacesSpecialTypes) + { + diagnosticInfo = compilation.GetSpecialType(type).GetUseSiteInfo().DiagnosticInfo; + if (diagnosticInfo is { }) + { + break; + } + } + } + if (diagnosticInfo is null) { foreach (var type in s_requiredWellKnownTypes) @@ -138,6 +162,18 @@ internal static NamedTypeSymbol Create(SourceModuleSymbol containingModule, stri } } + if (hasReadOnlyInterfaces && diagnosticInfo is null) + { + foreach (var member in s_readOnlyInterfacesWellKnownMembers) + { + diagnosticInfo = getWellKnownTypeMemberDiagnosticInfo(compilation, member); + if (diagnosticInfo is { }) + { + break; + } + } + } + if (!hasKnownLength) { if (diagnosticInfo is null) @@ -163,7 +199,7 @@ internal static NamedTypeSymbol Create(SourceModuleSymbol containingModule, stri return new ExtendedErrorTypeSymbol(compilation, name, arity: 1, diagnosticInfo, unreported: true); } - return new SynthesizedReadOnlyListTypeSymbol(containingModule, name, hasKnownLength); + return new SynthesizedReadOnlyListTypeSymbol(containingModule, name, hasKnownLength, hasReadOnlyInterfaces); static DiagnosticInfo? getSpecialTypeMemberDiagnosticInfo(CSharpCompilation compilation, SpecialMember member) { @@ -194,7 +230,7 @@ internal static NamedTypeSymbol Create(SourceModuleSymbol containingModule, stri private readonly ImmutableArray _members; private readonly FieldSymbol _field; - private SynthesizedReadOnlyListTypeSymbol(SourceModuleSymbol containingModule, string name, bool hasKnownLength) + private SynthesizedReadOnlyListTypeSymbol(SourceModuleSymbol containingModule, string name, bool hasKnownLength, bool hasReadOnlyInterfaces) { var compilation = containingModule.DeclaringCompilation; @@ -218,15 +254,23 @@ private SynthesizedReadOnlyListTypeSymbol(SourceModuleSymbol containingModule, s var iCollectionT = compilation.GetSpecialType(SpecialType.System_Collections_Generic_ICollection_T).Construct(typeArgs); var iListT = compilation.GetSpecialType(SpecialType.System_Collections_Generic_IList_T).Construct(typeArgs); - _interfaces = ImmutableArray.Create( - iEnumerable, - iCollection, - iList, - iEnumerableT, - iReadOnlyCollectionT, - iReadOnlyListT, - iCollectionT, - iListT); + _interfaces = hasReadOnlyInterfaces + ? ImmutableArray.Create( + iEnumerable, + iCollection, + iList, + iEnumerableT, + iReadOnlyCollectionT, + iReadOnlyListT, + iCollectionT, + iListT) + : ImmutableArray.Create( + iEnumerable, + iCollection, + iList, + iEnumerableT, + iCollectionT, + iListT); var membersBuilder = ArrayBuilder.GetInstance(); membersBuilder.Add( @@ -314,16 +358,19 @@ private SynthesizedReadOnlyListTypeSymbol(SourceModuleSymbol containingModule, s this, ((MethodSymbol)compilation.GetSpecialTypeMember(SpecialMember.System_Collections_Generic_IEnumerable_T__GetEnumerator)!).AsMember(iEnumerableT), generateGetEnumeratorT)); - addProperty(membersBuilder, - new SynthesizedReadOnlyListProperty( - this, - ((PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_IReadOnlyCollection_T__Count)!).AsMember(iReadOnlyCollectionT), - generateCount)); - addProperty(membersBuilder, - new SynthesizedReadOnlyListProperty( - this, - ((PropertySymbol)((MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_IReadOnlyList_T__get_Item)!).AssociatedSymbol).AsMember(iReadOnlyListT), - generateIndexer)); + if (hasReadOnlyInterfaces) + { + addProperty(membersBuilder, + new SynthesizedReadOnlyListProperty( + this, + ((PropertySymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_IReadOnlyCollection_T__Count)!).AsMember(iReadOnlyCollectionT), + generateCount)); + addProperty(membersBuilder, + new SynthesizedReadOnlyListProperty( + this, + ((PropertySymbol)((MethodSymbol)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_IReadOnlyList_T__get_Item)!).AssociatedSymbol).AsMember(iReadOnlyListT), + generateIndexer)); + } addProperty(membersBuilder, new SynthesizedReadOnlyListProperty( this, diff --git a/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs b/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs index cf432dc6ac66e..5d69e61707763 100644 --- a/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs +++ b/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs @@ -9468,11 +9468,11 @@ static void compareMembers(NamedTypeSymbol sourceType, NamedTypeSymbol synthesiz [Theory] [InlineData(SpecialType.System_Collections_IEnumerable, "System.Collections.IEnumerable")] [InlineData(SpecialType.System_Collections_Generic_IEnumerable_T, "System.Collections.Generic.IEnumerable`1")] - [InlineData(SpecialType.System_Collections_Generic_IReadOnlyCollection_T, "System.Collections.Generic.IReadOnlyCollection`1")] - [InlineData(SpecialType.System_Collections_Generic_IReadOnlyList_T, "System.Collections.Generic.IReadOnlyList`1")] + [InlineData(SpecialType.System_Collections_Generic_IReadOnlyCollection_T, "System.Collections.Generic.IReadOnlyCollection`1", true)] + [InlineData(SpecialType.System_Collections_Generic_IReadOnlyList_T, "System.Collections.Generic.IReadOnlyList`1", true)] [InlineData(SpecialType.System_Collections_Generic_ICollection_T, "System.Collections.Generic.ICollection`1")] [InlineData(SpecialType.System_Collections_Generic_IList_T, "System.Collections.Generic.IList`1")] - public void SynthesizedReadOnlyList_MissingSpecialTypes(SpecialType missingType, string missingTypeName) + public void SynthesizedReadOnlyList_MissingSpecialTypes(SpecialType missingType, string missingTypeName, bool isOptional = false) { string source = """ using System.Collections.Generic; @@ -9487,13 +9487,81 @@ static void Main() """; var comp = CreateCompilation(source); comp.MakeTypeMissing(missingType); - comp.VerifyEmitDiagnostics( - // (6,30): error CS0518: Predefined type 'System.Collections.IEnumerable' is not defined or imported - // IEnumerable x = [0]; - Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "[0]").WithArguments(missingTypeName).WithLocation(6, 30), - // (7,30): error CS0518: Predefined type 'System.Collections.IEnumerable' is not defined or imported - // IEnumerable y = [..x]; - Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "[..x]").WithArguments(missingTypeName).WithLocation(7, 30)); + comp.VerifyEmitDiagnostics(isOptional + ? [] + : [ + // (6,30): error CS0518: Predefined type 'System.Collections.IEnumerable' is not defined or imported + // IEnumerable x = [0]; + Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "[0]").WithArguments(missingTypeName).WithLocation(6, 30), + // (7,30): error CS0518: Predefined type 'System.Collections.IEnumerable' is not defined or imported + // IEnumerable y = [..x]; + Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "[..x]").WithArguments(missingTypeName).WithLocation(7, 30), + ]); + } + + [Theory] + [InlineData(new SpecialType[0])] + [InlineData(new[] { SpecialType.System_Collections_Generic_IReadOnlyCollection_T })] + [InlineData(new[] { SpecialType.System_Collections_Generic_IReadOnlyList_T })] + [InlineData(new[] { SpecialType.System_Collections_Generic_IReadOnlyCollection_T, + SpecialType.System_Collections_Generic_IReadOnlyList_T })] + public void SynthesizedReadOnlyList_MissingOptionalSpecialTypes(SpecialType[] missingTypes) + { + string source = """ + using System.Collections.Generic; + class Program + { + static void Main() + { + IEnumerable x = [0]; + IEnumerable y = [..x]; + } + } + """; + + var comp = CreateCompilation(source); + foreach (var missingType in missingTypes) + { + comp.MakeTypeMissing(missingType); + } + + var verifier = CompileAndVerify( + comp, + symbolValidator: module => + { + verifyInterfaces(module, "<>z__ReadOnlyArray"); + verifyInterfaces(module, "<>z__ReadOnlyList"); + }); + verifier.VerifyDiagnostics(); + + void verifyInterfaces(ModuleSymbol module, string typeName) + { + var synthesizedType = module.GlobalNamespace.GetTypeMember(typeName); + var interfaces = synthesizedType.InterfacesNoUseSiteDiagnostics(); + AssertEx.Equal( + missingTypes is [] + ? new[] + { + "System.Collections.IEnumerable", + "System.Collections.ICollection", + "System.Collections.IList", + "System.Collections.Generic.IEnumerable", + "System.Collections.Generic.IReadOnlyCollection", + "System.Collections.Generic.IReadOnlyList", + "System.Collections.Generic.ICollection", + "System.Collections.Generic.IList", + } + : new[] + { + "System.Collections.IEnumerable", + "System.Collections.ICollection", + "System.Collections.IList", + "System.Collections.Generic.IEnumerable", + "System.Collections.Generic.ICollection", + "System.Collections.Generic.IList", + }, + interfaces.ToTestDisplayStrings()); + } } [Theory] From cfba8aa8a7c08e903d2eb03c10b2c359b6ce3d3c Mon Sep 17 00:00:00 2001 From: Charles Stoner <10732005+cston@users.noreply.github.com> Date: Mon, 11 Dec 2023 22:08:01 -0800 Subject: [PATCH 101/141] Collection expressions: align ConversionsBase.GetCollectionExpressionTypeKind() with spec (#70975) --- .../Portable/Binder/Binder.ValueChecks.cs | 1 - .../Portable/Binder/Binder_Conversions.cs | 18 +- .../CollectionExpressionTypeKind.cs | 2 - .../Semantics/Conversions/ConversionsBase.cs | 37 +- .../LocalRewriter_CollectionExpression.cs | 107 +- .../Operations/CSharpOperationFactory.cs | 20 +- .../Semantics/CollectionExpressionTests.cs | 1428 +++++++++++++---- 7 files changed, 1251 insertions(+), 362 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs b/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs index cc6a9d0daf136..1940090525932 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs @@ -4042,7 +4042,6 @@ private bool HasLocalScope(BoundCollectionExpression expr) switch (collectionTypeKind) { case CollectionExpressionTypeKind.ReadOnlySpan: - case CollectionExpressionTypeKind.ImmutableArray: // Error case. Debug.Assert(elementType.Type is { }); return !LocalRewriter.ShouldUseRuntimeHelpersCreateSpan(expr, elementType.Type); case CollectionExpressionTypeKind.Span: diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs index d2a8087714a7a..bc01f88477852 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs @@ -688,7 +688,7 @@ private BoundCollectionExpression ConvertCollectionExpression( } else { - if ((collectionTypeKind is CollectionExpressionTypeKind.ArrayInterface or CollectionExpressionTypeKind.List) || + if ((collectionTypeKind is CollectionExpressionTypeKind.ArrayInterface) || node.HasSpreadElements(out _, out _)) { // Verify the existence of the List members that may be used in lowering, even @@ -697,11 +697,7 @@ private BoundCollectionExpression ConvertCollectionExpression( _ = GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__ctor, diagnostics, syntax: syntax); _ = GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__ctorInt32, diagnostics, syntax: syntax); _ = GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__Add, diagnostics, syntax: syntax); - - if (collectionTypeKind != CollectionExpressionTypeKind.List) - { - _ = GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__ToArray, diagnostics, syntax: syntax); - } + _ = GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__ToArray, diagnostics, syntax: syntax); } var elementConversions = conversion.UnderlyingConversions; @@ -771,6 +767,16 @@ BoundNode bindSpreadElement(BoundCollectionExpressionSpreadElement element, Type } } + internal static BoundExpression GetUnderlyingCollectionExpressionElement(BoundExpression element) + { + return element switch + { + BoundCollectionElementInitializer collectionInitializer => collectionInitializer.Arguments[collectionInitializer.InvokedAsExtensionMethod ? 1 : 0], + BoundDynamicCollectionElementInitializer dynamicInitializer => dynamicInitializer.Arguments[0], + _ => element, + }; + } + internal bool TryGetCollectionIterationType(ExpressionSyntax syntax, TypeSymbol collectionType, out TypeWithAnnotations iterationType) { BoundExpression collectionExpr = new BoundValuePlaceholder(syntax, collectionType); diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/CollectionExpressionTypeKind.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/CollectionExpressionTypeKind.cs index 433b698b3dab4..ee9b8e7283ac3 100644 --- a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/CollectionExpressionTypeKind.cs +++ b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/CollectionExpressionTypeKind.cs @@ -8,10 +8,8 @@ internal enum CollectionExpressionTypeKind { None = 0, Array, - ImmutableArray, Span, ReadOnlySpan, - List, CollectionBuilder, ImplementsIEnumerableT, ImplementsIEnumerable, diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs index 1b1311d26c2a2..76cb56ae935a2 100644 --- a/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs +++ b/src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs @@ -1638,23 +1638,14 @@ internal static CollectionExpressionTypeKind GetCollectionExpressionTypeKind(CSh return CollectionExpressionTypeKind.Array; } } - else if (isSpanOrListType(compilation, destination, WellKnownType.System_Collections_Immutable_ImmutableArray_T, out elementType) - && compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_ImmutableCollectionsMarshal__AsImmutableArray_T) is not null) - { - return CollectionExpressionTypeKind.ImmutableArray; - } - else if (isSpanOrListType(compilation, destination, WellKnownType.System_Span_T, out elementType)) + else if (IsSpanOrListType(compilation, destination, WellKnownType.System_Span_T, out elementType)) { return CollectionExpressionTypeKind.Span; } - else if (isSpanOrListType(compilation, destination, WellKnownType.System_ReadOnlySpan_T, out elementType)) + else if (IsSpanOrListType(compilation, destination, WellKnownType.System_ReadOnlySpan_T, out elementType)) { return CollectionExpressionTypeKind.ReadOnlySpan; } - else if (isSpanOrListType(compilation, destination, WellKnownType.System_Collections_Generic_List_T, out elementType)) - { - return CollectionExpressionTypeKind.List; - } else if ((destination as NamedTypeSymbol)?.HasCollectionBuilderAttribute(out _, out _) == true) { return CollectionExpressionTypeKind.CollectionBuilder; @@ -1683,18 +1674,6 @@ internal static CollectionExpressionTypeKind GetCollectionExpressionTypeKind(CSh elementType = default; return CollectionExpressionTypeKind.None; - static bool isSpanOrListType(CSharpCompilation compilation, TypeSymbol targetType, WellKnownType spanType, [NotNullWhen(true)] out TypeWithAnnotations elementType) - { - if (targetType is NamedTypeSymbol { Arity: 1 } namedType - && ReferenceEquals(namedType.OriginalDefinition, compilation.GetWellKnownType(spanType))) - { - elementType = namedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0]; - return true; - } - elementType = default; - return false; - } - static bool implementsSpecialInterface(CSharpCompilation compilation, TypeSymbol targetType, SpecialType specialInterface) { var allInterfaces = targetType.GetAllInterfacesOrEffectiveInterfaces(); @@ -1702,6 +1681,18 @@ static bool implementsSpecialInterface(CSharpCompilation compilation, TypeSymbol return allInterfaces.Any(static (a, b) => ReferenceEquals(a.OriginalDefinition, b), specialType); } } + + internal static bool IsSpanOrListType(CSharpCompilation compilation, TypeSymbol targetType, WellKnownType spanType, [NotNullWhen(true)] out TypeWithAnnotations elementType) + { + if (targetType is NamedTypeSymbol { Arity: 1 } namedType + && ReferenceEquals(namedType.OriginalDefinition, compilation.GetWellKnownType(spanType))) + { + elementType = namedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0]; + return true; + } + elementType = default; + return false; + } #nullable disable internal Conversion ClassifyImplicitUserDefinedConversionForV6SwitchGoverningType(TypeSymbol sourceType, out TypeSymbol switchGoverningType, ref CompoundUseSiteInfo useSiteInfo) diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CollectionExpression.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CollectionExpression.cs index 578b2aef34c0e..139bd48c1a769 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CollectionExpression.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CollectionExpression.cs @@ -36,20 +36,27 @@ private BoundExpression RewriteCollectionExpressionConversion(Conversion convers var collectionTypeKind = conversion.GetCollectionExpressionTypeKind(out var elementType); switch (collectionTypeKind) { - case CollectionExpressionTypeKind.ImplementsIEnumerableT: case CollectionExpressionTypeKind.ImplementsIEnumerable: return VisitCollectionInitializerCollectionExpression(node, node.Type); + case CollectionExpressionTypeKind.ImplementsIEnumerableT: + if (useListOptimization(_compilation, node, out var listElementType)) + { + return CreateAndPopulateList(node, listElementType, node.Elements.SelectAsArray(unwrapListElement)); + } + return VisitCollectionInitializerCollectionExpression(node, node.Type); case CollectionExpressionTypeKind.Array: case CollectionExpressionTypeKind.Span: case CollectionExpressionTypeKind.ReadOnlySpan: Debug.Assert(elementType is { }); return VisitArrayOrSpanCollectionExpression(node, collectionTypeKind, node.Type, TypeWithAnnotations.Create(elementType)); - case CollectionExpressionTypeKind.ImmutableArray: - Debug.Assert(elementType is { }); - return VisitImmutableArrayCollectionExpression(node, elementType); - case CollectionExpressionTypeKind.List: - return CreateAndPopulateList(node, TypeWithAnnotations.Create(elementType)); case CollectionExpressionTypeKind.CollectionBuilder: + // If the collection type is ImmutableArray, then construction is optimized to use + // ImmutableCollectionsMarshal.AsImmutableArray. + if (ConversionsBase.IsSpanOrListType(_compilation, node.Type, WellKnownType.System_Collections_Immutable_ImmutableArray_T, out var arrayElementType) && + _compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_ImmutableCollectionsMarshal__AsImmutableArray_T) is MethodSymbol asImmutableArray) + { + return VisitImmutableArrayCollectionExpression(node, arrayElementType, asImmutableArray); + } return VisitCollectionBuilderCollectionExpression(node); case CollectionExpressionTypeKind.ArrayInterface: return VisitListInterfaceCollectionExpression(node); @@ -61,19 +68,75 @@ private BoundExpression RewriteCollectionExpressionConversion(Conversion convers { _factory.Syntax = previousSyntax; } + + // If the collection type is List and items are added using the expected List.Add(T) method, + // then construction can be optimized to use CollectionsMarshal methods. + static bool useListOptimization(CSharpCompilation compilation, BoundCollectionExpression node, out TypeWithAnnotations elementType) + { + if (!ConversionsBase.IsSpanOrListType(compilation, node.Type, WellKnownType.System_Collections_Generic_List_T, out elementType)) + { + return false; + } + var elements = node.Elements; + if (elements.Length == 0) + { + return true; + } + var addMethod = (MethodSymbol?)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__Add); + if (addMethod is null) + { + return false; + } + return elements.All(canOptimizeListElement, addMethod); + } + + static bool canOptimizeListElement(BoundNode element, MethodSymbol addMethod) + { + BoundExpression expr; + if (element is BoundCollectionExpressionSpreadElement spreadElement) + { + Debug.Assert(spreadElement.IteratorBody is { }); + expr = ((BoundExpressionStatement)spreadElement.IteratorBody).Expression; + } + else + { + expr = (BoundExpression)element; + } + if (expr is BoundCollectionElementInitializer collectionInitializer) + { + return addMethod.Equals(collectionInitializer.AddMethod.OriginalDefinition); + } + return false; + } + + static BoundNode unwrapListElement(BoundNode element) + { + if (element is BoundCollectionExpressionSpreadElement spreadElement) + { + Debug.Assert(spreadElement.IteratorBody is { }); + var iteratorBody = Binder.GetUnderlyingCollectionExpressionElement(((BoundExpressionStatement)spreadElement.IteratorBody).Expression); + return spreadElement.Update( + spreadElement.Expression, + spreadElement.ExpressionPlaceholder, + spreadElement.Conversion, + spreadElement.EnumeratorInfoOpt, + spreadElement.LengthOrCount, + spreadElement.ElementPlaceholder, + new BoundExpressionStatement(iteratorBody.Syntax, iteratorBody)); + } + return Binder.GetUnderlyingCollectionExpressionElement((BoundExpression)element); + } } - private BoundExpression VisitImmutableArrayCollectionExpression(BoundCollectionExpression node, TypeSymbol elementType) + private BoundExpression VisitImmutableArrayCollectionExpression(BoundCollectionExpression node, TypeWithAnnotations elementType, MethodSymbol asImmutableArray) { - var elementTypeWithAnnotations = TypeWithAnnotations.Create(elementType); var arrayCreation = VisitArrayOrSpanCollectionExpression( node, CollectionExpressionTypeKind.Array, - ArrayTypeSymbol.CreateSZArray(_compilation.Assembly, elementTypeWithAnnotations), - elementTypeWithAnnotations); - var asImmutableArray = (MethodSymbol)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_InteropServices_ImmutableCollectionsMarshal__AsImmutableArray_T)!; + ArrayTypeSymbol.CreateSZArray(_compilation.Assembly, elementType), + elementType); // ImmutableCollectionsMarshal.AsImmutableArray(arrayCreation) - return _factory.StaticCall(asImmutableArray.Construct(elementType), ImmutableArray.Create(arrayCreation)); + return _factory.StaticCall(asImmutableArray.Construct(ImmutableArray.Create(elementType)), ImmutableArray.Create(arrayCreation)); } private BoundExpression VisitArrayOrSpanCollectionExpression(BoundCollectionExpression node, CollectionExpressionTypeKind collectionTypeKind, TypeSymbol collectionType, TypeWithAnnotations elementType) @@ -84,6 +147,7 @@ private BoundExpression VisitArrayOrSpanCollectionExpression(BoundCollectionExpr Debug.Assert(node.Placeholder is null); var syntax = node.Syntax; + var elements = node.Elements; MethodSymbol? spanConstructor = null; var arrayType = collectionType as ArrayTypeSymbol; @@ -91,7 +155,6 @@ private BoundExpression VisitArrayOrSpanCollectionExpression(BoundCollectionExpr { // We're constructing a Span or ReadOnlySpan rather than T[]. var spanType = (NamedTypeSymbol)collectionType; - var elements = node.Elements; Debug.Assert(collectionTypeKind is CollectionExpressionTypeKind.Span or CollectionExpressionTypeKind.ReadOnlySpan); Debug.Assert(spanType.OriginalDefinition.Equals(_compilation.GetWellKnownType( @@ -128,7 +191,7 @@ private BoundExpression VisitArrayOrSpanCollectionExpression(BoundCollectionExpr Debug.Assert(IsAllocatingRefStructCollectionExpression(node, collectionTypeKind, elementType.Type, _compilation)); arrayType = ArrayTypeSymbol.CreateSZArray(_compilation.Assembly, elementType); - spanConstructor = ((MethodSymbol)_compilation.GetWellKnownTypeMember( + spanConstructor = ((MethodSymbol)_factory.WellKnownMember( collectionTypeKind == CollectionExpressionTypeKind.Span ? WellKnownMember.System_Span_T__ctor_Array : WellKnownMember.System_ReadOnlySpan_T__ctor_Array)!).AsMember(spanType); } @@ -141,12 +204,12 @@ private BoundExpression VisitArrayOrSpanCollectionExpression(BoundCollectionExpr { // The array initializer has an unknown length, so we'll create an intermediate List instance. // https://github.com/dotnet/roslyn/issues/68785: Emit Enumerable.TryGetNonEnumeratedCount() and avoid intermediate List at runtime. - var list = CreateAndPopulateList(node, elementType); + var list = CreateAndPopulateList(node, elementType, elements); Debug.Assert(list.Type is { }); Debug.Assert(list.Type.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_List_T), TypeCompareKind.AllIgnoreOptions)); - var listToArray = ((MethodSymbol)_compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__ToArray)!).AsMember((NamedTypeSymbol)list.Type); + var listToArray = ((MethodSymbol)_factory.WellKnownMember(WellKnownMember.System_Collections_Generic_List_T__ToArray)).AsMember((NamedTypeSymbol)list.Type); array = _factory.Call(list, listToArray); } @@ -233,6 +296,7 @@ private BoundExpression VisitListInterfaceCollectionExpression(BoundCollectionEx var syntax = node.Syntax; var collectionType = (NamedTypeSymbol)node.Type; var elementType = collectionType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single(); + var elements = node.Elements; BoundExpression arrayOrList; if (collectionType.OriginalDefinition.SpecialType is @@ -243,7 +307,7 @@ SpecialType.System_Collections_Generic_IReadOnlyCollection_T or int numberIncludingLastSpread; bool useKnownLength = ShouldUseKnownLength(node, out numberIncludingLastSpread); - if (numberIncludingLastSpread == 0 && node.Elements.Length == 0) + if (numberIncludingLastSpread == 0 && elements.Length == 0) { // arrayOrList = Array.Empty(); arrayOrList = CreateEmptyArray(syntax, ArrayTypeSymbol.CreateSZArray(_compilation.Assembly, elementType)); @@ -267,7 +331,7 @@ SpecialType.System_Collections_Generic_IReadOnlyCollection_T or else { // fieldValue = new List { e1, ..., eN }; - fieldValue = CreateAndPopulateList(node, elementType); + fieldValue = CreateAndPopulateList(node, elementType, elements); } // arrayOrList = new <>z__ReadOnlyList(fieldValue); @@ -276,7 +340,7 @@ SpecialType.System_Collections_Generic_IReadOnlyCollection_T or } else { - arrayOrList = CreateAndPopulateList(node, elementType); + arrayOrList = CreateAndPopulateList(node, elementType, elements); } return _factory.Convert(collectionType, arrayOrList); @@ -552,13 +616,10 @@ private BoundExpression CreateAndPopulateArray(BoundCollectionExpression node, A /// Create and populate an list from a collection expression. /// The collection may or may not have a known length. /// - private BoundExpression CreateAndPopulateList(BoundCollectionExpression node, TypeWithAnnotations elementType) + private BoundExpression CreateAndPopulateList(BoundCollectionExpression node, TypeWithAnnotations elementType, ImmutableArray elements) { Debug.Assert(!_inExpressionLambda); - Debug.Assert(node.CollectionCreation is null); - Debug.Assert(node.Placeholder is null); - var elements = node.Elements; var typeArguments = ImmutableArray.Create(elementType); var collectionType = _factory.WellKnownType(WellKnownType.System_Collections_Generic_List_T).Construct(typeArguments); diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index ca980022b9d80..f3584bb2b9cf3 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -1250,12 +1250,6 @@ private ICollectionExpressionOperation CreateBoundCollectionExpression(BoundColl return (expr.CollectionCreation as BoundObjectCreationExpression)?.Constructor; case CollectionExpressionTypeKind.CollectionBuilder: return expr.CollectionBuilderMethod; - case CollectionExpressionTypeKind.ImmutableArray: - // https://github.com/dotnet/roslyn/issues/70880: Return the [CollectionBuilder] method. - return null; - case CollectionExpressionTypeKind.List: - Debug.Assert(expr.Type is { }); - return ((MethodSymbol?)compilation.GetWellKnownTypeMember(WellKnownMember.System_Collections_Generic_List_T__ctor))?.AsMember((NamedTypeSymbol)expr.Type); default: throw ExceptionUtilities.UnexpectedValue(expr.CollectionTypeKind); } @@ -1266,23 +1260,13 @@ private IOperation CreateBoundCollectionExpressionElement(BoundNode element) { return element is BoundCollectionExpressionSpreadElement spreadElement ? CreateBoundCollectionExpressionSpreadElement(spreadElement) : - Create(GetUnderlyingCollectionExpressionElement((BoundExpression)element)); - } - - private static BoundExpression GetUnderlyingCollectionExpressionElement(BoundExpression element) - { - return element switch - { - BoundCollectionElementInitializer collectionInitializer => collectionInitializer.Arguments[collectionInitializer.InvokedAsExtensionMethod ? 1 : 0], - BoundDynamicCollectionElementInitializer dynamicInitializer => dynamicInitializer.Arguments[0], - _ => element, - }; + Create(Binder.GetUnderlyingCollectionExpressionElement((BoundExpression)element)); } private ISpreadOperation CreateBoundCollectionExpressionSpreadElement(BoundCollectionExpressionSpreadElement element) { var iteratorBody = ((BoundExpressionStatement?)element.IteratorBody)?.Expression; - var iteratorItem = iteratorBody is null ? null : GetUnderlyingCollectionExpressionElement(iteratorBody); + var iteratorItem = iteratorBody is null ? null : Binder.GetUnderlyingCollectionExpressionElement(iteratorBody); var collection = Create(element.Expression); SyntaxNode syntax = element.Syntax; bool isImplicit = element.WasCompilerGenerated; diff --git a/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs b/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs index 5d69e61707763..42e1b7174d52a 100644 --- a/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs +++ b/src/Compilers/CSharp/Test/Emit2/Semantics/CollectionExpressionTests.cs @@ -3811,6 +3811,9 @@ static void Main() // 1.cs(7,31): error CS1503: Argument 1: cannot convert from 'int' to 'string' // ListBase y = [1, 2]; Diagnostic(ErrorCode.ERR_BadArgType, "2").WithArguments("1", "int", "string").WithLocation(7, 31)); + + var collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Generic_List_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.ImplementsIEnumerable, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out _)); } [WorkItem("https://github.com/dotnet/roslyn/issues/69839")] @@ -3862,9 +3865,6 @@ static void Main() comp.VerifyEmitDiagnostics( // warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options. Diagnostic(ErrorCode.WRN_NoRuntimeMetadataVersion).WithLocation(1, 1), - // 1.cs(6,23): error CS0656: Missing compiler required member 'System.Collections.Generic.List`1..ctor' - // List l = [1]; - Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[1]").WithArguments("System.Collections.Generic.List`1", ".ctor").WithLocation(6, 23), // 1.cs(7,16): error CS9174: Cannot initialize type 'IA' with a collection expression because the type is not constructible. // IA a = [2]; Diagnostic(ErrorCode.ERR_CollectionExpressionTargetTypeNotConstructible, "[2]").WithArguments("System.Collections.Generic.IA").WithLocation(7, 16), @@ -3877,6 +3877,9 @@ static void Main() // 1.cs(10,32): error CS9174: Cannot initialize type 'ID' with a collection expression because the type is not constructible. // ID d = [5]; Diagnostic(ErrorCode.ERR_CollectionExpressionTargetTypeNotConstructible, "[5]").WithArguments("System.Collections.Generic.ID").WithLocation(10, 32)); + + var collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Generic_List_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.ImplementsIEnumerable, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out _)); } [Fact] @@ -3926,12 +3929,12 @@ static void Main() comp.VerifyEmitDiagnostics( // warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options. Diagnostic(ErrorCode.WRN_NoRuntimeMetadataVersion).WithLocation(1, 1), - // 1.cs(7,23): error CS0656: Missing compiler required member 'System.Collections.Generic.List`1..ctor' - // List l = [1]; - Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[1]").WithArguments("System.Collections.Generic.List`1", ".ctor").WithLocation(7, 23), // 1.cs(8,29): error CS9174: Cannot initialize type 'IEquatable' with a collection expression because the type is not constructible. // IEquatable e = [2]; Diagnostic(ErrorCode.ERR_CollectionExpressionTargetTypeNotConstructible, "[2]").WithArguments("System.IEquatable").WithLocation(8, 29)); + + var collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Generic_List_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.ImplementsIEnumerable, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out _)); } [Fact] @@ -3974,15 +3977,19 @@ static void Main() comp.VerifyEmitDiagnostics( // warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options. Diagnostic(ErrorCode.WRN_NoRuntimeMetadataVersion).WithLocation(1, 1), - // 1.cs(7,23): error CS0656: Missing compiler required member 'System.Collections.Generic.List`1..ctor' + // 1.cs(7,23): error CS9174: Cannot initialize type 'List' with a collection expression because the type is not constructible. // List l = [1]; - Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[1]").WithArguments("System.Collections.Generic.List`1", ".ctor").WithLocation(7, 23), + Diagnostic(ErrorCode.ERR_CollectionExpressionTargetTypeNotConstructible, "[1]").WithArguments("System.Collections.Generic.List").WithLocation(7, 23), // 1.cs(8,30): error CS0656: Missing compiler required member 'System.Collections.Generic.List`1..ctor' // IEnumerable e = [2]; Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[2]").WithArguments("System.Collections.Generic.List`1", ".ctor").WithLocation(8, 30), // 1.cs(8,30): error CS0656: Missing compiler required member 'System.Collections.Generic.List`1.ToArray' // IEnumerable e = [2]; Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[2]").WithArguments("System.Collections.Generic.List`1", "ToArray").WithLocation(8, 30)); + + var listType = comp.GetWellKnownType(WellKnownType.System_Collections_Generic_List_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.None, ConversionsBase.GetCollectionExpressionTypeKind(comp, listType, out var elementType)); + Assert.False(elementType.HasType); } [Theory] @@ -7368,41 +7375,66 @@ .locals init (int V_0, verifier.VerifyIL("Program.F", """ { - // Code size 63 (0x3f) - .maxstack 2 + // Code size 141 (0x8d) + .maxstack 9 .locals init (System.Collections.Generic.List V_0, System.Collections.Generic.List.Enumerator V_1, object V_2) - IL_0000: ldarg.0 - IL_0001: dup - IL_0002: callvirt "int System.Collections.Generic.List.Count.get" - IL_0007: newobj "System.Collections.Generic.List..ctor(int)" - IL_000c: stloc.0 - IL_000d: callvirt "System.Collections.Generic.List.Enumerator System.Collections.Generic.List.GetEnumerator()" - IL_0012: stloc.1 + IL_0000: newobj "System.Collections.Generic.List..ctor()" + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: callvirt "System.Collections.Generic.List.Enumerator System.Collections.Generic.List.GetEnumerator()" + IL_000c: stloc.1 .try { - IL_0013: br.s IL_0024 - IL_0015: ldloca.s V_1 - IL_0017: call "dynamic System.Collections.Generic.List.Enumerator.Current.get" - IL_001c: stloc.2 - IL_001d: ldloc.0 - IL_001e: ldloc.2 - IL_001f: callvirt "void System.Collections.Generic.List.Add(object)" - IL_0024: ldloca.s V_1 - IL_0026: call "bool System.Collections.Generic.List.Enumerator.MoveNext()" - IL_002b: brtrue.s IL_0015 - IL_002d: leave.s IL_003d + IL_000d: br.s IL_0072 + IL_000f: ldloca.s V_1 + IL_0011: call "dynamic System.Collections.Generic.List.Enumerator.Current.get" + IL_0016: stloc.2 + IL_0017: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_001c: brtrue.s IL_005c + IL_001e: ldc.i4 0x100 + IL_0023: ldstr "Add" + IL_0028: ldnull + IL_0029: ldtoken "Program" + IL_002e: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" + IL_0033: ldc.i4.2 + IL_0034: newarr "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo" + IL_0039: dup + IL_003a: ldc.i4.0 + IL_003b: ldc.i4.1 + IL_003c: ldnull + IL_003d: call "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)" + IL_0042: stelem.ref + IL_0043: dup + IL_0044: ldc.i4.1 + IL_0045: ldc.i4.0 + IL_0046: ldnull + IL_0047: call "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)" + IL_004c: stelem.ref + IL_004d: call "System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, string, System.Collections.Generic.IEnumerable, System.Type, System.Collections.Generic.IEnumerable)" + IL_0052: call "System.Runtime.CompilerServices.CallSite, dynamic>> System.Runtime.CompilerServices.CallSite, dynamic>>.Create(System.Runtime.CompilerServices.CallSiteBinder)" + IL_0057: stsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_005c: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_0061: ldfld "System.Action, dynamic> System.Runtime.CompilerServices.CallSite, dynamic>>.Target" + IL_0066: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_006b: ldloc.0 + IL_006c: ldloc.2 + IL_006d: callvirt "void System.Action, dynamic>.Invoke(System.Runtime.CompilerServices.CallSite, System.Collections.Generic.List, dynamic)" + IL_0072: ldloca.s V_1 + IL_0074: call "bool System.Collections.Generic.List.Enumerator.MoveNext()" + IL_0079: brtrue.s IL_000f + IL_007b: leave.s IL_008b } finally { - IL_002f: ldloca.s V_1 - IL_0031: constrained. "System.Collections.Generic.List.Enumerator" - IL_0037: callvirt "void System.IDisposable.Dispose()" - IL_003c: endfinally + IL_007d: ldloca.s V_1 + IL_007f: constrained. "System.Collections.Generic.List.Enumerator" + IL_0085: callvirt "void System.IDisposable.Dispose()" + IL_008a: endfinally } - IL_003d: ldloc.0 - IL_003e: ret + IL_008b: ldloc.0 + IL_008c: ret } """); } @@ -8167,7 +8199,7 @@ .locals init (object V_0, } [Fact] - public void KnownLength_List_MissingConstructor() + public void KnownLength_List_MissingConstructor_01() { string source = """ using System.Collections.Generic; @@ -8177,22 +8209,37 @@ static void Main() { List x = []; List y = [1, 2, 3]; - List z = [4, ..y]; } } """; var comp = CreateCompilation(source); comp.MakeMemberMissing(WellKnownMember.System_Collections_Generic_List_T__ctorInt32); comp.VerifyEmitDiagnostics( - // (6,23): error CS0656: Missing compiler required member 'System.Collections.Generic.List`1..ctor' - // List x = []; - Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[]").WithArguments("System.Collections.Generic.List`1", ".ctor").WithLocation(6, 23), // (7,23): error CS0656: Missing compiler required member 'System.Collections.Generic.List`1..ctor' // List y = [1, 2, 3]; - Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[1, 2, 3]").WithArguments("System.Collections.Generic.List`1", ".ctor").WithLocation(7, 23), - // (8,26): error CS0656: Missing compiler required member 'System.Collections.Generic.List`1..ctor' + Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[1, 2, 3]").WithArguments("System.Collections.Generic.List`1", ".ctor").WithLocation(7, 23)); + } + + [Fact] + public void KnownLength_List_MissingConstructor_02() + { + string source = """ + using System.Collections.Generic; + class Program + { + static void Main() + { + List y = new() { 1, 2, 3 }; + List z = [4, ..y]; + } + } + """; + var comp = CreateCompilation(source); + comp.MakeMemberMissing(WellKnownMember.System_Collections_Generic_List_T__ctorInt32); + comp.VerifyEmitDiagnostics( + // (7,26): error CS0656: Missing compiler required member 'System.Collections.Generic.List`1..ctor' // List z = [4, ..y]; - Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[4, ..y]").WithArguments("System.Collections.Generic.List`1", ".ctor").WithLocation(8, 26)); + Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[4, ..y]").WithArguments("System.Collections.Generic.List`1", ".ctor").WithLocation(7, 26)); } [Fact] @@ -15461,6 +15508,95 @@ class MyCollection : MyCollectionBase Diagnostic(ErrorCode.ERR_NoTypeDef, "Create").WithArguments("MyCollectionBuilderBase", $"{assemblyA}, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(2, 76)); } + [Fact] + public void CollectionBuilder_MissingReadOnlySpanConstructor() + { + string sourceA = """ + namespace System + { + public class Object { } + public abstract class ValueType { } + public class String { } + public class Type { } + public struct Void { } + public struct Boolean { } + public struct Int32 { } + public struct Enum { } + public class Attribute { } + public class AttributeUsageAttribute : Attribute + { + public AttributeUsageAttribute(AttributeTargets t) { } + public bool AllowMultiple { get; set; } + public bool Inherited { get; set; } + } + public enum AttributeTargets { } + public ref struct ReadOnlySpan + { + } + } + namespace System.Collections + { + public interface IEnumerator + { + bool MoveNext(); + object Current { get; } + } + public interface IEnumerable + { + IEnumerator GetEnumerator(); + } + } + namespace System.Collections.Generic + { + public interface IEnumerator : IEnumerator + { + new T Current { get; } + } + public interface IEnumerable : IEnumerable + { + new IEnumerator GetEnumerator(); + } + } + namespace System.Runtime.CompilerServices + { + public class CollectionBuilderAttribute : Attribute + { + public CollectionBuilderAttribute(Type builderType, string methodName) { } + } + } + """; + string sourceB = """ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Runtime.CompilerServices; + [CollectionBuilder(typeof(MyCollectionBuilder), "Create")] + class MyCollection : IEnumerable + { + IEnumerator IEnumerable.GetEnumerator() => null; + IEnumerator IEnumerable.GetEnumerator() => null; + } + class MyCollectionBuilder + { + public static MyCollection Create(ReadOnlySpan items) => null; + } + class Program + { + static void Main() + { + MyCollection c = [1, 2, 3]; + } + } + """; + var comp = CreateEmptyCompilation(new[] { sourceA, sourceB }); + comp.VerifyEmitDiagnostics( + // warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options. + Diagnostic(ErrorCode.WRN_NoRuntimeMetadataVersion).WithLocation(1, 1), + // 1.cs(19,34): error CS0656: Missing compiler required member 'System.ReadOnlySpan`1..ctor' + // MyCollection c = [1, 2, 3]; + Diagnostic(ErrorCode.ERR_MissingPredefinedMember, "[1, 2, 3]").WithArguments("System.ReadOnlySpan`1", ".ctor").WithLocation(19, 34)); + } + [Fact] public void CollectionBuilder_Async() { @@ -16392,125 +16528,408 @@ static void Main() comp.VerifyEmitDiagnostics(); } - // List optimizations are skipped in async methods since the optimizations use Span. - [CombinatorialData] - [Theory] - public void ListConstruction_Async( - [CombinatorialValues(TargetFramework.Net70, TargetFramework.Net80)] TargetFramework targetFramework) + // List optimizations are skipped when unexpected Add() method is used. + [Fact] + public void ListConstruction_OtherAddMethod() { - string source = $$""" - using System.Collections.Generic; - using System.Threading.Tasks; - class Program + string sourceA = """ + using System.Collections; + namespace System { - static async Task Main() + public class Object { } + public abstract class ValueType { } + public class String { } + public class Type { } + public struct Void { } + public struct Boolean { } + public struct Int32 { } + public interface IDisposable { - var x = await F(1, 2, 3); - x.Report(); + void Dispose(); } - static async Task Yield(T t) + } + namespace System.Collections + { + public interface IEnumerator { - Task.Yield(); - return t; + bool MoveNext(); + object Current { get; } } - static async Task> F(T x, T y, T z) + public interface IEnumerable { - return [x, await Yield(y), z]; + IEnumerator GetEnumerator(); + } + } + namespace System.Collections.Generic + { + public interface IEnumerator : IEnumerator + { + T Current { get; } + } + public interface IEnumerable : IEnumerable + { + IEnumerator GetEnumerator(); + } + public class List : IEnumerable + { + public List() { } + public List(int capacity) { } + public void Add(T t) { } + public void Add(string s) { } + public int Length => 0; + IEnumerator IEnumerable.GetEnumerator() => null; + IEnumerator IEnumerable.GetEnumerator() => null; } } """; - var verifier = CompileAndVerify( - new[] { source, s_collectionExtensions }, - targetFramework: targetFramework, - verify: Verification.FailsPEVerify, - expectedOutput: IncludeExpectedOutput("[1, 2, 3], ")); - verifier.VerifyIL("Program.d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", """ + string sourceB = """ + using System.Collections.Generic; + class Program { - // Code size 229 (0xe5) + static List F1(object x, string y) => [x, y]; + static List F2(List z) => [..z]; + } + """; + var comp = CreateEmptyCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.RegularPreview.WithNoRefSafetyRulesAttribute()); + var verifier = CompileAndVerify(comp, verify: Verification.FailsPEVerify); + verifier.VerifyIL("Program.F1", """ + { + // Code size 20 (0x14) .maxstack 3 - .locals init (int V_0, - System.Collections.Generic.List V_1, - T V_2, - System.Runtime.CompilerServices.TaskAwaiter V_3, - System.Exception V_4) - IL_0000: ldarg.0 - IL_0001: ldfld "int Program.d__2.<>1__state" - IL_0006: stloc.0 + IL_0000: newobj "System.Collections.Generic.List..ctor()" + IL_0005: dup + IL_0006: ldarg.0 + IL_0007: callvirt "void System.Collections.Generic.List.Add(object)" + IL_000c: dup + IL_000d: ldarg.1 + IL_000e: callvirt "void System.Collections.Generic.List.Add(string)" + IL_0013: ret + } + """); + verifier.VerifyIL("Program.F2", """ + { + // Code size 58 (0x3a) + .maxstack 2 + .locals init (System.Collections.Generic.List V_0, + System.Collections.Generic.IEnumerator V_1, + string V_2, + System.IDisposable V_3) + IL_0000: newobj "System.Collections.Generic.List..ctor()" + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: callvirt "System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator()" + IL_000c: stloc.1 .try { - IL_0007: ldloc.0 - IL_0008: brfalse.s IL_006d - IL_000a: ldarg.0 - IL_000b: ldc.i4.3 - IL_000c: newobj "System.Collections.Generic.List..ctor(int)" - IL_0011: stfld "System.Collections.Generic.List Program.d__2.<>7__wrap2" - IL_0016: ldarg.0 - IL_0017: ldfld "System.Collections.Generic.List Program.d__2.<>7__wrap2" - IL_001c: ldarg.0 - IL_001d: ldfld "T Program.d__2.x" - IL_0022: callvirt "void System.Collections.Generic.List.Add(T)" - IL_0027: ldarg.0 - IL_0028: ldarg.0 - IL_0029: ldfld "System.Collections.Generic.List Program.d__2.<>7__wrap2" - IL_002e: stfld "System.Collections.Generic.List Program.d__2.<>7__wrap1" - IL_0033: ldarg.0 - IL_0034: ldfld "T Program.d__2.y" - IL_0039: call "System.Threading.Tasks.Task Program.Yield(T)" - IL_003e: callvirt "System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()" - IL_0043: stloc.3 - IL_0044: ldloca.s V_3 - IL_0046: call "bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get" - IL_004b: brtrue.s IL_0089 - IL_004d: ldarg.0 - IL_004e: ldc.i4.0 - IL_004f: dup - IL_0050: stloc.0 - IL_0051: stfld "int Program.d__2.<>1__state" - IL_0056: ldarg.0 - IL_0057: ldloc.3 - IL_0058: stfld "System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1" - IL_005d: ldarg.0 - IL_005e: ldflda "System.Runtime.CompilerServices.AsyncTaskMethodBuilder> Program.d__2.<>t__builder" - IL_0063: ldloca.s V_3 - IL_0065: ldarg.0 - IL_0066: call "void System.Runtime.CompilerServices.AsyncTaskMethodBuilder>.AwaitUnsafeOnCompleted, Program.d__2>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Program.d__2)" - IL_006b: leave.s IL_00e4 - IL_006d: ldarg.0 - IL_006e: ldfld "System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1" - IL_0073: stloc.3 - IL_0074: ldarg.0 - IL_0075: ldflda "System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1" - IL_007a: initobj "System.Runtime.CompilerServices.TaskAwaiter" - IL_0080: ldarg.0 - IL_0081: ldc.i4.m1 - IL_0082: dup - IL_0083: stloc.0 - IL_0084: stfld "int Program.d__2.<>1__state" - IL_0089: ldloca.s V_3 - IL_008b: call "T System.Runtime.CompilerServices.TaskAwaiter.GetResult()" - IL_0090: stloc.2 - IL_0091: ldarg.0 - IL_0092: ldfld "System.Collections.Generic.List Program.d__2.<>7__wrap1" - IL_0097: ldloc.2 - IL_0098: callvirt "void System.Collections.Generic.List.Add(T)" - IL_009d: ldarg.0 - IL_009e: ldfld "System.Collections.Generic.List Program.d__2.<>7__wrap2" - IL_00a3: ldarg.0 - IL_00a4: ldfld "T Program.d__2.z" - IL_00a9: callvirt "void System.Collections.Generic.List.Add(T)" - IL_00ae: ldarg.0 - IL_00af: ldfld "System.Collections.Generic.List Program.d__2.<>7__wrap2" - IL_00b4: stloc.1 - IL_00b5: leave.s IL_00d0 + IL_000d: br.s IL_001d + IL_000f: ldloc.1 + IL_0010: callvirt "string System.Collections.Generic.IEnumerator.Current.get" + IL_0015: stloc.2 + IL_0016: ldloc.0 + IL_0017: ldloc.2 + IL_0018: callvirt "void System.Collections.Generic.List.Add(string)" + IL_001d: ldloc.1 + IL_001e: callvirt "bool System.Collections.IEnumerator.MoveNext()" + IL_0023: brtrue.s IL_000f + IL_0025: leave.s IL_0038 } - catch System.Exception + finally { - IL_00b7: stloc.s V_4 - IL_00b9: ldarg.0 - IL_00ba: ldc.i4.s -2 - IL_00bc: stfld "int Program.d__2.<>1__state" - IL_00c1: ldarg.0 - IL_00c2: ldflda "System.Runtime.CompilerServices.AsyncTaskMethodBuilder> Program.d__2.<>t__builder" + IL_0027: ldloc.1 + IL_0028: isinst "System.IDisposable" + IL_002d: stloc.3 + IL_002e: ldloc.3 + IL_002f: brfalse.s IL_0037 + IL_0031: ldloc.3 + IL_0032: callvirt "void System.IDisposable.Dispose()" + IL_0037: endfinally + } + IL_0038: ldloc.0 + IL_0039: ret + } + """); + } + + // List optimizations are skipped when List has a [CollectionBuilder] attribute. + [Fact] + public void ListConstruction_CollectionBuilder() + { + string sourceA = """ + using System.Collections; + using System.Runtime.CompilerServices; + namespace System + { + public class Object { } + public abstract class ValueType { } + public class String { } + public class Type { } + public struct Void { } + public struct Boolean { } + public struct Int32 { } + public interface IDisposable + { + void Dispose(); + } + public struct Enum { } + public class Attribute { } + public class AttributeUsageAttribute : Attribute + { + public AttributeUsageAttribute(AttributeTargets t) { } + public bool AllowMultiple { get; set; } + public bool Inherited { get; set; } + } + public enum AttributeTargets { } + public ref struct ReadOnlySpan + { + public ReadOnlySpan(T[] array) { } + } + } + namespace System.Collections + { + public interface IEnumerator + { + bool MoveNext(); + object Current { get; } + } + public interface IEnumerable + { + IEnumerator GetEnumerator(); + } + } + namespace System.Collections.Generic + { + public interface IEnumerator : IEnumerator + { + new T Current { get; } + } + public interface IEnumerable : IEnumerable + { + new IEnumerator GetEnumerator(); + } + [CollectionBuilder(typeof(ListBuilder), "Create")] + public class List : IEnumerable + { + public List() { } + public List(int capacity) { } + public void Add(T t) { } + public int Length => 0; + public T[] ToArray() => null; + IEnumerator IEnumerable.GetEnumerator() => null; + IEnumerator IEnumerable.GetEnumerator() => null; + } + public class ListBuilder + { + public static List Create(ReadOnlySpan items) => null; + } + } + namespace System.Runtime.CompilerServices + { + public class CollectionBuilderAttribute : Attribute + { + public CollectionBuilderAttribute(Type builderType, string methodName) { } + } + } + """; + string sourceB = """ + using System.Collections.Generic; + class Program + { + static List F1(object x) => [x]; + static List F2(List y) => [..y]; + } + """; + var comp = CreateEmptyCompilation(new[] { sourceA, sourceB }, parseOptions: TestOptions.RegularPreview.WithNoRefSafetyRulesAttribute()); + var verifier = CompileAndVerify(comp, verify: Verification.FailsPEVerify); + verifier.VerifyIL("Program.F1", """ + { + // Code size 21 (0x15) + .maxstack 4 + IL_0000: ldc.i4.1 + IL_0001: newarr "object" + IL_0006: dup + IL_0007: ldc.i4.0 + IL_0008: ldarg.0 + IL_0009: stelem.ref + IL_000a: newobj "System.ReadOnlySpan..ctor(object[])" + IL_000f: call "System.Collections.Generic.List System.Collections.Generic.ListBuilder.Create(System.ReadOnlySpan)" + IL_0014: ret + } + """); + verifier.VerifyIL("Program.F2", """ + { + // Code size 80 (0x50) + .maxstack 3 + .locals init (int V_0, + object[] V_1, + System.Collections.Generic.IEnumerator V_2, + object V_3, + System.IDisposable V_4) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: stloc.0 + IL_0003: dup + IL_0004: callvirt "int System.Collections.Generic.List.Length.get" + IL_0009: newarr "object" + IL_000e: stloc.1 + IL_000f: callvirt "System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator()" + IL_0014: stloc.2 + .try + { + IL_0015: br.s IL_0026 + IL_0017: ldloc.2 + IL_0018: callvirt "object System.Collections.Generic.IEnumerator.Current.get" + IL_001d: stloc.3 + IL_001e: ldloc.1 + IL_001f: ldloc.0 + IL_0020: ldloc.3 + IL_0021: stelem.ref + IL_0022: ldloc.0 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.0 + IL_0026: ldloc.2 + IL_0027: callvirt "bool System.Collections.IEnumerator.MoveNext()" + IL_002c: brtrue.s IL_0017 + IL_002e: leave.s IL_0044 + } + finally + { + IL_0030: ldloc.2 + IL_0031: isinst "System.IDisposable" + IL_0036: stloc.s V_4 + IL_0038: ldloc.s V_4 + IL_003a: brfalse.s IL_0043 + IL_003c: ldloc.s V_4 + IL_003e: callvirt "void System.IDisposable.Dispose()" + IL_0043: endfinally + } + IL_0044: ldloc.1 + IL_0045: newobj "System.ReadOnlySpan..ctor(object[])" + IL_004a: call "System.Collections.Generic.List System.Collections.Generic.ListBuilder.Create(System.ReadOnlySpan)" + IL_004f: ret + } + """); + } + + // List optimizations are skipped in async methods since the optimizations use Span. + [CombinatorialData] + [Theory] + public void ListConstruction_Async( + [CombinatorialValues(TargetFramework.Net70, TargetFramework.Net80)] TargetFramework targetFramework) + { + string source = $$""" + using System.Collections.Generic; + using System.Threading.Tasks; + class Program + { + static async Task Main() + { + var x = await F(1, 2, 3); + x.Report(); + } + static async Task Yield(T t) + { + Task.Yield(); + return t; + } + static async Task> F(T x, T y, T z) + { + return [x, await Yield(y), z]; + } + } + """; + var verifier = CompileAndVerify( + new[] { source, s_collectionExtensions }, + targetFramework: targetFramework, + verify: Verification.FailsPEVerify, + expectedOutput: IncludeExpectedOutput("[1, 2, 3], ")); + verifier.VerifyIL("Program.d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", """ + { + // Code size 229 (0xe5) + .maxstack 3 + .locals init (int V_0, + System.Collections.Generic.List V_1, + T V_2, + System.Runtime.CompilerServices.TaskAwaiter V_3, + System.Exception V_4) + IL_0000: ldarg.0 + IL_0001: ldfld "int Program.d__2.<>1__state" + IL_0006: stloc.0 + .try + { + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_006d + IL_000a: ldarg.0 + IL_000b: ldc.i4.3 + IL_000c: newobj "System.Collections.Generic.List..ctor(int)" + IL_0011: stfld "System.Collections.Generic.List Program.d__2.<>7__wrap2" + IL_0016: ldarg.0 + IL_0017: ldfld "System.Collections.Generic.List Program.d__2.<>7__wrap2" + IL_001c: ldarg.0 + IL_001d: ldfld "T Program.d__2.x" + IL_0022: callvirt "void System.Collections.Generic.List.Add(T)" + IL_0027: ldarg.0 + IL_0028: ldarg.0 + IL_0029: ldfld "System.Collections.Generic.List Program.d__2.<>7__wrap2" + IL_002e: stfld "System.Collections.Generic.List Program.d__2.<>7__wrap1" + IL_0033: ldarg.0 + IL_0034: ldfld "T Program.d__2.y" + IL_0039: call "System.Threading.Tasks.Task Program.Yield(T)" + IL_003e: callvirt "System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()" + IL_0043: stloc.3 + IL_0044: ldloca.s V_3 + IL_0046: call "bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get" + IL_004b: brtrue.s IL_0089 + IL_004d: ldarg.0 + IL_004e: ldc.i4.0 + IL_004f: dup + IL_0050: stloc.0 + IL_0051: stfld "int Program.d__2.<>1__state" + IL_0056: ldarg.0 + IL_0057: ldloc.3 + IL_0058: stfld "System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1" + IL_005d: ldarg.0 + IL_005e: ldflda "System.Runtime.CompilerServices.AsyncTaskMethodBuilder> Program.d__2.<>t__builder" + IL_0063: ldloca.s V_3 + IL_0065: ldarg.0 + IL_0066: call "void System.Runtime.CompilerServices.AsyncTaskMethodBuilder>.AwaitUnsafeOnCompleted, Program.d__2>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Program.d__2)" + IL_006b: leave.s IL_00e4 + IL_006d: ldarg.0 + IL_006e: ldfld "System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1" + IL_0073: stloc.3 + IL_0074: ldarg.0 + IL_0075: ldflda "System.Runtime.CompilerServices.TaskAwaiter Program.d__2.<>u__1" + IL_007a: initobj "System.Runtime.CompilerServices.TaskAwaiter" + IL_0080: ldarg.0 + IL_0081: ldc.i4.m1 + IL_0082: dup + IL_0083: stloc.0 + IL_0084: stfld "int Program.d__2.<>1__state" + IL_0089: ldloca.s V_3 + IL_008b: call "T System.Runtime.CompilerServices.TaskAwaiter.GetResult()" + IL_0090: stloc.2 + IL_0091: ldarg.0 + IL_0092: ldfld "System.Collections.Generic.List Program.d__2.<>7__wrap1" + IL_0097: ldloc.2 + IL_0098: callvirt "void System.Collections.Generic.List.Add(T)" + IL_009d: ldarg.0 + IL_009e: ldfld "System.Collections.Generic.List Program.d__2.<>7__wrap2" + IL_00a3: ldarg.0 + IL_00a4: ldfld "T Program.d__2.z" + IL_00a9: callvirt "void System.Collections.Generic.List.Add(T)" + IL_00ae: ldarg.0 + IL_00af: ldfld "System.Collections.Generic.List Program.d__2.<>7__wrap2" + IL_00b4: stloc.1 + IL_00b5: leave.s IL_00d0 + } + catch System.Exception + { + IL_00b7: stloc.s V_4 + IL_00b9: ldarg.0 + IL_00ba: ldc.i4.s -2 + IL_00bc: stfld "int Program.d__2.<>1__state" + IL_00c1: ldarg.0 + IL_00c2: ldflda "System.Runtime.CompilerServices.AsyncTaskMethodBuilder> Program.d__2.<>t__builder" IL_00c7: ldloc.s V_4 IL_00c9: call "void System.Runtime.CompilerServices.AsyncTaskMethodBuilder>.SetException(System.Exception)" IL_00ce: leave.s IL_00e4 @@ -16552,131 +16971,131 @@ static void Main() verifier.VerifyIL("Program.F1", """ { - // Code size 90 (0x5a) - .maxstack 2 - .locals init (System.Collections.Generic.List V_0, - System.Collections.Generic.List V_1, - System.Span V_2, - int V_3, - System.Collections.Generic.List.Enumerator V_4, - object V_5) - IL_0000: ldarg.0 - IL_0001: stloc.0 - IL_0002: newobj "System.Collections.Generic.List..ctor()" - IL_0007: stloc.1 - IL_0008: ldloc.1 - IL_0009: ldloc.0 - IL_000a: callvirt "int System.Collections.Generic.List.Count.get" - IL_000f: call "void System.Runtime.InteropServices.CollectionsMarshal.SetCount(System.Collections.Generic.List, int)" - IL_0014: ldloc.1 - IL_0015: call "System.Span System.Runtime.InteropServices.CollectionsMarshal.AsSpan(System.Collections.Generic.List)" - IL_001a: stloc.2 - IL_001b: ldc.i4.0 - IL_001c: stloc.3 - IL_001d: ldloc.0 - IL_001e: callvirt "System.Collections.Generic.List.Enumerator System.Collections.Generic.List.GetEnumerator()" - IL_0023: stloc.s V_4 + // Code size 141 (0x8d) + .maxstack 9 + .locals init (System.Collections.Generic.List V_0, + System.Collections.Generic.List.Enumerator V_1, + object V_2) + IL_0000: newobj "System.Collections.Generic.List..ctor()" + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: callvirt "System.Collections.Generic.List.Enumerator System.Collections.Generic.List.GetEnumerator()" + IL_000c: stloc.1 .try { - IL_0025: br.s IL_003f - IL_0027: ldloca.s V_4 - IL_0029: call "dynamic System.Collections.Generic.List.Enumerator.Current.get" - IL_002e: stloc.s V_5 - IL_0030: ldloca.s V_2 - IL_0032: ldloc.3 - IL_0033: call "ref object System.Span.this[int].get" - IL_0038: ldloc.s V_5 - IL_003a: stind.ref - IL_003b: ldloc.3 - IL_003c: ldc.i4.1 - IL_003d: add - IL_003e: stloc.3 - IL_003f: ldloca.s V_4 - IL_0041: call "bool System.Collections.Generic.List.Enumerator.MoveNext()" - IL_0046: brtrue.s IL_0027 - IL_0048: leave.s IL_0058 + IL_000d: br.s IL_0072 + IL_000f: ldloca.s V_1 + IL_0011: call "dynamic System.Collections.Generic.List.Enumerator.Current.get" + IL_0016: stloc.2 + IL_0017: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_001c: brtrue.s IL_005c + IL_001e: ldc.i4 0x100 + IL_0023: ldstr "Add" + IL_0028: ldnull + IL_0029: ldtoken "Program" + IL_002e: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" + IL_0033: ldc.i4.2 + IL_0034: newarr "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo" + IL_0039: dup + IL_003a: ldc.i4.0 + IL_003b: ldc.i4.1 + IL_003c: ldnull + IL_003d: call "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)" + IL_0042: stelem.ref + IL_0043: dup + IL_0044: ldc.i4.1 + IL_0045: ldc.i4.0 + IL_0046: ldnull + IL_0047: call "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)" + IL_004c: stelem.ref + IL_004d: call "System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, string, System.Collections.Generic.IEnumerable, System.Type, System.Collections.Generic.IEnumerable)" + IL_0052: call "System.Runtime.CompilerServices.CallSite, dynamic>> System.Runtime.CompilerServices.CallSite, dynamic>>.Create(System.Runtime.CompilerServices.CallSiteBinder)" + IL_0057: stsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_005c: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_0061: ldfld "System.Action, dynamic> System.Runtime.CompilerServices.CallSite, dynamic>>.Target" + IL_0066: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_006b: ldloc.0 + IL_006c: ldloc.2 + IL_006d: callvirt "void System.Action, dynamic>.Invoke(System.Runtime.CompilerServices.CallSite, System.Collections.Generic.List, dynamic)" + IL_0072: ldloca.s V_1 + IL_0074: call "bool System.Collections.Generic.List.Enumerator.MoveNext()" + IL_0079: brtrue.s IL_000f + IL_007b: leave.s IL_008b } finally { - IL_004a: ldloca.s V_4 - IL_004c: constrained. "System.Collections.Generic.List.Enumerator" - IL_0052: callvirt "void System.IDisposable.Dispose()" - IL_0057: endfinally + IL_007d: ldloca.s V_1 + IL_007f: constrained. "System.Collections.Generic.List.Enumerator" + IL_0085: callvirt "void System.IDisposable.Dispose()" + IL_008a: endfinally } - IL_0058: ldloc.1 - IL_0059: ret + IL_008b: ldloc.0 + IL_008c: ret } """); verifier.VerifyIL("Program.F2", """ { - // Code size 153 (0x99) - .maxstack 4 - .locals init (System.Collections.Generic.List V_0, - System.Collections.Generic.List V_1, - System.Span V_2, - int V_3, - System.Collections.Generic.List.Enumerator V_4, - object V_5) - IL_0000: ldarg.0 - IL_0001: stloc.0 - IL_0002: newobj "System.Collections.Generic.List..ctor()" - IL_0007: stloc.1 - IL_0008: ldloc.1 - IL_0009: ldloc.0 - IL_000a: callvirt "int System.Collections.Generic.List.Count.get" - IL_000f: call "void System.Runtime.InteropServices.CollectionsMarshal.SetCount(System.Collections.Generic.List, int)" - IL_0014: ldloc.1 - IL_0015: call "System.Span System.Runtime.InteropServices.CollectionsMarshal.AsSpan(System.Collections.Generic.List)" - IL_001a: stloc.2 - IL_001b: ldc.i4.0 - IL_001c: stloc.3 - IL_001d: ldloc.0 - IL_001e: callvirt "System.Collections.Generic.List.Enumerator System.Collections.Generic.List.GetEnumerator()" - IL_0023: stloc.s V_4 + // Code size 141 (0x8d) + .maxstack 9 + .locals init (System.Collections.Generic.List V_0, + System.Collections.Generic.List.Enumerator V_1, + object V_2) + IL_0000: newobj "System.Collections.Generic.List..ctor()" + IL_0005: stloc.0 + IL_0006: ldarg.0 + IL_0007: callvirt "System.Collections.Generic.List.Enumerator System.Collections.Generic.List.GetEnumerator()" + IL_000c: stloc.1 .try { - IL_0025: br.s IL_007e - IL_0027: ldloca.s V_4 - IL_0029: call "dynamic System.Collections.Generic.List.Enumerator.Current.get" - IL_002e: stloc.s V_5 - IL_0030: ldloca.s V_2 - IL_0032: ldloc.3 - IL_0033: call "ref int System.Span.this[int].get" - IL_0038: ldsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__1.<>p__0" - IL_003d: brtrue.s IL_0063 - IL_003f: ldc.i4.0 - IL_0040: ldtoken "int" - IL_0045: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" - IL_004a: ldtoken "Program" - IL_004f: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" - IL_0054: call "System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.Convert(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, System.Type, System.Type)" - IL_0059: call "System.Runtime.CompilerServices.CallSite> System.Runtime.CompilerServices.CallSite>.Create(System.Runtime.CompilerServices.CallSiteBinder)" - IL_005e: stsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__1.<>p__0" - IL_0063: ldsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__1.<>p__0" - IL_0068: ldfld "System.Func System.Runtime.CompilerServices.CallSite>.Target" - IL_006d: ldsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__1.<>p__0" - IL_0072: ldloc.s V_5 - IL_0074: callvirt "int System.Func.Invoke(System.Runtime.CompilerServices.CallSite, dynamic)" - IL_0079: stind.i4 - IL_007a: ldloc.3 - IL_007b: ldc.i4.1 - IL_007c: add - IL_007d: stloc.3 - IL_007e: ldloca.s V_4 - IL_0080: call "bool System.Collections.Generic.List.Enumerator.MoveNext()" - IL_0085: brtrue.s IL_0027 - IL_0087: leave.s IL_0097 + IL_000d: br.s IL_0072 + IL_000f: ldloca.s V_1 + IL_0011: call "dynamic System.Collections.Generic.List.Enumerator.Current.get" + IL_0016: stloc.2 + IL_0017: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__1.<>p__0" + IL_001c: brtrue.s IL_005c + IL_001e: ldc.i4 0x100 + IL_0023: ldstr "Add" + IL_0028: ldnull + IL_0029: ldtoken "Program" + IL_002e: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" + IL_0033: ldc.i4.2 + IL_0034: newarr "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo" + IL_0039: dup + IL_003a: ldc.i4.0 + IL_003b: ldc.i4.1 + IL_003c: ldnull + IL_003d: call "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)" + IL_0042: stelem.ref + IL_0043: dup + IL_0044: ldc.i4.1 + IL_0045: ldc.i4.0 + IL_0046: ldnull + IL_0047: call "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)" + IL_004c: stelem.ref + IL_004d: call "System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, string, System.Collections.Generic.IEnumerable, System.Type, System.Collections.Generic.IEnumerable)" + IL_0052: call "System.Runtime.CompilerServices.CallSite, dynamic>> System.Runtime.CompilerServices.CallSite, dynamic>>.Create(System.Runtime.CompilerServices.CallSiteBinder)" + IL_0057: stsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__1.<>p__0" + IL_005c: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__1.<>p__0" + IL_0061: ldfld "System.Action, dynamic> System.Runtime.CompilerServices.CallSite, dynamic>>.Target" + IL_0066: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__1.<>p__0" + IL_006b: ldloc.0 + IL_006c: ldloc.2 + IL_006d: callvirt "void System.Action, dynamic>.Invoke(System.Runtime.CompilerServices.CallSite, System.Collections.Generic.List, dynamic)" + IL_0072: ldloca.s V_1 + IL_0074: call "bool System.Collections.Generic.List.Enumerator.MoveNext()" + IL_0079: brtrue.s IL_000f + IL_007b: leave.s IL_008b } finally { - IL_0089: ldloca.s V_4 - IL_008b: constrained. "System.Collections.Generic.List.Enumerator" - IL_0091: callvirt "void System.IDisposable.Dispose()" - IL_0096: endfinally + IL_007d: ldloca.s V_1 + IL_007f: constrained. "System.Collections.Generic.List.Enumerator" + IL_0085: callvirt "void System.IDisposable.Dispose()" + IL_008a: endfinally } - IL_0097: ldloc.1 - IL_0098: ret + IL_008b: ldloc.0 + IL_008c: ret } """); } @@ -16761,27 +17180,245 @@ .locals init (System.Collections.Generic.List V_0, } [Fact] - public void ListConstruction_Dynamic_03() + public void ListConstruction_Dynamic_03() + { + string source = $$""" + using System.Collections.Generic; + class Program + { + static List F2(dynamic e) => [..e]; + static void Main() + { + F2((int[])[4, 5]).Report(); + } + } + """; + // https://github.com/dotnet/roslyn/issues/69704: Should compile and run with expectedOutput: "[4, 5], " + var comp = CreateCompilation( + new[] { source, s_collectionExtensions }, + targetFramework: TargetFramework.Net80); + comp.VerifyEmitDiagnostics( + // 0.cs(4,42): error CS0029: Cannot implicitly convert type 'object' to 'int' + // static List F2(dynamic e) => [..e]; + Diagnostic(ErrorCode.ERR_NoImplicitConv, "e").WithArguments("object", "int").WithLocation(4, 42)); + } + + [Fact] + public void ListConstruction_Dynamic_04() + { + string source = $$""" + using System.Collections.Generic; + class Program + { + static List F1(dynamic d) => [d]; + static List F2(dynamic d) => [d]; + static void Main() + { + F1(1).Report(); + F2(2).Report(); + } + } + """; + var verifier = CompileAndVerify( + new[] { source, s_collectionExtensions }, + targetFramework: TargetFramework.Net80, + options: TestOptions.ReleaseExe, + verify: Verification.FailsPEVerify, + expectedOutput: IncludeExpectedOutput("[1], [2], ")); + verifier.VerifyIL("Program.F1", + """ + { + // Code size 99 (0x63) + .maxstack 9 + .locals init (System.Collections.Generic.List V_0) + IL_0000: newobj "System.Collections.Generic.List..ctor()" + IL_0005: stloc.0 + IL_0006: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_000b: brtrue.s IL_004b + IL_000d: ldc.i4 0x100 + IL_0012: ldstr "Add" + IL_0017: ldnull + IL_0018: ldtoken "Program" + IL_001d: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" + IL_0022: ldc.i4.2 + IL_0023: newarr "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo" + IL_0028: dup + IL_0029: ldc.i4.0 + IL_002a: ldc.i4.1 + IL_002b: ldnull + IL_002c: call "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)" + IL_0031: stelem.ref + IL_0032: dup + IL_0033: ldc.i4.1 + IL_0034: ldc.i4.0 + IL_0035: ldnull + IL_0036: call "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)" + IL_003b: stelem.ref + IL_003c: call "System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, string, System.Collections.Generic.IEnumerable, System.Type, System.Collections.Generic.IEnumerable)" + IL_0041: call "System.Runtime.CompilerServices.CallSite, dynamic>> System.Runtime.CompilerServices.CallSite, dynamic>>.Create(System.Runtime.CompilerServices.CallSiteBinder)" + IL_0046: stsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_004b: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_0050: ldfld "System.Action, dynamic> System.Runtime.CompilerServices.CallSite, dynamic>>.Target" + IL_0055: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__0.<>p__0" + IL_005a: ldloc.0 + IL_005b: ldarg.0 + IL_005c: callvirt "void System.Action, dynamic>.Invoke(System.Runtime.CompilerServices.CallSite, System.Collections.Generic.List, dynamic)" + IL_0061: ldloc.0 + IL_0062: ret + } + """); + verifier.VerifyIL("Program.F2", + """ + { + // Code size 99 (0x63) + .maxstack 9 + .locals init (System.Collections.Generic.List V_0) + IL_0000: newobj "System.Collections.Generic.List..ctor()" + IL_0005: stloc.0 + IL_0006: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__1.<>p__0" + IL_000b: brtrue.s IL_004b + IL_000d: ldc.i4 0x100 + IL_0012: ldstr "Add" + IL_0017: ldnull + IL_0018: ldtoken "Program" + IL_001d: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" + IL_0022: ldc.i4.2 + IL_0023: newarr "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo" + IL_0028: dup + IL_0029: ldc.i4.0 + IL_002a: ldc.i4.1 + IL_002b: ldnull + IL_002c: call "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)" + IL_0031: stelem.ref + IL_0032: dup + IL_0033: ldc.i4.1 + IL_0034: ldc.i4.0 + IL_0035: ldnull + IL_0036: call "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)" + IL_003b: stelem.ref + IL_003c: call "System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, string, System.Collections.Generic.IEnumerable, System.Type, System.Collections.Generic.IEnumerable)" + IL_0041: call "System.Runtime.CompilerServices.CallSite, dynamic>> System.Runtime.CompilerServices.CallSite, dynamic>>.Create(System.Runtime.CompilerServices.CallSiteBinder)" + IL_0046: stsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__1.<>p__0" + IL_004b: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__1.<>p__0" + IL_0050: ldfld "System.Action, dynamic> System.Runtime.CompilerServices.CallSite, dynamic>>.Target" + IL_0055: ldsfld "System.Runtime.CompilerServices.CallSite, dynamic>> Program.<>o__1.<>p__0" + IL_005a: ldloc.0 + IL_005b: ldarg.0 + IL_005c: callvirt "void System.Action, dynamic>.Invoke(System.Runtime.CompilerServices.CallSite, System.Collections.Generic.List, dynamic)" + IL_0061: ldloc.0 + IL_0062: ret + } + """); + } + + [Fact] + public void ListConstruction_Dynamic_05() { string source = $$""" using System.Collections.Generic; class Program { - static List F2(dynamic e) => [..e]; + static List F1(dynamic[] d) => [d]; + static List F2(List e) => [..e]; static void Main() { - F2((int[])[4, 5]).Report(); + F1([1, 2, 3]).Report(); + F2([[4], [5]]).Report(); } } """; - // https://github.com/dotnet/roslyn/issues/69704: Should compile and run with expectedOutput: "[4, 5], " - var comp = CreateCompilation( + var verifier = CompileAndVerify( new[] { source, s_collectionExtensions }, - targetFramework: TargetFramework.Net80); - comp.VerifyEmitDiagnostics( - // 0.cs(4,42): error CS0029: Cannot implicitly convert type 'object' to 'int' - // static List F2(dynamic e) => [..e]; - Diagnostic(ErrorCode.ERR_NoImplicitConv, "e").WithArguments("object", "int").WithLocation(4, 42)); + targetFramework: TargetFramework.Net80, + options: TestOptions.ReleaseExe, + verify: Verification.FailsPEVerify, + expectedOutput: IncludeExpectedOutput("[[1, 2, 3]], [[4], [5]], ")); + verifier.VerifyIL("Program.F1", + """ + { + // Code size 36 (0x24) + .maxstack 3 + .locals init (System.Span V_0, + int V_1) + IL_0000: newobj "System.Collections.Generic.List..ctor()" + IL_0005: dup + IL_0006: ldc.i4.1 + IL_0007: call "void System.Runtime.InteropServices.CollectionsMarshal.SetCount(System.Collections.Generic.List, int)" + IL_000c: dup + IL_000d: call "System.Span System.Runtime.InteropServices.CollectionsMarshal.AsSpan(System.Collections.Generic.List)" + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: stloc.1 + IL_0015: ldloca.s V_0 + IL_0017: ldloc.1 + IL_0018: call "ref object System.Span.this[int].get" + IL_001d: ldarg.0 + IL_001e: stind.ref + IL_001f: ldloc.1 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.1 + IL_0023: ret + } + """); + verifier.VerifyIL("Program.F2", + """ + { + // Code size 90 (0x5a) + .maxstack 2 + .locals init (System.Collections.Generic.List V_0, + System.Collections.Generic.List V_1, + System.Span V_2, + int V_3, + System.Collections.Generic.List.Enumerator V_4, + dynamic[] V_5) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: newobj "System.Collections.Generic.List..ctor()" + IL_0007: stloc.1 + IL_0008: ldloc.1 + IL_0009: ldloc.0 + IL_000a: callvirt "int System.Collections.Generic.List.Count.get" + IL_000f: call "void System.Runtime.InteropServices.CollectionsMarshal.SetCount(System.Collections.Generic.List, int)" + IL_0014: ldloc.1 + IL_0015: call "System.Span System.Runtime.InteropServices.CollectionsMarshal.AsSpan(System.Collections.Generic.List)" + IL_001a: stloc.2 + IL_001b: ldc.i4.0 + IL_001c: stloc.3 + IL_001d: ldloc.0 + IL_001e: callvirt "System.Collections.Generic.List.Enumerator System.Collections.Generic.List.GetEnumerator()" + IL_0023: stloc.s V_4 + .try + { + IL_0025: br.s IL_003f + IL_0027: ldloca.s V_4 + IL_0029: call "dynamic[] System.Collections.Generic.List.Enumerator.Current.get" + IL_002e: stloc.s V_5 + IL_0030: ldloca.s V_2 + IL_0032: ldloc.3 + IL_0033: call "ref object System.Span.this[int].get" + IL_0038: ldloc.s V_5 + IL_003a: stind.ref + IL_003b: ldloc.3 + IL_003c: ldc.i4.1 + IL_003d: add + IL_003e: stloc.3 + IL_003f: ldloca.s V_4 + IL_0041: call "bool System.Collections.Generic.List.Enumerator.MoveNext()" + IL_0046: brtrue.s IL_0027 + IL_0048: leave.s IL_0058 + } + finally + { + IL_004a: ldloca.s V_4 + IL_004c: constrained. "System.Collections.Generic.List.Enumerator" + IL_0052: callvirt "void System.IDisposable.Dispose()" + IL_0057: endfinally + } + IL_0058: ldloc.1 + IL_0059: ret + } + """); } [ConditionalFact(typeof(DesktopOnly))] @@ -21197,7 +21834,7 @@ static ImmutableArray Create(ImmutableArray x, int y) VerifyOperationTreeForTest(comp, """ - ICollectionExpressionOperation (2 elements, ConstructMethod: null) (OperationKind.CollectionExpression, Type: System.Collections.Immutable.ImmutableArray) (Syntax: '[..x, y]') + ICollectionExpressionOperation (2 elements, ConstructMethod: System.Collections.Immutable.ImmutableArray System.Collections.Immutable.ImmutableArray.Create(System.ReadOnlySpan items)) (OperationKind.CollectionExpression, Type: System.Collections.Immutable.ImmutableArray) (Syntax: '[..x, y]') Elements(2): ISpreadOperation (ElementType: System.Int32) (OperationKind.Spread, Type: null) (Syntax: '..x') Operand: @@ -21225,7 +21862,7 @@ static ImmutableArray Create(ImmutableArray x, int y) Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) (CollectionExpression) Operand: - ICollectionExpressionOperation (2 elements, ConstructMethod: null) (OperationKind.CollectionExpression, Type: System.Collections.Immutable.ImmutableArray) (Syntax: '[..x, y]') + ICollectionExpressionOperation (2 elements, ConstructMethod: System.Collections.Immutable.ImmutableArray System.Collections.Immutable.ImmutableArray.Create(System.ReadOnlySpan items)) (OperationKind.CollectionExpression, Type: System.Collections.Immutable.ImmutableArray) (Syntax: '[..x, y]') Elements(2): ISpreadOperation (ElementType: System.Int32) (OperationKind.Spread, Type: null) (Syntax: '..x') Operand: @@ -23594,6 +24231,10 @@ .locals init (int V_0, //x IL_0048: ret } """); + + var collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.CollectionBuilder, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out var elementType)); + Assert.False(elementType.HasType); } [Fact] @@ -23649,6 +24290,10 @@ .locals init (int V_0, //x IL_0028: ret } """); + + var comp = (CSharpCompilation)verifier.Compilation; + var collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.CollectionBuilder, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out _)); } [Fact] @@ -23881,18 +24526,21 @@ class Program static void Main() { ImmutableArray arr = [1, 2, 3]; - arr.Report(); } } """; - var comp = CreateCompilation(new[] { sourceA, s_collectionExtensions }, targetFramework: TargetFramework.Net60); + var comp = CreateCompilation(sourceA, targetFramework: TargetFramework.Net60); comp.VerifyEmitDiagnostics( // 0.cs(7,35): error CS9210: This version of 'ImmutableArray' cannot be used with collection expressions. // ImmutableArray arr = [1, 2, 3]; Diagnostic(ErrorCode.ERR_CollectionExpressionImmutableArray, "[1, 2, 3]").WithArguments("System.Collections.Immutable.ImmutableArray").WithLocation(7, 35)); - // Can work around this error in downlevel scenarios by defining ImmutableCollectionsMarshal.AsImmutableArray + var collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.ImplementsIEnumerableT, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out _)); + + // ImmutableCollectionsMarshal.AsImmutableArray is not sufficient to optimize collection expressions + // targeting ImmutableArray. ImmutableArray must also have a [CollectionBuilder] attribute. string sourceB = """ using System.Collections.Immutable; @@ -23906,28 +24554,18 @@ public static class ImmutableCollectionsMarshal } """; - var verifier = CompileAndVerify(new[] { sourceA, sourceB, s_collectionExtensions }, targetFramework: TargetFramework.Net60, verify: Verification.Skipped, expectedOutput: IncludeExpectedOutput("[1, 2, 3],")); - verifier.VerifyDiagnostics(); - verifier.VerifyIL("Program.Main", """ - { - // Code size 34 (0x22) - .maxstack 3 - IL_0000: ldc.i4.3 - IL_0001: newarr "int" - IL_0006: dup - IL_0007: ldtoken ".__StaticArrayInitTypeSize=12 .4636993D3E1DA4E9D6B8F87B79E8F7C6D018580D52661950EABC3845C5897A4D" - IL_000c: call "void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" - IL_0011: call "System.Collections.Immutable.ImmutableArray System.Runtime.InteropServices.ImmutableCollectionsMarshal.AsImmutableArray(int[])" - IL_0016: box "System.Collections.Immutable.ImmutableArray" - IL_001b: ldc.i4.0 - IL_001c: call "void CollectionExtensions.Report(object, bool)" - IL_0021: ret - } - """); + comp = CreateCompilation(new[] { sourceA, sourceB }, targetFramework: TargetFramework.Net60); + comp.VerifyEmitDiagnostics( + // 0.cs(7,35): error CS9210: This version of 'ImmutableArray' cannot be used with collection expressions. + // ImmutableArray arr = [1, 2, 3]; + Diagnostic(ErrorCode.ERR_CollectionExpressionImmutableArray, "[1, 2, 3]").WithArguments("System.Collections.Immutable.ImmutableArray").WithLocation(7, 35)); + + collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.ImplementsIEnumerableT, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out _)); } [Fact] - public void ImmutableArray_07() + public void ImmutableArray_IEnumerableOnly() { // Test an ImmutableArray which implements only non-generic IEnumerable. string sourceA = """ @@ -23956,6 +24594,215 @@ public void Add(T t) { } // 0.cs(7,35): error CS9210: This version of 'ImmutableArray' cannot be used with collection expressions. // ImmutableArray arr = [1, 2, 3]; Diagnostic(ErrorCode.ERR_CollectionExpressionImmutableArray, "[1, 2, 3]").WithArguments("System.Collections.Immutable.ImmutableArray").WithLocation(7, 35)); + + var collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.ImplementsIEnumerable, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out _)); + + // With ImmutableCollectionsMarshal.AsImmutableArray. + string sourceB = """ + using System.Collections.Immutable; + + namespace System.Runtime.InteropServices + { + static class ImmutableCollectionsMarshal + { + public static ImmutableArray AsImmutableArray(T[] array) => default; + } + } + """; + + comp = CreateCompilation(new[] { sourceA, sourceB }, targetFramework: TargetFramework.Mscorlib40); + comp.VerifyEmitDiagnostics( + // 0.cs(7,35): error CS9210: This version of 'ImmutableArray' cannot be used with collection expressions. + // ImmutableArray arr = [1, 2, 3]; + Diagnostic(ErrorCode.ERR_CollectionExpressionImmutableArray, "[1, 2, 3]").WithArguments("System.Collections.Immutable.ImmutableArray").WithLocation(7, 35)); + + collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.ImplementsIEnumerable, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out _)); + } + + [Fact] + public void ImmutableArray_NoInterfaces() + { + string sourceA = """ + using System.Collections.Immutable; + + class Program + { + static void Main() + { + ImmutableArray arr = [1, 2, 3]; + } + } + + namespace System.Collections.Immutable + { + struct ImmutableArray + { + } + } + """; + + var comp = CreateCompilation(sourceA, targetFramework: TargetFramework.Mscorlib40); + comp.VerifyEmitDiagnostics( + // (7,35): error CS9174: Cannot initialize type 'ImmutableArray' with a collection expression because the type is not constructible. + // ImmutableArray arr = [1, 2, 3]; + Diagnostic(ErrorCode.ERR_CollectionExpressionTargetTypeNotConstructible, "[1, 2, 3]").WithArguments("System.Collections.Immutable.ImmutableArray").WithLocation(7, 35)); + + var collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.None, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out _)); + + // With ImmutableCollectionsMarshal.AsImmutableArray. + string sourceB = """ + using System.Collections.Immutable; + + namespace System.Runtime.InteropServices + { + static class ImmutableCollectionsMarshal + { + public static ImmutableArray AsImmutableArray(T[] array) => default; + } + } + """; + + comp = CreateCompilation(new[] { sourceA, sourceB }, targetFramework: TargetFramework.Mscorlib40); + comp.VerifyEmitDiagnostics( + // (7,35): error CS9174: Cannot initialize type 'ImmutableArray' with a collection expression because the type is not constructible. + // ImmutableArray arr = [1, 2, 3]; + Diagnostic(ErrorCode.ERR_CollectionExpressionTargetTypeNotConstructible, "[1, 2, 3]").WithArguments("System.Collections.Immutable.ImmutableArray").WithLocation(7, 35)); + + collectionType = comp.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T).Construct(comp.GetSpecialType(SpecialType.System_Int32)); + Assert.Equal(CollectionExpressionTypeKind.None, ConversionsBase.GetCollectionExpressionTypeKind(comp, collectionType, out _)); + } + + [Fact] + public void ImmutableArray_Dynamic_01() + { + string source = """ + using System.Collections.Generic; + using System.Collections.Immutable; + class Program + { + static ImmutableArray F1(dynamic d) => [d]; + static ImmutableArray F2(List e) => [..e]; + static ImmutableArray F3(dynamic[] d) => [d]; + static void Main() + { + F1(1).Report(); + F2([2, 3]).Report(); + F3([4, 5]).Report(); + } + } + """; + var verifier = CompileAndVerify( + new[] { source, s_collectionExtensions }, + targetFramework: TargetFramework.Net80, + expectedOutput: IncludeExpectedOutput("[1], [2, 3], [[4, 5]], "), + verify: Verification.Skipped); + verifier.VerifyIL("Program.F1", """ + { + // Code size 79 (0x4f) + .maxstack 6 + IL_0000: ldc.i4.1 + IL_0001: newarr "int" + IL_0006: dup + IL_0007: ldc.i4.0 + IL_0008: ldsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__0.<>p__0" + IL_000d: brtrue.s IL_0033 + IL_000f: ldc.i4.0 + IL_0010: ldtoken "int" + IL_0015: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" + IL_001a: ldtoken "Program" + IL_001f: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" + IL_0024: call "System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.Convert(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, System.Type, System.Type)" + IL_0029: call "System.Runtime.CompilerServices.CallSite> System.Runtime.CompilerServices.CallSite>.Create(System.Runtime.CompilerServices.CallSiteBinder)" + IL_002e: stsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__0.<>p__0" + IL_0033: ldsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__0.<>p__0" + IL_0038: ldfld "System.Func System.Runtime.CompilerServices.CallSite>.Target" + IL_003d: ldsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__0.<>p__0" + IL_0042: ldarg.0 + IL_0043: callvirt "int System.Func.Invoke(System.Runtime.CompilerServices.CallSite, dynamic)" + IL_0048: stelem.i4 + IL_0049: call "System.Collections.Immutable.ImmutableArray System.Runtime.InteropServices.ImmutableCollectionsMarshal.AsImmutableArray(int[])" + IL_004e: ret + } + """); + verifier.VerifyIL("Program.F2", """ + { + // Code size 134 (0x86) + .maxstack 5 + .locals init (int V_0, + int[] V_1, + System.Collections.Generic.List.Enumerator V_2, + object V_3) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: stloc.0 + IL_0003: dup + IL_0004: callvirt "int System.Collections.Generic.List.Count.get" + IL_0009: newarr "int" + IL_000e: stloc.1 + IL_000f: callvirt "System.Collections.Generic.List.Enumerator System.Collections.Generic.List.GetEnumerator()" + IL_0014: stloc.2 + .try + { + IL_0015: br.s IL_0066 + IL_0017: ldloca.s V_2 + IL_0019: call "dynamic System.Collections.Generic.List.Enumerator.Current.get" + IL_001e: stloc.3 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: ldsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__1.<>p__0" + IL_0026: brtrue.s IL_004c + IL_0028: ldc.i4.0 + IL_0029: ldtoken "int" + IL_002e: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" + IL_0033: ldtoken "Program" + IL_0038: call "System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)" + IL_003d: call "System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.Convert(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, System.Type, System.Type)" + IL_0042: call "System.Runtime.CompilerServices.CallSite> System.Runtime.CompilerServices.CallSite>.Create(System.Runtime.CompilerServices.CallSiteBinder)" + IL_0047: stsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__1.<>p__0" + IL_004c: ldsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__1.<>p__0" + IL_0051: ldfld "System.Func System.Runtime.CompilerServices.CallSite>.Target" + IL_0056: ldsfld "System.Runtime.CompilerServices.CallSite> Program.<>o__1.<>p__0" + IL_005b: ldloc.3 + IL_005c: callvirt "int System.Func.Invoke(System.Runtime.CompilerServices.CallSite, dynamic)" + IL_0061: stelem.i4 + IL_0062: ldloc.0 + IL_0063: ldc.i4.1 + IL_0064: add + IL_0065: stloc.0 + IL_0066: ldloca.s V_2 + IL_0068: call "bool System.Collections.Generic.List.Enumerator.MoveNext()" + IL_006d: brtrue.s IL_0017 + IL_006f: leave.s IL_007f + } + finally + { + IL_0071: ldloca.s V_2 + IL_0073: constrained. "System.Collections.Generic.List.Enumerator" + IL_0079: callvirt "void System.IDisposable.Dispose()" + IL_007e: endfinally + } + IL_007f: ldloc.1 + IL_0080: call "System.Collections.Immutable.ImmutableArray System.Runtime.InteropServices.ImmutableCollectionsMarshal.AsImmutableArray(int[])" + IL_0085: ret + } + """); + verifier.VerifyIL("Program.F3", """ + { + // Code size 16 (0x10) + .maxstack 4 + IL_0000: ldc.i4.1 + IL_0001: newarr "object" + IL_0006: dup + IL_0007: ldc.i4.0 + IL_0008: ldarg.0 + IL_0009: stelem.ref + IL_000a: call "System.Collections.Immutable.ImmutableArray System.Runtime.InteropServices.ImmutableCollectionsMarshal.AsImmutableArray(object[])" + IL_000f: ret + } + """); } [Fact] @@ -24126,9 +24973,12 @@ class Program """; var comp = CreateCompilation(new[] { sourceA, sourceB }, targetFramework: TargetFramework.Net80); comp.VerifyEmitDiagnostics( - // 1.cs(6,52): error CS9203: A collection expression of type 'ImmutableArray' cannot be used in this context because it may be exposed outside of the current scope. + // 1.cs(5,40): error CS9174: Cannot initialize type 'ImmutableArray' with a collection expression because the type is not constructible. + // static ImmutableArray F1() => [1, 2, 3]; + Diagnostic(ErrorCode.ERR_CollectionExpressionTargetTypeNotConstructible, "[1, 2, 3]").WithArguments("System.Collections.Immutable.ImmutableArray").WithLocation(5, 40), + // 1.cs(6,52): error CS9174: Cannot initialize type 'ImmutableArray' with a collection expression because the type is not constructible. // static ImmutableArray F2(int x, int y) => [x, y]; - Diagnostic(ErrorCode.ERR_CollectionExpressionEscape, "[x, y]").WithArguments("System.Collections.Immutable.ImmutableArray").WithLocation(6, 52)); + Diagnostic(ErrorCode.ERR_CollectionExpressionTargetTypeNotConstructible, "[x, y]").WithArguments("System.Collections.Immutable.ImmutableArray").WithLocation(6, 52)); } [WorkItem("https://github.com/dotnet/roslyn/issues/70638")] From 28b837f686f22720b3acb6580ad5db28c26211a1 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 12 Dec 2023 17:31:00 +1100 Subject: [PATCH 102/141] Update after merge --- src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs b/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs index 29d4b17840b31..9fafd66553e07 100644 --- a/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs +++ b/src/Tools/ExternalAccess/RazorTest/Cohost/RazorCohostTests.cs @@ -210,8 +210,8 @@ protected override Task HandleRequestAsync(TextDocumentPositionPara [method: Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] private class NoOpLspLoggerFactory() : ILspServiceLoggerFactory { - public Task CreateLoggerAsync(string serverTypeName, JsonRpc jsonRpc, CancellationToken cancellationToken) - => Task.FromResult(NoOpLspLogger.Instance); + public Task CreateLoggerAsync(string serverTypeName, JsonRpc jsonRpc, CancellationToken cancellationToken) + => Task.FromResult((AbstractLspLogger)NoOpLspLogger.Instance); } [PartNotDiscoverable] From 97689b5a1d91b3c3c14fdac7331a614b84ed1f87 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 12 Dec 2023 17:58:16 +1100 Subject: [PATCH 103/141] Fix capabilities so didOpen doesn't get sent at all --- .../Razor/Cohost/RazorCohostDidOpenEndpoint.cs | 10 +--------- .../Razor/Cohost/RazorCohostLanguageClient.cs | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs index db88f4102f2da..cf04d3c08f08f 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostDidOpenEndpoint.cs @@ -19,8 +19,7 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; [method: ImportingConstructor] [method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] internal sealed class RazorCohostDidOpenEndpoint( - [Import(AllowDefault = true)] IRazorCohostDidOpenHandler? didOpenHandler, - [Import(AllowDefault = true)] IRazorCohostLanguageClientActivationService? razorCohostLanguageClientActivationService) + [Import(AllowDefault = true)] IRazorCohostDidOpenHandler? didOpenHandler) : ILspServiceNotificationHandler, ITextDocumentIdentifierHandler { public bool MutatesSolutionState => true; @@ -31,13 +30,6 @@ public Uri GetTextDocumentIdentifier(DidOpenTextDocumentParams request) public async Task HandleNotificationAsync(DidOpenTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) { - // VS platform doesn't seem to honour the fact that we don't want to receive didOpen notifications if the Cohost server is disabled - // so we have to check again here to avoid doing unnecessary work. - if (razorCohostLanguageClientActivationService?.ShouldActivateCohostServer() != true) - { - return; - } - context.TraceInformation($"didOpen for {request.TextDocument.Uri}"); var sourceText = SourceText.From(request.TextDocument.Text, System.Text.Encoding.UTF8, SourceHashAlgorithms.OpenDocumentChecksumAlgorithm); diff --git a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs index 4e3f48864fc13..81149a07a2ea7 100644 --- a/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs +++ b/src/Tools/ExternalAccess/Razor/Cohost/RazorCohostLanguageClient.cs @@ -50,7 +50,7 @@ public override ServerCapabilities GetCapabilities(ClientCapabilities clientCapa // wasteful if we don't want to handle anything, as we'd track document content. return new() { - TextDocumentSync = null + TextDocumentSync = new TextDocumentSyncOptions { OpenClose = false, Change = TextDocumentSyncKind.None, Save = false, WillSave = false, WillSaveWaitUntil = false } }; } From e1cbd05e9b304a82718122d5e6a46bfc7a42ee43 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 11 Dec 2023 23:47:25 -0800 Subject: [PATCH 104/141] Fix infinite loop in tagging --- .../Tagging/Utilities/TagSpanIntervalTree.cs | 58 ++-- .../Test/Tagging/AsynchronousTaggerTests.cs | 260 +++++++++--------- 2 files changed, 166 insertions(+), 152 deletions(-) diff --git a/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs b/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs index f47cb1570d81a..238fd27c7acb1 100644 --- a/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs +++ b/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs @@ -53,11 +53,16 @@ public bool HasSpanThatContains(SnapshotPoint point) public IList> GetIntersectingSpans(SnapshotSpan snapshotSpan) => SegmentedListPool.ComputeList( - static (args, tags) => args.@this.AddIntersectingSpans(args.snapshotSpan, tags), + static (args, tags) => args.@this.AddIntersectingSpansInSortedOrder(args.snapshotSpan, tags), (@this: this, snapshotSpan), _: (ITagSpan?)null); - private void AddIntersectingSpans(SnapshotSpan snapshotSpan, SegmentedList> result) + /// + /// Gets all the spans that intersect with in sorted order and adds them to + /// . Note the sorted chunk of items are appended to . This + /// means that may not be sorted if there were already items in them. + /// + private void AddIntersectingSpansInSortedOrder(SnapshotSpan snapshotSpan, SegmentedList> result) { var snapshot = snapshotSpan.Snapshot; Debug.Assert(snapshot.TextBuffer == _textBuffer); @@ -110,7 +115,7 @@ private void AddIntersectingTagSpansWorker( // Special case the case where there is only one requested span. In that case, we don't // need to allocate any intermediate collections if (requestedSpans.Count == 1) - AddIntersectingSpans(requestedSpans[0], tags); + AddIntersectingSpansInSortedOrder(requestedSpans[0], tags); else if (requestedSpans.Count < MaxNumberOfRequestedSpans) AddTagsForSmallNumberOfSpans(requestedSpans, tags); else @@ -122,7 +127,7 @@ private void AddTagsForSmallNumberOfSpans( SegmentedList> tags) { foreach (var span in requestedSpans) - AddIntersectingSpans(span, tags); + AddIntersectingSpansInSortedOrder(span, tags); } private void AddTagsForLargeNumberOfSpans(NormalizedSnapshotSpanCollection requestedSpans, SegmentedList> tags) @@ -134,10 +139,12 @@ private void AddTagsForLargeNumberOfSpans(NormalizedSnapshotSpanCollection reque using var _1 = SegmentedListPool.GetPooledList>(out var tempList); - AddIntersectingSpans(mergedSpan, tempList); + AddIntersectingSpansInSortedOrder(mergedSpan, tempList); if (tempList.Count == 0) return; + // Note: from this point on, both 'requstedSpans' and 'tempList' are in sorted + using var enumerator = tempList.GetEnumerator(); if (!enumerator.MoveNext()) @@ -145,38 +152,49 @@ private void AddTagsForLargeNumberOfSpans(NormalizedSnapshotSpanCollection reque using var _2 = PooledHashSet>.GetInstance(out var hashSet); + var requestIndex = 0; while (true) { - var requestIndex = 0; var currentTag = enumerator.Current; var currentRequestSpan = requestedSpans[requestIndex]; var currentTagSpan = currentTag.Span; - if (currentRequestSpan.Start > currentTagSpan.End) + // The current tag is *before* the current span we're trying to intersect with. Move to the next tag to + // see if it intersects with the current span. + if (currentTagSpan.End < currentRequestSpan.Start) { + // If there are no more tags, then we're done. if (!enumerator.MoveNext()) - break; + return; + + continue; } - else if (currentTagSpan.Start > currentRequestSpan.End) + + // The current tag is *after* teh current span we're trying to intersect with. Move to the next span to + // see if it intersects with the current tag. + if (currentTagSpan.Start > currentRequestSpan.End) { requestIndex++; + // If there are no more spans to intersect with, then we're done. if (requestIndex >= requestedSpans.Count) - break; + return; + + continue; } - else - { - // Only if this is the first time we are seeing this tag do we add it to the result. - if (currentTagSpan.Length > 0 && - hashSet.Add(currentTag)) - { - tags.Add(currentTag); - } - if (!enumerator.MoveNext()) - break; + // This tag intersects the current span we're trying to intersect with. Ensure we only see and add a + // particular tag once. + + if (currentTagSpan.Length > 0 && + hashSet.Add(currentTag)) + { + tags.Add(currentTag); } + + if (!enumerator.MoveNext()) + break; } } } diff --git a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs index 51758a014a39a..3bed8c904264c 100644 --- a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs +++ b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs @@ -24,92 +24,104 @@ using Roslyn.Utilities; using Xunit; -namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Tagging -{ - [UseExportProvider] - public class AsynchronousTaggerTests : TestBase - { - /// - /// This hits a special codepath in the product that is optimized for more than 100 spans. - /// I'm leaving this test here because it covers that code path (as shown by code coverage) - /// - [WpfFact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530368")] - public async Task LargeNumberOfSpans() - { - using var workspace = TestWorkspace.CreateCSharp(@"class Program +namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Tagging; + +[UseExportProvider] +public class AsynchronousTaggerTests : TestBase { - void M() + /// + /// This hits a special codepath in the product that is optimized for more than 100 spans. + /// I'm leaving this test here because it covers that code path (as shown by code coverage) + /// + [WpfTheory] + [WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530368")] + [WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1927519")] + [InlineData(0)] + [InlineData(1)] + [InlineData(100)] + [InlineData(101)] + public async Task LargeNumberOfSpans(int tagsProduced) { - int z = 0; - z = z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z; - } -}"); - static List> tagProducer(SnapshotSpan span, CancellationToken cancellationToken) + using var workspace = TestWorkspace.CreateCSharp(""" + class Program { - return new List>() { new TagSpan(span, new TestTag()) }; + void M() + { + int z = 0; + z = z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z; + } } + """); - var asyncListener = new AsynchronousOperationListener(); + List> tagProducer(SnapshotSpan span, CancellationToken cancellationToken) + { + return Enumerable + .Range(0, tagsProduced) + .Select(_ => (ITagSpan)new TagSpan(span, new TestTag())) + .ToList(); + } - WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(LargeNumberOfSpans)} creates asynchronous taggers"); + var asyncListener = new AsynchronousOperationListener(); - var eventSource = CreateEventSource(); - var taggerProvider = new TestTaggerProvider( - workspace.GetService(), - tagProducer, - eventSource, - workspace.GetService(), - asyncListener); + WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(LargeNumberOfSpans)} creates asynchronous taggers"); - var document = workspace.Documents.First(); - var textBuffer = document.GetTextBuffer(); - var snapshot = textBuffer.CurrentSnapshot; - using var tagger = taggerProvider.CreateTagger(textBuffer); - Contract.ThrowIfNull(tagger); + var eventSource = CreateEventSource(); + var taggerProvider = new TestTaggerProvider( + workspace.GetService(), + tagProducer, + eventSource, + workspace.GetService(), + asyncListener); - var spans = Enumerable.Range(0, 101).Select(i => new Span(i * 4, 1)); - var snapshotSpans = new NormalizedSnapshotSpanCollection(snapshot, spans); + var document = workspace.Documents.First(); + var textBuffer = document.GetTextBuffer(); + var snapshot = textBuffer.CurrentSnapshot; + using var tagger = taggerProvider.CreateTagger(textBuffer); + Contract.ThrowIfNull(tagger); - eventSource.SendUpdateEvent(); + var spans = Enumerable.Range(0, 101).Select(i => new Span(i * 4, 1)); + var snapshotSpans = new NormalizedSnapshotSpanCollection(snapshot, spans); - await asyncListener.ExpeditedWaitAsync(); + eventSource.SendUpdateEvent(); - var tags = tagger.GetTags(snapshotSpans); + await asyncListener.ExpeditedWaitAsync(); - Assert.Equal(1, tags.Count()); - } + var tags = tagger.GetTags(snapshotSpans); - [WpfFact] - public void TestNotSynchronousOutlining() - { - using var workspace = TestWorkspace.CreateCSharp("class Program {\r\n\r\n}", composition: EditorTestCompositions.EditorFeaturesWpf); - WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(TestNotSynchronousOutlining)} creates asynchronous taggers"); + Assert.Equal(tagsProduced, tags.Count()); + } - var tagProvider = workspace.ExportProvider.GetExportedValue(); + [WpfFact] + public void TestNotSynchronousOutlining() + { + using var workspace = TestWorkspace.CreateCSharp("class Program {\r\n\r\n}", composition: EditorTestCompositions.EditorFeaturesWpf); + WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(TestNotSynchronousOutlining)} creates asynchronous taggers"); - var document = workspace.Documents.First(); - var textBuffer = document.GetTextBuffer(); - using var tagger = tagProvider.CreateTagger(textBuffer); - Contract.ThrowIfNull(tagger); + var tagProvider = workspace.ExportProvider.GetExportedValue(); - // The very first all to get tags will not be synchronous as this contains no #region tag - var tags = tagger.GetTags(new NormalizedSnapshotSpanCollection(textBuffer.CurrentSnapshot.GetFullSpan())); - Assert.Equal(0, tags.Count()); - } + var document = workspace.Documents.First(); + var textBuffer = document.GetTextBuffer(); + using var tagger = tagProvider.CreateTagger(textBuffer); + Contract.ThrowIfNull(tagger); - [WpfFact] - public void TestSynchronousOutlining() - { - using var workspace = TestWorkspace.CreateCSharp(@" + // The very first all to get tags will not be synchronous as this contains no #region tag + var tags = tagger.GetTags(new NormalizedSnapshotSpanCollection(textBuffer.CurrentSnapshot.GetFullSpan())); + Assert.Equal(0, tags.Count()); + } + + [WpfFact] + public void TestSynchronousOutlining() + { + using var workspace = TestWorkspace.CreateCSharp(@" #region x class Program @@ -117,90 +129,74 @@ class Program } #endregion", composition: EditorTestCompositions.EditorFeaturesWpf); - WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(TestSynchronousOutlining)} creates asynchronous taggers"); + WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(TestSynchronousOutlining)} creates asynchronous taggers"); - var tagProvider = workspace.ExportProvider.GetExportedValue(); + var tagProvider = workspace.ExportProvider.GetExportedValue(); - var document = workspace.Documents.First(); - var textBuffer = document.GetTextBuffer(); - using var tagger = tagProvider.CreateTagger(textBuffer); - Contract.ThrowIfNull(tagger); + var document = workspace.Documents.First(); + var textBuffer = document.GetTextBuffer(); + using var tagger = tagProvider.CreateTagger(textBuffer); + Contract.ThrowIfNull(tagger); - // The very first all to get tags will be synchronous because of the #region - var tags = tagger.GetTags(new NormalizedSnapshotSpanCollection(textBuffer.CurrentSnapshot.GetFullSpan())); - Assert.Equal(2, tags.Count()); - } + // The very first all to get tags will be synchronous because of the #region + var tags = tagger.GetTags(new NormalizedSnapshotSpanCollection(textBuffer.CurrentSnapshot.GetFullSpan())); + Assert.Equal(2, tags.Count()); + } - private static TestTaggerEventSource CreateEventSource() - => new TestTaggerEventSource(); + private static TestTaggerEventSource CreateEventSource() + => new(); - private sealed class TestTag : TextMarkerTag + private sealed class TestTag : TextMarkerTag + { + public TestTag() + : base("Test") { - public TestTag() - : base("Test") - { - } } + } - private delegate List> Callback(SnapshotSpan span, CancellationToken cancellationToken); - - private sealed class TestTaggerProvider : AsynchronousTaggerProvider - { - private readonly Callback _callback; - private readonly ITaggerEventSource _eventSource; - - public TestTaggerProvider( - IThreadingContext threadingContext, - Callback callback, - ITaggerEventSource eventSource, - IGlobalOptionService globalOptions, - IAsynchronousOperationListener asyncListener) - : base(threadingContext, globalOptions, visibilityTracker: null, asyncListener) - { - _callback = callback; - _eventSource = eventSource; - } - - protected override TaggerDelay EventChangeDelay => TaggerDelay.NearImmediate; + private sealed class TestTaggerProvider( + IThreadingContext threadingContext, + Func>> callback, + ITaggerEventSource eventSource, + IGlobalOptionService globalOptions, + IAsynchronousOperationListener asyncListener) + : AsynchronousTaggerProvider(threadingContext, globalOptions, visibilityTracker: null, asyncListener) + { + protected override TaggerDelay EventChangeDelay => TaggerDelay.NearImmediate; - protected override ITaggerEventSource CreateEventSource(ITextView? textView, ITextBuffer subjectBuffer) - => _eventSource; + protected override ITaggerEventSource CreateEventSource(ITextView? textView, ITextBuffer subjectBuffer) + => eventSource; - protected override Task ProduceTagsAsync( - TaggerContext context, DocumentSnapshotSpan snapshotSpan, int? caretPosition, CancellationToken cancellationToken) + protected override Task ProduceTagsAsync( + TaggerContext context, DocumentSnapshotSpan snapshotSpan, int? caretPosition, CancellationToken cancellationToken) + { + var tags = callback(snapshotSpan.SnapshotSpan, cancellationToken); + if (tags != null) { - var tags = _callback(snapshotSpan.SnapshotSpan, cancellationToken); - if (tags != null) + foreach (var tag in tags) { - foreach (var tag in tags) - { - context.AddTag(tag); - } + context.AddTag(tag); } - - return Task.CompletedTask; } - protected override bool TagEquals(TestTag tag1, TestTag tag2) - => tag1 == tag2; + return Task.CompletedTask; } - private sealed class TestTaggerEventSource : AbstractTaggerEventSource - { - public TestTaggerEventSource() - { - } + protected override bool TagEquals(TestTag tag1, TestTag tag2) + => tag1 == tag2; + } - public void SendUpdateEvent() - => this.RaiseChanged(); + private sealed class TestTaggerEventSource() : AbstractTaggerEventSource + { + public void SendUpdateEvent() + => this.RaiseChanged(); - public override void Connect() - { - } + public override void Connect() + { + } - public override void Disconnect() - { - } + public override void Disconnect() + { } } } From 309a45d0edd5c8e9663a697016ddf7bf17c51761 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 11 Dec 2023 23:54:44 -0800 Subject: [PATCH 105/141] Add tests --- .../Test/Tagging/AsynchronousTaggerTests.cs | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs index 3bed8c904264c..43c176cdc18ba 100644 --- a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs +++ b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs @@ -99,6 +99,74 @@ List> tagProducer(SnapshotSpan span, CancellationToken cancell Assert.Equal(tagsProduced, tags.Count()); } + /// + /// This hits a special codepath in the product that is optimized for more than 100 spans. + /// I'm leaving this test here because it covers that code path (as shown by code coverage) + /// + [WpfTheory] + [WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530368")] + [WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1927519")] + [InlineData(0)] + [InlineData(1)] + [InlineData(100)] + [InlineData(101)] + public async Task LargeNumberOfSpans2(int tagsProduced) + { + using var workspace = TestWorkspace.CreateCSharp(""" + class Program + { + void M() + { + int z = 0; + z = z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z + + z + z + z + z + z + z + z + z + z + z; + } + } + """); + + List> tagProducer(SnapshotSpan span, CancellationToken cancellationToken) + { + return Enumerable + .Range(0, tagsProduced) + .Select(i => (ITagSpan)new TagSpan(new SnapshotSpan(span.Snapshot, new Span(50 + i * 2, 1)), new TestTag())) + .ToList(); + } + + var asyncListener = new AsynchronousOperationListener(); + + WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(LargeNumberOfSpans)} creates asynchronous taggers"); + + var eventSource = CreateEventSource(); + var taggerProvider = new TestTaggerProvider( + workspace.GetService(), + tagProducer, + eventSource, + workspace.GetService(), + asyncListener); + + var document = workspace.Documents.First(); + var textBuffer = document.GetTextBuffer(); + var snapshot = textBuffer.CurrentSnapshot; + using var tagger = taggerProvider.CreateTagger(textBuffer); + Contract.ThrowIfNull(tagger); + + var spans = Enumerable.Range(0, 101).Select(i => new Span(i * 4, 1)); + var snapshotSpans = new NormalizedSnapshotSpanCollection(snapshot, spans); + + eventSource.SendUpdateEvent(); + + await asyncListener.ExpeditedWaitAsync(); + + var tags = tagger.GetTags(snapshotSpans); + } [WpfFact] public void TestNotSynchronousOutlining() From 5c8f982f62813407abc06ebf77bff5e74f3b77d0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 11 Dec 2023 23:55:29 -0800 Subject: [PATCH 106/141] text --- .../Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs b/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs index 238fd27c7acb1..9f11287307ec5 100644 --- a/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs +++ b/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs @@ -143,7 +143,7 @@ private void AddTagsForLargeNumberOfSpans(NormalizedSnapshotSpanCollection reque if (tempList.Count == 0) return; - // Note: from this point on, both 'requstedSpans' and 'tempList' are in sorted + // Note: both 'requstedSpans' and 'tempList' are in sorted order. using var enumerator = tempList.GetEnumerator(); From bb3380c9be3ba80009da0cadae34470c6329ff43 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 11 Dec 2023 23:56:15 -0800 Subject: [PATCH 107/141] text --- .../Shared/Tagging/Utilities/TagSpanIntervalTree.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs b/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs index 9f11287307ec5..e3ea78ecce785 100644 --- a/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs +++ b/src/EditorFeatures/Core/Shared/Tagging/Utilities/TagSpanIntervalTree.cs @@ -53,7 +53,7 @@ public bool HasSpanThatContains(SnapshotPoint point) public IList> GetIntersectingSpans(SnapshotSpan snapshotSpan) => SegmentedListPool.ComputeList( - static (args, tags) => args.@this.AddIntersectingSpansInSortedOrder(args.snapshotSpan, tags), + static (args, tags) => args.@this.AppendIntersectingSpansInSortedOrder(args.snapshotSpan, tags), (@this: this, snapshotSpan), _: (ITagSpan?)null); @@ -62,7 +62,7 @@ public IList> GetIntersectingSpans(SnapshotSpan snapshotSpan) /// . Note the sorted chunk of items are appended to . This /// means that may not be sorted if there were already items in them. /// - private void AddIntersectingSpansInSortedOrder(SnapshotSpan snapshotSpan, SegmentedList> result) + private void AppendIntersectingSpansInSortedOrder(SnapshotSpan snapshotSpan, SegmentedList> result) { var snapshot = snapshotSpan.Snapshot; Debug.Assert(snapshot.TextBuffer == _textBuffer); @@ -115,7 +115,7 @@ private void AddIntersectingTagSpansWorker( // Special case the case where there is only one requested span. In that case, we don't // need to allocate any intermediate collections if (requestedSpans.Count == 1) - AddIntersectingSpansInSortedOrder(requestedSpans[0], tags); + AppendIntersectingSpansInSortedOrder(requestedSpans[0], tags); else if (requestedSpans.Count < MaxNumberOfRequestedSpans) AddTagsForSmallNumberOfSpans(requestedSpans, tags); else @@ -127,7 +127,7 @@ private void AddTagsForSmallNumberOfSpans( SegmentedList> tags) { foreach (var span in requestedSpans) - AddIntersectingSpansInSortedOrder(span, tags); + AppendIntersectingSpansInSortedOrder(span, tags); } private void AddTagsForLargeNumberOfSpans(NormalizedSnapshotSpanCollection requestedSpans, SegmentedList> tags) @@ -139,7 +139,7 @@ private void AddTagsForLargeNumberOfSpans(NormalizedSnapshotSpanCollection reque using var _1 = SegmentedListPool.GetPooledList>(out var tempList); - AddIntersectingSpansInSortedOrder(mergedSpan, tempList); + AppendIntersectingSpansInSortedOrder(mergedSpan, tempList); if (tempList.Count == 0) return; From 08bf22ed96213a5151a295beaa2497266bdd1733 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 12 Dec 2023 00:02:41 -0800 Subject: [PATCH 108/141] Simplify tests --- .../Test/Tagging/AsynchronousTaggerTests.cs | 81 ++----------------- 1 file changed, 6 insertions(+), 75 deletions(-) diff --git a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs index 43c176cdc18ba..bf9a1c70540f2 100644 --- a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs +++ b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs @@ -36,81 +36,11 @@ public class AsynchronousTaggerTests : TestBase [WpfTheory] [WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530368")] [WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1927519")] - [InlineData(0)] - [InlineData(1)] - [InlineData(100)] - [InlineData(101)] - public async Task LargeNumberOfSpans(int tagsProduced) - { - using var workspace = TestWorkspace.CreateCSharp(""" - class Program - { - void M() - { - int z = 0; - z = z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z + - z + z + z + z + z + z + z + z + z + z; - } - } - """); - - List> tagProducer(SnapshotSpan span, CancellationToken cancellationToken) - { - return Enumerable - .Range(0, tagsProduced) - .Select(_ => (ITagSpan)new TagSpan(span, new TestTag())) - .ToList(); - } - - var asyncListener = new AsynchronousOperationListener(); - - WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(LargeNumberOfSpans)} creates asynchronous taggers"); - - var eventSource = CreateEventSource(); - var taggerProvider = new TestTaggerProvider( - workspace.GetService(), - tagProducer, - eventSource, - workspace.GetService(), - asyncListener); - - var document = workspace.Documents.First(); - var textBuffer = document.GetTextBuffer(); - var snapshot = textBuffer.CurrentSnapshot; - using var tagger = taggerProvider.CreateTagger(textBuffer); - Contract.ThrowIfNull(tagger); - - var spans = Enumerable.Range(0, 101).Select(i => new Span(i * 4, 1)); - var snapshotSpans = new NormalizedSnapshotSpanCollection(snapshot, spans); - - eventSource.SendUpdateEvent(); - - await asyncListener.ExpeditedWaitAsync(); - - var tags = tagger.GetTags(snapshotSpans); - - Assert.Equal(tagsProduced, tags.Count()); - } - /// - /// This hits a special codepath in the product that is optimized for more than 100 spans. - /// I'm leaving this test here because it covers that code path (as shown by code coverage) - /// - [WpfTheory] - [WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530368")] - [WorkItem("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1927519")] - [InlineData(0)] - [InlineData(1)] - [InlineData(100)] - [InlineData(101)] - public async Task LargeNumberOfSpans2(int tagsProduced) + [InlineData(0, 0)] + [InlineData(1, 0)] + [InlineData(100, 50)] + [InlineData(101, 50)] + public async Task LargeNumberOfSpans(int tagsProduced, int expectedCount) { using var workspace = TestWorkspace.CreateCSharp(""" class Program @@ -166,6 +96,7 @@ List> tagProducer(SnapshotSpan span, CancellationToken cancell await asyncListener.ExpeditedWaitAsync(); var tags = tagger.GetTags(snapshotSpans); + Assert.Equal(expectedCount, tags.Count()); } [WpfFact] From 0f83a185d8f6664b3148adfe71a9f055910158ad Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 12 Dec 2023 00:07:17 -0800 Subject: [PATCH 109/141] Simplify tests --- .../Test/Tagging/AsynchronousTaggerTests.cs | 56 ++++++++----------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs index bf9a1c70540f2..d2f62061aaa11 100644 --- a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs +++ b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs @@ -27,7 +27,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Tagging; [UseExportProvider] -public class AsynchronousTaggerTests : TestBase +public sealed class AsynchronousTaggerTests : TestBase { /// /// This hits a special codepath in the product that is optimized for more than 100 spans. @@ -62,14 +62,6 @@ void M() } """); - List> tagProducer(SnapshotSpan span, CancellationToken cancellationToken) - { - return Enumerable - .Range(0, tagsProduced) - .Select(i => (ITagSpan)new TagSpan(new SnapshotSpan(span.Snapshot, new Span(50 + i * 2, 1)), new TestTag())) - .ToList(); - } - var asyncListener = new AsynchronousOperationListener(); WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(LargeNumberOfSpans)} creates asynchronous taggers"); @@ -77,7 +69,9 @@ List> tagProducer(SnapshotSpan span, CancellationToken cancell var eventSource = CreateEventSource(); var taggerProvider = new TestTaggerProvider( workspace.GetService(), - tagProducer, + (s, c) => Enumerable + .Range(0, tagsProduced) + .Select(i => (ITagSpan)new TagSpan(new SnapshotSpan(s.Snapshot, new Span(50 + i * 2, 1)), new TestTag())), eventSource, workspace.GetService(), asyncListener); @@ -102,7 +96,11 @@ List> tagProducer(SnapshotSpan span, CancellationToken cancell [WpfFact] public void TestNotSynchronousOutlining() { - using var workspace = TestWorkspace.CreateCSharp("class Program {\r\n\r\n}", composition: EditorTestCompositions.EditorFeaturesWpf); + using var workspace = TestWorkspace.CreateCSharp(""" + class Program { + + } + """, composition: EditorTestCompositions.EditorFeaturesWpf); WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(TestNotSynchronousOutlining)} creates asynchronous taggers"); var tagProvider = workspace.ExportProvider.GetExportedValue(); @@ -120,14 +118,15 @@ public void TestNotSynchronousOutlining() [WpfFact] public void TestSynchronousOutlining() { - using var workspace = TestWorkspace.CreateCSharp(@" -#region x + using var workspace = TestWorkspace.CreateCSharp(""" + #region x -class Program -{ -} + class Program + { + } -#endregion", composition: EditorTestCompositions.EditorFeaturesWpf); + #endregion + """, composition: EditorTestCompositions.EditorFeaturesWpf); WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(TestSynchronousOutlining)} creates asynchronous taggers"); var tagProvider = workspace.ExportProvider.GetExportedValue(); @@ -145,23 +144,18 @@ class Program private static TestTaggerEventSource CreateEventSource() => new(); - private sealed class TestTag : TextMarkerTag - { - public TestTag() - : base("Test") - { - } - } + private sealed class TestTag() : TextMarkerTag("Test"); private sealed class TestTaggerProvider( IThreadingContext threadingContext, - Func>> callback, + Func>> callback, ITaggerEventSource eventSource, IGlobalOptionService globalOptions, IAsynchronousOperationListener asyncListener) : AsynchronousTaggerProvider(threadingContext, globalOptions, visibilityTracker: null, asyncListener) { - protected override TaggerDelay EventChangeDelay => TaggerDelay.NearImmediate; + protected override TaggerDelay EventChangeDelay + => TaggerDelay.NearImmediate; protected override ITaggerEventSource CreateEventSource(ITextView? textView, ITextBuffer subjectBuffer) => eventSource; @@ -169,14 +163,8 @@ protected override ITaggerEventSource CreateEventSource(ITextView? textView, ITe protected override Task ProduceTagsAsync( TaggerContext context, DocumentSnapshotSpan snapshotSpan, int? caretPosition, CancellationToken cancellationToken) { - var tags = callback(snapshotSpan.SnapshotSpan, cancellationToken); - if (tags != null) - { - foreach (var tag in tags) - { - context.AddTag(tag); - } - } + foreach (var tag in callback(snapshotSpan.SnapshotSpan, cancellationToken)) + context.AddTag(tag); return Task.CompletedTask; } From ae758668db8518fec9cc282b6ec06e1ddf0ec868 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 12 Dec 2023 00:09:14 -0800 Subject: [PATCH 110/141] Simplify tests --- src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs index d2f62061aaa11..1dce70ac37a1b 100644 --- a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs +++ b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs @@ -82,8 +82,8 @@ void M() using var tagger = taggerProvider.CreateTagger(textBuffer); Contract.ThrowIfNull(tagger); - var spans = Enumerable.Range(0, 101).Select(i => new Span(i * 4, 1)); - var snapshotSpans = new NormalizedSnapshotSpanCollection(snapshot, spans); + var snapshotSpans = new NormalizedSnapshotSpanCollection( + snapshot, Enumerable.Range(0, 101).Select(i => new Span(i * 4, 1))); eventSource.SendUpdateEvent(); From 90c6c103ab89b1de4559f52897c03ec98ea1deb8 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 12 Dec 2023 00:12:39 -0800 Subject: [PATCH 111/141] Simplify tests --- src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs index 1dce70ac37a1b..cea05f33f4492 100644 --- a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs +++ b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs @@ -71,7 +71,7 @@ void M() workspace.GetService(), (s, c) => Enumerable .Range(0, tagsProduced) - .Select(i => (ITagSpan)new TagSpan(new SnapshotSpan(s.Snapshot, new Span(50 + i * 2, 1)), new TestTag())), + .Select(i => new TagSpan(new SnapshotSpan(s.Snapshot, new Span(50 + i * 2, 1)), new TestTag())), eventSource, workspace.GetService(), asyncListener); From 1453cea7f79bf924ddf392066c6996c9d7ba718e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 12 Dec 2023 00:13:50 -0800 Subject: [PATCH 112/141] Simplify tests --- .../Test/Tagging/AsynchronousTaggerTests.cs | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs index cea05f33f4492..80a66d8574847 100644 --- a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs +++ b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs @@ -67,11 +67,11 @@ void M() WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(LargeNumberOfSpans)} creates asynchronous taggers"); var eventSource = CreateEventSource(); - var taggerProvider = new TestTaggerProvider( + var taggerProvider = new TextMarkerTaggerProvider( workspace.GetService(), (s, c) => Enumerable .Range(0, tagsProduced) - .Select(i => new TagSpan(new SnapshotSpan(s.Snapshot, new Span(50 + i * 2, 1)), new TestTag())), + .Select(i => new TagSpan(new SnapshotSpan(s.Snapshot, new Span(50 + i * 2, 1)), new TextMarkerTag($"Test{i}"))), eventSource, workspace.GetService(), asyncListener); @@ -141,18 +141,16 @@ class Program Assert.Equal(2, tags.Count()); } - private static TestTaggerEventSource CreateEventSource() + private static TextMarkerTaggerEventSource CreateEventSource() => new(); - private sealed class TestTag() : TextMarkerTag("Test"); - - private sealed class TestTaggerProvider( + private sealed class TextMarkerTaggerProvider( IThreadingContext threadingContext, - Func>> callback, + Func>> callback, ITaggerEventSource eventSource, IGlobalOptionService globalOptions, IAsynchronousOperationListener asyncListener) - : AsynchronousTaggerProvider(threadingContext, globalOptions, visibilityTracker: null, asyncListener) + : AsynchronousTaggerProvider(threadingContext, globalOptions, visibilityTracker: null, asyncListener) { protected override TaggerDelay EventChangeDelay => TaggerDelay.NearImmediate; @@ -161,7 +159,7 @@ protected override ITaggerEventSource CreateEventSource(ITextView? textView, ITe => eventSource; protected override Task ProduceTagsAsync( - TaggerContext context, DocumentSnapshotSpan snapshotSpan, int? caretPosition, CancellationToken cancellationToken) + TaggerContext context, DocumentSnapshotSpan snapshotSpan, int? caretPosition, CancellationToken cancellationToken) { foreach (var tag in callback(snapshotSpan.SnapshotSpan, cancellationToken)) context.AddTag(tag); @@ -169,11 +167,11 @@ protected override Task ProduceTagsAsync( return Task.CompletedTask; } - protected override bool TagEquals(TestTag tag1, TestTag tag2) + protected override bool TagEquals(TextMarkerTag tag1, TextMarkerTag tag2) => tag1 == tag2; } - private sealed class TestTaggerEventSource() : AbstractTaggerEventSource + private sealed class TextMarkerTaggerEventSource() : AbstractTaggerEventSource { public void SendUpdateEvent() => this.RaiseChanged(); From 42ca5ef677e1ae46cb477794e2f8b9a21f396a6e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 12 Dec 2023 00:16:49 -0800 Subject: [PATCH 113/141] Simplify tests --- src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs index 80a66d8574847..b0f7922a473b0 100644 --- a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs +++ b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs @@ -27,7 +27,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Tagging; [UseExportProvider] -public sealed class AsynchronousTaggerTests : TestBase +public sealed class AsynchronousTaggerTests { /// /// This hits a special codepath in the product that is optimized for more than 100 spans. From 207a6ac04f1d54249cd82c9e7d7a181f4101fc12 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 12 Dec 2023 00:18:35 -0800 Subject: [PATCH 114/141] Simplify tests --- .../Test/Tagging/AsynchronousTaggerTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs index b0f7922a473b0..b70a217868886 100644 --- a/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs +++ b/src/EditorFeatures/Test/Tagging/AsynchronousTaggerTests.cs @@ -67,7 +67,7 @@ void M() WpfTestRunner.RequireWpfFact($"{nameof(AsynchronousTaggerTests)}.{nameof(LargeNumberOfSpans)} creates asynchronous taggers"); var eventSource = CreateEventSource(); - var taggerProvider = new TextMarkerTaggerProvider( + var taggerProvider = new TestTaggerProvider( workspace.GetService(), (s, c) => Enumerable .Range(0, tagsProduced) @@ -141,10 +141,10 @@ class Program Assert.Equal(2, tags.Count()); } - private static TextMarkerTaggerEventSource CreateEventSource() + private static TestTaggerEventSource CreateEventSource() => new(); - private sealed class TextMarkerTaggerProvider( + private sealed class TestTaggerProvider( IThreadingContext threadingContext, Func>> callback, ITaggerEventSource eventSource, @@ -171,7 +171,7 @@ protected override bool TagEquals(TextMarkerTag tag1, TextMarkerTag tag2) => tag1 == tag2; } - private sealed class TextMarkerTaggerEventSource() : AbstractTaggerEventSource + private sealed class TestTaggerEventSource() : AbstractTaggerEventSource { public void SendUpdateEvent() => this.RaiseChanged(); From 861e1fae1603c98d66feae409f2d360a094d6a75 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:37:01 +0000 Subject: [PATCH 115/141] Update dependencies from https://github.com/dotnet/arcade build 20231211.2 (#71227) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 12 ++++++------ eng/common/build.ps1 | 3 +++ eng/common/build.sh | 8 ++++++++ eng/common/tools.ps1 | 3 ++- global.json | 4 ++-- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2177209cfbc7e..50f5f497d11ef 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -27,14 +27,14 @@ - + https://github.com/dotnet/arcade - 3faeb9817f465151aa4bbcdb315f0a6170206760 + 0a0217fe0cdd3654105d1c46be4e43eeae9c163e - + https://github.com/dotnet/arcade - 3faeb9817f465151aa4bbcdb315f0a6170206760 + 0a0217fe0cdd3654105d1c46be4e43eeae9c163e https://github.com/dotnet/symreader @@ -49,9 +49,9 @@ https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - 3faeb9817f465151aa4bbcdb315f0a6170206760 + 0a0217fe0cdd3654105d1c46be4e43eeae9c163e https://github.com/dotnet/roslyn-analyzers diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 33a6f2d0e2481..066044f62f29b 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -19,6 +19,7 @@ Param( [switch] $pack, [switch] $publish, [switch] $clean, + [switch] $verticalBuild, [switch][Alias('bl')]$binaryLog, [switch][Alias('nobl')]$excludeCIBinarylog, [switch] $ci, @@ -58,6 +59,7 @@ function Print-Usage() { Write-Host " -sign Sign build outputs" Write-Host " -publish Publish artifacts (e.g. symbols)" Write-Host " -clean Clean the solution" + Write-Host " -verticalBuild Run in 'vertical build' infra mode." Write-Host "" Write-Host "Advanced settings:" @@ -120,6 +122,7 @@ function Build { /p:Deploy=$deploy ` /p:Test=$test ` /p:Pack=$pack ` + /p:ArcadeBuildVertical=$verticalBuild ` /p:IntegrationTest=$integrationTest ` /p:PerformanceTest=$performanceTest ` /p:Sign=$sign ` diff --git a/eng/common/build.sh b/eng/common/build.sh index 2c17ba529b913..5ce01dd161aaf 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -59,6 +59,7 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" restore=false build=false source_build=false +vertical_build=false rebuild=false test=false integration_test=false @@ -129,6 +130,12 @@ while [[ $# > 0 ]]; do restore=true pack=true ;; + -verticalbuild|-vb) + build=true + vertical_build=true + restore=true + pack=true + ;; -test|-t) test=true ;; @@ -220,6 +227,7 @@ function Build { /p:Restore=$restore \ /p:Build=$build \ /p:ArcadeBuildFromSource=$source_build \ + /p:ArcadeBuildVertical=$vertical_build \ /p:Rebuild=$rebuild \ /p:Test=$test \ /p:Pack=$pack \ diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index e8def7e6a85f2..162dee2b9363c 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -827,7 +827,8 @@ function MSBuild-Core() { } } - $env:ARCADE_BUILD_TOOL_COMMAND = "$($buildTool.Path) $cmdArgs" + # Be sure quote the path in case there are spaces in the dotnet installation location. + $env:ARCADE_BUILD_TOOL_COMMAND = "`"$($buildTool.Path)`" $cmdArgs" $exitCode = Exec-Process $buildTool.Path $cmdArgs diff --git a/global.json b/global.json index c771a891c9b08..cadadc5e5a480 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "xcopy-msbuild": "17.8.1-2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23607.2", - "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23607.2" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23611.2", + "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23611.2" } } From ed023e4548b513f81100f74fd463a1b9cc4c524e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 12 Dec 2023 10:25:42 -0800 Subject: [PATCH 116/141] Remove methods not used by F# --- .../FSharpDocumentNavigationService.cs | 37 ------------------- .../IFSharpDocumentNavigationService.cs | 22 ----------- 2 files changed, 59 deletions(-) diff --git a/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs b/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs index 3317650a1a72f..121b0ecf4f6af 100644 --- a/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs +++ b/src/Tools/ExternalAccess/FSharp/Navigation/FSharpDocumentNavigationService.cs @@ -10,7 +10,6 @@ using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Navigation; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation; @@ -21,10 +20,6 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation; internal class FSharpDocumentNavigationService(IThreadingContext threadingContext) : IFSharpDocumentNavigationService { - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan) - => CanNavigateToSpan(workspace, documentId, textSpan, CancellationToken.None); - public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) { var service = workspace.Services.GetService(); @@ -32,18 +27,6 @@ public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSp service.CanNavigateToSpanAsync(workspace, documentId, textSpan, cancellationToken)); } - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset) - => CanNavigateToLineAndOffset(workspace, documentId, lineNumber, offset, CancellationToken.None); - - [Obsolete("Call overloads that take a span or position", error: false)] - public bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) - => false; - - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace) - => CanNavigateToPosition(workspace, documentId, position, virtualSpace, CancellationToken.None); - public bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) { var service = workspace.Services.GetService(); @@ -51,10 +34,6 @@ public bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, in service.CanNavigateToPositionAsync(workspace, documentId, position, virtualSpace, cancellationToken)); } - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options) - => TryNavigateToSpan(workspace, documentId, textSpan, CancellationToken.None); - public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) { var service = workspace.Services.GetService(); @@ -63,22 +42,6 @@ public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSp threadingContext, workspace, documentId, textSpan, NavigationOptions.Default with { PreferProvisionalTab = true }, cancellationToken)); } - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, OptionSet options) - => TryNavigateToLineAndOffset(workspace, documentId, lineNumber, offset, CancellationToken.None); - - public bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken) - { - var service = workspace.Services.GetService(); - return threadingContext.JoinableTaskFactory.Run(() => - service.TryNavigateToPositionAsync( - threadingContext, workspace, documentId, lineNumber, offset, NavigationOptions.Default with { PreferProvisionalTab = true }, cancellationToken)); - } - - [Obsolete("Call overload that takes a CancellationToken", error: false)] - public bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, OptionSet options) - => TryNavigateToPosition(workspace, documentId, position, virtualSpace, CancellationToken.None); - public bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, CancellationToken cancellationToken) { var service = workspace.Services.GetService(); diff --git a/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs b/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs index b56c4904e7f40..10b733b1c7c72 100644 --- a/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs +++ b/src/Tools/ExternalAccess/FSharp/Navigation/IFSharpDocumentNavigationService.cs @@ -4,37 +4,15 @@ #nullable disable -using System; using System.Threading; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Navigation; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation; internal interface IFSharpDocumentNavigationService : IWorkspaceService { - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan); - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset); -#pragma warning disable RS0060 // API with optional parameter(s) should have the most parameters amongst its public overloads - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0); - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options = null); - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, OptionSet options = null); - [Obsolete("Call overload that takes a CancellationToken", error: false)] - bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0, OptionSet options = null); -#pragma warning restore RS0060 // API with optional parameter(s) should have the most parameters amongst its public overloads - - [Obsolete("Call overloads that take a span or position", error: false)] - bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken); - [Obsolete("Call overloads that take a span or position", error: false)] - bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, CancellationToken cancellationToken); - /// bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); /// From 0af0f8876429f2f618e3b710222e52ca487ab4bd Mon Sep 17 00:00:00 2001 From: Michael Simons Date: Tue, 12 Dec 2023 12:42:03 -0600 Subject: [PATCH 117/141] Remove unnecessary source-build metadata from the runtime dependencies. --- eng/Version.Details.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7fceac086699d..5344ed3b3d9bc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -28,17 +28,14 @@ https://github.com/dotnet/runtime d099f075e45d2aa6007a22b71b45a08758559f80 - https://github.com/dotnet/runtime d099f075e45d2aa6007a22b71b45a08758559f80 - https://github.com/dotnet/runtime d099f075e45d2aa6007a22b71b45a08758559f80 - From 4405f0ede8ec376df6bd28ac25f75b94fdb7deb0 Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Tue, 12 Dec 2023 19:56:23 +0100 Subject: [PATCH 118/141] Start local function analysis with captured variables marked "not null" (#71148) * Mark captured variables as not null at start * Simplify where the bottom state is created * Add more tests * Fixup numbered comments --- .../Portable/FlowAnalysis/NullableWalker.cs | 12 +- .../Semantics/NullableReferenceTypesTests.cs | 627 +++++++++++++++++- 2 files changed, 605 insertions(+), 34 deletions(-) diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs index ef9ba8bacba2d..c1f77682eef8c 100644 --- a/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs +++ b/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs @@ -3030,10 +3030,13 @@ private void VisitStatementsWithLocalFunctions(BoundBlock block) { var localFunc = node.Symbol; var localFunctionState = GetOrCreateLocalFuncUsages(localFunc); - // The starting state is the top state, but with captured - // variables set according to Joining the state at all the - // local function use sites + + // The starting state (`state`) is the top state ("maybe null"). var state = TopState(); + + // Captured variables are joined with the state + // at all the local function use sites (`localFunctionState.StartingState`) + // which starts as the bottom state ("not null"). var startingState = localFunctionState.StartingState; startingState.ForEach( (slot, variables) => @@ -3045,6 +3048,7 @@ private void VisitStatementsWithLocalFunctions(BoundBlock block) } }, _variables); + localFunctionState.Visited = true; AnalyzeLocalFunctionOrLambda( @@ -12095,7 +12099,7 @@ protected override LocalFunctionState CreateLocalFunctionState(LocalFunctionSymb { var variables = (symbol.ContainingSymbol is MethodSymbol containingMethod ? _variables.GetVariablesForMethodScope(containingMethod) : null) ?? _variables.GetRootScope(); - return new LocalFunctionState(LocalState.UnreachableState(variables)); + return new LocalFunctionState(LocalState.ReachableStateWithNotNulls(variables)); } private sealed class NullabilityInfoTypeComparer : IEqualityComparer<(NullabilityInfo info, TypeSymbol? type)> diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs index 5f72aac920dfb..bb9e7dba67c83 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs @@ -63464,7 +63464,7 @@ static void F1(object? x1) { void f1() { - x1.ToString(); // 1 + x1.ToString(); } } static void F2(object? x2) @@ -63472,7 +63472,7 @@ static void F2(object? x2) if (x2 == null) return; void f2() { - x2.ToString(); // 2 + x2.ToString(); } } static void F3(object? x3) @@ -63480,38 +63480,26 @@ static void F3(object? x3) object? y3 = x3; void f3() { - y3.ToString(); // 3 + y3.ToString(); } if (y3 == null) return; void g3() { - y3.ToString(); // 4 + y3.ToString(); } } static void F4() { void f4(object? x4) { - x4.ToString(); // 5 + x4.ToString(); // 1 } } }"; var comp = CreateCompilation(new[] { source }, options: WithNullableEnable()); comp.VerifyDiagnostics( - // (8,13): warning CS8602: Dereference of a possibly null reference. - // x1.ToString(); // 1 - Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x1").WithLocation(8, 13), - // (16,13): warning CS8602: Dereference of a possibly null reference. - // x2.ToString(); // 2 - Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x2").WithLocation(16, 13), - // (24,13): warning CS8602: Dereference of a possibly null reference. - // y3.ToString(); // 3 - Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "y3").WithLocation(24, 13), - // (29,13): warning CS8602: Dereference of a possibly null reference. - // y3.ToString(); // 4 - Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "y3").WithLocation(29, 13), // (36,13): warning CS8602: Dereference of a possibly null reference. - // x4.ToString(); // 5 + // x4.ToString(); // 1 Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x4").WithLocation(36, 13)); } @@ -63550,6 +63538,594 @@ public void LocalFunctions_Speculation() Assert.Equal("System.Object", objectSymbol2.ToTestDisplayString()); } + [Theory, WorkItem("https://github.com/dotnet/roslyn/issues/70856")] + [InlineData("foreach (var c in y)")] + [InlineData("while (y.Length != 2)")] + [InlineData("for (int i = 0; i < y.Length; i++)")] + public void LocalFunction_Loop(string loopHead) + { + var source = $$""" + #nullable enable + class C + { + void M() + { + var x = "a"; + + f1(); + + void f2(string y) + { + {{loopHead}} + { + } + + x.ToString(); + } + + void f1() + { + f2("b"); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/70856")] + public void LocalFunction_Loop_Member() + { + var source = """ + #nullable enable + class C + { + string? F; + void M() + { + F = "a"; + + f1(); + + void f2(string y) + { + foreach (var c in y) + { + } + + F.ToString(); + } + + void f1() + { + f2("b"); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics(); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/70856")] + public void LocalFunction_Loop_Goto() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = "a"; + + f1(); + + void f2(string y) + { + label: + if (y.Length != 0) + { + goto label; + } + + x.ToString(); + } + + void f1() + { + f2("b"); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics(); + } + + [Fact] + public void LocalFunction_UnreachableInOnePath() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = "a"; + + f1(); + + void f1() + { + x.ToString(); + } + + void f2() + { + f1(); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (15,14): warning CS8321: The local function 'f2' is declared but never used + // void f2() + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "f2").WithArguments("f2").WithLocation(15, 14)); + } + + [Fact] + public void LocalFunction_UnreachableInOnePath_Null() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = (string?)null; + + f1(); + + void f1() + { + x.ToString(); + } + + void f2() + { + f1(); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (12,13): warning CS8602: Dereference of a possibly null reference. + // x.ToString(); + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(12, 13), + // (15,14): warning CS8321: The local function 'f2' is declared but never used + // void f2() + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "f2").WithArguments("f2").WithLocation(15, 14)); + } + + [Fact] + public void LocalFunction_UnreachableInOnePath_Worsening() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = "a"; + + f1(); + + void f1() + { + x.ToString(); + x = null; + x.ToString(); // 1 + } + + void f2() + { + f1(); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (14,13): warning CS8602: Dereference of a possibly null reference. + // x.ToString(); // 1 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(14, 13), + // (17,14): warning CS8321: The local function 'f2' is declared but never used + // void f2() + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "f2").WithArguments("f2").WithLocation(17, 14)); + } + + [Fact] + public void LocalFunction_UnreachableInOnePath_Worsening_Null() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = (string?)null; + + f1(); + + void f1() + { + x.ToString(); // 1 + x = null; + x.ToString(); // 2 + } + + void f2() + { + f1(); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (12,13): warning CS8602: Dereference of a possibly null reference. + // x.ToString(); // 1 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(12, 13), + // (14,13): warning CS8602: Dereference of a possibly null reference. + // x.ToString(); // 2 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(14, 13), + // (17,14): warning CS8321: The local function 'f2' is declared but never used + // void f2() + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "f2").WithArguments("f2").WithLocation(17, 14)); + } + + [Fact] + public void LocalFunction_Unreachable() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = "a"; + + void f1() + { + x.ToString(); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (8,14): warning CS8321: The local function 'f1' is declared but never used + // void f1() + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "f1").WithArguments("f1").WithLocation(8, 14)); + } + + [Fact] + public void LocalFunction_Unreachable_Null() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = (string?)null; + + void f1() + { + x.ToString(); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (8,14): warning CS8321: The local function 'f1' is declared but never used + // void f1() + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "f1").WithArguments("f1").WithLocation(8, 14)); + } + + [Fact] + public void LocalFunction_Unreachable_Worsening() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = "a"; + + void f1() + { + x.ToString(); + x = null; + x.ToString(); // 1 + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (8,14): warning CS8321: The local function 'f1' is declared but never used + // void f1() + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "f1").WithArguments("f1").WithLocation(8, 14), + // (12,13): warning CS8602: Dereference of a possibly null reference. + // x.ToString(); // 1 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(12, 13)); + } + + [Fact] + public void LocalFunction_Unreachable_Worsening_Null() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = (string?)null; + + void f1() + { + x.ToString(); + x = null; + x.ToString(); // 1 + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (8,14): warning CS8321: The local function 'f1' is declared but never used + // void f1() + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "f1").WithArguments("f1").WithLocation(8, 14), + // (12,13): warning CS8602: Dereference of a possibly null reference. + // x.ToString(); // 1 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(12, 13)); + } + + [Fact] + public void LocalFunction_Reachable() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = "a"; + + f1(); + + void f1() + { + x.ToString(); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics(); + } + + [Fact] + public void LocalFunction_Reachable_Null() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = (string?)null; + + f1(); + + void f1() + { + x.ToString(); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (12,13): warning CS8602: Dereference of a possibly null reference. + // x.ToString(); + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(12, 13)); + } + + [Fact] + public void LocalFunction_Reachable_Worsening() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = "a"; + + f1(); + + void f1() + { + x.ToString(); + x = null; + x.ToString(); // 1 + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (14,13): warning CS8602: Dereference of a possibly null reference. + // x.ToString(); // 1 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(14, 13)); + } + + [Fact] + public void LocalFunction_Reachable_Worsening_Null() + { + var source = """ + #nullable enable + class C + { + void M() + { + var x = (string?)null; + + f1(); + + void f1() + { + x.ToString(); // 1 + x = null; + x.ToString(); // 2 + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (12,13): warning CS8602: Dereference of a possibly null reference. + // x.ToString(); // 1 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(12, 13), + // (14,13): warning CS8602: Dereference of a possibly null reference. + // x.ToString(); // 2 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(14, 13)); + } + + [Fact] + public void LocalFunction_Member() + { + var source = """ + #nullable enable + class C + { + string? F; + void M() + { + F = "a"; + local1(); + F = null; + local2(); + + void local1() + { + F.ToString(); + } + + void local2() + { + F.ToString(); // 1 + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (19,13): warning CS8602: Dereference of a possibly null reference. + // F.ToString(); // 1 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "F").WithLocation(19, 13)); + } + + [Fact] + public void LocalFunction_Member_TwiceTheSame_Unreachable() + { + var source = """ + #nullable enable + #pragma warning disable CS0649 // field not assigned + class C + { + string? F; + void M() + { + void local1() + { + F.ToString(); // 1 + } + + void local2() + { + F.ToString(); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (8,14): warning CS8321: The local function 'local1' is declared but never used + // void local1() + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "local1").WithArguments("local1").WithLocation(8, 14), + // (10,13): warning CS8602: Dereference of a possibly null reference. + // F.ToString(); // 1 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "F").WithLocation(10, 13), + // (13,14): warning CS8321: The local function 'local2' is declared but never used + // void local2() + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "local2").WithArguments("local2").WithLocation(13, 14)); + } + + [Fact] + public void LocalFunction_Member_TwiceTheSame_Reachable() + { + var source = """ + #nullable enable + class C + { + string? F; + void M() + { + F = "a"; + local1(); + local2(); + + void local1() + { + F.ToString(); + } + + void local2() + { + F.ToString(); + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics(); + } + + [Fact] + public void LocalFunction_Member_TwiceTheSame_Reachable_Null() + { + var source = """ + #nullable enable + #pragma warning disable CS0649 // field not assigned + class C + { + string? F; + void M() + { + local1(); + local2(); + + void local1() + { + F.ToString(); // 1 + } + + void local2() + { + F.ToString(); // 2 + } + } + } + """; + CreateCompilation(source).VerifyDiagnostics( + // (13,13): warning CS8602: Dereference of a possibly null reference. + // F.ToString(); // 1 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "F").WithLocation(13, 13), + // (18,13): warning CS8602: Dereference of a possibly null reference. + // F.ToString(); // 2 + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "F").WithLocation(18, 13)); + } + [Fact] public void New_01() { @@ -109037,10 +109613,7 @@ void g() comp.VerifyDiagnostics( // (12,21): warning CS8602: Dereference of a possibly null reference. // int n = this.F.Length; // 1 - Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "this.F").WithLocation(12, 21), - // (18,21): warning CS8602: Dereference of a possibly null reference. - // int n = base.F.Length; // 2 - Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "base.F").WithLocation(18, 21)); + Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "this.F").WithLocation(12, 21)); } [WorkItem(31620, "https://github.com/dotnet/roslyn/issues/31620")] @@ -152069,10 +152642,7 @@ void M() comp.VerifyDiagnostics( // (11,14): warning CS8321: The local function 'local2' is declared but never used // void local2() => y.ToString(); - Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "local2").WithArguments("local2").WithLocation(11, 14), - // (11,26): warning CS8602: Dereference of a possibly null reference. - // void local2() => y.ToString(); - Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "y").WithLocation(11, 26) + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "local2").WithArguments("local2").WithLocation(11, 14) ); } @@ -152098,10 +152668,7 @@ void M() comp.VerifyDiagnostics( // (11,14): warning CS8321: The local function 'local2' is declared but never used // void local2() => y.ToString(); - Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "local2").WithArguments("local2").WithLocation(11, 14), - // (11,26): warning CS8602: Dereference of a possibly null reference. - // void local2() => y.ToString(); - Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "y").WithLocation(11, 26) + Diagnostic(ErrorCode.WRN_UnreferencedLocalFunction, "local2").WithArguments("local2").WithLocation(11, 14) ); } From a9e0428644dcc28616e88913e1f6bbbc168217f3 Mon Sep 17 00:00:00 2001 From: Michael Simons Date: Tue, 12 Dec 2023 13:09:30 -0600 Subject: [PATCH 119/141] Update allowed prebuilts --- eng/SourceBuildPrebuiltBaseline.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index 8c7ed433692b5..59ecdd109f41a 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -23,5 +23,8 @@ + + + From 9904c64f2cee141d20c6ab3fd116586ed0b81733 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 12 Dec 2023 11:14:20 -0800 Subject: [PATCH 120/141] Add System.Text.Json so the live version is also picked up --- eng/Version.Details.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5344ed3b3d9bc..bcc5cb00a1bc2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -37,6 +37,10 @@ https://github.com/dotnet/runtime d099f075e45d2aa6007a22b71b45a08758559f80 + + https://github.com/dotnet/runtime + 0a2bda10e81d901396c3cff95533529e3a93ad47 + From 64fa3857f504fffba7c83120cc3a211f20ba2075 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 13 Dec 2023 07:23:26 +1100 Subject: [PATCH 121/141] Add exception message --- src/Features/LanguageServer/Protocol/Handler/RequestContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs index 62094a8362931..f85b0291b3bb8 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs @@ -127,7 +127,7 @@ public Document? Document } // Explicitly throw for attempts to get a Document when only a TextDocument is available. - throw new InvalidOperationException(); + throw new InvalidOperationException($"Attempted to retrieve a Document but a TextDocument was found instead."); } } From f29d7f96042cba689cfdce05313d25018c125815 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Tue, 12 Dec 2023 11:33:08 -0800 Subject: [PATCH 122/141] Restore using dotnet CLI to ensure NuGet environment variables are used --- azure-pipelines-pr-validation.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/azure-pipelines-pr-validation.yml b/azure-pipelines-pr-validation.yml index 0cc8b8917d512..088d5ebe3edd4 100644 --- a/azure-pipelines-pr-validation.yml +++ b/azure-pipelines-pr-validation.yml @@ -101,15 +101,8 @@ stages: useGlobalJson: true workingDirectory: '$(Build.SourcesDirectory)' - # Needed to restore the Microsoft.DevDiv.Optimization.Data.PowerShell package - - task: NuGetCommand@2 + - script: dotnet restore eng\common\internal\Tools.csproj displayName: Restore internal tools - inputs: - command: restore - feedsToUse: config - restoreSolution: 'eng\common\internal\Tools.csproj' - nugetConfigPath: 'NuGet.config' - restoreDirectory: '$(Build.SourcesDirectory)\.packages' - task: MicroBuildSigningPlugin@2 inputs: From 2adbadba6e52e10364d948135d44d402b2ca746a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 12 Dec 2023 13:50:33 -0800 Subject: [PATCH 123/141] Use file scoped namespaces (#71193) --- .../Syntax.xml.Internal.Generated.cs | 61659 ++++++++-------- .../Syntax.xml.Main.Generated.cs | 10096 ++- .../Syntax.xml.Syntax.Generated.cs | 25517 ++++--- .../CSharpSyntaxGenerator/SourceWriter.cs | 14 +- 4 files changed, 48635 insertions(+), 48651 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs index 702f4bad1a7c5..4631a0eea939f 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Internal.Generated.cs @@ -9,37883 +9,37880 @@ using Roslyn.Utilities; using CoreSyntax = Microsoft.CodeAnalysis.Syntax.InternalSyntax; -namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax -{ +namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax; +/// Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. +internal abstract partial class NameSyntax : TypeSyntax +{ + internal NameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - /// Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. - internal abstract partial class NameSyntax : TypeSyntax + internal NameSyntax(SyntaxKind kind) + : base(kind) { - internal NameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + } +} - internal NameSyntax(SyntaxKind kind) - : base(kind) - { - } +/// Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. +internal abstract partial class SimpleNameSyntax : NameSyntax +{ + internal SimpleNameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. - internal abstract partial class SimpleNameSyntax : NameSyntax + internal SimpleNameSyntax(SyntaxKind kind) + : base(kind) { - internal SimpleNameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + } - internal SimpleNameSyntax(SyntaxKind kind) - : base(kind) - { - } + /// SyntaxToken representing the identifier of the simple name. + public abstract SyntaxToken Identifier { get; } +} + +/// Class which represents the syntax node for identifier name. +internal sealed partial class IdentifierNameSyntax : SimpleNameSyntax +{ + internal readonly SyntaxToken identifier; - /// SyntaxToken representing the identifier of the simple name. - public abstract SyntaxToken Identifier { get; } + internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } - /// Class which represents the syntax node for identifier name. - internal sealed partial class IdentifierNameSyntax : SimpleNameSyntax + internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken identifier; + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + /// SyntaxToken representing the keyword for the kind of the identifier name. + public override SyntaxToken Identifier => this.identifier; - internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.identifier : null; - /// SyntaxToken representing the keyword for the kind of the identifier name. - public override SyntaxToken Identifier => this.identifier; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IdentifierNameSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.identifier : null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IdentifierNameSyntax(this, parent, position); + public IdentifierNameSyntax Update(SyntaxToken identifier) + { + if (identifier != this.Identifier) + { + var newNode = SyntaxFactory.IdentifierName(identifier); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); + return this; + } - public IdentifierNameSyntax Update(SyntaxToken identifier) - { - if (identifier != this.Identifier) - { - var newNode = SyntaxFactory.IdentifierName(identifier); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IdentifierNameSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IdentifierNameSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IdentifierNameSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for qualified name. +internal sealed partial class QualifiedNameSyntax : NameSyntax +{ + internal readonly NameSyntax left; + internal readonly SyntaxToken dotToken; + internal readonly SimpleNameSyntax right; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IdentifierNameSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations); + internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(right); + this.right = right; } - /// Class which represents the syntax node for qualified name. - internal sealed partial class QualifiedNameSyntax : NameSyntax + internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, SyntaxFactoryContext context) + : base(kind) { - internal readonly NameSyntax left; - internal readonly SyntaxToken dotToken; - internal readonly SimpleNameSyntax right; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + /// NameSyntax node representing the name on the left side of the dot token of the qualified name. + public NameSyntax Left => this.left; + /// SyntaxToken representing the dot. + public SyntaxToken DotToken => this.dotToken; + /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. + public SimpleNameSyntax Right => this.right; - internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + 0 => this.left, + 1 => this.dotToken, + 2 => this.right, + _ => null, + }; - /// NameSyntax node representing the name on the left side of the dot token of the qualified name. - public NameSyntax Left => this.left; - /// SyntaxToken representing the dot. - public SyntaxToken DotToken => this.dotToken; - /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. - public SimpleNameSyntax Right => this.right; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedNameSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.left, - 1 => this.dotToken, - 2 => this.right, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedNameSyntax(this, parent, position); + public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + { + if (left != this.Left || dotToken != this.DotToken || right != this.Right) + { + var newNode = SyntaxFactory.QualifiedName(left, dotToken, right); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); + return this; + } - public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) - { - if (left != this.Left || dotToken != this.DotToken || right != this.Right) - { - var newNode = SyntaxFactory.QualifiedName(left, dotToken, right); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for generic name. +internal sealed partial class GenericNameSyntax : SimpleNameSyntax +{ + internal readonly SyntaxToken identifier; + internal readonly TypeArgumentListSyntax typeArgumentList; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new QualifiedNameSyntax(this.Kind, this.left, this.dotToken, this.right, GetDiagnostics(), annotations); + internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(typeArgumentList); + this.typeArgumentList = typeArgumentList; } - /// Class which represents the syntax node for generic name. - internal sealed partial class GenericNameSyntax : SimpleNameSyntax + internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken identifier; - internal readonly TypeArgumentListSyntax typeArgumentList; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(typeArgumentList); + this.typeArgumentList = typeArgumentList; + } - internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(typeArgumentList); - this.typeArgumentList = typeArgumentList; - } + internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(typeArgumentList); + this.typeArgumentList = typeArgumentList; + } - internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, SyntaxFactoryContext context) - : base(kind) + /// SyntaxToken representing the name of the identifier of the generic name. + public override SyntaxToken Identifier => this.identifier; + /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. + public TypeArgumentListSyntax TypeArgumentList => this.typeArgumentList; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(typeArgumentList); - this.typeArgumentList = typeArgumentList; - } + 0 => this.identifier, + 1 => this.typeArgumentList, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GenericNameSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); - internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) - : base(kind) + public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + { + if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(typeArgumentList); - this.typeArgumentList = typeArgumentList; + var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// SyntaxToken representing the name of the identifier of the generic name. - public override SyntaxToken Identifier => this.identifier; - /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. - public TypeArgumentListSyntax TypeArgumentList => this.typeArgumentList; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.identifier, - 1 => this.typeArgumentList, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GenericNameSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); +/// Class which represents the syntax node for type argument list. +internal sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken lessThanToken; + internal readonly GreenNode? arguments; + internal readonly SyntaxToken greaterThanToken; - public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (arguments != null) { - if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList) - { - var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new GenericNameSyntax(this.Kind, this.identifier, this.typeArgumentList, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; } - /// Class which represents the syntax node for type argument list. - internal sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode + internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken lessThanToken; - internal readonly GreenNode? arguments; - internal readonly SyntaxToken greaterThanToken; - - internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (arguments != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, SyntaxFactoryContext context) - : base(kind) + internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (arguments != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } + + /// SyntaxToken representing less than. + public SyntaxToken LessThanToken => this.lessThanToken; + /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. + public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + /// SyntaxToken representing greater than. + public SyntaxToken GreaterThanToken => this.greaterThanToken; - internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } + 0 => this.lessThanToken, + 1 => this.arguments, + 2 => this.greaterThanToken, + _ => null, + }; - /// SyntaxToken representing less than. - public SyntaxToken LessThanToken => this.lessThanToken; - /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. - public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); - /// SyntaxToken representing greater than. - public SyntaxToken GreaterThanToken => this.greaterThanToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeArgumentListSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanToken, - 1 => this.arguments, - 2 => this.greaterThanToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeArgumentListSyntax(this, parent, position); + public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) + { + var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); + return this; + } - public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) - { - if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for alias qualified name. +internal sealed partial class AliasQualifiedNameSyntax : NameSyntax +{ + internal readonly IdentifierNameSyntax alias; + internal readonly SyntaxToken colonColonToken; + internal readonly SimpleNameSyntax name; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeArgumentListSyntax(this.Kind, this.lessThanToken, this.arguments, this.greaterThanToken, GetDiagnostics(), annotations); + internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(alias); + this.alias = alias; + this.AdjustFlagsAndWidth(colonColonToken); + this.colonColonToken = colonColonToken; + this.AdjustFlagsAndWidth(name); + this.name = name; } - /// Class which represents the syntax node for alias qualified name. - internal sealed partial class AliasQualifiedNameSyntax : NameSyntax + internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, SyntaxFactoryContext context) + : base(kind) { - internal readonly IdentifierNameSyntax alias; - internal readonly SyntaxToken colonColonToken; - internal readonly SimpleNameSyntax name; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(alias); + this.alias = alias; + this.AdjustFlagsAndWidth(colonColonToken); + this.colonColonToken = colonColonToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - this.AdjustFlagsAndWidth(colonColonToken); - this.colonColonToken = colonColonToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(alias); + this.alias = alias; + this.AdjustFlagsAndWidth(colonColonToken); + this.colonColonToken = colonColonToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, SyntaxFactoryContext context) - : base(kind) + /// IdentifierNameSyntax node representing the name of the alias + public IdentifierNameSyntax Alias => this.alias; + /// SyntaxToken representing colon colon. + public SyntaxToken ColonColonToken => this.colonColonToken; + /// SimpleNameSyntax node representing the name that is being alias qualified. + public SimpleNameSyntax Name => this.name; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - this.AdjustFlagsAndWidth(colonColonToken); - this.colonColonToken = colonColonToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + 0 => this.alias, + 1 => this.colonColonToken, + 2 => this.name, + _ => null, + }; - internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AliasQualifiedNameSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); + + public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + { + if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - this.AdjustFlagsAndWidth(colonColonToken); - this.colonColonToken = colonColonToken; - this.AdjustFlagsAndWidth(name); - this.name = name; + var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// IdentifierNameSyntax node representing the name of the alias - public IdentifierNameSyntax Alias => this.alias; - /// SyntaxToken representing colon colon. - public SyntaxToken ColonColonToken => this.colonColonToken; - /// SimpleNameSyntax node representing the name that is being alias qualified. - public SimpleNameSyntax Name => this.name; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.alias, - 1 => this.colonColonToken, - 2 => this.name, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AliasQualifiedNameSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); +/// Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. +internal abstract partial class TypeSyntax : ExpressionSyntax +{ + internal TypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) - { - if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name) - { - var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal TypeSyntax(SyntaxKind kind) + : base(kind) + { + } +} - return this; - } +/// Class which represents the syntax node for predefined types. +internal sealed partial class PredefinedTypeSyntax : TypeSyntax +{ + internal readonly SyntaxToken keyword; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, diagnostics, GetAnnotations()); + internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AliasQualifiedNameSyntax(this.Kind, this.alias, this.colonColonToken, this.name, GetDiagnostics(), annotations); + internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; } - /// Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. - internal abstract partial class TypeSyntax : ExpressionSyntax + internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword) + : base(kind) { - internal TypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + this.SlotCount = 1; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + } + + /// SyntaxToken which represents the keyword corresponding to the predefined type. + public SyntaxToken Keyword => this.keyword; + + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.keyword : null; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PredefinedTypeSyntax(this, parent, position); - internal TypeSyntax(SyntaxKind kind) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); + + public PredefinedTypeSyntax Update(SyntaxToken keyword) + { + if (keyword != this.Keyword) { + var newNode = SyntaxFactory.PredefinedType(keyword); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; } - /// Class which represents the syntax node for predefined types. - internal sealed partial class PredefinedTypeSyntax : TypeSyntax - { - internal readonly SyntaxToken keyword; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PredefinedTypeSyntax(this.Kind, this.keyword, diagnostics, GetAnnotations()); - internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PredefinedTypeSyntax(this.Kind, this.keyword, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for the array type. +internal sealed partial class ArrayTypeSyntax : TypeSyntax +{ + internal readonly TypeSyntax elementType; + internal readonly GreenNode? rankSpecifiers; + + internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + if (rankSpecifiers != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; + this.AdjustFlagsAndWidth(rankSpecifiers); + this.rankSpecifiers = rankSpecifiers; } + } - internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxFactoryContext context) - : base(kind) + internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + if (rankSpecifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; + this.AdjustFlagsAndWidth(rankSpecifiers); + this.rankSpecifiers = rankSpecifiers; } + } - internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword) - : base(kind) + internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + if (rankSpecifiers != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; + this.AdjustFlagsAndWidth(rankSpecifiers); + this.rankSpecifiers = rankSpecifiers; } + } - /// SyntaxToken which represents the keyword corresponding to the predefined type. - public SyntaxToken Keyword => this.keyword; + /// TypeSyntax node representing the type of the element of the array. + public TypeSyntax ElementType => this.elementType; + /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. + public CoreSyntax.SyntaxList RankSpecifiers => new CoreSyntax.SyntaxList(this.rankSpecifiers); - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.keyword : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.elementType, + 1 => this.rankSpecifiers, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PredefinedTypeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayTypeSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); - public PredefinedTypeSyntax Update(SyntaxToken keyword) + public ArrayTypeSyntax Update(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) + { + if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) { - if (keyword != this.Keyword) - { - var newNode = SyntaxFactory.PredefinedType(keyword); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PredefinedTypeSyntax(this.Kind, this.keyword, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PredefinedTypeSyntax(this.Kind, this.keyword, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for the array type. - internal sealed partial class ArrayTypeSyntax : TypeSyntax - { - internal readonly TypeSyntax elementType; - internal readonly GreenNode? rankSpecifiers; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, GetDiagnostics(), annotations); +} + +internal sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? sizes; + internal readonly SyntaxToken closeBracketToken; - internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (sizes != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - if (rankSpecifiers != null) - { - this.AdjustFlagsAndWidth(rankSpecifiers); - this.rankSpecifiers = rankSpecifiers; - } + this.AdjustFlagsAndWidth(sizes); + this.sizes = sizes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, SyntaxFactoryContext context) - : base(kind) + internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (sizes != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - if (rankSpecifiers != null) - { - this.AdjustFlagsAndWidth(rankSpecifiers); - this.rankSpecifiers = rankSpecifiers; - } + this.AdjustFlagsAndWidth(sizes); + this.sizes = sizes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers) - : base(kind) + internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (sizes != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - if (rankSpecifiers != null) - { - this.AdjustFlagsAndWidth(rankSpecifiers); - this.rankSpecifiers = rankSpecifiers; - } + this.AdjustFlagsAndWidth(sizes); + this.sizes = sizes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - /// TypeSyntax node representing the type of the element of the array. - public TypeSyntax ElementType => this.elementType; - /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. - public CoreSyntax.SyntaxList RankSpecifiers => new CoreSyntax.SyntaxList(this.rankSpecifiers); + public SyntaxToken OpenBracketToken => this.openBracketToken; + public CoreSyntax.SeparatedSyntaxList Sizes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.sizes)); + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.elementType, - 1 => this.rankSpecifiers, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.sizes, + 2 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayTypeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayRankSpecifierSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); - public ArrayTypeSyntax Update(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) + public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) { - if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) - { - var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for pointer type. +internal sealed partial class PointerTypeSyntax : TypeSyntax +{ + internal readonly TypeSyntax elementType; + internal readonly SyntaxToken asteriskToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArrayTypeSyntax(this.Kind, this.elementType, this.rankSpecifiers, GetDiagnostics(), annotations); + internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; } - internal sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode + internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? sizes; - internal readonly SyntaxToken closeBracketToken; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + } - internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (sizes != null) - { - this.AdjustFlagsAndWidth(sizes); - this.sizes = sizes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + } + + /// TypeSyntax node that represents the element type of the pointer. + public TypeSyntax ElementType => this.elementType; + /// SyntaxToken representing the asterisk. + public SyntaxToken AsteriskToken => this.asteriskToken; - internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (sizes != null) - { - this.AdjustFlagsAndWidth(sizes); - this.sizes = sizes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + 0 => this.elementType, + 1 => this.asteriskToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PointerTypeSyntax(this, parent, position); - internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); + + public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) + { + if (elementType != this.ElementType || asteriskToken != this.AsteriskToken) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (sizes != null) - { - this.AdjustFlagsAndWidth(sizes); - this.sizes = sizes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + var newNode = SyntaxFactory.PointerType(elementType, asteriskToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken OpenBracketToken => this.openBracketToken; - public CoreSyntax.SeparatedSyntaxList Sizes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.sizes)); - public SyntaxToken CloseBracketToken => this.closeBracketToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.sizes, - 2 => this.closeBracketToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayRankSpecifierSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); +internal sealed partial class FunctionPointerTypeSyntax : TypeSyntax +{ + internal readonly SyntaxToken delegateKeyword; + internal readonly SyntaxToken asteriskToken; + internal readonly FunctionPointerCallingConventionSyntax? callingConvention; + internal readonly FunctionPointerParameterListSyntax parameterList; - public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + if (callingConvention != null) { - if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(callingConvention); + this.callingConvention = callingConvention; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArrayRankSpecifierSyntax(this.Kind, this.openBracketToken, this.sizes, this.closeBracketToken, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; } - /// Class which represents the syntax node for pointer type. - internal sealed partial class PointerTypeSyntax : TypeSyntax + internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, SyntaxFactoryContext context) + : base(kind) { - internal readonly TypeSyntax elementType; - internal readonly SyntaxToken asteriskToken; - - internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + if (callingConvention != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; + this.AdjustFlagsAndWidth(callingConvention); + this.callingConvention = callingConvention; } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } - internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, SyntaxFactoryContext context) - : base(kind) + internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(asteriskToken); + this.asteriskToken = asteriskToken; + if (callingConvention != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; + this.AdjustFlagsAndWidth(callingConvention); + this.callingConvention = callingConvention; } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } - internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken) - : base(kind) + /// SyntaxToken representing the delegate keyword. + public SyntaxToken DelegateKeyword => this.delegateKeyword; + /// SyntaxToken representing the asterisk. + public SyntaxToken AsteriskToken => this.asteriskToken; + /// Node representing the optional calling convention. + public FunctionPointerCallingConventionSyntax? CallingConvention => this.callingConvention; + /// List of the parameter types and return type of the function pointer. + public FunctionPointerParameterListSyntax ParameterList => this.parameterList; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; - } + 0 => this.delegateKeyword, + 1 => this.asteriskToken, + 2 => this.callingConvention, + 3 => this.parameterList, + _ => null, + }; - /// TypeSyntax node that represents the element type of the pointer. - public TypeSyntax ElementType => this.elementType; - /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => this.asteriskToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerTypeSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.elementType, - 1 => this.asteriskToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PointerTypeSyntax(this, parent, position); + public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax callingConvention, FunctionPointerParameterListSyntax parameterList) + { + if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList) + { + var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); + return this; + } - public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) - { - if (elementType != this.ElementType || asteriskToken != this.AsteriskToken) - { - var newNode = SyntaxFactory.PointerType(elementType, asteriskToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, diagnostics, GetAnnotations()); +/// Function pointer parameter list syntax. +internal sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken lessThanToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken greaterThanToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PointerTypeSyntax(this.Kind, this.elementType, this.asteriskToken, GetDiagnostics(), annotations); + internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) + { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; + } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; } - internal sealed partial class FunctionPointerTypeSyntax : TypeSyntax + internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken delegateKeyword; - internal readonly SyntaxToken asteriskToken; - internal readonly FunctionPointerCallingConventionSyntax? callingConvention; - internal readonly FunctionPointerParameterListSyntax parameterList; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) + { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; + } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; - if (callingConvention != null) - { - this.AdjustFlagsAndWidth(callingConvention); - this.callingConvention = callingConvention; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; - if (callingConvention != null) - { - this.AdjustFlagsAndWidth(callingConvention); - this.callingConvention = callingConvention; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } + /// SyntaxToken representing the less than token. + public SyntaxToken LessThanToken => this.lessThanToken; + /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. + public CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// SyntaxToken representing the greater than token. + public SyntaxToken GreaterThanToken => this.greaterThanToken; - internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(asteriskToken); - this.asteriskToken = asteriskToken; - if (callingConvention != null) - { - this.AdjustFlagsAndWidth(callingConvention); - this.callingConvention = callingConvention; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } + 0 => this.lessThanToken, + 1 => this.parameters, + 2 => this.greaterThanToken, + _ => null, + }; - /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => this.delegateKeyword; - /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => this.asteriskToken; - /// Node representing the optional calling convention. - public FunctionPointerCallingConventionSyntax? CallingConvention => this.callingConvention; - /// List of the parameter types and return type of the function pointer. - public FunctionPointerParameterListSyntax ParameterList => this.parameterList; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterListSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.delegateKeyword, - 1 => this.asteriskToken, - 2 => this.callingConvention, - 3 => this.parameterList, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerTypeSyntax(this, parent, position); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); - - public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax callingConvention, FunctionPointerParameterListSyntax parameterList) + public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) { - if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList) - { - var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerTypeSyntax(this.Kind, this.delegateKeyword, this.asteriskToken, this.callingConvention, this.parameterList, GetDiagnostics(), annotations); + return this; } - /// Function pointer parameter list syntax. - internal sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken lessThanToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken greaterThanToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations); +} + +/// Function pointer calling convention syntax. +internal sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken managedOrUnmanagedKeyword; + internal readonly FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList; - internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); + this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; + if (unmanagedCallingConventionList != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(unmanagedCallingConventionList); + this.unmanagedCallingConventionList = unmanagedCallingConventionList; } + } - internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) - : base(kind) + internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); + this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; + if (unmanagedCallingConventionList != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(unmanagedCallingConventionList); + this.unmanagedCallingConventionList = unmanagedCallingConventionList; } + } - internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) - : base(kind) + internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); + this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; + if (unmanagedCallingConventionList != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(unmanagedCallingConventionList); + this.unmanagedCallingConventionList = unmanagedCallingConventionList; } + } - /// SyntaxToken representing the less than token. - public SyntaxToken LessThanToken => this.lessThanToken; - /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. - public CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); - /// SyntaxToken representing the greater than token. - public SyntaxToken GreaterThanToken => this.greaterThanToken; + /// SyntaxToken representing whether the calling convention is managed or unmanaged. + public SyntaxToken ManagedOrUnmanagedKeyword => this.managedOrUnmanagedKeyword; + /// Optional list of identifiers that will contribute to an unmanaged calling convention. + public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => this.unmanagedCallingConventionList; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanToken, - 1 => this.parameters, - 2 => this.greaterThanToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.managedOrUnmanagedKeyword, + 1 => this.unmanagedCallingConventionList, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerCallingConventionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); - public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax unmanagedCallingConventionList) + { + if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList) { - if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations); + return this; } - /// Function pointer calling convention syntax. - internal sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken managedOrUnmanagedKeyword; - internal readonly FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, GetDiagnostics(), annotations); +} + +/// Function pointer calling convention syntax. +internal sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? callingConventions; + internal readonly SyntaxToken closeBracketToken; - internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (callingConventions != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); - this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; - if (unmanagedCallingConventionList != null) - { - this.AdjustFlagsAndWidth(unmanagedCallingConventionList); - this.unmanagedCallingConventionList = unmanagedCallingConventionList; - } + this.AdjustFlagsAndWidth(callingConventions); + this.callingConventions = callingConventions; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, SyntaxFactoryContext context) - : base(kind) + internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (callingConventions != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); - this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; - if (unmanagedCallingConventionList != null) - { - this.AdjustFlagsAndWidth(unmanagedCallingConventionList); - this.unmanagedCallingConventionList = unmanagedCallingConventionList; - } + this.AdjustFlagsAndWidth(callingConventions); + this.callingConventions = callingConventions; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) - : base(kind) + internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (callingConventions != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(managedOrUnmanagedKeyword); - this.managedOrUnmanagedKeyword = managedOrUnmanagedKeyword; - if (unmanagedCallingConventionList != null) - { - this.AdjustFlagsAndWidth(unmanagedCallingConventionList); - this.unmanagedCallingConventionList = unmanagedCallingConventionList; - } + this.AdjustFlagsAndWidth(callingConventions); + this.callingConventions = callingConventions; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - /// SyntaxToken representing whether the calling convention is managed or unmanaged. - public SyntaxToken ManagedOrUnmanagedKeyword => this.managedOrUnmanagedKeyword; - /// Optional list of identifiers that will contribute to an unmanaged calling convention. - public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => this.unmanagedCallingConventionList; + /// SyntaxToken representing open bracket. + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// SeparatedSyntaxList of calling convention identifiers. + public CoreSyntax.SeparatedSyntaxList CallingConventions => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.callingConventions)); + /// SyntaxToken representing close bracket. + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.managedOrUnmanagedKeyword, - 1 => this.unmanagedCallingConventionList, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.callingConventions, + 2 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerCallingConventionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax unmanagedCallingConventionList) + public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) { - if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList) - { - var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, GetDiagnostics(), annotations); +} + +/// Individual function pointer unmanaged calling convention. +internal sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken name; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerCallingConventionSyntax(this.Kind, this.managedOrUnmanagedKeyword, this.unmanagedCallingConventionList, GetDiagnostics(), annotations); + internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(name); + this.name = name; } - /// Function pointer calling convention syntax. - internal sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode + internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? callingConventions; - internal readonly SyntaxToken closeBracketToken; + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (callingConventions != null) - { - this.AdjustFlagsAndWidth(callingConventions); - this.callingConventions = callingConventions; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (callingConventions != null) - { - this.AdjustFlagsAndWidth(callingConventions); - this.callingConventions = callingConventions; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + /// SyntaxToken representing the calling convention identifier. + public SyntaxToken Name => this.name; - internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (callingConventions != null) - { - this.AdjustFlagsAndWidth(callingConventions); - this.callingConventions = callingConventions; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.name : null; - /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// SeparatedSyntaxList of calling convention identifiers. - public CoreSyntax.SeparatedSyntaxList CallingConventions => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.callingConventions)); - /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => this.closeBracketToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.callingConventions, - 2 => this.closeBracketToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionListSyntax(this, parent, position); + public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name) + { + if (name != this.Name) + { + var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); + return this; + } - public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for a nullable type. +internal sealed partial class NullableTypeSyntax : TypeSyntax +{ + internal readonly TypeSyntax elementType; + internal readonly SyntaxToken questionToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerUnmanagedCallingConventionListSyntax(this.Kind, this.openBracketToken, this.callingConventions, this.closeBracketToken, GetDiagnostics(), annotations); + internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; } - /// Individual function pointer unmanaged calling convention. - internal sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode + internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken name; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + } - internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elementType); + this.elementType = elementType; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + } - internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + /// TypeSyntax node representing the type of the element. + public TypeSyntax ElementType => this.elementType; + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken => this.questionToken; - internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(name); - this.name = name; - } - - /// SyntaxToken representing the calling convention identifier. - public SyntaxToken Name => this.name; + 0 => this.elementType, + 1 => this.questionToken, + _ => null, + }; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.name : null; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableTypeSyntax(this, parent, position); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerUnmanagedCallingConventionSyntax(this, parent, position); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - - public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name) + public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) + { + if (elementType != this.ElementType || questionToken != this.QuestionToken) { - if (name != this.Name) - { - var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.NullableType(elementType, questionToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerUnmanagedCallingConventionSyntax(this.Kind, this.name, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for a nullable type. - internal sealed partial class NullableTypeSyntax : TypeSyntax - { - internal readonly TypeSyntax elementType; - internal readonly SyntaxToken questionToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for tuple type. +internal sealed partial class TupleTypeSyntax : TypeSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? elements; + internal readonly SyntaxToken closeParenToken; - internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (elements != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, SyntaxFactoryContext context) - : base(kind) + internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (elements != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken) - : base(kind) + internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (elements != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elementType); - this.elementType = elementType; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - /// TypeSyntax node representing the type of the element. - public TypeSyntax ElementType => this.elementType; - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => this.questionToken; + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + public CoreSyntax.SeparatedSyntaxList Elements => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.elements)); + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.elementType, - 1 => this.questionToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.elements, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableTypeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleTypeSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); - public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) + public TupleTypeSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) { - if (elementType != this.ElementType || questionToken != this.QuestionToken) - { - var newNode = SyntaxFactory.NullableType(elementType, questionToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NullableTypeSyntax(this.Kind, this.elementType, this.questionToken, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for tuple type. - internal sealed partial class TupleTypeSyntax : TypeSyntax - { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? elements; - internal readonly SyntaxToken closeParenToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, GetDiagnostics(), annotations); +} + +/// Tuple type element. +internal sealed partial class TupleElementSyntax : CSharpSyntaxNode +{ + internal readonly TypeSyntax type; + internal readonly SyntaxToken? identifier; - internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + } - internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + } - internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken) - : base(kind) + internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + } - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - public CoreSyntax.SeparatedSyntaxList Elements => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.elements)); - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + /// Gets the type of the tuple element. + public TypeSyntax Type => this.type; + /// Gets the name of the tuple element. + public SyntaxToken? Identifier => this.identifier; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.elements, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.identifier, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleTypeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleElementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); - public TupleTypeSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) + { + if (type != this.Type || identifier != this.Identifier) { - if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TupleElement(type, identifier); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TupleElementSyntax(this.Kind, this.type, this.identifier, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TupleElementSyntax(this.Kind, this.type, this.identifier, GetDiagnostics(), annotations); +} + +/// Class which represents a placeholder in the type argument list of an unbound generic type. +internal sealed partial class OmittedTypeArgumentSyntax : TypeSyntax +{ + internal readonly SyntaxToken omittedTypeArgumentToken; + + internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedTypeArgumentToken); + this.omittedTypeArgumentToken = omittedTypeArgumentToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TupleTypeSyntax(this.Kind, this.openParenToken, this.elements, this.closeParenToken, GetDiagnostics(), annotations); + internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedTypeArgumentToken); + this.omittedTypeArgumentToken = omittedTypeArgumentToken; } - /// Tuple type element. - internal sealed partial class TupleElementSyntax : CSharpSyntaxNode + internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken) + : base(kind) { - internal readonly TypeSyntax type; - internal readonly SyntaxToken? identifier; + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedTypeArgumentToken); + this.omittedTypeArgumentToken = omittedTypeArgumentToken; + } - internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - } + /// SyntaxToken representing the omitted type argument. + public SyntaxToken OmittedTypeArgumentToken => this.omittedTypeArgumentToken; - internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.omittedTypeArgumentToken : null; - internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedTypeArgumentSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); + + public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken) + { + if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// Gets the type of the tuple element. - public TypeSyntax Type => this.type; - /// Gets the name of the tuple element. - public SyntaxToken? Identifier => this.identifier; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.identifier, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleElementSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); +/// The ref modifier of a method's return value or a local. +internal sealed partial class RefTypeSyntax : TypeSyntax +{ + internal readonly SyntaxToken refKeyword; + internal readonly SyntaxToken? readOnlyKeyword; + internal readonly TypeSyntax type; - public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) + internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + if (readOnlyKeyword != null) { - if (type != this.Type || identifier != this.Identifier) - { - var newNode = SyntaxFactory.TupleElement(type, identifier); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TupleElementSyntax(this.Kind, this.type, this.identifier, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TupleElementSyntax(this.Kind, this.type, this.identifier, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(type); + this.type = type; } - /// Class which represents a placeholder in the type argument list of an unbound generic type. - internal sealed partial class OmittedTypeArgumentSyntax : TypeSyntax + internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken omittedTypeArgumentToken; - - internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + if (readOnlyKeyword != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedTypeArgumentToken); - this.omittedTypeArgumentToken = omittedTypeArgumentToken; + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, SyntaxFactoryContext context) - : base(kind) + internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + if (readOnlyKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedTypeArgumentToken); - this.omittedTypeArgumentToken = omittedTypeArgumentToken; + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + this.AdjustFlagsAndWidth(type); + this.type = type; + } + + public SyntaxToken RefKeyword => this.refKeyword; + /// Gets the optional "readonly" keyword. + public SyntaxToken? ReadOnlyKeyword => this.readOnlyKeyword; + public TypeSyntax Type => this.type; - internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedTypeArgumentToken); - this.omittedTypeArgumentToken = omittedTypeArgumentToken; - } + 0 => this.refKeyword, + 1 => this.readOnlyKeyword, + 2 => this.type, + _ => null, + }; - /// SyntaxToken representing the omitted type argument. - public SyntaxToken OmittedTypeArgumentToken => this.omittedTypeArgumentToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.omittedTypeArgumentToken : null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedTypeArgumentSyntax(this, parent, position); + public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + { + if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) + { + var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); + return this; + } - public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken) - { - if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken) - { - var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, diagnostics, GetAnnotations()); +/// The 'scoped' modifier of a local. +internal sealed partial class ScopedTypeSyntax : TypeSyntax +{ + internal readonly SyntaxToken scopedKeyword; + internal readonly TypeSyntax type; + + internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(scopedKeyword); + this.scopedKeyword = scopedKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OmittedTypeArgumentSyntax(this.Kind, this.omittedTypeArgumentToken, GetDiagnostics(), annotations); + internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(scopedKeyword); + this.scopedKeyword = scopedKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; } - /// The ref modifier of a method's return value or a local. - internal sealed partial class RefTypeSyntax : TypeSyntax + internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type) + : base(kind) { - internal readonly SyntaxToken refKeyword; - internal readonly SyntaxToken? readOnlyKeyword; - internal readonly TypeSyntax type; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(scopedKeyword); + this.scopedKeyword = scopedKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + public SyntaxToken ScopedKeyword => this.scopedKeyword; + public TypeSyntax Type => this.type; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - } + 0 => this.scopedKeyword, + 1 => this.type, + _ => null, + }; - internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ScopedTypeSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); + + public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) + { + if (scopedKeyword != this.ScopedKeyword || type != this.Type) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; + var newNode = SyntaxFactory.ScopedType(scopedKeyword, type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - } + return this; + } - public SyntaxToken RefKeyword => this.refKeyword; - /// Gets the optional "readonly" keyword. - public SyntaxToken? ReadOnlyKeyword => this.readOnlyKeyword; - public TypeSyntax Type => this.type; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ScopedTypeSyntax(this.Kind, this.scopedKeyword, this.type, diagnostics, GetAnnotations()); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.refKeyword, - 1 => this.readOnlyKeyword, - 2 => this.type, - _ => null, - }; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ScopedTypeSyntax(this.Kind, this.scopedKeyword, this.type, GetDiagnostics(), annotations); +} - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeSyntax(this, parent, position); +internal abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode +{ + internal ExpressionOrPatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); + internal ExpressionOrPatternSyntax(SyntaxKind kind) + : base(kind) + { + } +} - public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) - { - if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) - { - var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +/// Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. +internal abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax +{ + internal ExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - return this; - } + internal ExpressionSyntax(SyntaxKind kind) + : base(kind) + { + } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for parenthesized expression. +internal sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RefTypeSyntax(this.Kind, this.refKeyword, this.readOnlyKeyword, this.type, GetDiagnostics(), annotations); + internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - /// The 'scoped' modifier of a local. - internal sealed partial class ScopedTypeSyntax : TypeSyntax + internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken scopedKeyword; - internal readonly TypeSyntax type; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(scopedKeyword); - this.scopedKeyword = scopedKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(scopedKeyword); - this.scopedKeyword = scopedKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// ExpressionSyntax node representing the expression enclosed within the parenthesis. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(scopedKeyword); - this.scopedKeyword = scopedKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + 0 => this.openParenToken, + 1 => this.expression, + 2 => this.closeParenToken, + _ => null, + }; - public SyntaxToken ScopedKeyword => this.scopedKeyword; - public TypeSyntax Type => this.type; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.scopedKeyword, - 1 => this.type, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ScopedTypeSyntax(this, parent, position); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); - - public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) + public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { - if (scopedKeyword != this.ScopedKeyword || type != this.Type) - { - var newNode = SyntaxFactory.ScopedType(scopedKeyword, type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ScopedTypeSyntax(this.Kind, this.scopedKeyword, this.type, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ScopedTypeSyntax(this.Kind, this.scopedKeyword, this.type, GetDiagnostics(), annotations); + return this; } - internal abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode - { - internal ExpressionOrPatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); - internal ExpressionOrPatternSyntax(SyntaxKind kind) - : base(kind) - { - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for tuple expression. +internal sealed partial class TupleExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? arguments; + internal readonly SyntaxToken closeParenToken; - /// Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. - internal abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax + internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal ExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal ExpressionSyntax(SyntaxKind kind) - : base(kind) + internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - /// Class which represents the syntax node for parenthesized expression. - internal sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax + internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; - - internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + 0 => this.openParenToken, + 1 => this.arguments, + 2 => this.closeParenToken, + _ => null, + }; - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// ExpressionSyntax node representing the expression enclosed within the parenthesis. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.expression, - 2 => this.closeParenToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedExpressionSyntax(this, parent, position); + public TupleExpressionSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); + return this; + } - public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for prefix unary expression. +internal sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax operand; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParenthesizedExpressionSyntax(this.Kind, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); + internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; } - /// Class which represents the syntax node for tuple expression. - internal sealed partial class TupleExpressionSyntax : ExpressionSyntax + internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? arguments; - internal readonly SyntaxToken closeParenToken; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + } - internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + } - internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + /// SyntaxToken representing the kind of the operator of the prefix unary expression. + public SyntaxToken OperatorToken => this.operatorToken; + /// ExpressionSyntax representing the operand of the prefix unary expression. + public ExpressionSyntax Operand => this.operand; - internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + 0 => this.operatorToken, + 1 => this.operand, + _ => null, + }; - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrefixUnaryExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.arguments, - 2 => this.closeParenToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TupleExpressionSyntax(this, parent, position); + public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand) + { + if (operatorToken != this.OperatorToken || operand != this.Operand) + { + var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind, operatorToken, operand); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); + return this; + } - public TupleExpressionSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for an "await" expression. +internal sealed partial class AwaitExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken awaitKeyword; + internal readonly ExpressionSyntax expression; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TupleExpressionSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); + internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - /// Class which represents the syntax node for prefix unary expression. - internal sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax + internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax operand; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - } + internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - } + /// SyntaxToken representing the kind "await" keyword. + public SyntaxToken AwaitKeyword => this.awaitKeyword; + /// ExpressionSyntax representing the operand of the "await" operator. + public ExpressionSyntax Expression => this.expression; - internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - } + 0 => this.awaitKeyword, + 1 => this.expression, + _ => null, + }; - /// SyntaxToken representing the kind of the operator of the prefix unary expression. - public SyntaxToken OperatorToken => this.operatorToken; - /// ExpressionSyntax representing the operand of the prefix unary expression. - public ExpressionSyntax Operand => this.operand; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AwaitExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorToken, - 1 => this.operand, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrefixUnaryExpressionSyntax(this, parent, position); + public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression) + { + if (awaitKeyword != this.AwaitKeyword || expression != this.Expression) + { + var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); + return this; + } - public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand) - { - if (operatorToken != this.OperatorToken || operand != this.Operand) - { - var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind, operatorToken, operand); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for postfix unary expression. +internal sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax operand; + internal readonly SyntaxToken operatorToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PrefixUnaryExpressionSyntax(this.Kind, this.operatorToken, this.operand, GetDiagnostics(), annotations); + internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; } - /// Class which represents the syntax node for an "await" expression. - internal sealed partial class AwaitExpressionSyntax : ExpressionSyntax + internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken awaitKeyword; - internal readonly ExpressionSyntax expression; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + } - internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operand); + this.operand = operand; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + } - internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + /// ExpressionSyntax representing the operand of the postfix unary expression. + public ExpressionSyntax Operand => this.operand; + /// SyntaxToken representing the kind of the operator of the postfix unary expression. + public SyntaxToken OperatorToken => this.operatorToken; - internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + 0 => this.operand, + 1 => this.operatorToken, + _ => null, + }; - /// SyntaxToken representing the kind "await" keyword. - public SyntaxToken AwaitKeyword => this.awaitKeyword; - /// ExpressionSyntax representing the operand of the "await" operator. - public ExpressionSyntax Expression => this.expression; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PostfixUnaryExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.awaitKeyword, - 1 => this.expression, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AwaitExpressionSyntax(this, parent, position); + public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken) + { + if (operand != this.Operand || operatorToken != this.OperatorToken) + { + var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind, operand, operatorToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); + return this; + } - public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression) - { - if (awaitKeyword != this.AwaitKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for member access expression. +internal sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken operatorToken; + internal readonly SimpleNameSyntax name; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AwaitExpressionSyntax(this.Kind, this.awaitKeyword, this.expression, GetDiagnostics(), annotations); + internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; } - /// Class which represents the syntax node for postfix unary expression. - internal sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax + internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) + : base(kind) { - internal readonly ExpressionSyntax operand; - internal readonly SyntaxToken operatorToken; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - } + internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - } + /// ExpressionSyntax node representing the object that the member belongs to. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing the kind of the operator in the member access expression. + public SyntaxToken OperatorToken => this.operatorToken; + /// SimpleNameSyntax node representing the member being accessed. + public SimpleNameSyntax Name => this.name; - internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operand); - this.operand = operand; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - } + 0 => this.expression, + 1 => this.operatorToken, + 2 => this.name, + _ => null, + }; - /// ExpressionSyntax representing the operand of the postfix unary expression. - public ExpressionSyntax Operand => this.operand; - /// SyntaxToken representing the kind of the operator of the postfix unary expression. - public SyntaxToken OperatorToken => this.operatorToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberAccessExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operand, - 1 => this.operatorToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PostfixUnaryExpressionSyntax(this, parent, position); + public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + { + if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name) + { + var newNode = SyntaxFactory.MemberAccessExpression(this.Kind, expression, operatorToken, name); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); + return this; + } - public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken) - { - if (operand != this.Operand || operatorToken != this.OperatorToken) - { - var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind, operand, operatorToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for conditional access expression. +internal sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax whenNotNull; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PostfixUnaryExpressionSyntax(this.Kind, this.operand, this.operatorToken, GetDiagnostics(), annotations); + internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(whenNotNull); + this.whenNotNull = whenNotNull; } - /// Class which represents the syntax node for member access expression. - internal sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax + internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, SyntaxFactoryContext context) + : base(kind) { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken operatorToken; - internal readonly SimpleNameSyntax name; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(whenNotNull); + this.whenNotNull = whenNotNull; + } - internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(whenNotNull); + this.whenNotNull = whenNotNull; + } - internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + /// ExpressionSyntax node representing the object conditionally accessed. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing the question mark. + public SyntaxToken OperatorToken => this.operatorToken; + /// ExpressionSyntax node representing the access expression to be executed when the object is not null. + public ExpressionSyntax WhenNotNull => this.whenNotNull; - internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + 0 => this.expression, + 1 => this.operatorToken, + 2 => this.whenNotNull, + _ => null, + }; - /// ExpressionSyntax node representing the object that the member belongs to. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing the kind of the operator in the member access expression. - public SyntaxToken OperatorToken => this.operatorToken; - /// SimpleNameSyntax node representing the member being accessed. - public SimpleNameSyntax Name => this.name; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalAccessExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.operatorToken, - 2 => this.name, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberAccessExpressionSyntax(this, parent, position); + public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + { + if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull) + { + var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); + return this; + } - public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) - { - if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name) - { - var newNode = SyntaxFactory.MemberAccessExpression(this.Kind, expression, operatorToken, name); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for member binding expression. +internal sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken operatorToken; + internal readonly SimpleNameSyntax name; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new MemberAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.name, GetDiagnostics(), annotations); + internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; } - /// Class which represents the syntax node for conditional access expression. - internal sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax + internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) + : base(kind) { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax whenNotNull; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(whenNotNull); - this.whenNotNull = whenNotNull; - } + internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + } - internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(whenNotNull); - this.whenNotNull = whenNotNull; - } + /// SyntaxToken representing dot. + public SyntaxToken OperatorToken => this.operatorToken; + /// SimpleNameSyntax node representing the member being bound to. + public SimpleNameSyntax Name => this.name; - internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(whenNotNull); - this.whenNotNull = whenNotNull; - } + 0 => this.operatorToken, + 1 => this.name, + _ => null, + }; - /// ExpressionSyntax node representing the object conditionally accessed. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing the question mark. - public SyntaxToken OperatorToken => this.operatorToken; - /// ExpressionSyntax node representing the access expression to be executed when the object is not null. - public ExpressionSyntax WhenNotNull => this.whenNotNull; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberBindingExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.operatorToken, - 2 => this.whenNotNull, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalAccessExpressionSyntax(this, parent, position); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); - - public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name) + { + if (operatorToken != this.OperatorToken || name != this.Name) { - if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull) - { - var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConditionalAccessExpressionSyntax(this.Kind, this.expression, this.operatorToken, this.whenNotNull, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for member binding expression. - internal sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken operatorToken; - internal readonly SimpleNameSyntax name; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, diagnostics, GetAnnotations()); - internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, GetDiagnostics(), annotations); +} - internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } +/// Class which represents the syntax node for element binding expression. +internal sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax +{ + internal readonly BracketedArgumentListSyntax argumentList; - internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - } + internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - /// SyntaxToken representing dot. - public SyntaxToken OperatorToken => this.operatorToken; - /// SimpleNameSyntax node representing the member being bound to. - public SimpleNameSyntax Name => this.name; + internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorToken, - 1 => this.name, - _ => null, - }; + internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MemberBindingExpressionSyntax(this, parent, position); + /// BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. + public BracketedArgumentListSyntax ArgumentList => this.argumentList; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.argumentList : null; - public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name) - { - if (operatorToken != this.OperatorToken || name != this.Name) - { - var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementBindingExpressionSyntax(this, parent, position); - return this; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, diagnostics, GetAnnotations()); + public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList) + { + if (argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.ElementBindingExpression(argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new MemberBindingExpressionSyntax(this.Kind, this.operatorToken, this.name, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for element binding expression. - internal sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax - { - internal readonly BracketedArgumentListSyntax argumentList; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ElementBindingExpressionSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations()); - internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ElementBindingExpressionSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for a range expression. +internal sealed partial class RangeExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax? leftOperand; + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax? rightOperand; + + internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (leftOperand != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(leftOperand); + this.leftOperand = leftOperand; } - - internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (rightOperand != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(rightOperand); + this.rightOperand = rightOperand; } + } - internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) - : base(kind) + internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (leftOperand != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(leftOperand); + this.leftOperand = leftOperand; } - - /// BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. - public BracketedArgumentListSyntax ArgumentList => this.argumentList; - - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.argumentList : null; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementBindingExpressionSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); - - public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList) + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (rightOperand != null) { - if (argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ElementBindingExpression(argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(rightOperand); + this.rightOperand = rightOperand; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ElementBindingExpressionSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ElementBindingExpressionSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations); } - /// Class which represents the syntax node for a range expression. - internal sealed partial class RangeExpressionSyntax : ExpressionSyntax + internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) + : base(kind) { - internal readonly ExpressionSyntax? leftOperand; - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax? rightOperand; - - internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + if (leftOperand != null) { - this.SlotCount = 3; - if (leftOperand != null) - { - this.AdjustFlagsAndWidth(leftOperand); - this.leftOperand = leftOperand; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (rightOperand != null) - { - this.AdjustFlagsAndWidth(rightOperand); - this.rightOperand = rightOperand; - } + this.AdjustFlagsAndWidth(leftOperand); + this.leftOperand = leftOperand; } - - internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (rightOperand != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (leftOperand != null) - { - this.AdjustFlagsAndWidth(leftOperand); - this.leftOperand = leftOperand; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (rightOperand != null) - { - this.AdjustFlagsAndWidth(rightOperand); - this.rightOperand = rightOperand; - } + this.AdjustFlagsAndWidth(rightOperand); + this.rightOperand = rightOperand; } + } + + /// ExpressionSyntax node representing the expression on the left of the range operator. + public ExpressionSyntax? LeftOperand => this.leftOperand; + /// SyntaxToken representing the operator of the range expression. + public SyntaxToken OperatorToken => this.operatorToken; + /// ExpressionSyntax node representing the expression on the right of the range operator. + public ExpressionSyntax? RightOperand => this.rightOperand; - internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - if (leftOperand != null) - { - this.AdjustFlagsAndWidth(leftOperand); - this.leftOperand = leftOperand; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (rightOperand != null) - { - this.AdjustFlagsAndWidth(rightOperand); - this.rightOperand = rightOperand; - } - } + 0 => this.leftOperand, + 1 => this.operatorToken, + 2 => this.rightOperand, + _ => null, + }; - /// ExpressionSyntax node representing the expression on the left of the range operator. - public ExpressionSyntax? LeftOperand => this.leftOperand; - /// SyntaxToken representing the operator of the range expression. - public SyntaxToken OperatorToken => this.operatorToken; - /// ExpressionSyntax node representing the expression on the right of the range operator. - public ExpressionSyntax? RightOperand => this.rightOperand; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RangeExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.leftOperand, - 1 => this.operatorToken, - 2 => this.rightOperand, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RangeExpressionSyntax(this, parent, position); + public RangeExpressionSyntax Update(ExpressionSyntax leftOperand, SyntaxToken operatorToken, ExpressionSyntax rightOperand) + { + if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand) + { + var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); + return this; + } - public RangeExpressionSyntax Update(ExpressionSyntax leftOperand, SyntaxToken operatorToken, ExpressionSyntax rightOperand) - { - if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand) - { - var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for implicit element access expression. +internal sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax +{ + internal readonly BracketedArgumentListSyntax argumentList; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RangeExpressionSyntax(this.Kind, this.leftOperand, this.operatorToken, this.rightOperand, GetDiagnostics(), annotations); + internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - /// Class which represents the syntax node for implicit element access expression. - internal sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax + internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) { - internal readonly BracketedArgumentListSyntax argumentList; + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + /// BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. + public BracketedArgumentListSyntax ArgumentList => this.argumentList; - internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.argumentList : null; - /// BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. - public BracketedArgumentListSyntax ArgumentList => this.argumentList; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitElementAccessSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.argumentList : null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitElementAccessSyntax(this, parent, position); + public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList) + { + if (argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.ImplicitElementAccess(argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); + return this; + } - public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList) - { - if (argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ImplicitElementAccess(argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ImplicitElementAccessSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ImplicitElementAccessSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ImplicitElementAccessSyntax(this.Kind, this.argumentList, diagnostics, GetAnnotations()); +/// Class which represents an expression that has a binary operator. +internal sealed partial class BinaryExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax left; + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax right; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ImplicitElementAccessSyntax(this.Kind, this.argumentList, GetDiagnostics(), annotations); + internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; } - /// Class which represents an expression that has a binary operator. - internal sealed partial class BinaryExpressionSyntax : ExpressionSyntax + internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) + : base(kind) { - internal readonly ExpressionSyntax left; - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax right; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + /// ExpressionSyntax node representing the expression on the left of the binary operator. + public ExpressionSyntax Left => this.left; + /// SyntaxToken representing the operator of the binary expression. + public SyntaxToken OperatorToken => this.operatorToken; + /// ExpressionSyntax node representing the expression on the right of the binary operator. + public ExpressionSyntax Right => this.right; - internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + 0 => this.left, + 1 => this.operatorToken, + 2 => this.right, + _ => null, + }; - /// ExpressionSyntax node representing the expression on the left of the binary operator. - public ExpressionSyntax Left => this.left; - /// SyntaxToken representing the operator of the binary expression. - public SyntaxToken OperatorToken => this.operatorToken; - /// ExpressionSyntax node representing the expression on the right of the binary operator. - public ExpressionSyntax Right => this.right; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.left, - 1 => this.operatorToken, - 2 => this.right, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryExpressionSyntax(this, parent, position); + public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + { + var newNode = SyntaxFactory.BinaryExpression(this.Kind, left, operatorToken, right); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); + return this; + } - public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) - { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.BinaryExpression(this.Kind, left, operatorToken, right); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); +/// Class which represents an expression that has an assignment operator. +internal sealed partial class AssignmentExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax left; + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax right; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BinaryExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); + internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; } - /// Class which represents an expression that has an assignment operator. - internal sealed partial class AssignmentExpressionSyntax : ExpressionSyntax + internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) + : base(kind) { - internal readonly ExpressionSyntax left; - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax right; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) - : base(kind) + /// ExpressionSyntax node representing the expression on the left of the assignment operator. + public ExpressionSyntax Left => this.left; + /// SyntaxToken representing the operator of the assignment expression. + public SyntaxToken OperatorToken => this.operatorToken; + /// ExpressionSyntax node representing the expression on the right of the assignment operator. + public ExpressionSyntax Right => this.right; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; - } + 0 => this.left, + 1 => this.operatorToken, + 2 => this.right, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AssignmentExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); - internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) - : base(kind) + public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; + var newNode = SyntaxFactory.AssignmentExpression(this.Kind, left, operatorToken, right); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// ExpressionSyntax node representing the expression on the left of the assignment operator. - public ExpressionSyntax Left => this.left; - /// SyntaxToken representing the operator of the assignment expression. - public SyntaxToken OperatorToken => this.operatorToken; - /// ExpressionSyntax node representing the expression on the right of the assignment operator. - public ExpressionSyntax Right => this.right; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.left, - 1 => this.operatorToken, - 2 => this.right, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AssignmentExpressionSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); +/// Class which represents the syntax node for conditional expression. +internal sealed partial class ConditionalExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken questionToken; + internal readonly ExpressionSyntax whenTrue; + internal readonly SyntaxToken colonToken; + internal readonly ExpressionSyntax whenFalse; + + internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + this.AdjustFlagsAndWidth(whenTrue); + this.whenTrue = whenTrue; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenFalse); + this.whenFalse = whenFalse; + } + + internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + this.AdjustFlagsAndWidth(whenTrue); + this.whenTrue = whenTrue; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenFalse); + this.whenFalse = whenFalse; + } + + internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; + this.AdjustFlagsAndWidth(whenTrue); + this.whenTrue = whenTrue; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenFalse); + this.whenFalse = whenFalse; + } + + /// ExpressionSyntax node representing the condition of the conditional expression. + public ExpressionSyntax Condition => this.condition; + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken => this.questionToken; + /// ExpressionSyntax node representing the expression to be executed when the condition is true. + public ExpressionSyntax WhenTrue => this.whenTrue; + /// SyntaxToken representing the colon. + public SyntaxToken ColonToken => this.colonToken; + /// ExpressionSyntax node representing the expression to be executed when the condition is false. + public ExpressionSyntax WhenFalse => this.whenFalse; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.condition, + 1 => this.questionToken, + 2 => this.whenTrue, + 3 => this.colonToken, + 4 => this.whenFalse, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); + + public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + { + if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse) + { + var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, GetDiagnostics(), annotations); +} - public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) - { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.AssignmentExpression(this.Kind, left, operatorToken, right); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +/// Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. +internal abstract partial class InstanceExpressionSyntax : ExpressionSyntax +{ + internal InstanceExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - return this; - } + internal InstanceExpressionSyntax(SyntaxKind kind) + : base(kind) + { + } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for a this expression. +internal sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax +{ + internal readonly SyntaxToken token; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AssignmentExpressionSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); + internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; } - /// Class which represents the syntax node for conditional expression. - internal sealed partial class ConditionalExpressionSyntax : ExpressionSyntax + internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) + : base(kind) { - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken questionToken; - internal readonly ExpressionSyntax whenTrue; - internal readonly SyntaxToken colonToken; - internal readonly ExpressionSyntax whenFalse; + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - this.AdjustFlagsAndWidth(whenTrue); - this.whenTrue = whenTrue; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(whenFalse); - this.whenFalse = whenFalse; - } + internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - this.AdjustFlagsAndWidth(whenTrue); - this.whenTrue = whenTrue; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(whenFalse); - this.whenFalse = whenFalse; - } + /// SyntaxToken representing the this keyword. + public SyntaxToken Token => this.token; - internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - this.AdjustFlagsAndWidth(whenTrue); - this.whenTrue = whenTrue; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(whenFalse); - this.whenFalse = whenFalse; - } - - /// ExpressionSyntax node representing the condition of the conditional expression. - public ExpressionSyntax Condition => this.condition; - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => this.questionToken; - /// ExpressionSyntax node representing the expression to be executed when the condition is true. - public ExpressionSyntax WhenTrue => this.whenTrue; - /// SyntaxToken representing the colon. - public SyntaxToken ColonToken => this.colonToken; - /// ExpressionSyntax node representing the expression to be executed when the condition is false. - public ExpressionSyntax WhenFalse => this.whenFalse; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.condition, - 1 => this.questionToken, - 2 => this.whenTrue, - 3 => this.colonToken, - 4 => this.whenFalse, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.token : null; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConditionalExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThisExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); - public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + public ThisExpressionSyntax Update(SyntaxToken token) + { + if (token != this.Token) { - if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse) - { - var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ThisExpression(token); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConditionalExpressionSyntax(this.Kind, this.condition, this.questionToken, this.whenTrue, this.colonToken, this.whenFalse, GetDiagnostics(), annotations); + return this; } - /// Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. - internal abstract partial class InstanceExpressionSyntax : ExpressionSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ThisExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ThisExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for a base expression. +internal sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax +{ + internal readonly SyntaxToken token; + + internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal InstanceExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - internal InstanceExpressionSyntax(SyntaxKind kind) - : base(kind) - { - } + internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; } - /// Class which represents the syntax node for a this expression. - internal sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax + internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token) + : base(kind) { - internal readonly SyntaxToken token; + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + /// SyntaxToken representing the base keyword. + public SyntaxToken Token => this.token; - internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.token : null; - internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseExpressionSyntax(this, parent, position); - /// SyntaxToken representing the this keyword. - public SyntaxToken Token => this.token; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.token : null; + public BaseExpressionSyntax Update(SyntaxToken token) + { + if (token != this.Token) + { + var newNode = SyntaxFactory.BaseExpression(token); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThisExpressionSyntax(this, parent, position); + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BaseExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); - public ThisExpressionSyntax Update(SyntaxToken token) - { - if (token != this.Token) - { - var newNode = SyntaxFactory.ThisExpression(token); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BaseExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); +} - return this; - } +/// Class which represents the syntax node for a literal expression. +internal sealed partial class LiteralExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken token; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ThisExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); + internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ThisExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); + internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; } - /// Class which represents the syntax node for a base expression. - internal sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax + internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token) + : base(kind) { - internal readonly SyntaxToken token; + this.SlotCount = 1; + this.AdjustFlagsAndWidth(token); + this.token = token; + } - internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. + public SyntaxToken Token => this.token; - internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.token : null; - internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LiteralExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); + + public LiteralExpressionSyntax Update(SyntaxToken token) + { + if (token != this.Token) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; + var newNode = SyntaxFactory.LiteralExpression(this.Kind, token); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// SyntaxToken representing the base keyword. - public SyntaxToken Token => this.token; + return this; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.token : null; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LiteralExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseExpressionSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LiteralExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); +/// Class which represents the syntax node for MakeRef expression. +internal sealed partial class MakeRefExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + + internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + /// SyntaxToken representing the MakeRefKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Argument of the primary function. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.expression, + 3 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MakeRefExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); + + public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); +} - public BaseExpressionSyntax Update(SyntaxToken token) - { - if (token != this.Token) - { - var newNode = SyntaxFactory.BaseExpression(token); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +/// Class which represents the syntax node for RefType expression. +internal sealed partial class RefTypeExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + + internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + /// SyntaxToken representing the RefTypeKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Argument of the primary function. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.expression, + 3 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); + + public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); +} - return this; - } +/// Class which represents the syntax node for RefValue expression. +internal sealed partial class RefValueExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken comma; + internal readonly TypeSyntax type; + internal readonly SyntaxToken closeParenToken; + + internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(comma); + this.comma = comma; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(comma); + this.comma = comma; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 6; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(comma); + this.comma = comma; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + /// SyntaxToken representing the RefValueKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Typed reference expression. + public ExpressionSyntax Expression => this.expression; + /// Comma separating the arguments. + public SyntaxToken Comma => this.comma; + /// The type of the value. + public TypeSyntax Type => this.type; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.expression, + 3 => this.comma, + 4 => this.type, + 5 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefValueExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); + + public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for Checked or Unchecked expression. +internal sealed partial class CheckedExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + + internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + /// SyntaxToken representing the checked or unchecked keyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Argument of the primary function. + public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.expression, + 3 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); + + public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.CheckedExpression(this.Kind, keyword, openParenToken, expression, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for Default expression. +internal sealed partial class DefaultExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken closeParenToken; + + internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + /// SyntaxToken representing the DefaultKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Argument of the primary function. + public TypeSyntax Type => this.type; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.type, + 3 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); + + public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for TypeOf expression. +internal sealed partial class TypeOfExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken closeParenToken; + + internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + /// SyntaxToken representing the TypeOfKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// The expression to return type of. + public TypeSyntax Type => this.type; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.type, + 3 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeOfExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); + + public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BaseExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for SizeOf expression. +internal sealed partial class SizeOfExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken closeParenToken; + + internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + /// SyntaxToken representing the SizeOfKeyword. + public SyntaxToken Keyword => this.keyword; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Argument of the primary function. + public TypeSyntax Type => this.type; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.keyword, + 1 => this.openParenToken, + 2 => this.type, + 3 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SizeOfExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); + + public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for invocation expression. +internal sealed partial class InvocationExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly ArgumentListSyntax argumentList; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BaseExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); + internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - /// Class which represents the syntax node for a literal expression. - internal sealed partial class LiteralExpressionSyntax : ExpressionSyntax + internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken token; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } + /// ExpressionSyntax node representing the expression part of the invocation. + public ExpressionSyntax Expression => this.expression; + /// ArgumentListSyntax node representing the list of arguments of the invocation expression. + public ArgumentListSyntax ArgumentList => this.argumentList; - internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(token); - this.token = token; - } - - /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. - public SyntaxToken Token => this.token; + 0 => this.expression, + 1 => this.argumentList, + _ => null, + }; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.token : null; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InvocationExpressionSyntax(this, parent, position); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LiteralExpressionSyntax(this, parent, position); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); - - public LiteralExpressionSyntax Update(SyntaxToken token) + public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList) + { + if (expression != this.Expression || argumentList != this.ArgumentList) { - if (token != this.Token) - { - var newNode = SyntaxFactory.LiteralExpression(this.Kind, token); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.InvocationExpression(expression, argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LiteralExpressionSyntax(this.Kind, this.token, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LiteralExpressionSyntax(this.Kind, this.token, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for MakeRef expression. - internal sealed partial class MakeRefExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; - - internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations()); - internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations); +} - internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +/// Class which represents the syntax node for element access expression. +internal sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly BracketedArgumentListSyntax argumentList; - /// SyntaxToken representing the MakeRefKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Argument of the primary function. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.expression, - 3 => this.closeParenToken, - _ => null, - }; + internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MakeRefExpressionSyntax(this, parent, position); + internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); + /// ExpressionSyntax node representing the expression which is accessing the element. + public ExpressionSyntax Expression => this.expression; + /// BracketedArgumentListSyntax node representing the list of arguments of the element access expression. + public BracketedArgumentListSyntax ArgumentList => this.argumentList; - public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.expression, + 1 => this.argumentList, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementAccessExpressionSyntax(this, parent, position); - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); + + public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) + { + if (expression != this.Expression || argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new MakeRefExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); +/// Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. +internal abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode +{ + internal BaseArgumentListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// Class which represents the syntax node for RefType expression. - internal sealed partial class RefTypeExpressionSyntax : ExpressionSyntax + internal BaseArgumentListSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; + } - internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. + public abstract CoreSyntax.SeparatedSyntaxList Arguments { get; } +} + +/// Class which represents the syntax node for the list of arguments. +internal sealed partial class ArgumentListSyntax : BaseArgumentListSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? arguments; + internal readonly SyntaxToken closeParenToken; + + internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - : base(kind) + internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - /// SyntaxToken representing the RefTypeKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Argument of the primary function. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public override CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.expression, - 3 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.arguments, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefTypeExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); - public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + public ArgumentListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RefTypeExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for RefValue expression. - internal sealed partial class RefValueExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken comma; - internal readonly TypeSyntax type; - internal readonly SyntaxToken closeParenToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for bracketed argument list. +internal sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? arguments; + internal readonly SyntaxToken closeBracketToken; - internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (arguments != null) { - this.SlotCount = 6; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(comma); - this.comma = comma; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (arguments != null) { - this.SetFactoryContext(context); - this.SlotCount = 6; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(comma); - this.comma = comma; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) - : base(kind) + internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (arguments != null) { - this.SlotCount = 6; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(comma); - this.comma = comma; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - /// SyntaxToken representing the RefValueKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Typed reference expression. - public ExpressionSyntax Expression => this.expression; - /// Comma separating the arguments. - public SyntaxToken Comma => this.comma; - /// The type of the value. - public TypeSyntax Type => this.type; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.expression, - 3 => this.comma, - 4 => this.type, - 5 => this.closeParenToken, - _ => null, - }; + /// SyntaxToken representing open bracket. + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public override CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + /// SyntaxToken representing close bracket. + public SyntaxToken CloseBracketToken => this.closeBracketToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.arguments, + 2 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefValueExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedArgumentListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); - public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RefValueExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.comma, this.type, this.closeParenToken, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for Checked or Unchecked expression. - internal sealed partial class CheckedExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for argument. +internal sealed partial class ArgumentSyntax : CSharpSyntaxNode +{ + internal readonly NameColonSyntax? nameColon; + internal readonly SyntaxToken? refKindKeyword; + internal readonly ExpressionSyntax expression; - internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (nameColon != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; + } + if (refKindKeyword != null) + { + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (nameColon != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } + if (refKindKeyword != null) + { + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; + } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - : base(kind) + internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 3; + if (nameColon != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; + } + if (refKindKeyword != null) + { + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - /// SyntaxToken representing the checked or unchecked keyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Argument of the primary function. - public ExpressionSyntax Expression => this.expression; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + /// NameColonSyntax node representing the optional name arguments. + public NameColonSyntax? NameColon => this.nameColon; + /// SyntaxToken representing the optional ref or out keyword. + public SyntaxToken? RefKindKeyword => this.refKindKeyword; + /// ExpressionSyntax node representing the argument. + public ExpressionSyntax Expression => this.expression; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.expression, - 3 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.nameColon, + 1 => this.refKindKeyword, + 2 => this.expression, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); - public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + public ArgumentSyntax Update(NameColonSyntax nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) + { + if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CheckedExpression(this.Kind, keyword, openParenToken, expression, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CheckedExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.expression, this.closeParenToken, GetDiagnostics(), annotations); +internal abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode +{ + internal BaseExpressionColonSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// Class which represents the syntax node for Default expression. - internal sealed partial class DefaultExpressionSyntax : ExpressionSyntax + internal BaseExpressionColonSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken closeParenToken; + } - internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + public abstract ExpressionSyntax Expression { get; } - internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + public abstract SyntaxToken ColonToken { get; } +} - internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +internal sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken colonToken; - /// SyntaxToken representing the DefaultKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Argument of the primary function. - public TypeSyntax Type => this.type; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.type, - 3 => this.closeParenToken, - _ => null, - }; + internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultExpressionSyntax(this, parent, position); + internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); + public override ExpressionSyntax Expression => this.expression; + public override SyntaxToken ColonToken => this.colonToken; - public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.expression, + 1 => this.colonToken, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionColonSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DefaultExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); - /// Class which represents the syntax node for TypeOf expression. - internal sealed partial class TypeOfExpressionSyntax : ExpressionSyntax + public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken) { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken closeParenToken; - - internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (expression != this.Expression || colonToken != this.ColonToken) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + var newNode = SyntaxFactory.ExpressionColon(expression, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + return this; + } - internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, diagnostics, GetAnnotations()); - /// SyntaxToken representing the TypeOfKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// The expression to return type of. - public TypeSyntax Type => this.type; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, GetDiagnostics(), annotations); +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.type, - 3 => this.closeParenToken, - _ => null, - }; +/// Class which represents the syntax node for name colon syntax. +internal sealed partial class NameColonSyntax : BaseExpressionColonSyntax +{ + internal readonly IdentifierNameSyntax name; + internal readonly SyntaxToken colonToken; + + internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } + + internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeOfExpressionSyntax(this, parent, position); + internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); + /// IdentifierNameSyntax representing the identifier name. + public IdentifierNameSyntax Name => this.name; + /// SyntaxToken representing colon. + public override SyntaxToken ColonToken => this.colonToken; - public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.name, + 1 => this.colonToken, + _ => null, + }; - return this; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameColonSyntax(this, parent, position); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); + + public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken) + { + if (name != this.Name || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.NameColon(name, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for SizeOf expression. - internal sealed partial class SizeOfExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken closeParenToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NameColonSyntax(this.Kind, this.name, this.colonToken, diagnostics, GetAnnotations()); - internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } - - internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NameColonSyntax(this.Kind, this.name, this.colonToken, GetDiagnostics(), annotations); +} - internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +/// Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. +internal sealed partial class DeclarationExpressionSyntax : ExpressionSyntax +{ + internal readonly TypeSyntax type; + internal readonly VariableDesignationSyntax designation; - /// SyntaxToken representing the SizeOfKeyword. - public SyntaxToken Keyword => this.keyword; - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Argument of the primary function. - public TypeSyntax Type => this.type; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.openParenToken, - 2 => this.type, - 3 => this.closeParenToken, - _ => null, - }; + internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SizeOfExpressionSyntax(this, parent, position); + internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); + public TypeSyntax Type => this.type; + /// Declaration representing the variable declared in an out parameter or deconstruction. + public VariableDesignationSyntax Designation => this.designation; - public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.type, + 1 => this.designation, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationExpressionSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SizeOfExpressionSyntax(this.Kind, this.keyword, this.openParenToken, this.type, this.closeParenToken, GetDiagnostics(), annotations); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); - /// Class which represents the syntax node for invocation expression. - internal sealed partial class InvocationExpressionSyntax : ExpressionSyntax + public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) { - internal readonly ExpressionSyntax expression; - internal readonly ArgumentListSyntax argumentList; - - internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (type != this.Type || designation != this.Designation) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + var newNode = SyntaxFactory.DeclarationExpression(type, designation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + return this; + } - internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations()); - /// ExpressionSyntax node representing the expression part of the invocation. - public ExpressionSyntax Expression => this.expression; - /// ArgumentListSyntax node representing the list of arguments of the invocation expression. - public ArgumentListSyntax ArgumentList => this.argumentList; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations); +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.argumentList, - _ => null, - }; +/// Class which represents the syntax node for cast expression. +internal sealed partial class CastExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken closeParenToken; + internal readonly ExpressionSyntax expression; + + internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => this.openParenToken; + /// TypeSyntax node representing the type to which the expression is being cast. + public TypeSyntax Type => this.type; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => this.closeParenToken; + /// ExpressionSyntax node representing the expression that is being casted. + public ExpressionSyntax Expression => this.expression; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.type, + 2 => this.closeParenToken, + 3 => this.expression, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CastExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); + + public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + { + if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression) + { + var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, GetDiagnostics(), annotations); +} - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InvocationExpressionSyntax(this, parent, position); +/// Provides the base class from which the classes that represent anonymous function expressions are derived. +internal abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax +{ + internal AnonymousFunctionExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); + internal AnonymousFunctionExpressionSyntax(SyntaxKind kind) + : base(kind) + { + } - public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList) - { - if (expression != this.Expression || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.InvocationExpression(expression, argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public abstract CoreSyntax.SyntaxList Modifiers { get; } - return this; - } + /// + /// BlockSyntax node representing the body of the anonymous function. + /// Only one of Block or ExpressionBody will be non-null. + /// + public abstract BlockSyntax? Block { get; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations()); + /// + /// ExpressionSyntax node representing the body of the anonymous function. + /// Only one of Block or ExpressionBody will be non-null. + /// + public abstract ExpressionSyntax? ExpressionBody { get; } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InvocationExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations); - } +/// Class which represents the syntax node for anonymous method expression. +internal sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax +{ + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken delegateKeyword; + internal readonly ParameterListSyntax? parameterList; + internal readonly BlockSyntax block; + internal readonly ExpressionSyntax? expressionBody; - /// Class which represents the syntax node for element access expression. - internal sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax + internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal readonly ExpressionSyntax expression; - internal readonly BracketedArgumentListSyntax argumentList; - - internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - - internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) + this.SlotCount = 5; + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - : base(kind) + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + if (parameterList != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; } - - /// ExpressionSyntax node representing the expression which is accessing the element. - public ExpressionSyntax Expression => this.expression; - /// BracketedArgumentListSyntax node representing the list of arguments of the element access expression. - public BracketedArgumentListSyntax ArgumentList => this.argumentList; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.argumentList, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElementAccessExpressionSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); - - public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) + this.AdjustFlagsAndWidth(block); + this.block = block; + if (expressionBody != null) { - if (expression != this.Expression || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ElementAccessExpressionSyntax(this.Kind, this.expression, this.argumentList, GetDiagnostics(), annotations); } - /// Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. - internal abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode + internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) + : base(kind) { - internal BaseArgumentListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal BaseArgumentListSyntax(SyntaxKind kind) - : base(kind) + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + this.AdjustFlagsAndWidth(block); + this.block = block; + if (expressionBody != null) { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. - public abstract CoreSyntax.SeparatedSyntaxList Arguments { get; } } - /// Class which represents the syntax node for the list of arguments. - internal sealed partial class ArgumentListSyntax : BaseArgumentListSyntax + internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? arguments; - internal readonly SyntaxToken closeParenToken; - - internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + if (modifiers != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + if (parameterList != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; } - - internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) - : base(kind) + this.AdjustFlagsAndWidth(block); + this.block = block; + if (expressionBody != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } + } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// SyntaxToken representing the delegate keyword. + public SyntaxToken DelegateKeyword => this.delegateKeyword; + /// List of parameters of the anonymous method expression, or null if there no parameters are specified. + public ParameterListSyntax? ParameterList => this.parameterList; + /// + /// BlockSyntax node representing the body of the anonymous function. + /// This will never be null. + /// + public override BlockSyntax Block => this.block; + /// + /// Inherited from AnonymousFunctionExpressionSyntax, but not used for + /// AnonymousMethodExpressionSyntax. This will always be null. + /// + public override ExpressionSyntax? ExpressionBody => this.expressionBody; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.arguments, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.modifiers, + 1 => this.delegateKeyword, + 2 => this.parameterList, + 3 => this.block, + 4 => this.expressionBody, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousMethodExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); - public ArgumentListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public AnonymousMethodExpressionSyntax Update(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax parameterList, BlockSyntax block, ExpressionSyntax expressionBody) + { + if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, GetDiagnostics(), annotations); +} + +/// Provides the base class from which the classes that represent lambda expressions are derived. +internal abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax +{ + internal LambdaExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// Class which represents the syntax node for bracketed argument list. - internal sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax + internal LambdaExpressionSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? arguments; - internal readonly SyntaxToken closeBracketToken; + } + + public abstract CoreSyntax.SyntaxList AttributeLists { get; } + + /// SyntaxToken representing equals greater than. + public abstract SyntaxToken ArrowToken { get; } +} - internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +/// Class which represents the syntax node for a simple lambda expression. +internal sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly ParameterSyntax parameter; + internal readonly SyntaxToken arrowToken; + internal readonly BlockSyntax? block; + internal readonly ExpressionSyntax? expressionBody; + + internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken) - : base(kind) + this.AdjustFlagsAndWidth(parameter); + this.parameter = parameter; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(block); + this.block = block; } - - /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); - /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => this.closeBracketToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.arguments, - 2 => this.closeBracketToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedArgumentListSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); - - public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + if (expressionBody != null) { - if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BracketedArgumentListSyntax(this.Kind, this.openBracketToken, this.arguments, this.closeBracketToken, GetDiagnostics(), annotations); } - /// Class which represents the syntax node for argument. - internal sealed partial class ArgumentSyntax : CSharpSyntaxNode + internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) + : base(kind) { - internal readonly NameColonSyntax? nameColon; - internal readonly SyntaxToken? refKindKeyword; - internal readonly ExpressionSyntax expression; - - internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) { - this.SlotCount = 3; - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) - : base(kind) + this.AdjustFlagsAndWidth(parameter); + this.parameter = parameter; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) { - this.SlotCount = 3; - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(block); + this.block = block; } - - /// NameColonSyntax node representing the optional name arguments. - public NameColonSyntax? NameColon => this.nameColon; - /// SyntaxToken representing the optional ref or out keyword. - public SyntaxToken? RefKindKeyword => this.refKindKeyword; - /// ExpressionSyntax node representing the argument. - public ExpressionSyntax Expression => this.expression; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.nameColon, - 1 => this.refKindKeyword, - 2 => this.expression, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArgumentSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); - - public ArgumentSyntax Update(NameColonSyntax nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) + if (expressionBody != null) { - if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArgumentSyntax(this.Kind, this.nameColon, this.refKindKeyword, this.expression, GetDiagnostics(), annotations); } - internal abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode + internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + : base(kind) { - internal BaseExpressionColonSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 6; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseExpressionColonSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - public abstract ExpressionSyntax Expression { get; } - - public abstract SyntaxToken ColonToken { get; } - } - - internal sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax - { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken colonToken; - - internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.AdjustFlagsAndWidth(parameter); + this.parameter = parameter; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(block); + this.block = block; } - - internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + if (expressionBody != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// ParameterSyntax node representing the parameter of the lambda expression. + public ParameterSyntax Parameter => this.parameter; + /// SyntaxToken representing equals greater than. + public override SyntaxToken ArrowToken => this.arrowToken; + /// + /// BlockSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override BlockSyntax? Block => this.block; + /// + /// ExpressionSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override ExpressionSyntax? ExpressionBody => this.expressionBody; - internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.parameter, + 3 => this.arrowToken, + 4 => this.block, + 5 => this.expressionBody, + _ => null, + }; - public override ExpressionSyntax Expression => this.expression; - public override SyntaxToken ColonToken => this.colonToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleLambdaExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.colonToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionColonSyntax(this, parent, position); + public SimpleLambdaExpressionSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) + { + var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); + return this; + } - public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken) - { - if (expression != this.Expression || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.ExpressionColon(expression, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, diagnostics, GetAnnotations()); +internal sealed partial class RefExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken refKeyword; + internal readonly ExpressionSyntax expression; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ExpressionColonSyntax(this.Kind, this.expression, this.colonToken, GetDiagnostics(), annotations); + internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - /// Class which represents the syntax node for name colon syntax. - internal sealed partial class NameColonSyntax : BaseExpressionColonSyntax + internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) { - internal readonly IdentifierNameSyntax name; - internal readonly SyntaxToken colonToken; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } + internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(refKeyword); + this.refKeyword = refKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } + public SyntaxToken RefKeyword => this.refKeyword; + public ExpressionSyntax Expression => this.expression; - internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - } + 0 => this.refKeyword, + 1 => this.expression, + _ => null, + }; - /// IdentifierNameSyntax representing the identifier name. - public IdentifierNameSyntax Name => this.name; - /// SyntaxToken representing colon. - public override SyntaxToken ColonToken => this.colonToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.colonToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameColonSyntax(this, parent, position); + public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression) + { + if (refKeyword != this.RefKeyword || expression != this.Expression) + { + var newNode = SyntaxFactory.RefExpression(refKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); + return this; + } - public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken) - { - if (name != this.Name || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.NameColon(name, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NameColonSyntax(this.Kind, this.name, this.colonToken, diagnostics, GetAnnotations()); +/// Class which represents the syntax node for parenthesized lambda expression. +internal sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax? returnType; + internal readonly ParameterListSyntax parameterList; + internal readonly SyntaxToken arrowToken; + internal readonly BlockSyntax? block; + internal readonly ExpressionSyntax? expressionBody; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NameColonSyntax(this.Kind, this.name, this.colonToken, GetDiagnostics(), annotations); + internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 7; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + if (returnType != null) + { + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) + { + this.AdjustFlagsAndWidth(block); + this.block = block; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } } - /// Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. - internal sealed partial class DeclarationExpressionSyntax : ExpressionSyntax + internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) + : base(kind) { - internal readonly TypeSyntax type; - internal readonly VariableDesignationSyntax designation; - - internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 7; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) - : base(kind) + if (returnType != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; } - - public TypeSyntax Type => this.type; - /// Declaration representing the variable declared in an out parameter or deconstruction. - public VariableDesignationSyntax Designation => this.designation; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.designation, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationExpressionSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); - - public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) { - if (type != this.Type || designation != this.Designation) - { - var newNode = SyntaxFactory.DeclarationExpression(type, designation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(block); + this.block = block; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DeclarationExpressionSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations); } - /// Class which represents the syntax node for cast expression. - internal sealed partial class CastExpressionSyntax : ExpressionSyntax + internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken closeParenToken; - internal readonly ExpressionSyntax expression; - - internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 7; + if (attributeLists != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) - : base(kind) + if (returnType != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + if (block != null) + { + this.AdjustFlagsAndWidth(block); + this.block = block; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + } - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => this.openParenToken; - /// TypeSyntax node representing the type to which the expression is being cast. - public TypeSyntax Type => this.type; - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => this.closeParenToken; - /// ExpressionSyntax node representing the expression that is being casted. - public ExpressionSyntax Expression => this.expression; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public TypeSyntax? ReturnType => this.returnType; + /// ParameterListSyntax node representing the list of parameters for the lambda expression. + public ParameterListSyntax ParameterList => this.parameterList; + /// SyntaxToken representing equals greater than. + public override SyntaxToken ArrowToken => this.arrowToken; + /// + /// BlockSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override BlockSyntax? Block => this.block; + /// + /// ExpressionSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override ExpressionSyntax? ExpressionBody => this.expressionBody; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.type, - 2 => this.closeParenToken, - 3 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.returnType, + 3 => this.parameterList, + 4 => this.arrowToken, + 5 => this.block, + 6 => this.expressionBody, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CastExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedLambdaExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); - public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + public ParenthesizedLambdaExpressionSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) { - if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression) - { - var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CastExpressionSyntax(this.Kind, this.openParenToken, this.type, this.closeParenToken, this.expression, GetDiagnostics(), annotations); + return this; } - /// Provides the base class from which the classes that represent anonymous function expressions are derived. - internal abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for initializer expression. +internal sealed partial class InitializerExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? expressions; + internal readonly SyntaxToken closeBraceToken; + + internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal AnonymousFunctionExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (expressions != null) { + this.AdjustFlagsAndWidth(expressions); + this.expressions = expressions; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal AnonymousFunctionExpressionSyntax(SyntaxKind kind) - : base(kind) + internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (expressions != null) { + this.AdjustFlagsAndWidth(expressions); + this.expressions = expressions; } - - public abstract CoreSyntax.SyntaxList Modifiers { get; } - - /// - /// BlockSyntax node representing the body of the anonymous function. - /// Only one of Block or ExpressionBody will be non-null. - /// - public abstract BlockSyntax? Block { get; } - - /// - /// ExpressionSyntax node representing the body of the anonymous function. - /// Only one of Block or ExpressionBody will be non-null. - /// - public abstract ExpressionSyntax? ExpressionBody { get; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - /// Class which represents the syntax node for anonymous method expression. - internal sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax + internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken) + : base(kind) { - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken delegateKeyword; - internal readonly ParameterListSyntax? parameterList; - internal readonly BlockSyntax block; - internal readonly ExpressionSyntax? expressionBody; - - internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (expressions != null) { - this.SlotCount = 5; - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - this.AdjustFlagsAndWidth(block); - this.block = block; - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } + this.AdjustFlagsAndWidth(expressions); + this.expressions = expressions; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) - : base(kind) + /// SyntaxToken representing the open brace. + public SyntaxToken OpenBraceToken => this.openBraceToken; + /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. + public CoreSyntax.SeparatedSyntaxList Expressions => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.expressions)); + /// SyntaxToken representing the close brace. + public SyntaxToken CloseBraceToken => this.closeBraceToken; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - this.AdjustFlagsAndWidth(block); - this.block = block; - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - } + 0 => this.openBraceToken, + 1 => this.expressions, + 2 => this.closeBraceToken, + _ => null, + }; - internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InitializerExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); + + public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) { - this.SlotCount = 5; - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - this.AdjustFlagsAndWidth(block); - this.block = block; - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } + var newNode = SyntaxFactory.InitializerExpression(this.Kind, openBraceToken, expressions, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => this.delegateKeyword; - /// List of parameters of the anonymous method expression, or null if there no parameters are specified. - public ParameterListSyntax? ParameterList => this.parameterList; - /// - /// BlockSyntax node representing the body of the anonymous function. - /// This will never be null. - /// - public override BlockSyntax Block => this.block; - /// - /// Inherited from AnonymousFunctionExpressionSyntax, but not used for - /// AnonymousMethodExpressionSyntax. This will always be null. - /// - public override ExpressionSyntax? ExpressionBody => this.expressionBody; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.modifiers, - 1 => this.delegateKeyword, - 2 => this.parameterList, - 3 => this.block, - 4 => this.expressionBody, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousMethodExpressionSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, GetDiagnostics(), annotations); +} - public AnonymousMethodExpressionSyntax Update(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax parameterList, BlockSyntax block, ExpressionSyntax expressionBody) - { - if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +internal abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax +{ + internal BaseObjectCreationExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - return this; - } + internal BaseObjectCreationExpressionSyntax(SyntaxKind kind) + : base(kind) + { + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, diagnostics, GetAnnotations()); + /// SyntaxToken representing the new keyword. + public abstract SyntaxToken NewKeyword { get; } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AnonymousMethodExpressionSyntax(this.Kind, this.modifiers, this.delegateKeyword, this.parameterList, this.block, this.expressionBody, GetDiagnostics(), annotations); - } + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public abstract ArgumentListSyntax? ArgumentList { get; } - /// Provides the base class from which the classes that represent lambda expressions are derived. - internal abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public abstract InitializerExpressionSyntax? Initializer { get; } +} + +/// Class which represents the syntax node for implicit object creation expression. +internal sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly ArgumentListSyntax argumentList; + internal readonly InitializerExpressionSyntax? initializer; + + internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal LambdaExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + if (initializer != null) { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal LambdaExpressionSyntax(SyntaxKind kind) - : base(kind) + internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + if (initializer != null) { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } - - public abstract CoreSyntax.SyntaxList AttributeLists { get; } - - /// SyntaxToken representing equals greater than. - public abstract SyntaxToken ArrowToken { get; } } - /// Class which represents the syntax node for a simple lambda expression. - internal sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax + internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly ParameterSyntax parameter; - internal readonly SyntaxToken arrowToken; - internal readonly BlockSyntax? block; - internal readonly ExpressionSyntax? expressionBody; - - internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + if (initializer != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(parameter); - this.parameter = parameter; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) - : base(kind) + /// SyntaxToken representing the new keyword. + public override SyntaxToken NewKeyword => this.newKeyword; + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public override ArgumentListSyntax ArgumentList => this.argumentList; + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public override InitializerExpressionSyntax? Initializer => this.initializer; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(parameter); - this.parameter = parameter; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - } + 0 => this.newKeyword, + 1 => this.argumentList, + 2 => this.initializer, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitObjectCreationExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); - internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - : base(kind) + public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(parameter); - this.parameter = parameter; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } + var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// ParameterSyntax node representing the parameter of the lambda expression. - public ParameterSyntax Parameter => this.parameter; - /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => this.arrowToken; - /// - /// BlockSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override BlockSyntax? Block => this.block; - /// - /// ExpressionSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override ExpressionSyntax? ExpressionBody => this.expressionBody; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.parameter, - 3 => this.arrowToken, - 4 => this.block, - 5 => this.expressionBody, - _ => null, - }; + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleLambdaExpressionSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); +/// Class which represents the syntax node for object creation expression. +internal sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly TypeSyntax type; + internal readonly ArgumentListSyntax? argumentList; + internal readonly InitializerExpressionSyntax? initializer; - public SimpleLambdaExpressionSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) + internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (argumentList != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SimpleLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.parameter, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations); } - internal sealed partial class RefExpressionSyntax : ExpressionSyntax + internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken refKeyword; - internal readonly ExpressionSyntax expression; - - internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (argumentList != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - - internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + if (initializer != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression) - : base(kind) + internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (argumentList != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(refKeyword); - this.refKeyword = refKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - public SyntaxToken RefKeyword => this.refKeyword; - public ExpressionSyntax Expression => this.expression; + /// SyntaxToken representing the new keyword. + public override SyntaxToken NewKeyword => this.newKeyword; + /// TypeSyntax representing the type of the object being created. + public TypeSyntax Type => this.type; + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public override ArgumentListSyntax? ArgumentList => this.argumentList; + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public override InitializerExpressionSyntax? Initializer => this.initializer; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.refKeyword, - 1 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.newKeyword, + 1 => this.type, + 2 => this.argumentList, + 3 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RefExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ObjectCreationExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); - public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression) + public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) { - if (refKeyword != this.RefKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.RefExpression(refKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RefExpressionSyntax(this.Kind, this.refKeyword, this.expression, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for parenthesized lambda expression. - internal sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, GetDiagnostics(), annotations); +} + +internal sealed partial class WithExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken withKeyword; + internal readonly InitializerExpressionSyntax initializer; + + internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax? returnType; - internal readonly ParameterListSyntax parameterList; - internal readonly SyntaxToken arrowToken; - internal readonly BlockSyntax? block; - internal readonly ExpressionSyntax? expressionBody; + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(withKeyword); + this.withKeyword = withKeyword; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (returnType != null) - { - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - } + internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(withKeyword); + this.withKeyword = withKeyword; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (returnType != null) - { - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - } + internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(withKeyword); + this.withKeyword = withKeyword; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - : base(kind) - { - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (returnType != null) - { - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - if (block != null) - { - this.AdjustFlagsAndWidth(block); - this.block = block; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - } + public ExpressionSyntax Expression => this.expression; + public SyntaxToken WithKeyword => this.withKeyword; + /// InitializerExpressionSyntax representing the initializer expression for the with expression. + public InitializerExpressionSyntax Initializer => this.initializer; - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public TypeSyntax? ReturnType => this.returnType; - /// ParameterListSyntax node representing the list of parameters for the lambda expression. - public ParameterListSyntax ParameterList => this.parameterList; - /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => this.arrowToken; - /// - /// BlockSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override BlockSyntax? Block => this.block; - /// - /// ExpressionSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override ExpressionSyntax? ExpressionBody => this.expressionBody; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.returnType, - 3 => this.parameterList, - 4 => this.arrowToken, - 5 => this.block, - 6 => this.expressionBody, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.expression, + 1 => this.withKeyword, + 2 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedLambdaExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WithExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); - public ParenthesizedLambdaExpressionSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax block, ExpressionSyntax expressionBody) + public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + { + if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParenthesizedLambdaExpressionSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.parameterList, this.arrowToken, this.block, this.expressionBody, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for initializer expression. - internal sealed partial class InitializerExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? expressions; - internal readonly SyntaxToken closeBraceToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, GetDiagnostics(), annotations); +} - internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode +{ + internal readonly NameEqualsSyntax? nameEquals; + internal readonly ExpressionSyntax expression; + + internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (nameEquals != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (expressions != null) - { - this.AdjustFlagsAndWidth(expressions); - this.expressions = expressions; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + if (nameEquals != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (expressions != null) - { - this.AdjustFlagsAndWidth(expressions); - this.expressions = expressions; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken) - : base(kind) + internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + if (nameEquals != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (expressions != null) - { - this.AdjustFlagsAndWidth(expressions); - this.expressions = expressions; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => this.openBraceToken; - /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. - public CoreSyntax.SeparatedSyntaxList Expressions => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.expressions)); - /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => this.closeBraceToken; + /// NameEqualsSyntax representing the optional name of the member being initialized. + public NameEqualsSyntax? NameEquals => this.nameEquals; + /// ExpressionSyntax representing the value the member is initialized with. + public ExpressionSyntax Expression => this.expression; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBraceToken, - 1 => this.expressions, - 2 => this.closeBraceToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.nameEquals, + 1 => this.expression, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InitializerExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectMemberDeclaratorSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); - public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax nameEquals, ExpressionSyntax expression) + { + if (nameEquals != this.NameEquals || expression != this.Expression) { - if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.InitializerExpression(this.Kind, openBraceToken, expressions, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InitializerExpressionSyntax(this.Kind, this.openBraceToken, this.expressions, this.closeBraceToken, GetDiagnostics(), annotations); +/// Class which represents the syntax node for anonymous object creation expression. +internal sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? initializers; + internal readonly SyntaxToken closeBraceToken; + + internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (initializers != null) + { + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - internal abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax + internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) { - internal BaseObjectCreationExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (initializers != null) { + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal BaseObjectCreationExpressionSyntax(SyntaxKind kind) - : base(kind) + internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (initializers != null) { + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - /// SyntaxToken representing the new keyword. - public abstract SyntaxToken NewKeyword { get; } + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => this.newKeyword; + /// SyntaxToken representing the open brace. + public SyntaxToken OpenBraceToken => this.openBraceToken; + /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. + public CoreSyntax.SeparatedSyntaxList Initializers => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.initializers)); + /// SyntaxToken representing the close brace. + public SyntaxToken CloseBraceToken => this.closeBraceToken; - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public abstract ArgumentListSyntax? ArgumentList { get; } + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.newKeyword, + 1 => this.openBraceToken, + 2 => this.initializers, + 3 => this.closeBraceToken, + _ => null, + }; - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public abstract InitializerExpressionSyntax? Initializer { get; } - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectCreationExpressionSyntax(this, parent, position); - /// Class which represents the syntax node for implicit object creation expression. - internal sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); + + public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) { - internal readonly SyntaxToken newKeyword; - internal readonly ArgumentListSyntax argumentList; - internal readonly InitializerExpressionSyntax? initializer; + if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for array creation expression. +internal sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly ArrayTypeSyntax type; + internal readonly InitializerExpressionSyntax? initializer; - internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) - : base(kind) + internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) - : base(kind) + internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => this.newKeyword; - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public override ArgumentListSyntax ArgumentList => this.argumentList; - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public override InitializerExpressionSyntax? Initializer => this.initializer; + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => this.newKeyword; + /// ArrayTypeSyntax node representing the type of the array. + public ArrayTypeSyntax Type => this.type; + /// InitializerExpressionSyntax node representing the initializer of the array creation expression. + public InitializerExpressionSyntax? Initializer => this.initializer; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.argumentList, - 2 => this.initializer, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.newKeyword, + 1 => this.type, + 2 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitObjectCreationExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayCreationExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); - public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer) + public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer) { - if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ImplicitObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.argumentList, this.initializer, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for object creation expression. - internal sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax - { - internal readonly SyntaxToken newKeyword; - internal readonly TypeSyntax type; - internal readonly ArgumentListSyntax? argumentList; - internal readonly InitializerExpressionSyntax? initializer; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, diagnostics, GetAnnotations()); - internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for implicit array creation expression. +internal sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? commas; + internal readonly SyntaxToken closeBracketToken; + internal readonly InitializerExpressionSyntax initializer; + + internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (commas != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(commas); + this.commas = commas; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) - : base(kind) + internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (commas != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(commas); + this.commas = commas; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) - : base(kind) + internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (commas != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(commas); + this.commas = commas; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } - /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => this.newKeyword; - /// TypeSyntax representing the type of the object being created. - public TypeSyntax Type => this.type; - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public override ArgumentListSyntax? ArgumentList => this.argumentList; - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public override InitializerExpressionSyntax? Initializer => this.initializer; + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => this.newKeyword; + /// SyntaxToken representing the open bracket. + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. + public CoreSyntax.SyntaxList Commas => new CoreSyntax.SyntaxList(this.commas); + /// SyntaxToken representing the close bracket. + public SyntaxToken CloseBracketToken => this.closeBracketToken; + /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. + public InitializerExpressionSyntax Initializer => this.initializer; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.type, - 2 => this.argumentList, - 3 => this.initializer, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.newKeyword, + 1 => this.openBracketToken, + 2 => this.commas, + 3 => this.closeBracketToken, + 4 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ObjectCreationExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitArrayCreationExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); - public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax argumentList, InitializerExpressionSyntax initializer) + public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) { - if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.argumentList, this.initializer, GetDiagnostics(), annotations); + return this; } - internal sealed partial class WithExpressionSyntax : ExpressionSyntax - { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken withKeyword; - internal readonly InitializerExpressionSyntax initializer; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for stackalloc array creation expression. +internal sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken stackAllocKeyword; + internal readonly TypeSyntax type; + internal readonly InitializerExpressionSyntax? initializer; - internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(withKeyword); - this.withKeyword = withKeyword; this.AdjustFlagsAndWidth(initializer); this.initializer = initializer; } + } - internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) - : base(kind) + internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(withKeyword); - this.withKeyword = withKeyword; this.AdjustFlagsAndWidth(initializer); this.initializer = initializer; } + } - internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) - : base(kind) + internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (initializer != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(withKeyword); - this.withKeyword = withKeyword; this.AdjustFlagsAndWidth(initializer); this.initializer = initializer; } + } - public ExpressionSyntax Expression => this.expression; - public SyntaxToken WithKeyword => this.withKeyword; - /// InitializerExpressionSyntax representing the initializer expression for the with expression. - public InitializerExpressionSyntax Initializer => this.initializer; + /// SyntaxToken representing the stackalloc keyword. + public SyntaxToken StackAllocKeyword => this.stackAllocKeyword; + /// TypeSyntax node representing the type of the stackalloc array. + public TypeSyntax Type => this.type; + /// InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. + public InitializerExpressionSyntax? Initializer => this.initializer; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.withKeyword, - 2 => this.initializer, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.stackAllocKeyword, + 1 => this.type, + 2 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WithExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StackAllocArrayCreationExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); - public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax initializer) + { + if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer) { - if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer) - { - var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new WithExpressionSyntax(this.Kind, this.expression, this.withKeyword, this.initializer, GetDiagnostics(), annotations); + return this; } - internal sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode - { - internal readonly NameEqualsSyntax? nameEquals; - internal readonly ExpressionSyntax expression; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, GetDiagnostics(), annotations); +} + +/// Class which represents the syntax node for implicit stackalloc array creation expression. +internal sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken stackAllocKeyword; + internal readonly SyntaxToken openBracketToken; + internal readonly SyntaxToken closeBracketToken; + internal readonly InitializerExpressionSyntax initializer; + + internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + + internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + + internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(stackAllocKeyword); + this.stackAllocKeyword = stackAllocKeyword; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + + /// SyntaxToken representing the stackalloc keyword. + public SyntaxToken StackAllocKeyword => this.stackAllocKeyword; + /// SyntaxToken representing the open bracket. + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// SyntaxToken representing the close bracket. + public SyntaxToken CloseBracketToken => this.closeBracketToken; + /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. + public InitializerExpressionSyntax Initializer => this.initializer; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.stackAllocKeyword, + 1 => this.openBracketToken, + 2 => this.closeBracketToken, + 3 => this.initializer, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitStackAllocArrayCreationExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); + + public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { + if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) + { + var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations); +} - internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class CollectionExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? elements; + internal readonly SyntaxToken closeBracketToken; + + internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (elements != null) { - this.SlotCount = 2; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (elements != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression) - : base(kind) + internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (elements != null) { - this.SlotCount = 2; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(elements); + this.elements = elements; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - /// NameEqualsSyntax representing the optional name of the member being initialized. - public NameEqualsSyntax? NameEquals => this.nameEquals; - /// ExpressionSyntax representing the value the member is initialized with. - public ExpressionSyntax Expression => this.expression; + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. + public CoreSyntax.SeparatedSyntaxList Elements => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.elements)); + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.nameEquals, - 1 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.elements, + 2 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectMemberDeclaratorSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CollectionExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); - public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax nameEquals, ExpressionSyntax expression) + public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) { - if (nameEquals != this.NameEquals || expression != this.Expression) - { - var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CollectionExpressionSyntax(this.Kind, this.openBracketToken, this.elements, this.closeBracketToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AnonymousObjectMemberDeclaratorSyntax(this.Kind, this.nameEquals, this.expression, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CollectionExpressionSyntax(this.Kind, this.openBracketToken, this.elements, this.closeBracketToken, GetDiagnostics(), annotations); +} + +internal abstract partial class CollectionElementSyntax : CSharpSyntaxNode +{ + internal CollectionElementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// Class which represents the syntax node for anonymous object creation expression. - internal sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax + internal CollectionElementSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken newKeyword; - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? initializers; - internal readonly SyntaxToken closeBraceToken; + } +} - internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } +internal sealed partial class ExpressionElementSyntax : CollectionElementSyntax +{ + internal readonly ExpressionSyntax expression; - internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => this.newKeyword; - /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => this.openBraceToken; - /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. - public CoreSyntax.SeparatedSyntaxList Initializers => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.initializers)); - /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => this.closeBraceToken; + public ExpressionSyntax Expression => this.expression; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.openBraceToken, - 2 => this.initializers, - 3 => this.closeBraceToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.expression : null; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AnonymousObjectCreationExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionElementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); - public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + public ExpressionElementSyntax Update(ExpressionSyntax expression) + { + if (expression != this.Expression) { - if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ExpressionElement(expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AnonymousObjectCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBraceToken, this.initializers, this.closeBraceToken, GetDiagnostics(), annotations); + return this; } - /// Class which represents the syntax node for array creation expression. - internal sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken newKeyword; - internal readonly ArrayTypeSyntax type; - internal readonly InitializerExpressionSyntax? initializer; - - internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ExpressionElementSyntax(this.Kind, this.expression, diagnostics, GetAnnotations()); - internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ExpressionElementSyntax(this.Kind, this.expression, GetDiagnostics(), annotations); +} - internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } +internal sealed partial class SpreadElementSyntax : CollectionElementSyntax +{ + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax expression; - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => this.newKeyword; - /// ArrayTypeSyntax node representing the type of the array. - public ArrayTypeSyntax Type => this.type; - /// InitializerExpressionSyntax node representing the initializer of the array creation expression. - public InitializerExpressionSyntax? Initializer => this.initializer; + internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.type, - 2 => this.initializer, - _ => null, - }; + internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrayCreationExpressionSyntax(this, parent, position); + internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); + public SyntaxToken OperatorToken => this.operatorToken; + public ExpressionSyntax Expression => this.expression; - public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax initializer) + internal override GreenNode? GetSlot(int index) + => index switch { - if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; - } + 0 => this.operatorToken, + 1 => this.expression, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SpreadElementSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.type, this.initializer, GetDiagnostics(), annotations); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); - /// Class which represents the syntax node for implicit array creation expression. - internal sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax + public SpreadElementSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) { - internal readonly SyntaxToken newKeyword; - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? commas; - internal readonly SyntaxToken closeBracketToken; - internal readonly InitializerExpressionSyntax initializer; - - internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (operatorToken != this.OperatorToken || expression != this.Expression) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (commas != null) - { - this.AdjustFlagsAndWidth(commas); - this.commas = commas; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; + var newNode = SyntaxFactory.SpreadElement(operatorToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (commas != null) - { - this.AdjustFlagsAndWidth(commas); - this.commas = commas; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + return this; + } - internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (commas != null) - { - this.AdjustFlagsAndWidth(commas); - this.commas = commas; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SpreadElementSyntax(this.Kind, this.operatorToken, this.expression, diagnostics, GetAnnotations()); - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => this.newKeyword; - /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. - public CoreSyntax.SyntaxList Commas => new CoreSyntax.SyntaxList(this.commas); - /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => this.closeBracketToken; - /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. - public InitializerExpressionSyntax Initializer => this.initializer; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SpreadElementSyntax(this.Kind, this.operatorToken, this.expression, GetDiagnostics(), annotations); +} - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.openBracketToken, - 2 => this.commas, - 3 => this.closeBracketToken, - 4 => this.initializer, - _ => null, - }; +internal abstract partial class QueryClauseSyntax : CSharpSyntaxNode +{ + internal QueryClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitArrayCreationExpressionSyntax(this, parent, position); + internal QueryClauseSyntax(SyntaxKind kind) + : base(kind) + { + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); +internal abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode +{ + internal SelectOrGroupClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { - if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal SelectOrGroupClauseSyntax(SyntaxKind kind) + : base(kind) + { + } +} - return this; - } +internal sealed partial class QueryExpressionSyntax : ExpressionSyntax +{ + internal readonly FromClauseSyntax fromClause; + internal readonly QueryBodySyntax body; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations()); + internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(fromClause); + this.fromClause = fromClause; + this.AdjustFlagsAndWidth(body); + this.body = body; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ImplicitArrayCreationExpressionSyntax(this.Kind, this.newKeyword, this.openBracketToken, this.commas, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations); + internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(fromClause); + this.fromClause = fromClause; + this.AdjustFlagsAndWidth(body); + this.body = body; } - /// Class which represents the syntax node for stackalloc array creation expression. - internal sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax + internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body) + : base(kind) { - internal readonly SyntaxToken stackAllocKeyword; - internal readonly TypeSyntax type; - internal readonly InitializerExpressionSyntax? initializer; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(fromClause); + this.fromClause = fromClause; + this.AdjustFlagsAndWidth(body); + this.body = body; + } - internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + public FromClauseSyntax FromClause => this.fromClause; + public QueryBodySyntax Body => this.body; - internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - } + 0 => this.fromClause, + 1 => this.body, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryExpressionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); - internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) - : base(kind) + public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body) + { + if (fromClause != this.FromClause || body != this.Body) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + var newNode = SyntaxFactory.QueryExpression(fromClause, body); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => this.stackAllocKeyword; - /// TypeSyntax node representing the type of the stackalloc array. - public TypeSyntax Type => this.type; - /// InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. - public InitializerExpressionSyntax? Initializer => this.initializer; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.stackAllocKeyword, - 1 => this.type, - 2 => this.initializer, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StackAllocArrayCreationExpressionSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); +internal sealed partial class QueryBodySyntax : CSharpSyntaxNode +{ + internal readonly GreenNode? clauses; + internal readonly SelectOrGroupClauseSyntax selectOrGroup; + internal readonly QueryContinuationSyntax? continuation; - public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax initializer) + internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (clauses != null) { - if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer) - { - var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(clauses); + this.clauses = clauses; + } + this.AdjustFlagsAndWidth(selectOrGroup); + this.selectOrGroup = selectOrGroup; + if (continuation != null) + { + this.AdjustFlagsAndWidth(continuation); + this.continuation = continuation; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new StackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.type, this.initializer, GetDiagnostics(), annotations); } - /// Class which represents the syntax node for implicit stackalloc array creation expression. - internal sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax + internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken stackAllocKeyword; - internal readonly SyntaxToken openBracketToken; - internal readonly SyntaxToken closeBracketToken; - internal readonly InitializerExpressionSyntax initializer; - - internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + if (clauses != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; + this.AdjustFlagsAndWidth(clauses); + this.clauses = clauses; } - - internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(selectOrGroup); + this.selectOrGroup = selectOrGroup; + if (continuation != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; + this.AdjustFlagsAndWidth(continuation); + this.continuation = continuation; } + } - internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - : base(kind) + internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + : base(kind) + { + this.SlotCount = 3; + if (clauses != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(stackAllocKeyword); - this.stackAllocKeyword = stackAllocKeyword; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; + this.AdjustFlagsAndWidth(clauses); + this.clauses = clauses; } - - /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => this.stackAllocKeyword; - /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => this.closeBracketToken; - /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. - public InitializerExpressionSyntax Initializer => this.initializer; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.stackAllocKeyword, - 1 => this.openBracketToken, - 2 => this.closeBracketToken, - 3 => this.initializer, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ImplicitStackAllocArrayCreationExpressionSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); - - public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + this.AdjustFlagsAndWidth(selectOrGroup); + this.selectOrGroup = selectOrGroup; + if (continuation != null) { - if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(continuation); + this.continuation = continuation; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ImplicitStackAllocArrayCreationExpressionSyntax(this.Kind, this.stackAllocKeyword, this.openBracketToken, this.closeBracketToken, this.initializer, GetDiagnostics(), annotations); } - internal sealed partial class CollectionExpressionSyntax : ExpressionSyntax - { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? elements; - internal readonly SyntaxToken closeBracketToken; + public CoreSyntax.SyntaxList Clauses => new CoreSyntax.SyntaxList(this.clauses); + public SelectOrGroupClauseSyntax SelectOrGroup => this.selectOrGroup; + public QueryContinuationSyntax? Continuation => this.continuation; - internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + 0 => this.clauses, + 1 => this.selectOrGroup, + 2 => this.continuation, + _ => null, + }; - internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryBodySyntax(this, parent, position); - internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); + + public QueryBodySyntax Update(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax continuation) + { + if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (elements != null) - { - this.AdjustFlagsAndWidth(elements); - this.elements = elements; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. - public CoreSyntax.SeparatedSyntaxList Elements => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.elements)); - public SyntaxToken CloseBracketToken => this.closeBracketToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.elements, - 2 => this.closeBracketToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CollectionExpressionSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); +internal sealed partial class FromClauseSyntax : QueryClauseSyntax +{ + internal readonly SyntaxToken fromKeyword; + internal readonly TypeSyntax? type; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken inKeyword; + internal readonly ExpressionSyntax expression; - public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(fromKeyword); + this.fromKeyword = fromKeyword; + if (type != null) { - if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(type); + this.type = type; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CollectionExpressionSyntax(this.Kind, this.openBracketToken, this.elements, this.closeBracketToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CollectionExpressionSyntax(this.Kind, this.openBracketToken, this.elements, this.closeBracketToken, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - internal abstract partial class CollectionElementSyntax : CSharpSyntaxNode + internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) { - internal CollectionElementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(fromKeyword); + this.fromKeyword = fromKeyword; + if (type != null) { + this.AdjustFlagsAndWidth(type); + this.type = type; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal CollectionElementSyntax(SyntaxKind kind) - : base(kind) + internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(fromKeyword); + this.fromKeyword = fromKeyword; + if (type != null) { + this.AdjustFlagsAndWidth(type); + this.type = type; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - internal sealed partial class ExpressionElementSyntax : CollectionElementSyntax - { - internal readonly ExpressionSyntax expression; + public SyntaxToken FromKeyword => this.fromKeyword; + public TypeSyntax? Type => this.type; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public SyntaxToken InKeyword => this.inKeyword; + public ExpressionSyntax Expression => this.expression; - internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + 0 => this.fromKeyword, + 1 => this.type, + 2 => this.identifier, + 3 => this.inKeyword, + 4 => this.expression, + _ => null, + }; - internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FromClauseSyntax(this, parent, position); - internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); + + public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + { + if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public ExpressionSyntax Expression => this.expression; - - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.expression : null; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionElementSyntax(this, parent, position); + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, diagnostics, GetAnnotations()); - public ExpressionElementSyntax Update(ExpressionSyntax expression) - { - if (expression != this.Expression) - { - var newNode = SyntaxFactory.ExpressionElement(expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, GetDiagnostics(), annotations); +} - return this; - } +internal sealed partial class LetClauseSyntax : QueryClauseSyntax +{ + internal readonly SyntaxToken letKeyword; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken equalsToken; + internal readonly ExpressionSyntax expression; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ExpressionElementSyntax(this.Kind, this.expression, diagnostics, GetAnnotations()); + internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(letKeyword); + this.letKeyword = letKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ExpressionElementSyntax(this.Kind, this.expression, GetDiagnostics(), annotations); + internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(letKeyword); + this.letKeyword = letKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - internal sealed partial class SpreadElementSyntax : CollectionElementSyntax + internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + : base(kind) { - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax expression; + this.SlotCount = 4; + this.AdjustFlagsAndWidth(letKeyword); + this.letKeyword = letKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + public SyntaxToken LetKeyword => this.letKeyword; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public SyntaxToken EqualsToken => this.equalsToken; + public ExpressionSyntax Expression => this.expression; - internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + 0 => this.letKeyword, + 1 => this.identifier, + 2 => this.equalsToken, + 3 => this.expression, + _ => null, + }; - internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LetClauseSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); + + public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + { + if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken OperatorToken => this.operatorToken; - public ExpressionSyntax Expression => this.expression; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorToken, - 1 => this.expression, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SpreadElementSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, GetDiagnostics(), annotations); +} - public SpreadElementSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) +internal sealed partial class JoinClauseSyntax : QueryClauseSyntax +{ + internal readonly SyntaxToken joinKeyword; + internal readonly TypeSyntax? type; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken inKeyword; + internal readonly ExpressionSyntax inExpression; + internal readonly SyntaxToken onKeyword; + internal readonly ExpressionSyntax leftExpression; + internal readonly SyntaxToken equalsKeyword; + internal readonly ExpressionSyntax rightExpression; + internal readonly JoinIntoClauseSyntax? into; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 10; + this.AdjustFlagsAndWidth(joinKeyword); + this.joinKeyword = joinKeyword; + if (type != null) { - if (operatorToken != this.OperatorToken || expression != this.Expression) - { - var newNode = SyntaxFactory.SpreadElement(operatorToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(type); + this.type = type; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(inExpression); + this.inExpression = inExpression; + this.AdjustFlagsAndWidth(onKeyword); + this.onKeyword = onKeyword; + this.AdjustFlagsAndWidth(leftExpression); + this.leftExpression = leftExpression; + this.AdjustFlagsAndWidth(equalsKeyword); + this.equalsKeyword = equalsKeyword; + this.AdjustFlagsAndWidth(rightExpression); + this.rightExpression = rightExpression; + if (into != null) + { + this.AdjustFlagsAndWidth(into); + this.into = into; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SpreadElementSyntax(this.Kind, this.operatorToken, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SpreadElementSyntax(this.Kind, this.operatorToken, this.expression, GetDiagnostics(), annotations); } - internal abstract partial class QueryClauseSyntax : CSharpSyntaxNode + internal 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) + : base(kind) { - internal QueryClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 10; + this.AdjustFlagsAndWidth(joinKeyword); + this.joinKeyword = joinKeyword; + if (type != null) { + this.AdjustFlagsAndWidth(type); + this.type = type; } - - internal QueryClauseSyntax(SyntaxKind kind) - : base(kind) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(inExpression); + this.inExpression = inExpression; + this.AdjustFlagsAndWidth(onKeyword); + this.onKeyword = onKeyword; + this.AdjustFlagsAndWidth(leftExpression); + this.leftExpression = leftExpression; + this.AdjustFlagsAndWidth(equalsKeyword); + this.equalsKeyword = equalsKeyword; + this.AdjustFlagsAndWidth(rightExpression); + this.rightExpression = rightExpression; + if (into != null) { + this.AdjustFlagsAndWidth(into); + this.into = into; } } - internal abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode + internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + : base(kind) { - internal SelectOrGroupClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 10; + this.AdjustFlagsAndWidth(joinKeyword); + this.joinKeyword = joinKeyword; + if (type != null) { + this.AdjustFlagsAndWidth(type); + this.type = type; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(inExpression); + this.inExpression = inExpression; + this.AdjustFlagsAndWidth(onKeyword); + this.onKeyword = onKeyword; + this.AdjustFlagsAndWidth(leftExpression); + this.leftExpression = leftExpression; + this.AdjustFlagsAndWidth(equalsKeyword); + this.equalsKeyword = equalsKeyword; + this.AdjustFlagsAndWidth(rightExpression); + this.rightExpression = rightExpression; + if (into != null) + { + this.AdjustFlagsAndWidth(into); + this.into = into; + } + } + + public SyntaxToken JoinKeyword => this.joinKeyword; + public TypeSyntax? Type => this.type; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public SyntaxToken InKeyword => this.inKeyword; + public ExpressionSyntax InExpression => this.inExpression; + public SyntaxToken OnKeyword => this.onKeyword; + public ExpressionSyntax LeftExpression => this.leftExpression; + public SyntaxToken EqualsKeyword => this.equalsKeyword; + public ExpressionSyntax RightExpression => this.rightExpression; + public JoinIntoClauseSyntax? Into => this.into; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.joinKeyword, + 1 => this.type, + 2 => this.identifier, + 3 => this.inKeyword, + 4 => this.inExpression, + 5 => this.onKeyword, + 6 => this.leftExpression, + 7 => this.equalsKeyword, + 8 => this.rightExpression, + 9 => this.into, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinClauseSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); + + public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax into) + { + if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into) + { + var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, GetDiagnostics(), annotations); +} - internal SelectOrGroupClauseSyntax(SyntaxKind kind) - : base(kind) - { - } +internal sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken intoKeyword; + internal readonly SyntaxToken identifier; + + internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } - internal sealed partial class QueryExpressionSyntax : ExpressionSyntax + internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, SyntaxFactoryContext context) + : base(kind) { - internal readonly FromClauseSyntax fromClause; - internal readonly QueryBodySyntax body; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(fromClause); - this.fromClause = fromClause; - this.AdjustFlagsAndWidth(body); - this.body = body; - } + internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(fromClause); - this.fromClause = fromClause; - this.AdjustFlagsAndWidth(body); - this.body = body; - } + public SyntaxToken IntoKeyword => this.intoKeyword; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; - internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(fromClause); - this.fromClause = fromClause; - this.AdjustFlagsAndWidth(body); - this.body = body; - } + 0 => this.intoKeyword, + 1 => this.identifier, + _ => null, + }; - public FromClauseSyntax FromClause => this.fromClause; - public QueryBodySyntax Body => this.body; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinIntoClauseSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.fromClause, - 1 => this.body, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryExpressionSyntax(this, parent, position); + public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier) + { + if (intoKeyword != this.IntoKeyword || identifier != this.Identifier) + { + var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); + return this; + } - public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body) - { - if (fromClause != this.FromClause || body != this.Body) - { - var newNode = SyntaxFactory.QueryExpression(fromClause, body); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, diagnostics, GetAnnotations()); +internal sealed partial class WhereClauseSyntax : QueryClauseSyntax +{ + internal readonly SyntaxToken whereKeyword; + internal readonly ExpressionSyntax condition; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new QueryExpressionSyntax(this.Kind, this.fromClause, this.body, GetDiagnostics(), annotations); + internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; } - internal sealed partial class QueryBodySyntax : CSharpSyntaxNode + internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? clauses; - internal readonly SelectOrGroupClauseSyntax selectOrGroup; - internal readonly QueryContinuationSyntax? continuation; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } - internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - if (clauses != null) - { - this.AdjustFlagsAndWidth(clauses); - this.clauses = clauses; - } - this.AdjustFlagsAndWidth(selectOrGroup); - this.selectOrGroup = selectOrGroup; - if (continuation != null) - { - this.AdjustFlagsAndWidth(continuation); - this.continuation = continuation; - } - } + internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } - internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (clauses != null) - { - this.AdjustFlagsAndWidth(clauses); - this.clauses = clauses; - } - this.AdjustFlagsAndWidth(selectOrGroup); - this.selectOrGroup = selectOrGroup; - if (continuation != null) - { - this.AdjustFlagsAndWidth(continuation); - this.continuation = continuation; - } - } + public SyntaxToken WhereKeyword => this.whereKeyword; + public ExpressionSyntax Condition => this.condition; - internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - if (clauses != null) - { - this.AdjustFlagsAndWidth(clauses); - this.clauses = clauses; - } - this.AdjustFlagsAndWidth(selectOrGroup); - this.selectOrGroup = selectOrGroup; - if (continuation != null) - { - this.AdjustFlagsAndWidth(continuation); - this.continuation = continuation; - } - } + 0 => this.whereKeyword, + 1 => this.condition, + _ => null, + }; - public CoreSyntax.SyntaxList Clauses => new CoreSyntax.SyntaxList(this.clauses); - public SelectOrGroupClauseSyntax SelectOrGroup => this.selectOrGroup; - public QueryContinuationSyntax? Continuation => this.continuation; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhereClauseSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.clauses, - 1 => this.selectOrGroup, - 2 => this.continuation, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryBodySyntax(this, parent, position); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); - - public QueryBodySyntax Update(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax continuation) + public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition) + { + if (whereKeyword != this.WhereKeyword || condition != this.Condition) { - if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) - { - var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.WhereClause(whereKeyword, condition); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new QueryBodySyntax(this.Kind, this.clauses, this.selectOrGroup, this.continuation, GetDiagnostics(), annotations); + return this; } - internal sealed partial class FromClauseSyntax : QueryClauseSyntax - { - internal readonly SyntaxToken fromKeyword; - internal readonly TypeSyntax? type; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken inKeyword; - internal readonly ExpressionSyntax expression; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, GetDiagnostics(), annotations); +} + +internal sealed partial class OrderByClauseSyntax : QueryClauseSyntax +{ + internal readonly SyntaxToken orderByKeyword; + internal readonly GreenNode? orderings; - internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(orderByKeyword); + this.orderByKeyword = orderByKeyword; + if (orderings != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(fromKeyword); - this.fromKeyword = fromKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(orderings); + this.orderings = orderings; } + } - internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(orderByKeyword); + this.orderByKeyword = orderByKeyword; + if (orderings != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(fromKeyword); - this.fromKeyword = fromKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(orderings); + this.orderings = orderings; } + } - internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) - : base(kind) + internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(orderByKeyword); + this.orderByKeyword = orderByKeyword; + if (orderings != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(fromKeyword); - this.fromKeyword = fromKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(orderings); + this.orderings = orderings; } + } - public SyntaxToken FromKeyword => this.fromKeyword; - public TypeSyntax? Type => this.type; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public SyntaxToken InKeyword => this.inKeyword; - public ExpressionSyntax Expression => this.expression; + public SyntaxToken OrderByKeyword => this.orderByKeyword; + public CoreSyntax.SeparatedSyntaxList Orderings => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.orderings)); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.fromKeyword, - 1 => this.type, - 2 => this.identifier, - 3 => this.inKeyword, - 4 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.orderByKeyword, + 1 => this.orderings, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FromClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderByClauseSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); - public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) + { + if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) { - if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FromClauseSyntax(this.Kind, this.fromKeyword, this.type, this.identifier, this.inKeyword, this.expression, GetDiagnostics(), annotations); + return this; } - internal sealed partial class LetClauseSyntax : QueryClauseSyntax - { - internal readonly SyntaxToken letKeyword; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken equalsToken; - internal readonly ExpressionSyntax expression; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, GetDiagnostics(), annotations); +} + +internal sealed partial class OrderingSyntax : CSharpSyntaxNode +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken? ascendingOrDescendingKeyword; - internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (ascendingOrDescendingKeyword != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(letKeyword); - this.letKeyword = letKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); + this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; } + } - internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (ascendingOrDescendingKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(letKeyword); - this.letKeyword = letKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); + this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; } + } - internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) - : base(kind) + internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (ascendingOrDescendingKeyword != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(letKeyword); - this.letKeyword = letKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); + this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; } + } - public SyntaxToken LetKeyword => this.letKeyword; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public SyntaxToken EqualsToken => this.equalsToken; - public ExpressionSyntax Expression => this.expression; + public ExpressionSyntax Expression => this.expression; + public SyntaxToken? AscendingOrDescendingKeyword => this.ascendingOrDescendingKeyword; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.letKeyword, - 1 => this.identifier, - 2 => this.equalsToken, - 3 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.expression, + 1 => this.ascendingOrDescendingKeyword, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LetClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderingSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); - public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) + { + if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword) { - if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression) - { - var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Ordering(this.Kind, expression, ascendingOrDescendingKeyword); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, GetDiagnostics(), annotations); +} + +internal sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax +{ + internal readonly SyntaxToken selectKeyword; + internal readonly ExpressionSyntax expression; + + internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(selectKeyword); + this.selectKeyword = selectKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LetClauseSyntax(this.Kind, this.letKeyword, this.identifier, this.equalsToken, this.expression, GetDiagnostics(), annotations); + internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(selectKeyword); + this.selectKeyword = selectKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - internal sealed partial class JoinClauseSyntax : QueryClauseSyntax + internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression) + : base(kind) { - internal readonly SyntaxToken joinKeyword; - internal readonly TypeSyntax? type; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken inKeyword; - internal readonly ExpressionSyntax inExpression; - internal readonly SyntaxToken onKeyword; - internal readonly ExpressionSyntax leftExpression; - internal readonly SyntaxToken equalsKeyword; - internal readonly ExpressionSyntax rightExpression; - internal readonly JoinIntoClauseSyntax? into; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(selectKeyword); + this.selectKeyword = selectKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal 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) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 10; - this.AdjustFlagsAndWidth(joinKeyword); - this.joinKeyword = joinKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(inExpression); - this.inExpression = inExpression; - this.AdjustFlagsAndWidth(onKeyword); - this.onKeyword = onKeyword; - this.AdjustFlagsAndWidth(leftExpression); - this.leftExpression = leftExpression; - this.AdjustFlagsAndWidth(equalsKeyword); - this.equalsKeyword = equalsKeyword; - this.AdjustFlagsAndWidth(rightExpression); - this.rightExpression = rightExpression; - if (into != null) - { - this.AdjustFlagsAndWidth(into); - this.into = into; - } - } + public SyntaxToken SelectKeyword => this.selectKeyword; + public ExpressionSyntax Expression => this.expression; - internal 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) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 10; - this.AdjustFlagsAndWidth(joinKeyword); - this.joinKeyword = joinKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(inExpression); - this.inExpression = inExpression; - this.AdjustFlagsAndWidth(onKeyword); - this.onKeyword = onKeyword; - this.AdjustFlagsAndWidth(leftExpression); - this.leftExpression = leftExpression; - this.AdjustFlagsAndWidth(equalsKeyword); - this.equalsKeyword = equalsKeyword; - this.AdjustFlagsAndWidth(rightExpression); - this.rightExpression = rightExpression; - if (into != null) - { - this.AdjustFlagsAndWidth(into); - this.into = into; - } - } + 0 => this.selectKeyword, + 1 => this.expression, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SelectClauseSyntax(this, parent, position); - internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); + + public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression) + { + if (selectKeyword != this.SelectKeyword || expression != this.Expression) { - this.SlotCount = 10; - this.AdjustFlagsAndWidth(joinKeyword); - this.joinKeyword = joinKeyword; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(inExpression); - this.inExpression = inExpression; - this.AdjustFlagsAndWidth(onKeyword); - this.onKeyword = onKeyword; - this.AdjustFlagsAndWidth(leftExpression); - this.leftExpression = leftExpression; - this.AdjustFlagsAndWidth(equalsKeyword); - this.equalsKeyword = equalsKeyword; - this.AdjustFlagsAndWidth(rightExpression); - this.rightExpression = rightExpression; - if (into != null) - { - this.AdjustFlagsAndWidth(into); - this.into = into; - } + var newNode = SyntaxFactory.SelectClause(selectKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken JoinKeyword => this.joinKeyword; - public TypeSyntax? Type => this.type; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public SyntaxToken InKeyword => this.inKeyword; - public ExpressionSyntax InExpression => this.inExpression; - public SyntaxToken OnKeyword => this.onKeyword; - public ExpressionSyntax LeftExpression => this.leftExpression; - public SyntaxToken EqualsKeyword => this.equalsKeyword; - public ExpressionSyntax RightExpression => this.rightExpression; - public JoinIntoClauseSyntax? Into => this.into; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.joinKeyword, - 1 => this.type, - 2 => this.identifier, - 3 => this.inKeyword, - 4 => this.inExpression, - 5 => this.onKeyword, - 6 => this.leftExpression, - 7 => this.equalsKeyword, - 8 => this.rightExpression, - 9 => this.into, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinClauseSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); - - public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax into) - { - if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into) - { - var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + return this; + } - return this; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, diagnostics, GetAnnotations()); +internal sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax +{ + internal readonly SyntaxToken groupKeyword; + internal readonly ExpressionSyntax groupExpression; + internal readonly SyntaxToken byKeyword; + internal readonly ExpressionSyntax byExpression; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new JoinClauseSyntax(this.Kind, this.joinKeyword, this.type, this.identifier, this.inKeyword, this.inExpression, this.onKeyword, this.leftExpression, this.equalsKeyword, this.rightExpression, this.into, GetDiagnostics(), annotations); + internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(groupKeyword); + this.groupKeyword = groupKeyword; + this.AdjustFlagsAndWidth(groupExpression); + this.groupExpression = groupExpression; + this.AdjustFlagsAndWidth(byKeyword); + this.byKeyword = byKeyword; + this.AdjustFlagsAndWidth(byExpression); + this.byExpression = byExpression; } - internal sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode + internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken intoKeyword; - internal readonly SyntaxToken identifier; + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(groupKeyword); + this.groupKeyword = groupKeyword; + this.AdjustFlagsAndWidth(groupExpression); + this.groupExpression = groupExpression; + this.AdjustFlagsAndWidth(byKeyword); + this.byKeyword = byKeyword; + this.AdjustFlagsAndWidth(byExpression); + this.byExpression = byExpression; + } - internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(groupKeyword); + this.groupKeyword = groupKeyword; + this.AdjustFlagsAndWidth(groupExpression); + this.groupExpression = groupExpression; + this.AdjustFlagsAndWidth(byKeyword); + this.byKeyword = byKeyword; + this.AdjustFlagsAndWidth(byExpression); + this.byExpression = byExpression; + } - internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + public SyntaxToken GroupKeyword => this.groupKeyword; + public ExpressionSyntax GroupExpression => this.groupExpression; + public SyntaxToken ByKeyword => this.byKeyword; + public ExpressionSyntax ByExpression => this.byExpression; - internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + 0 => this.groupKeyword, + 1 => this.groupExpression, + 2 => this.byKeyword, + 3 => this.byExpression, + _ => null, + }; - public SyntaxToken IntoKeyword => this.intoKeyword; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GroupClauseSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.intoKeyword, - 1 => this.identifier, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); + + public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + { + if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression) + { + var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.JoinIntoClauseSyntax(this, parent, position); + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, diagnostics, GetAnnotations()); - public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier) - { - if (intoKeyword != this.IntoKeyword || identifier != this.Identifier) - { - var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, GetDiagnostics(), annotations); +} - return this; - } +internal sealed partial class QueryContinuationSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken intoKeyword; + internal readonly SyntaxToken identifier; + internal readonly QueryBodySyntax body; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, diagnostics, GetAnnotations()); + internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(body); + this.body = body; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new JoinIntoClauseSyntax(this.Kind, this.intoKeyword, this.identifier, GetDiagnostics(), annotations); + internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(body); + this.body = body; } - internal sealed partial class WhereClauseSyntax : QueryClauseSyntax + internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + : base(kind) { - internal readonly SyntaxToken whereKeyword; - internal readonly ExpressionSyntax condition; + this.SlotCount = 3; + this.AdjustFlagsAndWidth(intoKeyword); + this.intoKeyword = intoKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(body); + this.body = body; + } - internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } + public SyntaxToken IntoKeyword => this.intoKeyword; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public QueryBodySyntax Body => this.body; - internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } + 0 => this.intoKeyword, + 1 => this.identifier, + 2 => this.body, + _ => null, + }; - internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryContinuationSyntax(this, parent, position); - public SyntaxToken WhereKeyword => this.whereKeyword; - public ExpressionSyntax Condition => this.condition; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.whereKeyword, - 1 => this.condition, - _ => null, - }; + public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + { + if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body) + { + var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhereClauseSyntax(this, parent, position); + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, diagnostics, GetAnnotations()); - public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition) - { - if (whereKeyword != this.WhereKeyword || condition != this.Condition) - { - var newNode = SyntaxFactory.WhereClause(whereKeyword, condition); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, GetDiagnostics(), annotations); +} - return this; - } +/// Class which represents a placeholder in an array size list. +internal sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken omittedArraySizeExpressionToken; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, diagnostics, GetAnnotations()); + internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); + this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new WhereClauseSyntax(this.Kind, this.whereKeyword, this.condition, GetDiagnostics(), annotations); + internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); + this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; } - internal sealed partial class OrderByClauseSyntax : QueryClauseSyntax + internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken) + : base(kind) { - internal readonly SyntaxToken orderByKeyword; - internal readonly GreenNode? orderings; + this.SlotCount = 1; + this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); + this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; + } - internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(orderByKeyword); - this.orderByKeyword = orderByKeyword; - if (orderings != null) - { - this.AdjustFlagsAndWidth(orderings); - this.orderings = orderings; - } - } + /// SyntaxToken representing the omitted array size expression. + public SyntaxToken OmittedArraySizeExpressionToken => this.omittedArraySizeExpressionToken; - internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(orderByKeyword); - this.orderByKeyword = orderByKeyword; - if (orderings != null) - { - this.AdjustFlagsAndWidth(orderings); - this.orderings = orderings; - } - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.omittedArraySizeExpressionToken : null; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedArraySizeExpressionSyntax(this, parent, position); - internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); + + public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken) + { + if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(orderByKeyword); - this.orderByKeyword = orderByKeyword; - if (orderings != null) - { - this.AdjustFlagsAndWidth(orderings); - this.orderings = orderings; - } + var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken OrderByKeyword => this.orderByKeyword; - public CoreSyntax.SeparatedSyntaxList Orderings => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.orderings)); + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.orderByKeyword, - 1 => this.orderings, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderByClauseSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); +internal sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken stringStartToken; + internal readonly GreenNode? contents; + internal readonly SyntaxToken stringEndToken; - public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) + internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stringStartToken); + this.stringStartToken = stringStartToken; + if (contents != null) { - if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) - { - var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(contents); + this.contents = contents; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OrderByClauseSyntax(this.Kind, this.orderByKeyword, this.orderings, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(stringEndToken); + this.stringEndToken = stringEndToken; } - internal sealed partial class OrderingSyntax : CSharpSyntaxNode + internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken? ascendingOrDescendingKeyword; - - internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (ascendingOrDescendingKeyword != null) - { - this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); - this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; - } - } - - internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, SyntaxFactoryContext context) - : base(kind) + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stringStartToken); + this.stringStartToken = stringStartToken; + if (contents != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (ascendingOrDescendingKeyword != null) - { - this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); - this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; - } + this.AdjustFlagsAndWidth(contents); + this.contents = contents; } + this.AdjustFlagsAndWidth(stringEndToken); + this.stringEndToken = stringEndToken; + } - internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) - : base(kind) + internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(stringStartToken); + this.stringStartToken = stringStartToken; + if (contents != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (ascendingOrDescendingKeyword != null) - { - this.AdjustFlagsAndWidth(ascendingOrDescendingKeyword); - this.ascendingOrDescendingKeyword = ascendingOrDescendingKeyword; - } + this.AdjustFlagsAndWidth(contents); + this.contents = contents; } + this.AdjustFlagsAndWidth(stringEndToken); + this.stringEndToken = stringEndToken; + } - public ExpressionSyntax Expression => this.expression; - public SyntaxToken? AscendingOrDescendingKeyword => this.ascendingOrDescendingKeyword; + /// The first part of an interpolated string, $" or $@" or $""" + public SyntaxToken StringStartToken => this.stringStartToken; + /// List of parts of the interpolated string, each one is either a literal part or an interpolation. + public CoreSyntax.SyntaxList Contents => new CoreSyntax.SyntaxList(this.contents); + /// The closing quote of the interpolated string. + public SyntaxToken StringEndToken => this.stringEndToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.ascendingOrDescendingKeyword, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.stringStartToken, + 1 => this.contents, + 2 => this.stringEndToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OrderingSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); - public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) + public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) + { + if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) { - if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword) - { - var newNode = SyntaxFactory.Ordering(this.Kind, expression, ascendingOrDescendingKeyword); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OrderingSyntax(this.Kind, this.expression, this.ascendingOrDescendingKeyword, GetDiagnostics(), annotations); + return this; } - internal sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax - { - internal readonly SyntaxToken selectKeyword; - internal readonly ExpressionSyntax expression; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, diagnostics, GetAnnotations()); - internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(selectKeyword); - this.selectKeyword = selectKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - - internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(selectKeyword); - this.selectKeyword = selectKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, GetDiagnostics(), annotations); +} - internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(selectKeyword); - this.selectKeyword = selectKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } +/// Class which represents a simple pattern-matching expression using the "is" keyword. +internal sealed partial class IsPatternExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken isKeyword; + internal readonly PatternSyntax pattern; - public SyntaxToken SelectKeyword => this.selectKeyword; - public ExpressionSyntax Expression => this.expression; + internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(isKeyword); + this.isKeyword = isKeyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.selectKeyword, - 1 => this.expression, - _ => null, - }; + internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(isKeyword); + this.isKeyword = isKeyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SelectClauseSyntax(this, parent, position); + internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(isKeyword); + this.isKeyword = isKeyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); + /// ExpressionSyntax node representing the expression on the left of the "is" operator. + public ExpressionSyntax Expression => this.expression; + public SyntaxToken IsKeyword => this.isKeyword; + /// PatternSyntax node representing the pattern on the right of the "is" operator. + public PatternSyntax Pattern => this.pattern; - public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression) + internal override GreenNode? GetSlot(int index) + => index switch { - if (selectKeyword != this.SelectKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.SelectClause(selectKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.expression, + 1 => this.isKeyword, + 2 => this.pattern, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IsPatternExpressionSyntax(this, parent, position); - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); + + public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + { + if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern) + { + var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, GetDiagnostics(), annotations); +} + +internal sealed partial class ThrowExpressionSyntax : ExpressionSyntax +{ + internal readonly SyntaxToken throwKeyword; + internal readonly ExpressionSyntax expression; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SelectClauseSyntax(this.Kind, this.selectKeyword, this.expression, GetDiagnostics(), annotations); + internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - internal sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax + internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken groupKeyword; - internal readonly ExpressionSyntax groupExpression; - internal readonly SyntaxToken byKeyword; - internal readonly ExpressionSyntax byExpression; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(groupKeyword); - this.groupKeyword = groupKeyword; - this.AdjustFlagsAndWidth(groupExpression); - this.groupExpression = groupExpression; - this.AdjustFlagsAndWidth(byKeyword); - this.byKeyword = byKeyword; - this.AdjustFlagsAndWidth(byExpression); - this.byExpression = byExpression; - } + internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(groupKeyword); - this.groupKeyword = groupKeyword; - this.AdjustFlagsAndWidth(groupExpression); - this.groupExpression = groupExpression; - this.AdjustFlagsAndWidth(byKeyword); - this.byKeyword = byKeyword; - this.AdjustFlagsAndWidth(byExpression); - this.byExpression = byExpression; - } + public SyntaxToken ThrowKeyword => this.throwKeyword; + public ExpressionSyntax Expression => this.expression; - internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(groupKeyword); - this.groupKeyword = groupKeyword; - this.AdjustFlagsAndWidth(groupExpression); - this.groupExpression = groupExpression; - this.AdjustFlagsAndWidth(byKeyword); - this.byKeyword = byKeyword; - this.AdjustFlagsAndWidth(byExpression); - this.byExpression = byExpression; - } + 0 => this.throwKeyword, + 1 => this.expression, + _ => null, + }; - public SyntaxToken GroupKeyword => this.groupKeyword; - public ExpressionSyntax GroupExpression => this.groupExpression; - public SyntaxToken ByKeyword => this.byKeyword; - public ExpressionSyntax ByExpression => this.byExpression; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowExpressionSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.groupKeyword, - 1 => this.groupExpression, - 2 => this.byKeyword, - 3 => this.byExpression, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GroupClauseSyntax(this, parent, position); + public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression) + { + if (throwKeyword != this.ThrowKeyword || expression != this.Expression) + { + var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); + return this; + } - public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) - { - if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression) - { - var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, diagnostics, GetAnnotations()); +internal sealed partial class WhenClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken whenKeyword; + internal readonly ExpressionSyntax condition; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new GroupClauseSyntax(this.Kind, this.groupKeyword, this.groupExpression, this.byKeyword, this.byExpression, GetDiagnostics(), annotations); + internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; } - internal sealed partial class QueryContinuationSyntax : CSharpSyntaxNode + internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken intoKeyword; - internal readonly SyntaxToken identifier; - internal readonly QueryBodySyntax body; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } - internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(body); - this.body = body; - } + internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } + + public SyntaxToken WhenKeyword => this.whenKeyword; + public ExpressionSyntax Condition => this.condition; - internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(body); - this.body = body; - } + 0 => this.whenKeyword, + 1 => this.condition, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhenClauseSyntax(this, parent, position); - internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); + + public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition) + { + if (whenKeyword != this.WhenKeyword || condition != this.Condition) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(intoKeyword); - this.intoKeyword = intoKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(body); - this.body = body; + var newNode = SyntaxFactory.WhenClause(whenKeyword, condition); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken IntoKeyword => this.intoKeyword; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public QueryBodySyntax Body => this.body; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.intoKeyword, - 1 => this.identifier, - 2 => this.body, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QueryContinuationSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); +internal abstract partial class PatternSyntax : ExpressionOrPatternSyntax +{ + internal PatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) - { - if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body) - { - var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal PatternSyntax(SyntaxKind kind) + : base(kind) + { + } +} - return this; - } +internal sealed partial class DiscardPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken underscoreToken; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, diagnostics, GetAnnotations()); + internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new QueryContinuationSyntax(this.Kind, this.intoKeyword, this.identifier, this.body, GetDiagnostics(), annotations); + internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; } - /// Class which represents a placeholder in an array size list. - internal sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax + internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken) + : base(kind) { - internal readonly SyntaxToken omittedArraySizeExpressionToken; + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); - this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; - } + public SyntaxToken UnderscoreToken => this.underscoreToken; - internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); - this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.underscoreToken : null; - internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(omittedArraySizeExpressionToken); - this.omittedArraySizeExpressionToken = omittedArraySizeExpressionToken; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardPatternSyntax(this, parent, position); - /// SyntaxToken representing the omitted array size expression. - public SyntaxToken OmittedArraySizeExpressionToken => this.omittedArraySizeExpressionToken; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.omittedArraySizeExpressionToken : null; + public DiscardPatternSyntax Update(SyntaxToken underscoreToken) + { + if (underscoreToken != this.UnderscoreToken) + { + var newNode = SyntaxFactory.DiscardPattern(underscoreToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OmittedArraySizeExpressionSyntax(this, parent, position); + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DiscardPatternSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations()); - public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken) - { - if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken) - { - var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DiscardPatternSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations); +} - return this; - } +internal sealed partial class DeclarationPatternSyntax : PatternSyntax +{ + internal readonly TypeSyntax type; + internal readonly VariableDesignationSyntax designation; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, diagnostics, GetAnnotations()); + internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OmittedArraySizeExpressionSyntax(this.Kind, this.omittedArraySizeExpressionToken, GetDiagnostics(), annotations); + internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } - internal sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax + internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) + : base(kind) { - internal readonly SyntaxToken stringStartToken; - internal readonly GreenNode? contents; - internal readonly SyntaxToken stringEndToken; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stringStartToken); - this.stringStartToken = stringStartToken; - if (contents != null) - { - this.AdjustFlagsAndWidth(contents); - this.contents = contents; - } - this.AdjustFlagsAndWidth(stringEndToken); - this.stringEndToken = stringEndToken; - } + public TypeSyntax Type => this.type; + public VariableDesignationSyntax Designation => this.designation; - internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stringStartToken); - this.stringStartToken = stringStartToken; - if (contents != null) - { - this.AdjustFlagsAndWidth(contents); - this.contents = contents; - } - this.AdjustFlagsAndWidth(stringEndToken); - this.stringEndToken = stringEndToken; - } + 0 => this.type, + 1 => this.designation, + _ => null, + }; - internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(stringStartToken); - this.stringStartToken = stringStartToken; - if (contents != null) - { - this.AdjustFlagsAndWidth(contents); - this.contents = contents; - } - this.AdjustFlagsAndWidth(stringEndToken); - this.stringEndToken = stringEndToken; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationPatternSyntax(this, parent, position); - /// The first part of an interpolated string, $" or $@" or $""" - public SyntaxToken StringStartToken => this.stringStartToken; - /// List of parts of the interpolated string, each one is either a literal part or an interpolation. - public CoreSyntax.SyntaxList Contents => new CoreSyntax.SyntaxList(this.contents); - /// The closing quote of the interpolated string. - public SyntaxToken StringEndToken => this.stringEndToken; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.stringStartToken, - 1 => this.contents, - 2 => this.stringEndToken, - _ => null, - }; + public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + { + if (type != this.Type || designation != this.Designation) + { + var newNode = SyntaxFactory.DeclarationPattern(type, designation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringExpressionSyntax(this, parent, position); + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DeclarationPatternSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations()); - public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) - { - if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) - { - var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DeclarationPatternSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations); +} - return this; - } +internal sealed partial class VarPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken varKeyword; + internal readonly VariableDesignationSyntax designation; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, diagnostics, GetAnnotations()); + internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(varKeyword); + this.varKeyword = varKeyword; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterpolatedStringExpressionSyntax(this.Kind, this.stringStartToken, this.contents, this.stringEndToken, GetDiagnostics(), annotations); + internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(varKeyword); + this.varKeyword = varKeyword; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } - /// Class which represents a simple pattern-matching expression using the "is" keyword. - internal sealed partial class IsPatternExpressionSyntax : ExpressionSyntax + internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation) + : base(kind) { - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken isKeyword; - internal readonly PatternSyntax pattern; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(varKeyword); + this.varKeyword = varKeyword; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } - internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(isKeyword); - this.isKeyword = isKeyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + public SyntaxToken VarKeyword => this.varKeyword; + public VariableDesignationSyntax Designation => this.designation; - internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(isKeyword); - this.isKeyword = isKeyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + 0 => this.varKeyword, + 1 => this.designation, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VarPatternSyntax(this, parent, position); - internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); + + public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation) + { + if (varKeyword != this.VarKeyword || designation != this.Designation) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(isKeyword); - this.isKeyword = isKeyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; + var newNode = SyntaxFactory.VarPattern(varKeyword, designation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// ExpressionSyntax node representing the expression on the left of the "is" operator. - public ExpressionSyntax Expression => this.expression; - public SyntaxToken IsKeyword => this.isKeyword; - /// PatternSyntax node representing the pattern on the right of the "is" operator. - public PatternSyntax Pattern => this.pattern; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.isKeyword, - 2 => this.pattern, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IsPatternExpressionSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); +internal sealed partial class RecursivePatternSyntax : PatternSyntax +{ + internal readonly TypeSyntax? type; + internal readonly PositionalPatternClauseSyntax? positionalPatternClause; + internal readonly PropertyPatternClauseSyntax? propertyPatternClause; + internal readonly VariableDesignationSyntax? designation; - public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (type != null) { - if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern) - { - var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(type); + this.type = type; + } + if (positionalPatternClause != null) + { + this.AdjustFlagsAndWidth(positionalPatternClause); + this.positionalPatternClause = positionalPatternClause; + } + if (propertyPatternClause != null) + { + this.AdjustFlagsAndWidth(propertyPatternClause); + this.propertyPatternClause = propertyPatternClause; + } + if (designation != null) + { + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IsPatternExpressionSyntax(this.Kind, this.expression, this.isKeyword, this.pattern, GetDiagnostics(), annotations); } - internal sealed partial class ThrowExpressionSyntax : ExpressionSyntax + internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken throwKeyword; - internal readonly ExpressionSyntax expression; - - internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + if (type != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(type); + this.type = type; } - - internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + if (positionalPatternClause != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(positionalPatternClause); + this.positionalPatternClause = positionalPatternClause; + } + if (propertyPatternClause != null) + { + this.AdjustFlagsAndWidth(propertyPatternClause); + this.propertyPatternClause = propertyPatternClause; + } + if (designation != null) + { + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } + } - internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression) - : base(kind) + internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) + : base(kind) + { + this.SlotCount = 4; + if (type != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(type); + this.type = type; + } + if (positionalPatternClause != null) + { + this.AdjustFlagsAndWidth(positionalPatternClause); + this.positionalPatternClause = positionalPatternClause; } + if (propertyPatternClause != null) + { + this.AdjustFlagsAndWidth(propertyPatternClause); + this.propertyPatternClause = propertyPatternClause; + } + if (designation != null) + { + this.AdjustFlagsAndWidth(designation); + this.designation = designation; + } + } - public SyntaxToken ThrowKeyword => this.throwKeyword; - public ExpressionSyntax Expression => this.expression; + public TypeSyntax? Type => this.type; + public PositionalPatternClauseSyntax? PositionalPatternClause => this.positionalPatternClause; + public PropertyPatternClauseSyntax? PropertyPatternClause => this.propertyPatternClause; + public VariableDesignationSyntax? Designation => this.designation; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.throwKeyword, - 1 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.positionalPatternClause, + 2 => this.propertyPatternClause, + 3 => this.designation, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecursivePatternSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); - public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression) + public RecursivePatternSyntax Update(TypeSyntax type, PositionalPatternClauseSyntax positionalPatternClause, PropertyPatternClauseSyntax propertyPatternClause, VariableDesignationSyntax designation) + { + if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation) { - if (throwKeyword != this.ThrowKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ThrowExpressionSyntax(this.Kind, this.throwKeyword, this.expression, GetDiagnostics(), annotations); + return this; } - internal sealed partial class WhenClauseSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken whenKeyword; - internal readonly ExpressionSyntax condition; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, GetDiagnostics(), annotations); +} + +internal sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? subpatterns; + internal readonly SyntaxToken closeParenToken; - internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (subpatterns != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) - : base(kind) + internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (subpatterns != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition) - : base(kind) + internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (subpatterns != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public SyntaxToken WhenKeyword => this.whenKeyword; - public ExpressionSyntax Condition => this.condition; + public SyntaxToken OpenParenToken => this.openParenToken; + public CoreSyntax.SeparatedSyntaxList Subpatterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.subpatterns)); + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.whenKeyword, - 1 => this.condition, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.subpatterns, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhenClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PositionalPatternClauseSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); - public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition) + public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) { - if (whenKeyword != this.WhenKeyword || condition != this.Condition) - { - var newNode = SyntaxFactory.WhenClause(whenKeyword, condition); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new WhenClauseSyntax(this.Kind, this.whenKeyword, this.condition, GetDiagnostics(), annotations); + return this; } - internal abstract partial class PatternSyntax : ExpressionOrPatternSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, GetDiagnostics(), annotations); +} + +internal sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? subpatterns; + internal readonly SyntaxToken closeBraceToken; + + internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal PatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (subpatterns != null) { + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal PatternSyntax(SyntaxKind kind) - : base(kind) + internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (subpatterns != null) { + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - internal sealed partial class DiscardPatternSyntax : PatternSyntax + internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken) + : base(kind) { - internal readonly SyntaxToken underscoreToken; - - internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (subpatterns != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; + this.AdjustFlagsAndWidth(subpatterns); + this.subpatterns = subpatterns; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + + public SyntaxToken OpenBraceToken => this.openBraceToken; + public CoreSyntax.SeparatedSyntaxList Subpatterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.subpatterns)); + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; - } + 0 => this.openBraceToken, + 1 => this.subpatterns, + 2 => this.closeBraceToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyPatternClauseSyntax(this, parent, position); - internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); + + public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; + var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken UnderscoreToken => this.underscoreToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.underscoreToken : null; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardPatternSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); +internal sealed partial class SubpatternSyntax : CSharpSyntaxNode +{ + internal readonly BaseExpressionColonSyntax? expressionColon; + internal readonly PatternSyntax pattern; - public DiscardPatternSyntax Update(SyntaxToken underscoreToken) + internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (expressionColon != null) { - if (underscoreToken != this.UnderscoreToken) - { - var newNode = SyntaxFactory.DiscardPattern(underscoreToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(expressionColon); + this.expressionColon = expressionColon; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DiscardPatternSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DiscardPatternSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; } - internal sealed partial class DeclarationPatternSyntax : PatternSyntax + internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, SyntaxFactoryContext context) + : base(kind) { - internal readonly TypeSyntax type; - internal readonly VariableDesignationSyntax designation; - - internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 2; + if (expressionColon != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(expressionColon); + this.expressionColon = expressionColon; } + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) - : base(kind) + internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) + : base(kind) + { + this.SlotCount = 2; + if (expressionColon != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; + this.AdjustFlagsAndWidth(expressionColon); + this.expressionColon = expressionColon; } + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } + + public BaseExpressionColonSyntax? ExpressionColon => this.expressionColon; + public PatternSyntax Pattern => this.pattern; - internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } + 0 => this.expressionColon, + 1 => this.pattern, + _ => null, + }; - public TypeSyntax Type => this.type; - public VariableDesignationSyntax Designation => this.designation; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SubpatternSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.designation, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DeclarationPatternSyntax(this, parent, position); + public SubpatternSyntax Update(BaseExpressionColonSyntax expressionColon, PatternSyntax pattern) + { + if (expressionColon != this.ExpressionColon || pattern != this.Pattern) + { + var newNode = SyntaxFactory.Subpattern(expressionColon, pattern); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); + return this; + } - public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) - { - if (type != this.Type || designation != this.Designation) - { - var newNode = SyntaxFactory.DeclarationPattern(type, designation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DeclarationPatternSyntax(this.Kind, this.type, this.designation, diagnostics, GetAnnotations()); +internal sealed partial class ConstantPatternSyntax : PatternSyntax +{ + internal readonly ExpressionSyntax expression; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DeclarationPatternSyntax(this.Kind, this.type, this.designation, GetDiagnostics(), annotations); + internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - internal sealed partial class VarPatternSyntax : PatternSyntax + internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken varKeyword; - internal readonly VariableDesignationSyntax designation; + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(varKeyword); - this.varKeyword = varKeyword; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } + internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(varKeyword); - this.varKeyword = varKeyword; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } + /// ExpressionSyntax node representing the constant expression. + public ExpressionSyntax Expression => this.expression; - internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(varKeyword); - this.varKeyword = varKeyword; - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.expression : null; - public SyntaxToken VarKeyword => this.varKeyword; - public VariableDesignationSyntax Designation => this.designation; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstantPatternSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.varKeyword, - 1 => this.designation, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VarPatternSyntax(this, parent, position); + public ConstantPatternSyntax Update(ExpressionSyntax expression) + { + if (expression != this.Expression) + { + var newNode = SyntaxFactory.ConstantPattern(expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); + return this; + } - public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation) - { - if (varKeyword != this.VarKeyword || designation != this.Designation) - { - var newNode = SyntaxFactory.VarPattern(varKeyword, designation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConstantPatternSyntax(this.Kind, this.expression, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConstantPatternSyntax(this.Kind, this.expression, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, diagnostics, GetAnnotations()); +internal sealed partial class ParenthesizedPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly PatternSyntax pattern; + internal readonly SyntaxToken closeParenToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new VarPatternSyntax(this.Kind, this.varKeyword, this.designation, GetDiagnostics(), annotations); + internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - internal sealed partial class RecursivePatternSyntax : PatternSyntax + internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly TypeSyntax? type; - internal readonly PositionalPatternClauseSyntax? positionalPatternClause; - internal readonly PropertyPatternClauseSyntax? propertyPatternClause; - internal readonly VariableDesignationSyntax? designation; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - if (positionalPatternClause != null) - { - this.AdjustFlagsAndWidth(positionalPatternClause); - this.positionalPatternClause = positionalPatternClause; - } - if (propertyPatternClause != null) - { - this.AdjustFlagsAndWidth(propertyPatternClause); - this.propertyPatternClause = propertyPatternClause; - } - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } + internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - if (positionalPatternClause != null) - { - this.AdjustFlagsAndWidth(positionalPatternClause); - this.positionalPatternClause = positionalPatternClause; - } - if (propertyPatternClause != null) - { - this.AdjustFlagsAndWidth(propertyPatternClause); - this.propertyPatternClause = propertyPatternClause; - } - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } + public SyntaxToken OpenParenToken => this.openParenToken; + public PatternSyntax Pattern => this.pattern; + public SyntaxToken CloseParenToken => this.closeParenToken; - internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - if (positionalPatternClause != null) - { - this.AdjustFlagsAndWidth(positionalPatternClause); - this.positionalPatternClause = positionalPatternClause; - } - if (propertyPatternClause != null) - { - this.AdjustFlagsAndWidth(propertyPatternClause); - this.propertyPatternClause = propertyPatternClause; - } - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } + 0 => this.openParenToken, + 1 => this.pattern, + 2 => this.closeParenToken, + _ => null, + }; - public TypeSyntax? Type => this.type; - public PositionalPatternClauseSyntax? PositionalPatternClause => this.positionalPatternClause; - public PropertyPatternClauseSyntax? PropertyPatternClause => this.propertyPatternClause; - public VariableDesignationSyntax? Designation => this.designation; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedPatternSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.positionalPatternClause, - 2 => this.propertyPatternClause, - 3 => this.designation, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecursivePatternSyntax(this, parent, position); + public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); + return this; + } - public RecursivePatternSyntax Update(TypeSyntax type, PositionalPatternClauseSyntax positionalPatternClause, PropertyPatternClauseSyntax propertyPatternClause, VariableDesignationSyntax designation) - { - if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation) - { - var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, diagnostics, GetAnnotations()); +internal sealed partial class RelationalPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken operatorToken; + internal readonly ExpressionSyntax expression; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RecursivePatternSyntax(this.Kind, this.type, this.positionalPatternClause, this.propertyPatternClause, this.designation, GetDiagnostics(), annotations); + internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - internal sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode + internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? subpatterns; - internal readonly SyntaxToken closeParenToken; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + /// SyntaxToken representing the operator of the relational pattern. + public SyntaxToken OperatorToken => this.operatorToken; + public ExpressionSyntax Expression => this.expression; - internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + 0 => this.operatorToken, + 1 => this.expression, + _ => null, + }; - public SyntaxToken OpenParenToken => this.openParenToken; - public CoreSyntax.SeparatedSyntaxList Subpatterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.subpatterns)); - public SyntaxToken CloseParenToken => this.closeParenToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RelationalPatternSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.subpatterns, - 2 => this.closeParenToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PositionalPatternClauseSyntax(this, parent, position); + public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + { + if (operatorToken != this.OperatorToken || expression != this.Expression) + { + var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); + return this; + } - public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, diagnostics, GetAnnotations()); +internal sealed partial class TypePatternSyntax : PatternSyntax +{ + internal readonly TypeSyntax type; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PositionalPatternClauseSyntax(this.Kind, this.openParenToken, this.subpatterns, this.closeParenToken, GetDiagnostics(), annotations); + internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; } - internal sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode + internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? subpatterns; - internal readonly SyntaxToken closeBraceToken; + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + /// The type for the type pattern. + public TypeSyntax Type => this.type; - internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (subpatterns != null) - { - this.AdjustFlagsAndWidth(subpatterns); - this.subpatterns = subpatterns; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.type : null; - public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SeparatedSyntaxList Subpatterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.subpatterns)); - public SyntaxToken CloseBraceToken => this.closeBraceToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypePatternSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBraceToken, - 1 => this.subpatterns, - 2 => this.closeBraceToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyPatternClauseSyntax(this, parent, position); + public TypePatternSyntax Update(TypeSyntax type) + { + if (type != this.Type) + { + var newNode = SyntaxFactory.TypePattern(type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); + return this; + } - public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) - { - if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypePatternSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypePatternSyntax(this.Kind, this.type, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, diagnostics, GetAnnotations()); +internal sealed partial class BinaryPatternSyntax : PatternSyntax +{ + internal readonly PatternSyntax left; + internal readonly SyntaxToken operatorToken; + internal readonly PatternSyntax right; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PropertyPatternClauseSyntax(this.Kind, this.openBraceToken, this.subpatterns, this.closeBraceToken, GetDiagnostics(), annotations); + internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; } - internal sealed partial class SubpatternSyntax : CSharpSyntaxNode + internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, SyntaxFactoryContext context) + : base(kind) { - internal readonly BaseExpressionColonSyntax? expressionColon; - internal readonly PatternSyntax pattern; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - if (expressionColon != null) - { - this.AdjustFlagsAndWidth(expressionColon); - this.expressionColon = expressionColon; - } - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(left); + this.left = left; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(right); + this.right = right; + } - internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (expressionColon != null) - { - this.AdjustFlagsAndWidth(expressionColon); - this.expressionColon = expressionColon; - } - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + public PatternSyntax Left => this.left; + public SyntaxToken OperatorToken => this.operatorToken; + public PatternSyntax Right => this.right; - internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - if (expressionColon != null) - { - this.AdjustFlagsAndWidth(expressionColon); - this.expressionColon = expressionColon; - } - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + 0 => this.left, + 1 => this.operatorToken, + 2 => this.right, + _ => null, + }; - public BaseExpressionColonSyntax? ExpressionColon => this.expressionColon; - public PatternSyntax Pattern => this.pattern; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryPatternSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.expressionColon, - 1 => this.pattern, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); + + public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + { + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + { + var newNode = SyntaxFactory.BinaryPattern(this.Kind, left, operatorToken, right); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SubpatternSyntax(this, parent, position); + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); - public SubpatternSyntax Update(BaseExpressionColonSyntax expressionColon, PatternSyntax pattern) - { - if (expressionColon != this.ExpressionColon || pattern != this.Pattern) - { - var newNode = SyntaxFactory.Subpattern(expressionColon, pattern); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); +} - return this; - } +internal sealed partial class UnaryPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken operatorToken; + internal readonly PatternSyntax pattern; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, diagnostics, GetAnnotations()); + internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SubpatternSyntax(this.Kind, this.expressionColon, this.pattern, GetDiagnostics(), annotations); + internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; } - internal sealed partial class ConstantPatternSyntax : PatternSyntax + internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern) + : base(kind) { - internal readonly ExpressionSyntax expression; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + } - internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + public SyntaxToken OperatorToken => this.operatorToken; + public PatternSyntax Pattern => this.pattern; - internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } + 0 => this.operatorToken, + 1 => this.pattern, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnaryPatternSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); - internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression) - : base(kind) + public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern) + { + if (operatorToken != this.OperatorToken || pattern != this.Pattern) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// ExpressionSyntax node representing the constant expression. - public ExpressionSyntax Expression => this.expression; + return this; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.expression : null; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstantPatternSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); +internal sealed partial class ListPatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? patterns; + internal readonly SyntaxToken closeBracketToken; + internal readonly VariableDesignationSyntax? designation; - public ConstantPatternSyntax Update(ExpressionSyntax expression) + internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (patterns != null) { - if (expression != this.Expression) - { - var newNode = SyntaxFactory.ConstantPattern(expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(patterns); + this.patterns = patterns; + } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + if (designation != null) + { + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConstantPatternSyntax(this.Kind, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConstantPatternSyntax(this.Kind, this.expression, GetDiagnostics(), annotations); } - internal sealed partial class ParenthesizedPatternSyntax : PatternSyntax + internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly PatternSyntax pattern; - internal readonly SyntaxToken closeParenToken; - - internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (patterns != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(patterns); + this.patterns = patterns; } - - internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + if (designation != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } + } - internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) - : base(kind) + internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (patterns != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(patterns); + this.patterns = patterns; + } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + if (designation != null) + { + this.AdjustFlagsAndWidth(designation); + this.designation = designation; } + } - public SyntaxToken OpenParenToken => this.openParenToken; - public PatternSyntax Pattern => this.pattern; - public SyntaxToken CloseParenToken => this.closeParenToken; + public SyntaxToken OpenBracketToken => this.openBracketToken; + public CoreSyntax.SeparatedSyntaxList Patterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.patterns)); + public SyntaxToken CloseBracketToken => this.closeBracketToken; + public VariableDesignationSyntax? Designation => this.designation; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.pattern, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.patterns, + 2 => this.closeBracketToken, + 3 => this.designation, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedPatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ListPatternSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); - public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + public ListPatternSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax designation) + { + if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) { - if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ListPattern(openBracketToken, patterns, closeBracketToken, designation); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParenthesizedPatternSyntax(this.Kind, this.openParenToken, this.pattern, this.closeParenToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class RelationalPatternSyntax : PatternSyntax - { - internal readonly SyntaxToken operatorToken; - internal readonly ExpressionSyntax expression; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ListPatternSyntax(this.Kind, this.openBracketToken, this.patterns, this.closeBracketToken, this.designation, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ListPatternSyntax(this.Kind, this.openBracketToken, this.patterns, this.closeBracketToken, this.designation, GetDiagnostics(), annotations); +} + +internal sealed partial class SlicePatternSyntax : PatternSyntax +{ + internal readonly SyntaxToken dotDotToken; + internal readonly PatternSyntax? pattern; - internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(dotDotToken); + this.dotDotToken = dotDotToken; + if (pattern != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; } + } - internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(dotDotToken); + this.dotDotToken = dotDotToken; + if (pattern != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; } + } - internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) - : base(kind) + internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(dotDotToken); + this.dotDotToken = dotDotToken; + if (pattern != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; } + } - /// SyntaxToken representing the operator of the relational pattern. - public SyntaxToken OperatorToken => this.operatorToken; - public ExpressionSyntax Expression => this.expression; + public SyntaxToken DotDotToken => this.dotDotToken; + public PatternSyntax? Pattern => this.pattern; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorToken, - 1 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.dotDotToken, + 1 => this.pattern, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RelationalPatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SlicePatternSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); - public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax pattern) + { + if (dotDotToken != this.DotDotToken || pattern != this.Pattern) { - if (operatorToken != this.OperatorToken || expression != this.Expression) - { - var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.SlicePattern(dotDotToken, pattern); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SlicePatternSyntax(this.Kind, this.dotDotToken, this.pattern, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SlicePatternSyntax(this.Kind, this.dotDotToken, this.pattern, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RelationalPatternSyntax(this.Kind, this.operatorToken, this.expression, GetDiagnostics(), annotations); +internal abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode +{ + internal InterpolatedStringContentSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - internal sealed partial class TypePatternSyntax : PatternSyntax + internal InterpolatedStringContentSyntax(SyntaxKind kind) + : base(kind) { - internal readonly TypeSyntax type; + } +} - internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } +internal sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax +{ + internal readonly SyntaxToken textToken; - internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(textToken); + this.textToken = textToken; + } - internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type) - : base(kind) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(textToken); + this.textToken = textToken; + } + + internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(textToken); + this.textToken = textToken; + } - /// The type for the type pattern. - public TypeSyntax Type => this.type; + /// The text contents of a part of the interpolated string. + public SyntaxToken TextToken => this.textToken; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.type : null; + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.textToken : null; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypePatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringTextSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); - public TypePatternSyntax Update(TypeSyntax type) + public InterpolatedStringTextSyntax Update(SyntaxToken textToken) + { + if (textToken != this.TextToken) { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypePattern(type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.InterpolatedStringText(textToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypePatternSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypePatternSyntax(this.Kind, this.type, GetDiagnostics(), annotations); + return this; } - internal sealed partial class BinaryPatternSyntax : PatternSyntax - { - internal readonly PatternSyntax left; - internal readonly SyntaxToken operatorToken; - internal readonly PatternSyntax right; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterpolatedStringTextSyntax(this.Kind, this.textToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterpolatedStringTextSyntax(this.Kind, this.textToken, GetDiagnostics(), annotations); +} + +internal sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax +{ + internal readonly SyntaxToken openBraceToken; + internal readonly ExpressionSyntax expression; + internal readonly InterpolationAlignmentClauseSyntax? alignmentClause; + internal readonly InterpolationFormatClauseSyntax? formatClause; + internal readonly SyntaxToken closeBraceToken; - internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (alignmentClause != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; + this.AdjustFlagsAndWidth(alignmentClause); + this.alignmentClause = alignmentClause; } + if (formatClause != null) + { + this.AdjustFlagsAndWidth(formatClause); + this.formatClause = formatClause; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, SyntaxFactoryContext context) - : base(kind) + internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (alignmentClause != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; + this.AdjustFlagsAndWidth(alignmentClause); + this.alignmentClause = alignmentClause; } + if (formatClause != null) + { + this.AdjustFlagsAndWidth(formatClause); + this.formatClause = formatClause; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) - : base(kind) + internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (alignmentClause != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(left); - this.left = left; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(right); - this.right = right; + this.AdjustFlagsAndWidth(alignmentClause); + this.alignmentClause = alignmentClause; } + if (formatClause != null) + { + this.AdjustFlagsAndWidth(formatClause); + this.formatClause = formatClause; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - public PatternSyntax Left => this.left; - public SyntaxToken OperatorToken => this.operatorToken; - public PatternSyntax Right => this.right; + /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). + public SyntaxToken OpenBraceToken => this.openBraceToken; + public ExpressionSyntax Expression => this.expression; + public InterpolationAlignmentClauseSyntax? AlignmentClause => this.alignmentClause; + public InterpolationFormatClauseSyntax? FormatClause => this.formatClause; + /// + /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). + /// + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.left, - 1 => this.operatorToken, - 2 => this.right, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBraceToken, + 1 => this.expression, + 2 => this.alignmentClause, + 3 => this.formatClause, + 4 => this.closeBraceToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BinaryPatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); - public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken) { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.BinaryPattern(this.Kind, left, operatorToken, right); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, GetDiagnostics(), annotations); +} + +internal sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken commaToken; + internal readonly ExpressionSyntax value; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BinaryPatternSyntax(this.Kind, this.left, this.operatorToken, this.right, GetDiagnostics(), annotations); + internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(value); + this.value = value; } - internal sealed partial class UnaryPatternSyntax : PatternSyntax + internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken operatorToken; - internal readonly PatternSyntax pattern; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(value); + this.value = value; + } - internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(value); + this.value = value; + } - internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + public SyntaxToken CommaToken => this.commaToken; + public ExpressionSyntax Value => this.value; - internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + 0 => this.commaToken, + 1 => this.value, + _ => null, + }; - public SyntaxToken OperatorToken => this.operatorToken; - public PatternSyntax Pattern => this.pattern; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationAlignmentClauseSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorToken, - 1 => this.pattern, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); + + public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value) + { + if (commaToken != this.CommaToken || value != this.Value) + { + var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnaryPatternSyntax(this, parent, position); + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, diagnostics, GetAnnotations()); - public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern) - { - if (operatorToken != this.OperatorToken || pattern != this.Pattern) - { - var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, GetDiagnostics(), annotations); +} - return this; - } +internal sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken colonToken; + internal readonly SyntaxToken formatStringToken; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, diagnostics, GetAnnotations()); + internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(formatStringToken); + this.formatStringToken = formatStringToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new UnaryPatternSyntax(this.Kind, this.operatorToken, this.pattern, GetDiagnostics(), annotations); + internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(formatStringToken); + this.formatStringToken = formatStringToken; } - internal sealed partial class ListPatternSyntax : PatternSyntax + internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken) + : base(kind) { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? patterns; - internal readonly SyntaxToken closeBracketToken; - internal readonly VariableDesignationSyntax? designation; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(formatStringToken); + this.formatStringToken = formatStringToken; + } - internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (patterns != null) - { - this.AdjustFlagsAndWidth(patterns); - this.patterns = patterns; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } + public SyntaxToken ColonToken => this.colonToken; + /// The text contents of the format specifier for an interpolation. + public SyntaxToken FormatStringToken => this.formatStringToken; - internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (patterns != null) - { - this.AdjustFlagsAndWidth(patterns); - this.patterns = patterns; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } - } + 0 => this.colonToken, + 1 => this.formatStringToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationFormatClauseSyntax(this, parent, position); - internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); + + public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken) + { + if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (patterns != null) - { - this.AdjustFlagsAndWidth(patterns); - this.patterns = patterns; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - if (designation != null) - { - this.AdjustFlagsAndWidth(designation); - this.designation = designation; - } + var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken OpenBracketToken => this.openBracketToken; - public CoreSyntax.SeparatedSyntaxList Patterns => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.patterns)); - public SyntaxToken CloseBracketToken => this.closeBracketToken; - public VariableDesignationSyntax? Designation => this.designation; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.patterns, - 2 => this.closeBracketToken, - 3 => this.designation, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ListPatternSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); +internal sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly StatementSyntax statement; - public ListPatternSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax designation) + internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) - { - var newNode = SyntaxFactory.ListPattern(openBracketToken, patterns, closeBracketToken, designation); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ListPatternSyntax(this.Kind, this.openBracketToken, this.patterns, this.closeBracketToken, this.designation, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ListPatternSyntax(this.Kind, this.openBracketToken, this.patterns, this.closeBracketToken, this.designation, GetDiagnostics(), annotations); + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class SlicePatternSyntax : PatternSyntax + internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken dotDotToken; - internal readonly PatternSyntax? pattern; - - internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(dotDotToken); - this.dotDotToken = dotDotToken; - if (pattern != null) - { - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(dotDotToken); - this.dotDotToken = dotDotToken; - if (pattern != null) - { - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern) - : base(kind) + internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(dotDotToken); - this.dotDotToken = dotDotToken; - if (pattern != null) - { - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - public SyntaxToken DotDotToken => this.dotDotToken; - public PatternSyntax? Pattern => this.pattern; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public StatementSyntax Statement => this.statement; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.dotDotToken, - 1 => this.pattern, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.statement, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SlicePatternSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GlobalStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); - public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax pattern) + public GlobalStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) { - if (dotDotToken != this.DotDotToken || pattern != this.Pattern) - { - var newNode = SyntaxFactory.SlicePattern(dotDotToken, pattern); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SlicePatternSyntax(this.Kind, this.dotDotToken, this.pattern, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, GetDiagnostics(), annotations); +} + +/// Represents the base class for all statements syntax classes. +internal abstract partial class StatementSyntax : CSharpSyntaxNode +{ + internal StatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SlicePatternSyntax(this.Kind, this.dotDotToken, this.pattern, GetDiagnostics(), annotations); + internal StatementSyntax(SyntaxKind kind) + : base(kind) + { } - internal abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode + public abstract CoreSyntax.SyntaxList AttributeLists { get; } +} + +internal sealed partial class BlockSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? statements; + internal readonly SyntaxToken closeBraceToken; + + internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal InterpolatedStringContentSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 4; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal InterpolatedStringContentSyntax(SyntaxKind kind) - : base(kind) + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (statements != null) { + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - internal sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax + internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken textToken; - - internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(textToken); - this.textToken = textToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (statements != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(textToken); - this.textToken = textToken; + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken) - : base(kind) + internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 4; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (statements != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(textToken); - this.textToken = textToken; + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - /// The text contents of a part of the interpolated string. - public SyntaxToken TextToken => this.textToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken OpenBraceToken => this.openBraceToken; + public CoreSyntax.SyntaxList Statements => new CoreSyntax.SyntaxList(this.statements); + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.textToken : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.openBraceToken, + 2 => this.statements, + 3 => this.closeBraceToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolatedStringTextSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BlockSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); - public InterpolatedStringTextSyntax Update(SyntaxToken textToken) + public BlockSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + { + if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) { - if (textToken != this.TextToken) - { - var newNode = SyntaxFactory.InterpolatedStringText(textToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterpolatedStringTextSyntax(this.Kind, this.textToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterpolatedStringTextSyntax(this.Kind, this.textToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax - { - internal readonly SyntaxToken openBraceToken; - internal readonly ExpressionSyntax expression; - internal readonly InterpolationAlignmentClauseSyntax? alignmentClause; - internal readonly InterpolationFormatClauseSyntax? formatClause; - internal readonly SyntaxToken closeBraceToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, GetDiagnostics(), annotations); +} + +internal sealed partial class LocalFunctionStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax returnType; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax parameterList; + internal readonly GreenNode? constraintClauses; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 10; + if (attributeLists != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (alignmentClause != null) - { - this.AdjustFlagsAndWidth(alignmentClause); - this.alignmentClause = alignmentClause; - } - if (formatClause != null) - { - this.AdjustFlagsAndWidth(formatClause); - this.formatClause = formatClause; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (alignmentClause != null) - { - this.AdjustFlagsAndWidth(alignmentClause); - this.alignmentClause = alignmentClause; - } - if (formatClause != null) - { - this.AdjustFlagsAndWidth(formatClause); - this.formatClause = formatClause; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) - : base(kind) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (alignmentClause != null) - { - this.AdjustFlagsAndWidth(alignmentClause); - this.alignmentClause = alignmentClause; - } - if (formatClause != null) - { - this.AdjustFlagsAndWidth(formatClause); - this.formatClause = formatClause; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; } - - /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). - public SyntaxToken OpenBraceToken => this.openBraceToken; - public ExpressionSyntax Expression => this.expression; - public InterpolationAlignmentClauseSyntax? AlignmentClause => this.alignmentClause; - public InterpolationFormatClauseSyntax? FormatClause => this.formatClause; - /// - /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). - /// - public SyntaxToken CloseBraceToken => this.closeBraceToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBraceToken, - 1 => this.expression, - 2 => this.alignmentClause, - 3 => this.formatClause, - 4 => this.closeBraceToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); - - public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax alignmentClause, InterpolationFormatClauseSyntax formatClause, SyntaxToken closeBraceToken) + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) { - if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterpolationSyntax(this.Kind, this.openBraceToken, this.expression, this.alignmentClause, this.formatClause, this.closeBraceToken, GetDiagnostics(), annotations); } - internal sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode + internal 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) + : base(kind) { - internal readonly SyntaxToken commaToken; - internal readonly ExpressionSyntax value; - - internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 10; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(value); - this.value = value; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(value); - this.value = value; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value) - : base(kind) + internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + : base(kind) + { + this.SlotCount = 10; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(value); - this.value = value; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - public SyntaxToken CommaToken => this.commaToken; - public ExpressionSyntax Value => this.value; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public TypeSyntax ReturnType => this.returnType; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public ParameterListSyntax ParameterList => this.parameterList; + public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public BlockSyntax? Body => this.body; + public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.commaToken, - 1 => this.value, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.returnType, + 3 => this.identifier, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.constraintClauses, + 7 => this.body, + 8 => this.expressionBody, + 9 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationAlignmentClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalFunctionStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); - public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value) + public LocalFunctionStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (commaToken != this.CommaToken || value != this.Value) - { - var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterpolationAlignmentClauseSyntax(this.Kind, this.commaToken, this.value, GetDiagnostics(), annotations); + return this; } - internal sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken colonToken; - internal readonly SyntaxToken formatStringToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +} - internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class LocalDeclarationStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken? awaitKeyword; + internal readonly SyntaxToken? usingKeyword; + internal readonly GreenNode? modifiers; + internal readonly VariableDeclarationSyntax declaration; + internal readonly SyntaxToken semicolonToken; + + internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (awaitKeyword != null) + { + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + if (usingKeyword != null) + { + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + } + if (modifiers != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(formatStringToken); - this.formatStringToken = formatStringToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, SyntaxFactoryContext context) - : base(kind) + internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (awaitKeyword != null) + { + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + if (usingKeyword != null) + { + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + } + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(formatStringToken); - this.formatStringToken = formatStringToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken) - : base(kind) + internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (awaitKeyword != null) + { + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + if (usingKeyword != null) + { + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + } + if (modifiers != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(formatStringToken); - this.formatStringToken = formatStringToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public SyntaxToken ColonToken => this.colonToken; - /// The text contents of the format specifier for an interpolation. - public SyntaxToken FormatStringToken => this.formatStringToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken? AwaitKeyword => this.awaitKeyword; + public SyntaxToken? UsingKeyword => this.usingKeyword; + /// Gets the modifier list. + public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public VariableDeclarationSyntax Declaration => this.declaration; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.colonToken, - 1 => this.formatStringToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.awaitKeyword, + 2 => this.usingKeyword, + 3 => this.modifiers, + 4 => this.declaration, + 5 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterpolationFormatClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalDeclarationStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); - public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken) + public LocalDeclarationStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { - if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken) - { - var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterpolationFormatClauseSyntax(this.Kind, this.colonToken, this.formatStringToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly StatementSyntax statement; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); +} - internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode +{ + internal readonly TypeSyntax type; + internal readonly GreenNode? variables; + + internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (variables != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + } - internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (variables != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + } - internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement) - : base(kind) + internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (variables != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public StatementSyntax Statement => this.statement; + public TypeSyntax Type => this.type; + public CoreSyntax.SeparatedSyntaxList Variables => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.variables)); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.statement, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.variables, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GlobalStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); - public GlobalStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) + public VariableDeclarationSyntax Update(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) + { + if (type != this.Type || variables != this.Variables) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) - { - var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.VariableDeclaration(type, variables); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new GlobalStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.statement, GetDiagnostics(), annotations); + return this; } - /// Represents the base class for all statements syntax classes. - internal abstract partial class StatementSyntax : CSharpSyntaxNode + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new VariableDeclarationSyntax(this.Kind, this.type, this.variables, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new VariableDeclarationSyntax(this.Kind, this.type, this.variables, GetDiagnostics(), annotations); +} + +internal sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken identifier; + internal readonly BracketedArgumentListSyntax? argumentList; + internal readonly EqualsValueClauseSyntax? initializer; + + internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal StatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (argumentList != null) { + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - - internal StatementSyntax(SyntaxKind kind) - : base(kind) + if (initializer != null) { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } - - public abstract CoreSyntax.SyntaxList AttributeLists { get; } } - internal sealed partial class BlockSyntax : StatementSyntax + internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? statements; - internal readonly SyntaxToken closeBraceToken; - - internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (argumentList != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - - internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + if (initializer != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } + } - internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken) - : base(kind) + internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (argumentList != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SyntaxList Statements => new CoreSyntax.SyntaxList(this.statements); - public SyntaxToken CloseBraceToken => this.closeBraceToken; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public BracketedArgumentListSyntax? ArgumentList => this.argumentList; + public EqualsValueClauseSyntax? Initializer => this.initializer; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.openBraceToken, - 2 => this.statements, - 3 => this.closeBraceToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.identifier, + 1 => this.argumentList, + 2 => this.initializer, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BlockSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclaratorSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); - public BlockSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax argumentList, EqualsValueClauseSyntax initializer) + { + if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer) { - if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, GetDiagnostics(), annotations); +} + +internal sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken equalsToken; + internal readonly ExpressionSyntax value; + + internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(value); + this.value = value; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BlockSyntax(this.Kind, this.attributeLists, this.openBraceToken, this.statements, this.closeBraceToken, GetDiagnostics(), annotations); + internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(value); + this.value = value; } - internal sealed partial class LocalFunctionStatementSyntax : StatementSyntax + internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax returnType; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax parameterList; - internal readonly GreenNode? constraintClauses; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(value); + this.value = value; + } - internal 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) - : base(kind, diagnostics, annotations) + public SyntaxToken EqualsToken => this.equalsToken; + public ExpressionSyntax Value => this.value; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + 0 => this.equalsToken, + 1 => this.value, + _ => null, + }; - internal 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) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EqualsValueClauseSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); + + public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value) + { + if (equalsToken != this.EqualsToken || value != this.Value) { - this.SetFactoryContext(context); - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } - - internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - : base(kind) - { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public TypeSyntax ReturnType => this.returnType; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public ParameterListSyntax ParameterList => this.parameterList; - public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); - public BlockSyntax? Body => this.body; - public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.returnType, - 3 => this.identifier, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.constraintClauses, - 7 => this.body, - 8 => this.expressionBody, - 9 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalFunctionStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); - - public LocalFunctionStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + return this; + } - return this; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, diagnostics, GetAnnotations()); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LocalFunctionStatementSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +internal abstract partial class VariableDesignationSyntax : CSharpSyntaxNode +{ + internal VariableDesignationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - internal sealed partial class LocalDeclarationStatementSyntax : StatementSyntax + internal VariableDesignationSyntax(SyntaxKind kind) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken? awaitKeyword; - internal readonly SyntaxToken? usingKeyword; - internal readonly GreenNode? modifiers; - internal readonly VariableDeclarationSyntax declaration; - internal readonly SyntaxToken semicolonToken; + } +} - internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - if (usingKeyword != null) - { - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } +internal sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax +{ + internal readonly SyntaxToken identifier; - internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - if (usingKeyword != null) - { - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - : base(kind) - { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - if (usingKeyword != null) - { - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken? AwaitKeyword => this.awaitKeyword; - public SyntaxToken? UsingKeyword => this.usingKeyword; - /// Gets the modifier list. - public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public VariableDeclarationSyntax Declaration => this.declaration; - public SyntaxToken SemicolonToken => this.semicolonToken; + internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.awaitKeyword, - 2 => this.usingKeyword, - 3 => this.modifiers, - 4 => this.declaration, - 5 => this.semicolonToken, - _ => null, - }; + public SyntaxToken Identifier => this.identifier; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LocalDeclarationStatementSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.identifier : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SingleVariableDesignationSyntax(this, parent, position); - public LocalDeclarationStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); - return this; + public SingleVariableDesignationSyntax Update(SyntaxToken identifier) + { + if (identifier != this.Identifier) + { + var newNode = SyntaxFactory.SingleVariableDesignation(identifier); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LocalDeclarationStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode - { - internal readonly TypeSyntax type; - internal readonly GreenNode? variables; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SingleVariableDesignationSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations()); - internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SingleVariableDesignationSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations); +} - internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } - } +internal sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax +{ + internal readonly SyntaxToken underscoreToken; - internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables) - : base(kind) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } - } + internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - public TypeSyntax Type => this.type; - public CoreSyntax.SeparatedSyntaxList Variables => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.variables)); + internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.variables, - _ => null, - }; + internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(underscoreToken); + this.underscoreToken = underscoreToken; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclarationSyntax(this, parent, position); + public SyntaxToken UnderscoreToken => this.underscoreToken; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.underscoreToken : null; - public VariableDeclarationSyntax Update(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) - { - if (type != this.Type || variables != this.Variables) - { - var newNode = SyntaxFactory.VariableDeclaration(type, variables); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardDesignationSyntax(this, parent, position); - return this; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new VariableDeclarationSyntax(this.Kind, this.type, this.variables, diagnostics, GetAnnotations()); + public DiscardDesignationSyntax Update(SyntaxToken underscoreToken) + { + if (underscoreToken != this.UnderscoreToken) + { + var newNode = SyntaxFactory.DiscardDesignation(underscoreToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new VariableDeclarationSyntax(this.Kind, this.type, this.variables, GetDiagnostics(), annotations); + return this; } - internal sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken identifier; - internal readonly BracketedArgumentListSyntax? argumentList; - internal readonly EqualsValueClauseSyntax? initializer; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DiscardDesignationSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations()); - internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DiscardDesignationSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations); +} + +internal sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? variables; + internal readonly SyntaxToken closeParenToken; + + internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (variables != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, SyntaxFactoryContext context) - : base(kind) + internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (variables != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) - : base(kind) + internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (variables != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } + this.AdjustFlagsAndWidth(variables); + this.variables = variables; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public BracketedArgumentListSyntax? ArgumentList => this.argumentList; - public EqualsValueClauseSyntax? Initializer => this.initializer; + public SyntaxToken OpenParenToken => this.openParenToken; + public CoreSyntax.SeparatedSyntaxList Variables => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.variables)); + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.identifier, - 1 => this.argumentList, - 2 => this.initializer, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.variables, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.VariableDeclaratorSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedVariableDesignationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); - public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax argumentList, EqualsValueClauseSyntax initializer) + public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) { - if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new VariableDeclaratorSyntax(this.Kind, this.identifier, this.argumentList, this.initializer, GetDiagnostics(), annotations); + return this; } - internal sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken equalsToken; - internal readonly ExpressionSyntax value; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, GetDiagnostics(), annotations); +} + +internal sealed partial class ExpressionStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken semicolonToken; - internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(value); - this.value = value; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, SyntaxFactoryContext context) - : base(kind) + internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(value); - this.value = value; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value) - : base(kind) + internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(value); - this.value = value; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public SyntaxToken EqualsToken => this.equalsToken; - public ExpressionSyntax Value => this.value; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public ExpressionSyntax Expression => this.expression; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.equalsToken, - 1 => this.value, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.expression, + 2 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EqualsValueClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); - public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value) + public ExpressionStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) { - if (equalsToken != this.EqualsToken || value != this.Value) - { - var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EqualsValueClauseSyntax(this.Kind, this.equalsToken, this.value, GetDiagnostics(), annotations); + return this; } - internal abstract partial class VariableDesignationSyntax : CSharpSyntaxNode + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, GetDiagnostics(), annotations); +} + +internal sealed partial class EmptyStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken semicolonToken; + + internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal VariableDesignationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 2; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal VariableDesignationSyntax(SyntaxKind kind) - : base(kind) + internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax + internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken) + : base(kind) { - internal readonly SyntaxToken identifier; - - internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 2; + if (attributeLists != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) - : base(kind) + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + 0 => this.attributeLists, + 1 => this.semicolonToken, + _ => null, + }; - internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EmptyStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); + + public EmptyStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken Identifier => this.identifier; + return this; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.identifier : null; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SingleVariableDesignationSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); +/// Represents a labeled statement syntax. +internal sealed partial class LabeledStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken colonToken; + internal readonly StatementSyntax statement; - public SingleVariableDesignationSyntax Update(SyntaxToken identifier) + internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) { - if (identifier != this.Identifier) - { - var newNode = SyntaxFactory.SingleVariableDesignation(identifier); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SingleVariableDesignationSyntax(this.Kind, this.identifier, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SingleVariableDesignationSyntax(this.Kind, this.identifier, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax + internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken underscoreToken; - - internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) - : base(kind) + internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken) - : base(kind) + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + /// Gets a SyntaxToken that represents the colon following the statement's label. + public SyntaxToken ColonToken => this.colonToken; + public StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(underscoreToken); - this.underscoreToken = underscoreToken; - } + 0 => this.attributeLists, + 1 => this.identifier, + 2 => this.colonToken, + 3 => this.statement, + _ => null, + }; - public SyntaxToken UnderscoreToken => this.underscoreToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LabeledStatementSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.underscoreToken : null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DiscardDesignationSyntax(this, parent, position); + public LabeledStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) + { + var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); + return this; + } - public DiscardDesignationSyntax Update(SyntaxToken underscoreToken) - { - if (underscoreToken != this.UnderscoreToken) - { - var newNode = SyntaxFactory.DiscardDesignation(underscoreToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DiscardDesignationSyntax(this.Kind, this.underscoreToken, diagnostics, GetAnnotations()); +/// +/// Represents a goto statement syntax +/// +internal sealed partial class GotoStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken gotoKeyword; + internal readonly SyntaxToken? caseOrDefaultKeyword; + internal readonly ExpressionSyntax? expression; + internal readonly SyntaxToken semicolonToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DiscardDesignationSyntax(this.Kind, this.underscoreToken, GetDiagnostics(), annotations); + internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(gotoKeyword); + this.gotoKeyword = gotoKeyword; + if (caseOrDefaultKeyword != null) + { + this.AdjustFlagsAndWidth(caseOrDefaultKeyword); + this.caseOrDefaultKeyword = caseOrDefaultKeyword; + } + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax + internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? variables; - internal readonly SyntaxToken closeParenToken; - - internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(gotoKeyword); + this.gotoKeyword = gotoKeyword; + if (caseOrDefaultKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(caseOrDefaultKeyword); + this.caseOrDefaultKeyword = caseOrDefaultKeyword; + } + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken) - : base(kind) + internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (variables != null) - { - this.AdjustFlagsAndWidth(variables); - this.variables = variables; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(gotoKeyword); + this.gotoKeyword = gotoKeyword; + if (caseOrDefaultKeyword != null) + { + this.AdjustFlagsAndWidth(caseOrDefaultKeyword); + this.caseOrDefaultKeyword = caseOrDefaultKeyword; + } + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public SyntaxToken OpenParenToken => this.openParenToken; - public CoreSyntax.SeparatedSyntaxList Variables => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.variables)); - public SyntaxToken CloseParenToken => this.closeParenToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// + /// Gets a SyntaxToken that represents the goto keyword. + /// + public SyntaxToken GotoKeyword => this.gotoKeyword; + /// + /// Gets a SyntaxToken that represents the case or default keywords if any exists. + /// + public SyntaxToken? CaseOrDefaultKeyword => this.caseOrDefaultKeyword; + /// + /// Gets a constant expression for a goto case statement. + /// + public ExpressionSyntax? Expression => this.expression; + /// + /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. + /// + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.variables, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.gotoKeyword, + 2 => this.caseOrDefaultKeyword, + 3 => this.expression, + 4 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParenthesizedVariableDesignationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GotoStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); - public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + public GotoStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { - if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.GotoStatement(this.Kind, attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParenthesizedVariableDesignationSyntax(this.Kind, this.openParenToken, this.variables, this.closeParenToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class ExpressionStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken semicolonToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); +} + +internal sealed partial class BreakStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken breakKeyword; + internal readonly SyntaxToken semicolonToken; - internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(breakKeyword); + this.breakKeyword = breakKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(breakKeyword); + this.breakKeyword = breakKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) - : base(kind) + internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(breakKeyword); + this.breakKeyword = breakKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public ExpressionSyntax Expression => this.expression; - public SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken BreakKeyword => this.breakKeyword; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.expression, - 2 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.breakKeyword, + 2 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExpressionStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BreakStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); - public ExpressionStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + public BreakStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ExpressionStatementSyntax(this.Kind, this.attributeLists, this.expression, this.semicolonToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class EmptyStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken semicolonToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, diagnostics, GetAnnotations()); - internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, GetDiagnostics(), annotations); +} + +internal sealed partial class ContinueStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken continueKeyword; + internal readonly SyntaxToken semicolonToken; + + internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 2; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(continueKeyword); + this.continueKeyword = continueKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(continueKeyword); + this.continueKeyword = continueKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken) - : base(kind) + internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 2; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(continueKeyword); + this.continueKeyword = continueKeyword; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken ContinueKeyword => this.continueKeyword; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.continueKeyword, + 2 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EmptyStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ContinueStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); - public EmptyStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + public ContinueStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EmptyStatementSyntax(this.Kind, this.attributeLists, this.semicolonToken, GetDiagnostics(), annotations); + return this; } - /// Represents a labeled statement syntax. - internal sealed partial class LabeledStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken colonToken; - internal readonly StatementSyntax statement; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, GetDiagnostics(), annotations); +} - internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class ReturnStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken returnKeyword; + internal readonly ExpressionSyntax? expression; + internal readonly SyntaxToken semicolonToken; + + internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(returnKeyword); + this.returnKeyword = returnKeyword; + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(returnKeyword); + this.returnKeyword = returnKeyword; + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) - : base(kind) + internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(returnKeyword); + this.returnKeyword = returnKeyword; + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - /// Gets a SyntaxToken that represents the colon following the statement's label. - public SyntaxToken ColonToken => this.colonToken; - public StatementSyntax Statement => this.statement; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken ReturnKeyword => this.returnKeyword; + public ExpressionSyntax? Expression => this.expression; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.identifier, - 2 => this.colonToken, - 3 => this.statement, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.returnKeyword, + 2 => this.expression, + 3 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LabeledStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReturnStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); - public LabeledStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + public ReturnStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) - { - var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LabeledStatementSyntax(this.Kind, this.attributeLists, this.identifier, this.colonToken, this.statement, GetDiagnostics(), annotations); + return this; } - /// - /// Represents a goto statement syntax - /// - internal sealed partial class GotoStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken gotoKeyword; - internal readonly SyntaxToken? caseOrDefaultKeyword; - internal readonly ExpressionSyntax? expression; - internal readonly SyntaxToken semicolonToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); +} - internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class ThrowStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken throwKeyword; + internal readonly ExpressionSyntax? expression; + internal readonly SyntaxToken semicolonToken; + + internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(gotoKeyword); - this.gotoKeyword = gotoKeyword; - if (caseOrDefaultKeyword != null) - { - this.AdjustFlagsAndWidth(caseOrDefaultKeyword); - this.caseOrDefaultKeyword = caseOrDefaultKeyword; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + if (expression != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(gotoKeyword); - this.gotoKeyword = gotoKeyword; - if (caseOrDefaultKeyword != null) - { - this.AdjustFlagsAndWidth(caseOrDefaultKeyword); - this.caseOrDefaultKeyword = caseOrDefaultKeyword; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - : base(kind) + internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(gotoKeyword); - this.gotoKeyword = gotoKeyword; - if (caseOrDefaultKeyword != null) - { - this.AdjustFlagsAndWidth(caseOrDefaultKeyword); - this.caseOrDefaultKeyword = caseOrDefaultKeyword; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - /// - /// Gets a SyntaxToken that represents the goto keyword. - /// - public SyntaxToken GotoKeyword => this.gotoKeyword; - /// - /// Gets a SyntaxToken that represents the case or default keywords if any exists. - /// - public SyntaxToken? CaseOrDefaultKeyword => this.caseOrDefaultKeyword; - /// - /// Gets a constant expression for a goto case statement. - /// - public ExpressionSyntax? Expression => this.expression; - /// - /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. - /// - public SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.gotoKeyword, - 2 => this.caseOrDefaultKeyword, - 3 => this.expression, - 4 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.GotoStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); - - public GotoStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + if (expression != null) { - if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.GotoStatement(this.Kind, attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new GotoStatementSyntax(this.Kind, this.attributeLists, this.gotoKeyword, this.caseOrDefaultKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class BreakStatementSyntax : StatementSyntax + internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken breakKeyword; - internal readonly SyntaxToken semicolonToken; - - internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(breakKeyword); - this.breakKeyword = breakKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(throwKeyword); + this.throwKeyword = throwKeyword; + if (expression != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(breakKeyword); - this.breakKeyword = breakKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken ThrowKeyword => this.throwKeyword; + public ExpressionSyntax? Expression => this.expression; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(breakKeyword); - this.breakKeyword = breakKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + 0 => this.attributeLists, + 1 => this.throwKeyword, + 2 => this.expression, + 3 => this.semicolonToken, + _ => null, + }; - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken BreakKeyword => this.breakKeyword; - public SyntaxToken SemicolonToken => this.semicolonToken; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowStatementSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.breakKeyword, - 2 => this.semicolonToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BreakStatementSyntax(this, parent, position); + public ThrowStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); + return this; + } - public BreakStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, diagnostics, GetAnnotations()); +internal sealed partial class YieldStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken yieldKeyword; + internal readonly SyntaxToken returnOrBreakKeyword; + internal readonly ExpressionSyntax? expression; + internal readonly SyntaxToken semicolonToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BreakStatementSyntax(this.Kind, this.attributeLists, this.breakKeyword, this.semicolonToken, GetDiagnostics(), annotations); + internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(yieldKeyword); + this.yieldKeyword = yieldKeyword; + this.AdjustFlagsAndWidth(returnOrBreakKeyword); + this.returnOrBreakKeyword = returnOrBreakKeyword; + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class ContinueStatementSyntax : StatementSyntax + internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken continueKeyword; - internal readonly SyntaxToken semicolonToken; - - internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(continueKeyword); - this.continueKeyword = continueKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(yieldKeyword); + this.yieldKeyword = yieldKeyword; + this.AdjustFlagsAndWidth(returnOrBreakKeyword); + this.returnOrBreakKeyword = returnOrBreakKeyword; + if (expression != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(continueKeyword); - this.continueKeyword = continueKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) - : base(kind) + internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(continueKeyword); - this.continueKeyword = continueKeyword; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(yieldKeyword); + this.yieldKeyword = yieldKeyword; + this.AdjustFlagsAndWidth(returnOrBreakKeyword); + this.returnOrBreakKeyword = returnOrBreakKeyword; + if (expression != null) + { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken ContinueKeyword => this.continueKeyword; - public SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken YieldKeyword => this.yieldKeyword; + public SyntaxToken ReturnOrBreakKeyword => this.returnOrBreakKeyword; + public ExpressionSyntax? Expression => this.expression; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.continueKeyword, - 2 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.yieldKeyword, + 2 => this.returnOrBreakKeyword, + 3 => this.expression, + 4 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ContinueStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.YieldStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); - public ContinueStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + public YieldStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.YieldStatement(this.Kind, attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ContinueStatementSyntax(this.Kind, this.attributeLists, this.continueKeyword, this.semicolonToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class ReturnStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken returnKeyword; - internal readonly ExpressionSyntax? expression; - internal readonly SyntaxToken semicolonToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(returnKeyword); - this.returnKeyword = returnKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - - internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(returnKeyword); - this.returnKeyword = returnKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); +} - internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - : base(kind) - { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(returnKeyword); - this.returnKeyword = returnKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; +internal sealed partial class WhileStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken whileKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + + internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken WhileKeyword => this.whileKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public ExpressionSyntax Condition => this.condition; + public SyntaxToken CloseParenToken => this.closeParenToken; + public StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.whileKeyword, + 2 => this.openParenToken, + 3 => this.condition, + 4 => this.closeParenToken, + 5 => this.statement, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhileStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); + + public WhileStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken ReturnKeyword => this.returnKeyword; - public ExpressionSyntax? Expression => this.expression; - public SyntaxToken SemicolonToken => this.semicolonToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.returnKeyword, - 2 => this.expression, - 3 => this.semicolonToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReturnStatementSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); +internal sealed partial class DoStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken doKeyword; + internal readonly StatementSyntax statement; + internal readonly SyntaxToken whileKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken closeParenToken; + internal readonly SyntaxToken semicolonToken; + + internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(doKeyword); + this.doKeyword = doKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(doKeyword); + this.doKeyword = doKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(doKeyword); + this.doKeyword = doKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + this.AdjustFlagsAndWidth(whileKeyword); + this.whileKeyword = whileKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken DoKeyword => this.doKeyword; + public StatementSyntax Statement => this.statement; + public SyntaxToken WhileKeyword => this.whileKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public ExpressionSyntax Condition => this.condition; + public SyntaxToken CloseParenToken => this.closeParenToken; + public SyntaxToken SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.doKeyword, + 2 => this.statement, + 3 => this.whileKeyword, + 4 => this.openParenToken, + 5 => this.condition, + 6 => this.closeParenToken, + 7 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DoStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); + + public DoStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, GetDiagnostics(), annotations); +} - public ReturnStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) +internal sealed partial class ForStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken forKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly VariableDeclarationSyntax? declaration; + internal readonly GreenNode? initializers; + internal readonly SyntaxToken firstSemicolonToken; + internal readonly ExpressionSyntax? condition; + internal readonly SyntaxToken secondSemicolonToken; + internal readonly GreenNode? incrementors; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 11; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(forKeyword); + this.forKeyword = forKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) { - if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ReturnStatementSyntax(this.Kind, this.attributeLists, this.returnKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); + if (initializers != null) + { + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; + } + this.AdjustFlagsAndWidth(firstSemicolonToken); + this.firstSemicolonToken = firstSemicolonToken; + if (condition != null) + { + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } + this.AdjustFlagsAndWidth(secondSemicolonToken); + this.secondSemicolonToken = secondSemicolonToken; + if (incrementors != null) + { + this.AdjustFlagsAndWidth(incrementors); + this.incrementors = incrementors; + } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class ThrowStatementSyntax : StatementSyntax + internal 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) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken throwKeyword; - internal readonly ExpressionSyntax? expression; - internal readonly SyntaxToken semicolonToken; - - internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(forKeyword); + this.forKeyword = forKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + } + if (initializers != null) + { + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; + } + this.AdjustFlagsAndWidth(firstSemicolonToken); + this.firstSemicolonToken = firstSemicolonToken; + if (condition != null) + { + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } + this.AdjustFlagsAndWidth(secondSemicolonToken); + this.secondSemicolonToken = secondSemicolonToken; + if (incrementors != null) + { + this.AdjustFlagsAndWidth(incrementors); + this.incrementors = incrementors; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - : base(kind) + internal 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) + : base(kind) + { + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(throwKeyword); - this.throwKeyword = throwKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(forKeyword); + this.forKeyword = forKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) + { + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + } + if (initializers != null) + { + this.AdjustFlagsAndWidth(initializers); + this.initializers = initializers; + } + this.AdjustFlagsAndWidth(firstSemicolonToken); + this.firstSemicolonToken = firstSemicolonToken; + if (condition != null) + { + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + } + this.AdjustFlagsAndWidth(secondSemicolonToken); + this.secondSemicolonToken = secondSemicolonToken; + if (incrementors != null) + { + this.AdjustFlagsAndWidth(incrementors); + this.incrementors = incrementors; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken ThrowKeyword => this.throwKeyword; - public ExpressionSyntax? Expression => this.expression; - public SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken ForKeyword => this.forKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public VariableDeclarationSyntax? Declaration => this.declaration; + public CoreSyntax.SeparatedSyntaxList Initializers => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.initializers)); + public SyntaxToken FirstSemicolonToken => this.firstSemicolonToken; + public ExpressionSyntax? Condition => this.condition; + public SyntaxToken SecondSemicolonToken => this.secondSemicolonToken; + public CoreSyntax.SeparatedSyntaxList Incrementors => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.incrementors)); + public SyntaxToken CloseParenToken => this.closeParenToken; + public StatementSyntax Statement => this.statement; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.throwKeyword, - 2 => this.expression, - 3 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.forKeyword, + 2 => this.openParenToken, + 3 => this.declaration, + 4 => this.initializers, + 5 => this.firstSemicolonToken, + 6 => this.condition, + 7 => this.secondSemicolonToken, + 8 => this.incrementors, + 9 => this.closeParenToken, + 10 => this.statement, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ThrowStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); - public ThrowStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) + public ForStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) { - if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ThrowStatementSyntax(this.Kind, this.attributeLists, this.throwKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, GetDiagnostics(), annotations); +} + +internal abstract partial class CommonForEachStatementSyntax : StatementSyntax +{ + internal CommonForEachStatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - internal sealed partial class YieldStatementSyntax : StatementSyntax + internal CommonForEachStatementSyntax(SyntaxKind kind) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken yieldKeyword; - internal readonly SyntaxToken returnOrBreakKeyword; - internal readonly ExpressionSyntax? expression; - internal readonly SyntaxToken semicolonToken; + } - internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(yieldKeyword); - this.yieldKeyword = yieldKeyword; - this.AdjustFlagsAndWidth(returnOrBreakKeyword); - this.returnOrBreakKeyword = returnOrBreakKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + public abstract SyntaxToken? AwaitKeyword { get; } - internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(yieldKeyword); - this.yieldKeyword = yieldKeyword; - this.AdjustFlagsAndWidth(returnOrBreakKeyword); - this.returnOrBreakKeyword = returnOrBreakKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + public abstract SyntaxToken ForEachKeyword { get; } - internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - : base(kind) - { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(yieldKeyword); - this.yieldKeyword = yieldKeyword; - this.AdjustFlagsAndWidth(returnOrBreakKeyword); - this.returnOrBreakKeyword = returnOrBreakKeyword; - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + public abstract SyntaxToken OpenParenToken { get; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken YieldKeyword => this.yieldKeyword; - public SyntaxToken ReturnOrBreakKeyword => this.returnOrBreakKeyword; - public ExpressionSyntax? Expression => this.expression; - public SyntaxToken SemicolonToken => this.semicolonToken; + public abstract SyntaxToken InKeyword { get; } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.yieldKeyword, - 2 => this.returnOrBreakKeyword, - 3 => this.expression, - 4 => this.semicolonToken, - _ => null, - }; + public abstract ExpressionSyntax Expression { get; } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.YieldStatementSyntax(this, parent, position); + public abstract SyntaxToken CloseParenToken { get; } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); + public abstract StatementSyntax Statement { get; } +} - public YieldStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.YieldStatement(this.Kind, attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +internal sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken? awaitKeyword; + internal readonly SyntaxToken forEachKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken inKeyword; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; - return this; + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 10; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new YieldStatementSyntax(this.Kind, this.attributeLists, this.yieldKeyword, this.returnOrBreakKeyword, this.expression, this.semicolonToken, GetDiagnostics(), annotations); + if (awaitKeyword != null) + { + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class WhileStatementSyntax : StatementSyntax + internal 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) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken whileKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - - internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 10; + if (attributeLists != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + if (awaitKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 10; + if (attributeLists != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken WhileKeyword => this.whileKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public ExpressionSyntax Condition => this.condition; - public SyntaxToken CloseParenToken => this.closeParenToken; - public StatementSyntax Statement => this.statement; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.whileKeyword, - 2 => this.openParenToken, - 3 => this.condition, - 4 => this.closeParenToken, - 5 => this.statement, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WhileStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); - - public WhileStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + if (awaitKeyword != null) { - if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override SyntaxToken? AwaitKeyword => this.awaitKeyword; + public override SyntaxToken ForEachKeyword => this.forEachKeyword; + public override SyntaxToken OpenParenToken => this.openParenToken; + public TypeSyntax Type => this.type; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public override SyntaxToken InKeyword => this.inKeyword; + public override ExpressionSyntax Expression => this.expression; + public override SyntaxToken CloseParenToken => this.closeParenToken; + public override StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.awaitKeyword, + 2 => this.forEachKeyword, + 3 => this.openParenToken, + 4 => this.type, + 5 => this.identifier, + 6 => this.inKeyword, + 7 => this.expression, + 8 => this.closeParenToken, + 9 => this.statement, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); + + public ForEachStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); +internal sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken? awaitKeyword; + internal readonly SyntaxToken forEachKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax variable; + internal readonly SyntaxToken inKeyword; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new WhileStatementSyntax(this.Kind, this.attributeLists, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 9; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (awaitKeyword != null) + { + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(variable); + this.variable = variable; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class DoStatementSyntax : StatementSyntax + internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken doKeyword; - internal readonly StatementSyntax statement; - internal readonly SyntaxToken whileKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken closeParenToken; - internal readonly SyntaxToken semicolonToken; - - internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(doKeyword); - this.doKeyword = doKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (awaitKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(doKeyword); - this.doKeyword = doKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(variable); + this.variable = variable; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) - : base(kind) + internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(doKeyword); - this.doKeyword = doKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - this.AdjustFlagsAndWidth(whileKeyword); - this.whileKeyword = whileKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + if (awaitKeyword != null) + { + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; + } + this.AdjustFlagsAndWidth(forEachKeyword); + this.forEachKeyword = forEachKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(variable); + this.variable = variable; + this.AdjustFlagsAndWidth(inKeyword); + this.inKeyword = inKeyword; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override SyntaxToken? AwaitKeyword => this.awaitKeyword; + public override SyntaxToken ForEachKeyword => this.forEachKeyword; + public override SyntaxToken OpenParenToken => this.openParenToken; + /// + /// The variable(s) of the loop. In correct code this is a tuple + /// literal, declaration expression with a tuple designator, or + /// a discard syntax in the form of a simple identifier. In broken + /// code it could be something else. + /// + public ExpressionSyntax Variable => this.variable; + public override SyntaxToken InKeyword => this.inKeyword; + public override ExpressionSyntax Expression => this.expression; + public override SyntaxToken CloseParenToken => this.closeParenToken; + public override StatementSyntax Statement => this.statement; - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken DoKeyword => this.doKeyword; - public StatementSyntax Statement => this.statement; - public SyntaxToken WhileKeyword => this.whileKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public ExpressionSyntax Condition => this.condition; - public SyntaxToken CloseParenToken => this.closeParenToken; - public SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.doKeyword, - 2 => this.statement, - 3 => this.whileKeyword, - 4 => this.openParenToken, - 5 => this.condition, - 6 => this.closeParenToken, - 7 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.awaitKeyword, + 2 => this.forEachKeyword, + 3 => this.openParenToken, + 4 => this.variable, + 5 => this.inKeyword, + 6 => this.expression, + 7 => this.closeParenToken, + 8 => this.statement, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DoStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachVariableStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); - public DoStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + public ForEachVariableStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { - if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DoStatementSyntax(this.Kind, this.attributeLists, this.doKeyword, this.statement, this.whileKeyword, this.openParenToken, this.condition, this.closeParenToken, this.semicolonToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class ForStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken forKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly VariableDeclarationSyntax? declaration; - internal readonly GreenNode? initializers; - internal readonly SyntaxToken firstSemicolonToken; - internal readonly ExpressionSyntax? condition; - internal readonly SyntaxToken secondSemicolonToken; - internal readonly GreenNode? incrementors; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - internal 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) - : base(kind, diagnostics, annotations) + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); +} + +internal sealed partial class UsingStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken? awaitKeyword; + internal readonly SyntaxToken usingKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly VariableDeclarationSyntax? declaration; + internal readonly ExpressionSyntax? expression; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + + internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(forKeyword); - this.forKeyword = forKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(firstSemicolonToken); - this.firstSemicolonToken = firstSemicolonToken; - if (condition != null) - { - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } - this.AdjustFlagsAndWidth(secondSemicolonToken); - this.secondSemicolonToken = secondSemicolonToken; - if (incrementors != null) - { - this.AdjustFlagsAndWidth(incrementors); - this.incrementors = incrementors; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } - - internal 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) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(forKeyword); - this.forKeyword = forKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(firstSemicolonToken); - this.firstSemicolonToken = firstSemicolonToken; - if (condition != null) - { - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } - this.AdjustFlagsAndWidth(secondSemicolonToken); - this.secondSemicolonToken = secondSemicolonToken; - if (incrementors != null) - { - this.AdjustFlagsAndWidth(incrementors); - this.incrementors = incrementors; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (awaitKeyword != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(forKeyword); - this.forKeyword = forKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (initializers != null) - { - this.AdjustFlagsAndWidth(initializers); - this.initializers = initializers; - } - this.AdjustFlagsAndWidth(firstSemicolonToken); - this.firstSemicolonToken = firstSemicolonToken; - if (condition != null) - { - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - } - this.AdjustFlagsAndWidth(secondSemicolonToken); - this.secondSemicolonToken = secondSemicolonToken; - if (incrementors != null) - { - this.AdjustFlagsAndWidth(incrementors); - this.incrementors = incrementors; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken ForKeyword => this.forKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public VariableDeclarationSyntax? Declaration => this.declaration; - public CoreSyntax.SeparatedSyntaxList Initializers => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.initializers)); - public SyntaxToken FirstSemicolonToken => this.firstSemicolonToken; - public ExpressionSyntax? Condition => this.condition; - public SyntaxToken SecondSemicolonToken => this.secondSemicolonToken; - public CoreSyntax.SeparatedSyntaxList Incrementors => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.incrementors)); - public SyntaxToken CloseParenToken => this.closeParenToken; - public StatementSyntax Statement => this.statement; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.forKeyword, - 2 => this.openParenToken, - 3 => this.declaration, - 4 => this.initializers, - 5 => this.firstSemicolonToken, - 6 => this.condition, - 7 => this.secondSemicolonToken, - 8 => this.incrementors, - 9 => this.closeParenToken, - 10 => this.statement, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); - - public ForStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ForStatementSyntax(this.Kind, this.attributeLists, this.forKeyword, this.openParenToken, this.declaration, this.initializers, this.firstSemicolonToken, this.condition, this.secondSemicolonToken, this.incrementors, this.closeParenToken, this.statement, GetDiagnostics(), annotations); - } - - internal abstract partial class CommonForEachStatementSyntax : StatementSyntax - { - internal CommonForEachStatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) { + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } - - internal CommonForEachStatementSyntax(SyntaxKind kind) - : base(kind) + if (expression != null) { + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - - public abstract SyntaxToken? AwaitKeyword { get; } - - public abstract SyntaxToken ForEachKeyword { get; } - - public abstract SyntaxToken OpenParenToken { get; } - - public abstract SyntaxToken InKeyword { get; } - - public abstract ExpressionSyntax Expression { get; } - - public abstract SyntaxToken CloseParenToken { get; } - - public abstract StatementSyntax Statement { get; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax + internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken? awaitKeyword; - internal readonly SyntaxToken forEachKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken inKeyword; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - - internal 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) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (awaitKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } - - internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) + { + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + } + if (expression != null) { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; this.AdjustFlagsAndWidth(expression); this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override SyntaxToken? AwaitKeyword => this.awaitKeyword; - public override SyntaxToken ForEachKeyword => this.forEachKeyword; - public override SyntaxToken OpenParenToken => this.openParenToken; - public TypeSyntax Type => this.type; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public override SyntaxToken InKeyword => this.inKeyword; - public override ExpressionSyntax Expression => this.expression; - public override SyntaxToken CloseParenToken => this.closeParenToken; - public override StatementSyntax Statement => this.statement; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.awaitKeyword, - 2 => this.forEachKeyword, - 3 => this.openParenToken, - 4 => this.type, - 5 => this.identifier, - 6 => this.inKeyword, - 7 => this.expression, - 8 => this.closeParenToken, - 9 => this.statement, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); - - public ForEachStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ForEachStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.type, this.identifier, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax + internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken? awaitKeyword; - internal readonly SyntaxToken forEachKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax variable; - internal readonly SyntaxToken inKeyword; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - - internal 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) - : base(kind, diagnostics, annotations) + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(variable); - this.variable = variable; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + if (awaitKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(variable); - this.variable = variable; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(awaitKeyword); + this.awaitKeyword = awaitKeyword; } - - internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (declaration != null) + { + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + } + if (expression != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(forEachKeyword); - this.forEachKeyword = forEachKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(variable); - this.variable = variable; - this.AdjustFlagsAndWidth(inKeyword); - this.inKeyword = inKeyword; this.AdjustFlagsAndWidth(expression); this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override SyntaxToken? AwaitKeyword => this.awaitKeyword; - public override SyntaxToken ForEachKeyword => this.forEachKeyword; - public override SyntaxToken OpenParenToken => this.openParenToken; - /// - /// The variable(s) of the loop. In correct code this is a tuple - /// literal, declaration expression with a tuple designator, or - /// a discard syntax in the form of a simple identifier. In broken - /// code it could be something else. - /// - public ExpressionSyntax Variable => this.variable; - public override SyntaxToken InKeyword => this.inKeyword; - public override ExpressionSyntax Expression => this.expression; - public override SyntaxToken CloseParenToken => this.closeParenToken; - public override StatementSyntax Statement => this.statement; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.awaitKeyword, - 2 => this.forEachKeyword, - 3 => this.openParenToken, - 4 => this.variable, - 5 => this.inKeyword, - 6 => this.expression, - 7 => this.closeParenToken, - 8 => this.statement, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ForEachVariableStatementSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); - - public ForEachVariableStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ForEachVariableStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.forEachKeyword, this.openParenToken, this.variable, this.inKeyword, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } - internal sealed partial class UsingStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken? awaitKeyword; - internal readonly SyntaxToken usingKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly VariableDeclarationSyntax? declaration; - internal readonly ExpressionSyntax? expression; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken? AwaitKeyword => this.awaitKeyword; + public SyntaxToken UsingKeyword => this.usingKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public VariableDeclarationSyntax? Declaration => this.declaration; + public ExpressionSyntax? Expression => this.expression; + public SyntaxToken CloseParenToken => this.closeParenToken; + public StatementSyntax Statement => this.statement; - internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } + 0 => this.attributeLists, + 1 => this.awaitKeyword, + 2 => this.usingKeyword, + 3 => this.openParenToken, + 4 => this.declaration, + 5 => this.expression, + 6 => this.closeParenToken, + 7 => this.statement, + _ => null, + }; - internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingStatementSyntax(this, parent, position); - internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); + + public UsingStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (awaitKeyword != null) - { - this.AdjustFlagsAndWidth(awaitKeyword); - this.awaitKeyword = awaitKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (expression != null) - { - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken? AwaitKeyword => this.awaitKeyword; - public SyntaxToken UsingKeyword => this.usingKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public VariableDeclarationSyntax? Declaration => this.declaration; - public ExpressionSyntax? Expression => this.expression; - public SyntaxToken CloseParenToken => this.closeParenToken; - public StatementSyntax Statement => this.statement; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.awaitKeyword, - 2 => this.usingKeyword, - 3 => this.openParenToken, - 4 => this.declaration, - 5 => this.expression, - 6 => this.closeParenToken, - 7 => this.statement, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingStatementSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); +internal sealed partial class FixedStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken fixedKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly VariableDeclarationSyntax declaration; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + + internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(fixedKeyword); + this.fixedKeyword = fixedKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(fixedKeyword); + this.fixedKeyword = fixedKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(fixedKeyword); + this.fixedKeyword = fixedKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken FixedKeyword => this.fixedKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public VariableDeclarationSyntax Declaration => this.declaration; + public SyntaxToken CloseParenToken => this.closeParenToken; + public StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.fixedKeyword, + 2 => this.openParenToken, + 3 => this.declaration, + 4 => this.closeParenToken, + 5 => this.statement, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FixedStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); + + public FixedStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public UsingStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + return this; + } - return this; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new UsingStatementSyntax(this.Kind, this.attributeLists, this.awaitKeyword, this.usingKeyword, this.openParenToken, this.declaration, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); - } +internal sealed partial class CheckedStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken keyword; + internal readonly BlockSyntax block; - internal sealed partial class FixedStatementSyntax : StatementSyntax + internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken fixedKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly VariableDeclarationSyntax declaration; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - - internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(fixedKeyword); - this.fixedKeyword = fixedKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(fixedKeyword); - this.fixedKeyword = fixedKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(fixedKeyword); - this.fixedKeyword = fixedKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken FixedKeyword => this.fixedKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public VariableDeclarationSyntax Declaration => this.declaration; - public SyntaxToken CloseParenToken => this.closeParenToken; - public StatementSyntax Statement => this.statement; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken Keyword => this.keyword; + public BlockSyntax Block => this.block; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.fixedKeyword, - 2 => this.openParenToken, - 3 => this.declaration, - 4 => this.closeParenToken, - 5 => this.statement, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.keyword, + 2 => this.block, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FixedStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); - public FixedStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + public CheckedStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + { + if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) { - if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CheckedStatement(this.Kind, attributeLists, keyword, block); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FixedStatementSyntax(this.Kind, this.attributeLists, this.fixedKeyword, this.openParenToken, this.declaration, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + return this; } - internal sealed partial class CheckedStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken keyword; - internal readonly BlockSyntax block; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, diagnostics, GetAnnotations()); - internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, GetDiagnostics(), annotations); +} + +internal sealed partial class UnsafeStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken unsafeKeyword; + internal readonly BlockSyntax block; + + internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, SyntaxFactoryContext context) - : base(kind) + internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block) - : base(kind) + internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken Keyword => this.keyword; - public BlockSyntax Block => this.block; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken UnsafeKeyword => this.unsafeKeyword; + public BlockSyntax Block => this.block; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.keyword, - 2 => this.block, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.unsafeKeyword, + 2 => this.block, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CheckedStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnsafeStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); - public CheckedStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + public UnsafeStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + { + if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) { - if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) - { - var newNode = SyntaxFactory.CheckedStatement(this.Kind, attributeLists, keyword, block); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CheckedStatementSyntax(this.Kind, this.attributeLists, this.keyword, this.block, GetDiagnostics(), annotations); + return this; } - internal sealed partial class UnsafeStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken unsafeKeyword; - internal readonly BlockSyntax block; - - internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, diagnostics, GetAnnotations()); - internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, GetDiagnostics(), annotations); +} - internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) - : base(kind) - { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; +internal sealed partial class LockStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken lockKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + + internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(lockKeyword); + this.lockKeyword = lockKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(lockKeyword); + this.lockKeyword = lockKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 6; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(lockKeyword); + this.lockKeyword = lockKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken LockKeyword => this.lockKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public ExpressionSyntax Expression => this.expression; + public SyntaxToken CloseParenToken => this.closeParenToken; + public StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.lockKeyword, + 2 => this.openParenToken, + 3 => this.expression, + 4 => this.closeParenToken, + 5 => this.statement, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LockStatementSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); + + public LockStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken UnsafeKeyword => this.unsafeKeyword; - public BlockSyntax Block => this.block; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.unsafeKeyword, - 2 => this.block, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UnsafeStatementSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); +/// +/// Represents an if statement syntax. +/// +internal sealed partial class IfStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken ifKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken closeParenToken; + internal readonly StatementSyntax statement; + internal readonly ElseClauseSyntax? @else; - public UnsafeStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 7; + if (attributeLists != null) { - if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) - { - var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + if (@else != null) + { + this.AdjustFlagsAndWidth(@else); + this.@else = @else; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new UnsafeStatementSyntax(this.Kind, this.attributeLists, this.unsafeKeyword, this.block, GetDiagnostics(), annotations); } - internal sealed partial class LockStatementSyntax : StatementSyntax + internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken lockKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - - internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 7; + if (attributeLists != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(lockKeyword); - this.lockKeyword = lockKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + if (@else != null) { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(lockKeyword); - this.lockKeyword = lockKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(@else); + this.@else = @else; } + } - internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - : base(kind) + internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + : base(kind) + { + this.SlotCount = 7; + if (attributeLists != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(lockKeyword); - this.lockKeyword = lockKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + if (@else != null) + { + this.AdjustFlagsAndWidth(@else); + this.@else = @else; } + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken LockKeyword => this.lockKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public ExpressionSyntax Expression => this.expression; - public SyntaxToken CloseParenToken => this.closeParenToken; - public StatementSyntax Statement => this.statement; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// + /// Gets a SyntaxToken that represents the if keyword. + /// + public SyntaxToken IfKeyword => this.ifKeyword; + /// + /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. + /// + public SyntaxToken OpenParenToken => this.openParenToken; + /// + /// Gets an ExpressionSyntax that represents the condition of the if statement. + /// + public ExpressionSyntax Condition => this.condition; + /// + /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. + /// + public SyntaxToken CloseParenToken => this.closeParenToken; + /// + /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. + /// + public StatementSyntax Statement => this.statement; + /// + /// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. + /// + public ElseClauseSyntax? Else => this.@else; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.lockKeyword, - 2 => this.openParenToken, - 3 => this.expression, - 4 => this.closeParenToken, - 5 => this.statement, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.ifKeyword, + 2 => this.openParenToken, + 3 => this.condition, + 4 => this.closeParenToken, + 5 => this.statement, + 6 => this.@else, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LockStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); - public LockStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public IfStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax @else) + { + if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) { - if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, GetDiagnostics(), annotations); +} + +/// Represents an else statement syntax. +internal sealed partial class ElseClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken elseKeyword; + internal readonly StatementSyntax statement; + + internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } + + internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LockStatementSyntax(this.Kind, this.attributeLists, this.lockKeyword, this.openParenToken, this.expression, this.closeParenToken, this.statement, GetDiagnostics(), annotations); + internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(statement); + this.statement = statement; } /// - /// Represents an if statement syntax. + /// Gets a syntax token /// - internal sealed partial class IfStatementSyntax : StatementSyntax + public SyntaxToken ElseKeyword => this.elseKeyword; + public StatementSyntax Statement => this.statement; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.elseKeyword, + 1 => this.statement, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseClauseSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); + + public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken ifKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken closeParenToken; - internal readonly StatementSyntax statement; - internal readonly ElseClauseSyntax? @else; + if (elseKeyword != this.ElseKeyword || statement != this.Statement) + { + var newNode = SyntaxFactory.ElseClause(elseKeyword, statement); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, GetDiagnostics(), annotations); +} + +/// Represents a switch statement syntax. +internal sealed partial class SwitchStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken switchKeyword; + internal readonly SyntaxToken? openParenToken; + internal readonly ExpressionSyntax expression; + internal readonly SyntaxToken? closeParenToken; + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? sections; + internal readonly SyntaxToken closeBraceToken; - internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + if (openParenToken != null) { - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; this.AdjustFlagsAndWidth(openParenToken); this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; + } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (closeParenToken != null) + { this.AdjustFlagsAndWidth(closeParenToken); this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - if (@else != null) - { - this.AdjustFlagsAndWidth(@else); - this.@else = @else; - } } + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (sections != null) + { + this.AdjustFlagsAndWidth(sections); + this.sections = sections; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, SyntaxFactoryContext context) - : base(kind) + internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + if (openParenToken != null) { - this.SetFactoryContext(context); - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; this.AdjustFlagsAndWidth(openParenToken); this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; + } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (closeParenToken != null) + { this.AdjustFlagsAndWidth(closeParenToken); this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - if (@else != null) - { - this.AdjustFlagsAndWidth(@else); - this.@else = @else; - } } + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (sections != null) + { + this.AdjustFlagsAndWidth(sections); + this.sections = sections; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) - : base(kind) + internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + if (openParenToken != null) { - this.SlotCount = 7; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; this.AdjustFlagsAndWidth(openParenToken); this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; + } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + if (closeParenToken != null) + { this.AdjustFlagsAndWidth(closeParenToken); this.closeParenToken = closeParenToken; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; - if (@else != null) - { - this.AdjustFlagsAndWidth(@else); - this.@else = @else; - } } + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (sections != null) + { + this.AdjustFlagsAndWidth(sections); + this.sections = sections; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - /// - /// Gets a SyntaxToken that represents the if keyword. - /// - public SyntaxToken IfKeyword => this.ifKeyword; - /// - /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. - /// - public SyntaxToken OpenParenToken => this.openParenToken; - /// - /// Gets an ExpressionSyntax that represents the condition of the if statement. - /// - public ExpressionSyntax Condition => this.condition; - /// - /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. - /// - public SyntaxToken CloseParenToken => this.closeParenToken; - /// - /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. - /// - public StatementSyntax Statement => this.statement; - /// - /// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. - /// - public ElseClauseSyntax? Else => this.@else; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.ifKeyword, - 2 => this.openParenToken, - 3 => this.condition, - 4 => this.closeParenToken, - 5 => this.statement, - 6 => this.@else, - _ => null, - }; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// + /// Gets a SyntaxToken that represents the switch keyword. + /// + public SyntaxToken SwitchKeyword => this.switchKeyword; + /// + /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. + /// + public SyntaxToken? OpenParenToken => this.openParenToken; + /// + /// Gets an ExpressionSyntax representing the expression of the switch statement. + /// + public ExpressionSyntax Expression => this.expression; + /// + /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. + /// + public SyntaxToken? CloseParenToken => this.closeParenToken; + /// + /// Gets a SyntaxToken that represents the open braces preceding the switch sections. + /// + public SyntaxToken OpenBraceToken => this.openBraceToken; + /// + /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. + /// + public CoreSyntax.SyntaxList Sections => new CoreSyntax.SyntaxList(this.sections); + /// + /// Gets a SyntaxToken that represents the open braces following the switch sections. + /// + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfStatementSyntax(this, parent, position); + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.switchKeyword, + 2 => this.openParenToken, + 3 => this.expression, + 4 => this.closeParenToken, + 5 => this.openBraceToken, + 6 => this.sections, + 7 => this.closeBraceToken, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchStatementSyntax(this, parent, position); - public IfStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax @else) - { - if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) - { - var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); - return this; + public SwitchStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + { + if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IfStatementSyntax(this.Kind, this.attributeLists, this.ifKeyword, this.openParenToken, this.condition, this.closeParenToken, this.statement, this.@else, GetDiagnostics(), annotations); + return this; } - /// Represents an else statement syntax. - internal sealed partial class ElseClauseSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken elseKeyword; - internal readonly StatementSyntax statement; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, GetDiagnostics(), annotations); +} - internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +/// Represents a switch section syntax of a switch statement. +internal sealed partial class SwitchSectionSyntax : CSharpSyntaxNode +{ + internal readonly GreenNode? labels; + internal readonly GreenNode? statements; + + internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (labels != null) + { + this.AdjustFlagsAndWidth(labels); + this.labels = labels; + } + if (statements != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + } - internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, SyntaxFactoryContext context) - : base(kind) + internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + if (labels != null) + { + this.AdjustFlagsAndWidth(labels); + this.labels = labels; + } + if (statements != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + } - internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement) - : base(kind) + internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements) + : base(kind) + { + this.SlotCount = 2; + if (labels != null) + { + this.AdjustFlagsAndWidth(labels); + this.labels = labels; + } + if (statements != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(statement); - this.statement = statement; + this.AdjustFlagsAndWidth(statements); + this.statements = statements; } + } - /// - /// Gets a syntax token - /// - public SyntaxToken ElseKeyword => this.elseKeyword; - public StatementSyntax Statement => this.statement; + /// + /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. + /// + public CoreSyntax.SyntaxList Labels => new CoreSyntax.SyntaxList(this.labels); + /// + /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. + /// + public CoreSyntax.SyntaxList Statements => new CoreSyntax.SyntaxList(this.statements); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.elseKeyword, - 1 => this.statement, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.labels, + 1 => this.statements, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchSectionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); - public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement) + public SwitchSectionSyntax Update(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) + { + if (labels != this.Labels || statements != this.Statements) { - if (elseKeyword != this.ElseKeyword || statement != this.Statement) - { - var newNode = SyntaxFactory.ElseClause(elseKeyword, statement); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.SwitchSection(labels, statements); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SwitchSectionSyntax(this.Kind, this.labels, this.statements, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SwitchSectionSyntax(this.Kind, this.labels, this.statements, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ElseClauseSyntax(this.Kind, this.elseKeyword, this.statement, GetDiagnostics(), annotations); +/// Represents a switch label within a switch statement. +internal abstract partial class SwitchLabelSyntax : CSharpSyntaxNode +{ + internal SwitchLabelSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// Represents a switch statement syntax. - internal sealed partial class SwitchStatementSyntax : StatementSyntax + internal SwitchLabelSyntax(SyntaxKind kind) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken switchKeyword; - internal readonly SyntaxToken? openParenToken; - internal readonly ExpressionSyntax expression; - internal readonly SyntaxToken? closeParenToken; - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? sections; - internal readonly SyntaxToken closeBraceToken; + } + + /// + /// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. + /// + public abstract SyntaxToken Keyword { get; } + + /// + /// Gets a SyntaxToken that represents the colon that terminates the switch label. + /// + public abstract SyntaxToken ColonToken { get; } +} + +/// Represents a case label within a switch statement. +internal sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly PatternSyntax pattern; + internal readonly WhenClauseSyntax? whenClause; + internal readonly SyntaxToken colonToken; - internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - if (openParenToken != null) - { - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (closeParenToken != null) - { - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (sections != null) - { - this.AdjustFlagsAndWidth(sections); - this.sections = sections; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - if (openParenToken != null) - { - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (closeParenToken != null) - { - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (sections != null) - { - this.AdjustFlagsAndWidth(sections); - this.sections = sections; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken) - : base(kind) + internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - if (openParenToken != null) - { - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; - if (closeParenToken != null) - { - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (sections != null) - { - this.AdjustFlagsAndWidth(sections); - this.sections = sections; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - /// - /// Gets a SyntaxToken that represents the switch keyword. - /// - public SyntaxToken SwitchKeyword => this.switchKeyword; - /// - /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. - /// - public SyntaxToken? OpenParenToken => this.openParenToken; - /// - /// Gets an ExpressionSyntax representing the expression of the switch statement. - /// - public ExpressionSyntax Expression => this.expression; - /// - /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. - /// - public SyntaxToken? CloseParenToken => this.closeParenToken; - /// - /// Gets a SyntaxToken that represents the open braces preceding the switch sections. - /// - public SyntaxToken OpenBraceToken => this.openBraceToken; - /// - /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. - /// - public CoreSyntax.SyntaxList Sections => new CoreSyntax.SyntaxList(this.sections); - /// - /// Gets a SyntaxToken that represents the open braces following the switch sections. - /// - public SyntaxToken CloseBraceToken => this.closeBraceToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.switchKeyword, - 2 => this.openParenToken, - 3 => this.expression, - 4 => this.closeParenToken, - 5 => this.openBraceToken, - 6 => this.sections, - 7 => this.closeBraceToken, - _ => null, - }; + /// Gets the case keyword token. + public override SyntaxToken Keyword => this.keyword; + /// + /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. + /// + public PatternSyntax Pattern => this.pattern; + public WhenClauseSyntax? WhenClause => this.whenClause; + public override SyntaxToken ColonToken => this.colonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.keyword, + 1 => this.pattern, + 2 => this.whenClause, + 3 => this.colonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CasePatternSwitchLabelSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); - public SwitchStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken colonToken) + { + if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken) { - if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, GetDiagnostics(), annotations); +} + +/// Represents a case label within a switch statement. +internal sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly ExpressionSyntax value; + internal readonly SyntaxToken colonToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SwitchStatementSyntax(this.Kind, this.attributeLists, this.switchKeyword, this.openParenToken, this.expression, this.closeParenToken, this.openBraceToken, this.sections, this.closeBraceToken, GetDiagnostics(), annotations); + internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(value); + this.value = value; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; } - /// Represents a switch section syntax of a switch statement. - internal sealed partial class SwitchSectionSyntax : CSharpSyntaxNode + internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? labels; - internal readonly GreenNode? statements; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(value); + this.value = value; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - if (labels != null) - { - this.AdjustFlagsAndWidth(labels); - this.labels = labels; - } - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - } + internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(value); + this.value = value; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (labels != null) - { - this.AdjustFlagsAndWidth(labels); - this.labels = labels; - } - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - } + /// Gets the case keyword token. + public override SyntaxToken Keyword => this.keyword; + /// + /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. + /// + public ExpressionSyntax Value => this.value; + public override SyntaxToken ColonToken => this.colonToken; - internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - if (labels != null) - { - this.AdjustFlagsAndWidth(labels); - this.labels = labels; - } - if (statements != null) - { - this.AdjustFlagsAndWidth(statements); - this.statements = statements; - } - } + 0 => this.keyword, + 1 => this.value, + 2 => this.colonToken, + _ => null, + }; - /// - /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. - /// - public CoreSyntax.SyntaxList Labels => new CoreSyntax.SyntaxList(this.labels); - /// - /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. - /// - public CoreSyntax.SyntaxList Statements => new CoreSyntax.SyntaxList(this.statements); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CaseSwitchLabelSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.labels, - 1 => this.statements, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchSectionSyntax(this, parent, position); + public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + { + if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); + return this; + } - public SwitchSectionSyntax Update(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) - { - if (labels != this.Labels || statements != this.Statements) - { - var newNode = SyntaxFactory.SwitchSection(labels, statements); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SwitchSectionSyntax(this.Kind, this.labels, this.statements, diagnostics, GetAnnotations()); +/// Represents a default label within a switch statement. +internal sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax +{ + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken colonToken; + + internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SwitchSectionSyntax(this.Kind, this.labels, this.statements, GetDiagnostics(), annotations); + internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; } - /// Represents a switch label within a switch statement. - internal abstract partial class SwitchLabelSyntax : CSharpSyntaxNode + internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken) + : base(kind) { - internal SwitchLabelSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 2; + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } + + /// Gets the default keyword token. + public override SyntaxToken Keyword => this.keyword; + public override SyntaxToken ColonToken => this.colonToken; + + internal override GreenNode? GetSlot(int index) + => index switch { - } + 0 => this.keyword, + 1 => this.colonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultSwitchLabelSyntax(this, parent, position); - internal SwitchLabelSyntax(SyntaxKind kind) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); + + public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken) + { + if (keyword != this.Keyword || colonToken != this.ColonToken) { + var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// - /// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. - /// - public abstract SyntaxToken Keyword { get; } - - /// - /// Gets a SyntaxToken that represents the colon that terminates the switch label. - /// - public abstract SyntaxToken ColonToken { get; } + return this; } - /// Represents a case label within a switch statement. - internal sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax - { - internal readonly SyntaxToken keyword; - internal readonly PatternSyntax pattern; - internal readonly WhenClauseSyntax? whenClause; - internal readonly SyntaxToken colonToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, GetDiagnostics(), annotations); +} - internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class SwitchExpressionSyntax : ExpressionSyntax +{ + internal readonly ExpressionSyntax governingExpression; + internal readonly SyntaxToken switchKeyword; + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? arms; + internal readonly SyntaxToken closeBraceToken; + + internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(governingExpression); + this.governingExpression = governingExpression; + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (arms != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(arms); + this.arms = arms; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(governingExpression); + this.governingExpression = governingExpression; + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (arms != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(arms); + this.arms = arms; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) - : base(kind) + internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(governingExpression); + this.governingExpression = governingExpression; + this.AdjustFlagsAndWidth(switchKeyword); + this.switchKeyword = switchKeyword; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (arms != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(arms); + this.arms = arms; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - /// Gets the case keyword token. - public override SyntaxToken Keyword => this.keyword; - /// - /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. - /// - public PatternSyntax Pattern => this.pattern; - public WhenClauseSyntax? WhenClause => this.whenClause; - public override SyntaxToken ColonToken => this.colonToken; + public ExpressionSyntax GoverningExpression => this.governingExpression; + public SyntaxToken SwitchKeyword => this.switchKeyword; + public SyntaxToken OpenBraceToken => this.openBraceToken; + public CoreSyntax.SeparatedSyntaxList Arms => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arms)); + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.pattern, - 2 => this.whenClause, - 3 => this.colonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.governingExpression, + 1 => this.switchKeyword, + 2 => this.openBraceToken, + 3 => this.arms, + 4 => this.closeBraceToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CasePatternSwitchLabelSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); - public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken colonToken) + public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + { + if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) { - if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CasePatternSwitchLabelSyntax(this.Kind, this.keyword, this.pattern, this.whenClause, this.colonToken, GetDiagnostics(), annotations); + return this; } - /// Represents a case label within a switch statement. - internal sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax - { - internal readonly SyntaxToken keyword; - internal readonly ExpressionSyntax value; - internal readonly SyntaxToken colonToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, diagnostics, GetAnnotations()); - internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, GetDiagnostics(), annotations); +} + +internal sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode +{ + internal readonly PatternSyntax pattern; + internal readonly WhenClauseSyntax? whenClause; + internal readonly SyntaxToken equalsGreaterThanToken; + internal readonly ExpressionSyntax expression; + + internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(value); - this.value = value; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(equalsGreaterThanToken); + this.equalsGreaterThanToken = equalsGreaterThanToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(value); - this.value = value; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(equalsGreaterThanToken); + this.equalsGreaterThanToken = equalsGreaterThanToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) - : base(kind) + internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(pattern); + this.pattern = pattern; + if (whenClause != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(value); - this.value = value; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(whenClause); + this.whenClause = whenClause; } + this.AdjustFlagsAndWidth(equalsGreaterThanToken); + this.equalsGreaterThanToken = equalsGreaterThanToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - /// Gets the case keyword token. - public override SyntaxToken Keyword => this.keyword; - /// - /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. - /// - public ExpressionSyntax Value => this.value; - public override SyntaxToken ColonToken => this.colonToken; + public PatternSyntax Pattern => this.pattern; + public WhenClauseSyntax? WhenClause => this.whenClause; + public SyntaxToken EqualsGreaterThanToken => this.equalsGreaterThanToken; + public ExpressionSyntax Expression => this.expression; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.value, - 2 => this.colonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.pattern, + 1 => this.whenClause, + 2 => this.equalsGreaterThanToken, + 3 => this.expression, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CaseSwitchLabelSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionArmSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); - public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + { + if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression) { - if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CaseSwitchLabelSyntax(this.Kind, this.keyword, this.value, this.colonToken, GetDiagnostics(), annotations); + return this; } - /// Represents a default label within a switch statement. - internal sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax - { - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken colonToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, GetDiagnostics(), annotations); +} - internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class TryStatementSyntax : StatementSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken tryKeyword; + internal readonly BlockSyntax block; + internal readonly GreenNode? catches; + internal readonly FinallyClauseSyntax? @finally; + + internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(tryKeyword); + this.tryKeyword = tryKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + if (catches != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(catches); + this.catches = catches; } - - internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken) - : base(kind) + if (@finally != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(@finally); + this.@finally = @finally; } + } - /// Gets the default keyword token. - public override SyntaxToken Keyword => this.keyword; - public override SyntaxToken ColonToken => this.colonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.keyword, - 1 => this.colonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultSwitchLabelSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); - - public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken) + internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + if (attributeLists != null) { - if (keyword != this.Keyword || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + this.AdjustFlagsAndWidth(tryKeyword); + this.tryKeyword = tryKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + if (catches != null) + { + this.AdjustFlagsAndWidth(catches); + this.catches = catches; + } + if (@finally != null) + { + this.AdjustFlagsAndWidth(@finally); + this.@finally = @finally; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DefaultSwitchLabelSyntax(this.Kind, this.keyword, this.colonToken, GetDiagnostics(), annotations); } - internal sealed partial class SwitchExpressionSyntax : ExpressionSyntax + internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally) + : base(kind) { - internal readonly ExpressionSyntax governingExpression; - internal readonly SyntaxToken switchKeyword; - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? arms; - internal readonly SyntaxToken closeBraceToken; - - internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(governingExpression); - this.governingExpression = governingExpression; - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (arms != null) - { - this.AdjustFlagsAndWidth(arms); - this.arms = arms; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(tryKeyword); + this.tryKeyword = tryKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + if (catches != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(governingExpression); - this.governingExpression = governingExpression; - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (arms != null) - { - this.AdjustFlagsAndWidth(arms); - this.arms = arms; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(catches); + this.catches = catches; } - - internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken) - : base(kind) + if (@finally != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(governingExpression); - this.governingExpression = governingExpression; - this.AdjustFlagsAndWidth(switchKeyword); - this.switchKeyword = switchKeyword; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (arms != null) - { - this.AdjustFlagsAndWidth(arms); - this.arms = arms; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(@finally); + this.@finally = @finally; } + } - public ExpressionSyntax GoverningExpression => this.governingExpression; - public SyntaxToken SwitchKeyword => this.switchKeyword; - public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SeparatedSyntaxList Arms => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arms)); - public SyntaxToken CloseBraceToken => this.closeBraceToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken TryKeyword => this.tryKeyword; + public BlockSyntax Block => this.block; + public CoreSyntax.SyntaxList Catches => new CoreSyntax.SyntaxList(this.catches); + public FinallyClauseSyntax? Finally => this.@finally; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.governingExpression, - 1 => this.switchKeyword, - 2 => this.openBraceToken, - 3 => this.arms, - 4 => this.closeBraceToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.tryKeyword, + 2 => this.block, + 3 => this.catches, + 4 => this.@finally, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TryStatementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); - public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + public TryStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax @finally) + { + if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) { - if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SwitchExpressionSyntax(this.Kind, this.governingExpression, this.switchKeyword, this.openBraceToken, this.arms, this.closeBraceToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode - { - internal readonly PatternSyntax pattern; - internal readonly WhenClauseSyntax? whenClause; - internal readonly SyntaxToken equalsGreaterThanToken; - internal readonly ExpressionSyntax expression; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, GetDiagnostics(), annotations); +} + +internal sealed partial class CatchClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken catchKeyword; + internal readonly CatchDeclarationSyntax? declaration; + internal readonly CatchFilterClauseSyntax? filter; + internal readonly BlockSyntax block; - internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(catchKeyword); + this.catchKeyword = catchKeyword; + if (declaration != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(equalsGreaterThanToken); - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } + if (filter != null) + { + this.AdjustFlagsAndWidth(filter); + this.filter = filter; + } + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(catchKeyword); + this.catchKeyword = catchKeyword; + if (declaration != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(equalsGreaterThanToken); - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } + if (filter != null) + { + this.AdjustFlagsAndWidth(filter); + this.filter = filter; + } + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) - : base(kind) + internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(catchKeyword); + this.catchKeyword = catchKeyword; + if (declaration != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(pattern); - this.pattern = pattern; - if (whenClause != null) - { - this.AdjustFlagsAndWidth(whenClause); - this.whenClause = whenClause; - } - this.AdjustFlagsAndWidth(equalsGreaterThanToken); - this.equalsGreaterThanToken = equalsGreaterThanToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; } + if (filter != null) + { + this.AdjustFlagsAndWidth(filter); + this.filter = filter; + } + this.AdjustFlagsAndWidth(block); + this.block = block; + } - public PatternSyntax Pattern => this.pattern; - public WhenClauseSyntax? WhenClause => this.whenClause; - public SyntaxToken EqualsGreaterThanToken => this.equalsGreaterThanToken; - public ExpressionSyntax Expression => this.expression; + public SyntaxToken CatchKeyword => this.catchKeyword; + public CatchDeclarationSyntax? Declaration => this.declaration; + public CatchFilterClauseSyntax? Filter => this.filter; + public BlockSyntax Block => this.block; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.pattern, - 1 => this.whenClause, - 2 => this.equalsGreaterThanToken, - 3 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.catchKeyword, + 1 => this.declaration, + 2 => this.filter, + 3 => this.block, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SwitchExpressionArmSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchClauseSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); - public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax declaration, CatchFilterClauseSyntax filter, BlockSyntax block) + { + if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block) { - if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression) - { - var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SwitchExpressionArmSyntax(this.Kind, this.pattern, this.whenClause, this.equalsGreaterThanToken, this.expression, GetDiagnostics(), annotations); + return this; } - internal sealed partial class TryStatementSyntax : StatementSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken tryKeyword; - internal readonly BlockSyntax block; - internal readonly GreenNode? catches; - internal readonly FinallyClauseSyntax? @finally; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, diagnostics, GetAnnotations()); - internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(tryKeyword); - this.tryKeyword = tryKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - if (catches != null) - { - this.AdjustFlagsAndWidth(catches); - this.catches = catches; - } - if (@finally != null) - { - this.AdjustFlagsAndWidth(@finally); - this.@finally = @finally; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, GetDiagnostics(), annotations); +} + +internal sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openParenToken; + internal readonly TypeSyntax type; + internal readonly SyntaxToken? identifier; + internal readonly SyntaxToken closeParenToken; + + internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) + { + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, SyntaxFactoryContext context) - : base(kind) + internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(tryKeyword); - this.tryKeyword = tryKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - if (catches != null) - { - this.AdjustFlagsAndWidth(catches); - this.catches = catches; - } - if (@finally != null) - { - this.AdjustFlagsAndWidth(@finally); - this.@finally = @finally; - } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally) - : base(kind) + internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (identifier != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - this.AdjustFlagsAndWidth(tryKeyword); - this.tryKeyword = tryKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; - if (catches != null) - { - this.AdjustFlagsAndWidth(catches); - this.catches = catches; - } - if (@finally != null) - { - this.AdjustFlagsAndWidth(@finally); - this.@finally = @finally; - } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken TryKeyword => this.tryKeyword; - public BlockSyntax Block => this.block; - public CoreSyntax.SyntaxList Catches => new CoreSyntax.SyntaxList(this.catches); - public FinallyClauseSyntax? Finally => this.@finally; + public SyntaxToken OpenParenToken => this.openParenToken; + public TypeSyntax Type => this.type; + public SyntaxToken? Identifier => this.identifier; + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.tryKeyword, - 2 => this.block, - 3 => this.catches, - 4 => this.@finally, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.type, + 2 => this.identifier, + 3 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TryStatementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); - public TryStatementSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax @finally) + public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken) { - if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) - { - var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, GetDiagnostics(), annotations); +} + +internal sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken whenKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly ExpressionSyntax filterExpression; + internal readonly SyntaxToken closeParenToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TryStatementSyntax(this.Kind, this.attributeLists, this.tryKeyword, this.block, this.catches, this.@finally, GetDiagnostics(), annotations); + internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(filterExpression); + this.filterExpression = filterExpression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - internal sealed partial class CatchClauseSyntax : CSharpSyntaxNode + internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken catchKeyword; - internal readonly CatchDeclarationSyntax? declaration; - internal readonly CatchFilterClauseSyntax? filter; - internal readonly BlockSyntax block; + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(filterExpression); + this.filterExpression = filterExpression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(catchKeyword); - this.catchKeyword = catchKeyword; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (filter != null) - { - this.AdjustFlagsAndWidth(filter); - this.filter = filter; - } - this.AdjustFlagsAndWidth(block); - this.block = block; - } + internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whenKeyword); + this.whenKeyword = whenKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(filterExpression); + this.filterExpression = filterExpression; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(catchKeyword); - this.catchKeyword = catchKeyword; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (filter != null) - { - this.AdjustFlagsAndWidth(filter); - this.filter = filter; - } - this.AdjustFlagsAndWidth(block); - this.block = block; - } + public SyntaxToken WhenKeyword => this.whenKeyword; + public SyntaxToken OpenParenToken => this.openParenToken; + public ExpressionSyntax FilterExpression => this.filterExpression; + public SyntaxToken CloseParenToken => this.closeParenToken; - internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(catchKeyword); - this.catchKeyword = catchKeyword; - if (declaration != null) - { - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - } - if (filter != null) - { - this.AdjustFlagsAndWidth(filter); - this.filter = filter; - } - this.AdjustFlagsAndWidth(block); - this.block = block; - } + 0 => this.whenKeyword, + 1 => this.openParenToken, + 2 => this.filterExpression, + 3 => this.closeParenToken, + _ => null, + }; - public SyntaxToken CatchKeyword => this.catchKeyword; - public CatchDeclarationSyntax? Declaration => this.declaration; - public CatchFilterClauseSyntax? Filter => this.filter; - public BlockSyntax Block => this.block; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchFilterClauseSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.catchKeyword, - 1 => this.declaration, - 2 => this.filter, - 3 => this.block, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchClauseSyntax(this, parent, position); + public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + { + if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); + return this; + } - public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax declaration, CatchFilterClauseSyntax filter, BlockSyntax block) - { - if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block) - { - var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, diagnostics, GetAnnotations()); +internal sealed partial class FinallyClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken finallyKeyword; + internal readonly BlockSyntax block; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CatchClauseSyntax(this.Kind, this.catchKeyword, this.declaration, this.filter, this.block, GetDiagnostics(), annotations); + internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(finallyKeyword); + this.finallyKeyword = finallyKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; } - internal sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode + internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly TypeSyntax type; - internal readonly SyntaxToken? identifier; - internal readonly SyntaxToken closeParenToken; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(finallyKeyword); + this.finallyKeyword = finallyKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } - internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(finallyKeyword); + this.finallyKeyword = finallyKeyword; + this.AdjustFlagsAndWidth(block); + this.block = block; + } + + public SyntaxToken FinallyKeyword => this.finallyKeyword; + public BlockSyntax Block => this.block; - internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + 0 => this.finallyKeyword, + 1 => this.block, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FinallyClauseSyntax(this, parent, position); - internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); + + public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block) + { + if (finallyKeyword != this.FinallyKeyword || block != this.Block) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (identifier != null) - { - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken OpenParenToken => this.openParenToken; - public TypeSyntax Type => this.type; - public SyntaxToken? Identifier => this.identifier; - public SyntaxToken CloseParenToken => this.closeParenToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.type, - 2 => this.identifier, - 3 => this.closeParenToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchDeclarationSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); +internal sealed partial class CompilationUnitSyntax : CSharpSyntaxNode +{ + internal readonly GreenNode? externs; + internal readonly GreenNode? usings; + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? members; + internal readonly SyntaxToken endOfFileToken; - public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) + internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (externs != null) { - if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(externs); + this.externs = externs; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CatchDeclarationSyntax(this.Kind, this.openParenToken, this.type, this.identifier, this.closeParenToken, GetDiagnostics(), annotations); + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + this.AdjustFlagsAndWidth(endOfFileToken); + this.endOfFileToken = endOfFileToken; } - internal sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode + internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken whenKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly ExpressionSyntax filterExpression; - internal readonly SyntaxToken closeParenToken; - - internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + if (externs != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(filterExpression); - this.filterExpression = filterExpression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(externs); + this.externs = externs; } - - internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + if (usings != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(filterExpression); - this.filterExpression = filterExpression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(usings); + this.usings = usings; } - - internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) - : base(kind) + if (attributeLists != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whenKeyword); - this.whenKeyword = whenKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(filterExpression); - this.filterExpression = filterExpression; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - public SyntaxToken WhenKeyword => this.whenKeyword; - public SyntaxToken OpenParenToken => this.openParenToken; - public ExpressionSyntax FilterExpression => this.filterExpression; - public SyntaxToken CloseParenToken => this.closeParenToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.whenKeyword, - 1 => this.openParenToken, - 2 => this.filterExpression, - 3 => this.closeParenToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CatchFilterClauseSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); - - public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + if (members != null) { - if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(members); + this.members = members; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CatchFilterClauseSyntax(this.Kind, this.whenKeyword, this.openParenToken, this.filterExpression, this.closeParenToken, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(endOfFileToken); + this.endOfFileToken = endOfFileToken; } - internal sealed partial class FinallyClauseSyntax : CSharpSyntaxNode + internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken) + : base(kind) { - internal readonly SyntaxToken finallyKeyword; - internal readonly BlockSyntax block; - - internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + if (externs != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(finallyKeyword); - this.finallyKeyword = finallyKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(externs); + this.externs = externs; } - - internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, SyntaxFactoryContext context) - : base(kind) + if (usings != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(finallyKeyword); - this.finallyKeyword = finallyKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(usings); + this.usings = usings; } - - internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block) - : base(kind) + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(finallyKeyword); - this.finallyKeyword = finallyKeyword; - this.AdjustFlagsAndWidth(block); - this.block = block; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; } + this.AdjustFlagsAndWidth(endOfFileToken); + this.endOfFileToken = endOfFileToken; + } - public SyntaxToken FinallyKeyword => this.finallyKeyword; - public BlockSyntax Block => this.block; + public CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); + public CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); + /// Gets the attribute declaration list. + public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public SyntaxToken EndOfFileToken => this.endOfFileToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.finallyKeyword, - 1 => this.block, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.externs, + 1 => this.usings, + 2 => this.attributeLists, + 3 => this.members, + 4 => this.endOfFileToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FinallyClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CompilationUnitSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); - public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block) + public CompilationUnitSyntax Update(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) + { + if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) { - if (finallyKeyword != this.FinallyKeyword || block != this.Block) - { - var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FinallyClauseSyntax(this.Kind, this.finallyKeyword, this.block, GetDiagnostics(), annotations); + return this; } - internal sealed partial class CompilationUnitSyntax : CSharpSyntaxNode - { - internal readonly GreenNode? externs; - internal readonly GreenNode? usings; - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? members; - internal readonly SyntaxToken endOfFileToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, GetDiagnostics(), annotations); +} + +/// +/// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. +/// +internal sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken externKeyword; + internal readonly SyntaxToken aliasKeyword; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken semicolonToken; + + internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(externKeyword); + this.externKeyword = externKeyword; + this.AdjustFlagsAndWidth(aliasKeyword); + this.aliasKeyword = aliasKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(externKeyword); + this.externKeyword = externKeyword; + this.AdjustFlagsAndWidth(aliasKeyword); + this.aliasKeyword = aliasKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(externKeyword); + this.externKeyword = externKeyword; + this.AdjustFlagsAndWidth(aliasKeyword); + this.aliasKeyword = aliasKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + /// SyntaxToken representing the extern keyword. + public SyntaxToken ExternKeyword => this.externKeyword; + /// SyntaxToken representing the alias keyword. + public SyntaxToken AliasKeyword => this.aliasKeyword; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + /// SyntaxToken representing the semicolon token. + public SyntaxToken SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.externKeyword, + 1 => this.aliasKeyword, + 2 => this.identifier, + 3 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExternAliasDirectiveSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); + + public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + { + if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, GetDiagnostics(), annotations); +} + +internal sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken? globalKeyword; + internal readonly SyntaxToken usingKeyword; + internal readonly SyntaxToken? staticKeyword; + internal readonly SyntaxToken? unsafeKeyword; + internal readonly NameEqualsSyntax? alias; + internal readonly TypeSyntax namespaceOrType; + internal readonly SyntaxToken semicolonToken; - internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 7; + if (globalKeyword != null) { - this.SlotCount = 5; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(endOfFileToken); - this.endOfFileToken = endOfFileToken; + this.AdjustFlagsAndWidth(globalKeyword); + this.globalKeyword = globalKeyword; } - - internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + if (staticKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(endOfFileToken); - this.endOfFileToken = endOfFileToken; + this.AdjustFlagsAndWidth(staticKeyword); + this.staticKeyword = staticKeyword; } - - internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken) - : base(kind) + if (unsafeKeyword != null) { - this.SlotCount = 5; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(endOfFileToken); - this.endOfFileToken = endOfFileToken; + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; } - - public CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); - public CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); - /// Gets the attribute declaration list. - public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); - public SyntaxToken EndOfFileToken => this.endOfFileToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.externs, - 1 => this.usings, - 2 => this.attributeLists, - 3 => this.members, - 4 => this.endOfFileToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CompilationUnitSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); - - public CompilationUnitSyntax Update(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) + if (alias != null) { - if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) - { - var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(alias); + this.alias = alias; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CompilationUnitSyntax(this.Kind, this.externs, this.usings, this.attributeLists, this.members, this.endOfFileToken, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(namespaceOrType); + this.namespaceOrType = namespaceOrType; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - /// - /// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. - /// - internal sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode + internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken externKeyword; - internal readonly SyntaxToken aliasKeyword; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken semicolonToken; - - internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 7; + if (globalKeyword != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(externKeyword); - this.externKeyword = externKeyword; - this.AdjustFlagsAndWidth(aliasKeyword); - this.aliasKeyword = aliasKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(globalKeyword); + this.globalKeyword = globalKeyword; } - - internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + if (staticKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(externKeyword); - this.externKeyword = externKeyword; - this.AdjustFlagsAndWidth(aliasKeyword); - this.aliasKeyword = aliasKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(staticKeyword); + this.staticKeyword = staticKeyword; } - - internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) - : base(kind) + if (unsafeKeyword != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(externKeyword); - this.externKeyword = externKeyword; - this.AdjustFlagsAndWidth(aliasKeyword); - this.aliasKeyword = aliasKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; } - - /// SyntaxToken representing the extern keyword. - public SyntaxToken ExternKeyword => this.externKeyword; - /// SyntaxToken representing the alias keyword. - public SyntaxToken AliasKeyword => this.aliasKeyword; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - /// SyntaxToken representing the semicolon token. - public SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.externKeyword, - 1 => this.aliasKeyword, - 2 => this.identifier, - 3 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExternAliasDirectiveSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); - - public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + if (alias != null) { - if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(alias); + this.alias = alias; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ExternAliasDirectiveSyntax(this.Kind, this.externKeyword, this.aliasKeyword, this.identifier, this.semicolonToken, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(namespaceOrType); + this.namespaceOrType = namespaceOrType; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode + internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + : base(kind) { - internal readonly SyntaxToken? globalKeyword; - internal readonly SyntaxToken usingKeyword; - internal readonly SyntaxToken? staticKeyword; - internal readonly SyntaxToken? unsafeKeyword; - internal readonly NameEqualsSyntax? alias; - internal readonly TypeSyntax namespaceOrType; - internal readonly SyntaxToken semicolonToken; - - internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 7; + if (globalKeyword != null) { - this.SlotCount = 7; - if (globalKeyword != null) - { - this.AdjustFlagsAndWidth(globalKeyword); - this.globalKeyword = globalKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - if (staticKeyword != null) - { - this.AdjustFlagsAndWidth(staticKeyword); - this.staticKeyword = staticKeyword; - } - if (unsafeKeyword != null) - { - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - } - if (alias != null) - { - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - } - this.AdjustFlagsAndWidth(namespaceOrType); - this.namespaceOrType = namespaceOrType; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(globalKeyword); + this.globalKeyword = globalKeyword; } - - internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(usingKeyword); + this.usingKeyword = usingKeyword; + if (staticKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 7; - if (globalKeyword != null) - { - this.AdjustFlagsAndWidth(globalKeyword); - this.globalKeyword = globalKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - if (staticKeyword != null) - { - this.AdjustFlagsAndWidth(staticKeyword); - this.staticKeyword = staticKeyword; - } - if (unsafeKeyword != null) - { - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - } - if (alias != null) - { - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - } - this.AdjustFlagsAndWidth(namespaceOrType); - this.namespaceOrType = namespaceOrType; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(staticKeyword); + this.staticKeyword = staticKeyword; } - - internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) - : base(kind) + if (unsafeKeyword != null) { - this.SlotCount = 7; - if (globalKeyword != null) - { - this.AdjustFlagsAndWidth(globalKeyword); - this.globalKeyword = globalKeyword; - } - this.AdjustFlagsAndWidth(usingKeyword); - this.usingKeyword = usingKeyword; - if (staticKeyword != null) - { - this.AdjustFlagsAndWidth(staticKeyword); - this.staticKeyword = staticKeyword; - } - if (unsafeKeyword != null) - { - this.AdjustFlagsAndWidth(unsafeKeyword); - this.unsafeKeyword = unsafeKeyword; - } - if (alias != null) - { - this.AdjustFlagsAndWidth(alias); - this.alias = alias; - } - this.AdjustFlagsAndWidth(namespaceOrType); - this.namespaceOrType = namespaceOrType; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(unsafeKeyword); + this.unsafeKeyword = unsafeKeyword; + } + if (alias != null) + { + this.AdjustFlagsAndWidth(alias); + this.alias = alias; } + this.AdjustFlagsAndWidth(namespaceOrType); + this.namespaceOrType = namespaceOrType; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public SyntaxToken? GlobalKeyword => this.globalKeyword; - public SyntaxToken UsingKeyword => this.usingKeyword; - public SyntaxToken? StaticKeyword => this.staticKeyword; - public SyntaxToken? UnsafeKeyword => this.unsafeKeyword; - public NameEqualsSyntax? Alias => this.alias; - public TypeSyntax NamespaceOrType => this.namespaceOrType; - public SyntaxToken SemicolonToken => this.semicolonToken; + public SyntaxToken? GlobalKeyword => this.globalKeyword; + public SyntaxToken UsingKeyword => this.usingKeyword; + public SyntaxToken? StaticKeyword => this.staticKeyword; + public SyntaxToken? UnsafeKeyword => this.unsafeKeyword; + public NameEqualsSyntax? Alias => this.alias; + public TypeSyntax NamespaceOrType => this.namespaceOrType; + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.globalKeyword, - 1 => this.usingKeyword, - 2 => this.staticKeyword, - 3 => this.unsafeKeyword, - 4 => this.alias, - 5 => this.namespaceOrType, - 6 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.globalKeyword, + 1 => this.usingKeyword, + 2 => this.staticKeyword, + 3 => this.unsafeKeyword, + 4 => this.alias, + 5 => this.namespaceOrType, + 6 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingDirectiveSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UsingDirectiveSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); - public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + { + if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || unsafeKeyword != this.UnsafeKeyword || alias != this.Alias || namespaceOrType != this.NamespaceOrType || semicolonToken != this.SemicolonToken) { - if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || unsafeKeyword != this.UnsafeKeyword || alias != this.Alias || namespaceOrType != this.NamespaceOrType || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.unsafeKeyword, this.alias, this.namespaceOrType, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.unsafeKeyword, this.alias, this.namespaceOrType, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.unsafeKeyword, this.alias, this.namespaceOrType, this.semicolonToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new UsingDirectiveSyntax(this.Kind, this.globalKeyword, this.usingKeyword, this.staticKeyword, this.unsafeKeyword, this.alias, this.namespaceOrType, this.semicolonToken, GetDiagnostics(), annotations); +/// Member declaration syntax. +internal abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode +{ + internal MemberDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// Member declaration syntax. - internal abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode + internal MemberDeclarationSyntax(SyntaxKind kind) + : base(kind) { - internal MemberDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + } - internal MemberDeclarationSyntax(SyntaxKind kind) - : base(kind) - { - } + /// Gets the attribute declaration list. + public abstract CoreSyntax.SyntaxList AttributeLists { get; } - /// Gets the attribute declaration list. - public abstract CoreSyntax.SyntaxList AttributeLists { get; } + /// Gets the modifier list. + public abstract CoreSyntax.SyntaxList Modifiers { get; } +} - /// Gets the modifier list. - public abstract CoreSyntax.SyntaxList Modifiers { get; } +internal abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseNamespaceDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - internal abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax + internal BaseNamespaceDeclarationSyntax(SyntaxKind kind) + : base(kind) { - internal BaseNamespaceDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + } - internal BaseNamespaceDeclarationSyntax(SyntaxKind kind) - : base(kind) - { - } + public abstract SyntaxToken NamespaceKeyword { get; } - public abstract SyntaxToken NamespaceKeyword { get; } + public abstract NameSyntax Name { get; } - public abstract NameSyntax Name { get; } + public abstract CoreSyntax.SyntaxList Externs { get; } - public abstract CoreSyntax.SyntaxList Externs { get; } + public abstract CoreSyntax.SyntaxList Usings { get; } - public abstract CoreSyntax.SyntaxList Usings { get; } + public abstract CoreSyntax.SyntaxList Members { get; } +} - public abstract CoreSyntax.SyntaxList Members { get; } - } +internal sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken namespaceKeyword; + internal readonly NameSyntax name; + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? externs; + internal readonly GreenNode? usings; + internal readonly GreenNode? members; + internal readonly SyntaxToken closeBraceToken; + internal readonly SyntaxToken? semicolonToken; - internal sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax + internal 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) + : base(kind, diagnostics, annotations) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken namespaceKeyword; - internal readonly NameSyntax name; - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? externs; - internal readonly GreenNode? usings; - internal readonly GreenNode? members; - internal readonly SyntaxToken closeBraceToken; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SlotCount = 10; + if (attributeLists != null) { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) - : base(kind) + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (externs != null) { - this.SlotCount = 10; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(externs); + this.externs = externs; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; - public override NameSyntax Name => this.name; - public SyntaxToken OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); - public override CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); - public SyntaxToken CloseBraceToken => this.closeBraceToken; - /// Gets the optional semicolon token. - public SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.namespaceKeyword, - 3 => this.name, - 4 => this.openBraceToken, - 5 => this.externs, - 6 => this.usings, - 7 => this.members, - 8 => this.closeBraceToken, - 9 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NamespaceDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); - - public NamespaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); - } - - internal sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken namespaceKeyword; - internal readonly NameSyntax name; - internal readonly SyntaxToken semicolonToken; - internal readonly GreenNode? externs; - internal readonly GreenNode? usings; - internal readonly GreenNode? members; - - internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + if (semicolonToken != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; this.AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } } + } - internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxFactoryContext context) - : base(kind) + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 10; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (externs != null) + { + this.AdjustFlagsAndWidth(externs); + this.externs = externs; + } + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + if (semicolonToken != null) { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; this.AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } } + } - internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members) - : base(kind) + internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) + : base(kind) + { + this.SlotCount = 10; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (externs != null) + { + this.AdjustFlagsAndWidth(externs); + this.externs = externs; + } + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + if (semicolonToken != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(namespaceKeyword); - this.namespaceKeyword = namespaceKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; this.AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; - if (externs != null) - { - this.AdjustFlagsAndWidth(externs); - this.externs = externs; - } - if (usings != null) - { - this.AdjustFlagsAndWidth(usings); - this.usings = usings; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } } + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; - public override NameSyntax Name => this.name; - public SyntaxToken SemicolonToken => this.semicolonToken; - public override CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); - public override CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; + public override NameSyntax Name => this.name; + public SyntaxToken OpenBraceToken => this.openBraceToken; + public override CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); + public override CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public SyntaxToken CloseBraceToken => this.closeBraceToken; + /// Gets the optional semicolon token. + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.namespaceKeyword, - 3 => this.name, - 4 => this.semicolonToken, - 5 => this.externs, - 6 => this.usings, - 7 => this.members, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.namespaceKeyword, + 3 => this.name, + 4 => this.openBraceToken, + 5 => this.externs, + 6 => this.usings, + 7 => this.members, + 8 => this.closeBraceToken, + 9 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FileScopedNamespaceDeclarationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NamespaceDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); - public FileScopedNamespaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) + public NamespaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) - { - var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, GetDiagnostics(), annotations); + return this; } - /// Class representing one or more attributes applied to a language construct. - internal sealed partial class AttributeListSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken openBracketToken; - internal readonly AttributeTargetSpecifierSyntax? target; - internal readonly GreenNode? attributes; - internal readonly SyntaxToken closeBracketToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.openBraceToken, this.externs, this.usings, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); +} + +internal sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken namespaceKeyword; + internal readonly NameSyntax name; + internal readonly SyntaxToken semicolonToken; + internal readonly GreenNode? externs; + internal readonly GreenNode? usings; + internal readonly GreenNode? members; - internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (target != null) - { - this.AdjustFlagsAndWidth(target); - this.target = target; - } - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (target != null) - { - this.AdjustFlagsAndWidth(target); - this.target = target; - } - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken) - : base(kind) + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + if (externs != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (target != null) - { - this.AdjustFlagsAndWidth(target); - this.target = target; - } - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(externs); + this.externs = externs; } - - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => this.openBracketToken; - /// Gets the optional construct targeted by the attribute. - public AttributeTargetSpecifierSyntax? Target => this.target; - /// Gets the attribute declaration list. - public CoreSyntax.SeparatedSyntaxList Attributes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.attributes)); - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => this.closeBracketToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.target, - 2 => this.attributes, - 3 => this.closeBracketToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeListSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); - - public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + if (usings != null) { - if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, GetDiagnostics(), annotations); } - /// Class representing what language construct an attribute targets. - internal sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode + internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken colonToken; - - internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken) - : base(kind) + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + if (externs != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(externs); + this.externs = externs; } + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + } + + internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members) + : base(kind) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(namespaceKeyword); + this.namespaceKeyword = namespaceKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + if (externs != null) + { + this.AdjustFlagsAndWidth(externs); + this.externs = externs; + } + if (usings != null) + { + this.AdjustFlagsAndWidth(usings); + this.usings = usings; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + } - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - /// Gets the colon token. - public SyntaxToken ColonToken => this.colonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override SyntaxToken NamespaceKeyword => this.namespaceKeyword; + public override NameSyntax Name => this.name; + public SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList Externs => new CoreSyntax.SyntaxList(this.externs); + public override CoreSyntax.SyntaxList Usings => new CoreSyntax.SyntaxList(this.usings); + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.identifier, - 1 => this.colonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.namespaceKeyword, + 3 => this.name, + 4 => this.semicolonToken, + 5 => this.externs, + 6 => this.usings, + 7 => this.members, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeTargetSpecifierSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FileScopedNamespaceDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); - public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken) + public FileScopedNamespaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) { - if (identifier != this.Identifier || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, GetDiagnostics(), annotations); + return this; } - /// Attribute syntax. - internal sealed partial class AttributeSyntax : CSharpSyntaxNode - { - internal readonly NameSyntax name; - internal readonly AttributeArgumentListSyntax? argumentList; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FileScopedNamespaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.namespaceKeyword, this.name, this.semicolonToken, this.externs, this.usings, this.members, GetDiagnostics(), annotations); +} - internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +/// Class representing one or more attributes applied to a language construct. +internal sealed partial class AttributeListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openBracketToken; + internal readonly AttributeTargetSpecifierSyntax? target; + internal readonly GreenNode? attributes; + internal readonly SyntaxToken closeBracketToken; + + internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (target != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + this.AdjustFlagsAndWidth(target); + this.target = target; + } + if (attributes != null) + { + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, SyntaxFactoryContext context) - : base(kind) + internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (target != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + this.AdjustFlagsAndWidth(target); + this.target = target; + } + if (attributes != null) + { + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList) - : base(kind) + internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (target != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (argumentList != null) - { - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + this.AdjustFlagsAndWidth(target); + this.target = target; + } + if (attributes != null) + { + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - /// Gets the name. - public NameSyntax Name => this.name; - public AttributeArgumentListSyntax? ArgumentList => this.argumentList; + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => this.openBracketToken; + /// Gets the optional construct targeted by the attribute. + public AttributeTargetSpecifierSyntax? Target => this.target; + /// Gets the attribute declaration list. + public CoreSyntax.SeparatedSyntaxList Attributes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.attributes)); + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.argumentList, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.target, + 2 => this.attributes, + 3 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); - public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax argumentList) + public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) { - if (name != this.Name || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.Attribute(name, argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AttributeSyntax(this.Kind, this.name, this.argumentList, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AttributeSyntax(this.Kind, this.name, this.argumentList, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AttributeListSyntax(this.Kind, this.openBracketToken, this.target, this.attributes, this.closeBracketToken, GetDiagnostics(), annotations); +} + +/// Class representing what language construct an attribute targets. +internal sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken colonToken; + + internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; } - /// Attribute argument list syntax. - internal sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode + internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? arguments; - internal readonly SyntaxToken closeParenToken; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + /// Gets the colon token. + public SyntaxToken ColonToken => this.colonToken; - internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (arguments != null) - { - this.AdjustFlagsAndWidth(arguments); - this.arguments = arguments; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } - - /// Gets the open paren token. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Gets the arguments syntax list. - public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); - /// Gets the close paren token. - public SyntaxToken CloseParenToken => this.closeParenToken; + 0 => this.identifier, + 1 => this.colonToken, + _ => null, + }; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.arguments, - 2 => this.closeParenToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeTargetSpecifierSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); - public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken) + { + if (identifier != this.Identifier || colonToken != this.ColonToken) { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); + return this; } - /// Attribute argument syntax. - internal sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode - { - internal readonly NameEqualsSyntax? nameEquals; - internal readonly NameColonSyntax? nameColon; - internal readonly ExpressionSyntax expression; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, diagnostics, GetAnnotations()); - internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AttributeTargetSpecifierSyntax(this.Kind, this.identifier, this.colonToken, GetDiagnostics(), annotations); +} + +/// Attribute syntax. +internal sealed partial class AttributeSyntax : CSharpSyntaxNode +{ + internal readonly NameSyntax name; + internal readonly AttributeArgumentListSyntax? argumentList; + + internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (argumentList != null) { - this.SlotCount = 3; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } + } - internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (argumentList != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } + } - internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) - : base(kind) + internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (argumentList != null) { - this.SlotCount = 3; - if (nameEquals != null) - { - this.AdjustFlagsAndWidth(nameEquals); - this.nameEquals = nameEquals; - } - if (nameColon != null) - { - this.AdjustFlagsAndWidth(nameColon); - this.nameColon = nameColon; - } - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } + } - public NameEqualsSyntax? NameEquals => this.nameEquals; - public NameColonSyntax? NameColon => this.nameColon; - /// Gets the expression. - public ExpressionSyntax Expression => this.expression; + /// Gets the name. + public NameSyntax Name => this.name; + public AttributeArgumentListSyntax? ArgumentList => this.argumentList; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.nameEquals, - 1 => this.nameColon, - 2 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.argumentList, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); - public AttributeArgumentSyntax Update(NameEqualsSyntax nameEquals, NameColonSyntax nameColon, ExpressionSyntax expression) + public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax argumentList) + { + if (name != this.Name || argumentList != this.ArgumentList) { - if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression) - { - var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Attribute(name, argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, GetDiagnostics(), annotations); + return this; } - /// Class representing an identifier name followed by an equals token. - internal sealed partial class NameEqualsSyntax : CSharpSyntaxNode - { - internal readonly IdentifierNameSyntax name; - internal readonly SyntaxToken equalsToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AttributeSyntax(this.Kind, this.name, this.argumentList, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AttributeSyntax(this.Kind, this.name, this.argumentList, GetDiagnostics(), annotations); +} - internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +/// Attribute argument list syntax. +internal sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? arguments; + internal readonly SyntaxToken closeParenToken; + + internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, SyntaxFactoryContext context) - : base(kind) + internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken) - : base(kind) + internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (arguments != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(arguments); + this.arguments = arguments; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - /// Gets the identifier name. - public IdentifierNameSyntax Name => this.name; - public SyntaxToken EqualsToken => this.equalsToken; + /// Gets the open paren token. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Gets the arguments syntax list. + public CoreSyntax.SeparatedSyntaxList Arguments => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.arguments)); + /// Gets the close paren token. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.equalsToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.arguments, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameEqualsSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); - public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken) + public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { - if (name != this.Name || equalsToken != this.EqualsToken) - { - var newNode = SyntaxFactory.NameEquals(name, equalsToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, GetDiagnostics(), annotations); + return this; } - /// Type parameter list syntax. - internal sealed partial class TypeParameterListSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken lessThanToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken greaterThanToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AttributeArgumentListSyntax(this.Kind, this.openParenToken, this.arguments, this.closeParenToken, GetDiagnostics(), annotations); +} + +/// Attribute argument syntax. +internal sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode +{ + internal readonly NameEqualsSyntax? nameEquals; + internal readonly NameColonSyntax? nameColon; + internal readonly ExpressionSyntax expression; - internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (nameEquals != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; + } + if (nameColon != null) + { + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) - : base(kind) + internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (nameEquals != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; + } + if (nameColon != null) + { + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) - : base(kind) + internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 3; + if (nameEquals != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(nameEquals); + this.nameEquals = nameEquals; + } + if (nameColon != null) + { + this.AdjustFlagsAndWidth(nameColon); + this.nameColon = nameColon; } + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - /// Gets the < token. - public SyntaxToken LessThanToken => this.lessThanToken; - /// Gets the parameter list. - public CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); - /// Gets the > token. - public SyntaxToken GreaterThanToken => this.greaterThanToken; + public NameEqualsSyntax? NameEquals => this.nameEquals; + public NameColonSyntax? NameColon => this.nameColon; + /// Gets the expression. + public ExpressionSyntax Expression => this.expression; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanToken, - 1 => this.parameters, - 2 => this.greaterThanToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.nameEquals, + 1 => this.nameColon, + 2 => this.expression, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AttributeArgumentSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); - public TypeParameterListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public AttributeArgumentSyntax Update(NameEqualsSyntax nameEquals, NameColonSyntax nameColon, ExpressionSyntax expression) + { + if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression) { - if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AttributeArgumentSyntax(this.Kind, this.nameEquals, this.nameColon, this.expression, GetDiagnostics(), annotations); +} + +/// Class representing an identifier name followed by an equals token. +internal sealed partial class NameEqualsSyntax : CSharpSyntaxNode +{ + internal readonly IdentifierNameSyntax name; + internal readonly SyntaxToken equalsToken; + + internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations); + internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; } - /// Type parameter syntax. - internal sealed partial class TypeParameterSyntax : CSharpSyntaxNode + internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly SyntaxToken? varianceKeyword; - internal readonly SyntaxToken identifier; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + } - internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (varianceKeyword != null) - { - this.AdjustFlagsAndWidth(varianceKeyword); - this.varianceKeyword = varianceKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + /// Gets the identifier name. + public IdentifierNameSyntax Name => this.name; + public SyntaxToken EqualsToken => this.equalsToken; - internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (varianceKeyword != null) - { - this.AdjustFlagsAndWidth(varianceKeyword); - this.varianceKeyword = varianceKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - } + 0 => this.name, + 1 => this.equalsToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameEqualsSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); - internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) - : base(kind) + public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken) + { + if (name != this.Name || equalsToken != this.EqualsToken) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (varianceKeyword != null) - { - this.AdjustFlagsAndWidth(varianceKeyword); - this.varianceKeyword = varianceKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; + var newNode = SyntaxFactory.NameEquals(name, equalsToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// Gets the attribute declaration list. - public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public SyntaxToken? VarianceKeyword => this.varianceKeyword; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.varianceKeyword, - 2 => this.identifier, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NameEqualsSyntax(this.Kind, this.name, this.equalsToken, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); +/// Type parameter list syntax. +internal sealed partial class TypeParameterListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken lessThanToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken greaterThanToken; - public TypeParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) + internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) { - if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) - { - var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, GetDiagnostics(), annotations); + internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) + { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; + } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; } - /// Base class for type declaration syntax. - internal abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax + internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) + : base(kind) { - internal BaseTypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + if (parameters != null) { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } + + /// Gets the < token. + public SyntaxToken LessThanToken => this.lessThanToken; + /// Gets the parameter list. + public CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// Gets the > token. + public SyntaxToken GreaterThanToken => this.greaterThanToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.lessThanToken, + 1 => this.parameters, + 2 => this.greaterThanToken, + _ => null, + }; - internal BaseTypeDeclarationSyntax(SyntaxKind kind) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterListSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); + + public TypeParameterListSyntax Update(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) { + var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// Gets the identifier. - public abstract SyntaxToken Identifier { get; } + return this; + } - /// Gets the base type list. - public abstract BaseListSyntax? BaseList { get; } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, diagnostics, GetAnnotations()); - /// Gets the open brace token. - public abstract SyntaxToken? OpenBraceToken { get; } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeParameterListSyntax(this.Kind, this.lessThanToken, this.parameters, this.greaterThanToken, GetDiagnostics(), annotations); +} - /// Gets the close brace token. - public abstract SyntaxToken? CloseBraceToken { get; } +/// Type parameter syntax. +internal sealed partial class TypeParameterSyntax : CSharpSyntaxNode +{ + internal readonly GreenNode? attributeLists; + internal readonly SyntaxToken? varianceKeyword; + internal readonly SyntaxToken identifier; - /// Gets the optional semicolon token. - public abstract SyntaxToken? SemicolonToken { get; } + internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (varianceKeyword != null) + { + this.AdjustFlagsAndWidth(varianceKeyword); + this.varianceKeyword = varianceKeyword; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; } - /// Base class for type declaration syntax (class, struct, interface, record). - internal abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax + internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, SyntaxFactoryContext context) + : base(kind) { - internal TypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (varianceKeyword != null) { + this.AdjustFlagsAndWidth(varianceKeyword); + this.varianceKeyword = varianceKeyword; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - internal TypeDeclarationSyntax(SyntaxKind kind) - : base(kind) + internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (varianceKeyword != null) { + this.AdjustFlagsAndWidth(varianceKeyword); + this.varianceKeyword = varianceKeyword; } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + } - /// Gets the type keyword token ("class", "struct", "interface", "record"). - public abstract SyntaxToken Keyword { get; } + /// Gets the attribute declaration list. + public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public SyntaxToken? VarianceKeyword => this.varianceKeyword; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; - public abstract TypeParameterListSyntax? TypeParameterList { get; } + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.varianceKeyword, + 2 => this.identifier, + _ => null, + }; - public abstract ParameterListSyntax? ParameterList { get; } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterSyntax(this, parent, position); - /// Gets the type constraint list. - public abstract CoreSyntax.SyntaxList ConstraintClauses { get; } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); - /// Gets the member declarations. - public abstract CoreSyntax.SyntaxList Members { get; } - } - - /// Class type declaration syntax. - internal sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax + public TypeParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax? parameterList; - internal readonly BaseListSyntax? baseList; - internal readonly GreenNode? constraintClauses; - internal readonly SyntaxToken? openBraceToken; - internal readonly GreenNode? members; - internal readonly SyntaxToken? closeBraceToken; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } - - internal 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) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } - - internal 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) - : base(kind) + if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the class keyword token. - public override SyntaxToken Keyword => this.keyword; - public override SyntaxToken Identifier => this.identifier; - public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public override ParameterListSyntax? ParameterList => this.parameterList; - public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); - public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); - public override SyntaxToken? CloseBraceToken => this.closeBraceToken; - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.keyword, - 3 => this.identifier, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 8 => this.openBraceToken, - 9 => this.members, - 10 => this.closeBraceToken, - 11 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); - - public ClassDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + return this; + } - return this; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, diagnostics, GetAnnotations()); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeParameterSyntax(this.Kind, this.attributeLists, this.varianceKeyword, this.identifier, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); +/// Base class for type declaration syntax. +internal abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseTypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// Struct type declaration syntax. - internal sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax + internal BaseTypeDeclarationSyntax(SyntaxKind kind) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax? parameterList; - internal readonly BaseListSyntax? baseList; - internal readonly GreenNode? constraintClauses; - internal readonly SyntaxToken? openBraceToken; - internal readonly GreenNode? members; - internal readonly SyntaxToken? closeBraceToken; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + } - internal 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) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + /// Gets the identifier. + public abstract SyntaxToken Identifier { get; } - internal 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) - : base(kind) - { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + /// Gets the base type list. + public abstract BaseListSyntax? BaseList { get; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the struct keyword token. - public override SyntaxToken Keyword => this.keyword; - public override SyntaxToken Identifier => this.identifier; - public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public override ParameterListSyntax? ParameterList => this.parameterList; - public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); - public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); - public override SyntaxToken? CloseBraceToken => this.closeBraceToken; - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.keyword, - 3 => this.identifier, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 8 => this.openBraceToken, - 9 => this.members, - 10 => this.closeBraceToken, - 11 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StructDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); - - public StructDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + /// Gets the open brace token. + public abstract SyntaxToken? OpenBraceToken { get; } - return this; - } + /// Gets the close brace token. + public abstract SyntaxToken? CloseBraceToken { get; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + /// Gets the optional semicolon token. + public abstract SyntaxToken? SemicolonToken { get; } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); +/// Base class for type declaration syntax (class, struct, interface, record). +internal abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax +{ + internal TypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// Interface type declaration syntax. - internal sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax + internal TypeDeclarationSyntax(SyntaxKind kind) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax? parameterList; - internal readonly BaseListSyntax? baseList; - internal readonly GreenNode? constraintClauses; - internal readonly SyntaxToken? openBraceToken; - internal readonly GreenNode? members; - internal readonly SyntaxToken? closeBraceToken; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + } - internal 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) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + /// Gets the type keyword token ("class", "struct", "interface", "record"). + public abstract SyntaxToken Keyword { get; } - internal 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) - : base(kind) - { - this.SlotCount = 12; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + public abstract TypeParameterListSyntax? TypeParameterList { get; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the interface keyword token. - public override SyntaxToken Keyword => this.keyword; - public override SyntaxToken Identifier => this.identifier; - public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public override ParameterListSyntax? ParameterList => this.parameterList; - public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); - public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); - public override SyntaxToken? CloseBraceToken => this.closeBraceToken; - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.keyword, - 3 => this.identifier, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 8 => this.openBraceToken, - 9 => this.members, - 10 => this.closeBraceToken, - 11 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterfaceDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); - - public InterfaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public abstract ParameterListSyntax? ParameterList { get; } - return this; - } + /// Gets the type constraint list. + public abstract CoreSyntax.SyntaxList ConstraintClauses { get; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + /// Gets the member declarations. + public abstract CoreSyntax.SyntaxList Members { get; } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); - } +/// Class type declaration syntax. +internal sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax? parameterList; + internal readonly BaseListSyntax? baseList; + internal readonly GreenNode? constraintClauses; + internal readonly SyntaxToken? openBraceToken; + internal readonly GreenNode? members; + internal readonly SyntaxToken? closeBraceToken; + internal readonly SyntaxToken? semicolonToken; - internal sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax + internal 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) + : base(kind, diagnostics, annotations) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken keyword; - internal readonly SyntaxToken? classOrStructKeyword; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax? parameterList; - internal readonly BaseListSyntax? baseList; - internal readonly GreenNode? constraintClauses; - internal readonly SyntaxToken? openBraceToken; - internal readonly GreenNode? members; - internal readonly SyntaxToken? closeBraceToken; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SlotCount = 12; + if (attributeLists != null) { - this.SlotCount = 13; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (classOrStructKeyword != null) - { - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the class keyword token. + public override SyntaxToken Keyword => this.keyword; + public override SyntaxToken Identifier => this.identifier; + public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public override ParameterListSyntax? ParameterList => this.parameterList; + public override BaseListSyntax? BaseList => this.baseList; + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override SyntaxToken? OpenBraceToken => this.openBraceToken; + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override SyntaxToken? CloseBraceToken => this.closeBraceToken; + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.keyword, + 3 => this.identifier, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 8 => this.openBraceToken, + 9 => this.members, + 10 => this.closeBraceToken, + 11 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); + + public ClassDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ClassDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); +} + +/// Struct type declaration syntax. +internal sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax? parameterList; + internal readonly BaseListSyntax? baseList; + internal readonly GreenNode? constraintClauses; + internal readonly SyntaxToken? openBraceToken; + internal readonly GreenNode? members; + internal readonly SyntaxToken? closeBraceToken; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the struct keyword token. + public override SyntaxToken Keyword => this.keyword; + public override SyntaxToken Identifier => this.identifier; + public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public override ParameterListSyntax? ParameterList => this.parameterList; + public override BaseListSyntax? BaseList => this.baseList; + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override SyntaxToken? OpenBraceToken => this.openBraceToken; + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override SyntaxToken? CloseBraceToken => this.closeBraceToken; + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.keyword, + 3 => this.identifier, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 8 => this.openBraceToken, + 9 => this.members, + 10 => this.closeBraceToken, + 11 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.StructDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); + + public StructDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new StructDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); +} + +/// Interface type declaration syntax. +internal sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax? parameterList; + internal readonly BaseListSyntax? baseList; + internal readonly GreenNode? constraintClauses; + internal readonly SyntaxToken? openBraceToken; + internal readonly GreenNode? members; + internal readonly SyntaxToken? closeBraceToken; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SlotCount = 12; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the interface keyword token. + public override SyntaxToken Keyword => this.keyword; + public override SyntaxToken Identifier => this.identifier; + public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public override ParameterListSyntax? ParameterList => this.parameterList; + public override BaseListSyntax? BaseList => this.baseList; + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override SyntaxToken? OpenBraceToken => this.openBraceToken; + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override SyntaxToken? CloseBraceToken => this.closeBraceToken; + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.keyword, + 3 => this.identifier, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 8 => this.openBraceToken, + 9 => this.members, + 10 => this.closeBraceToken, + 11 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.InterfaceDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); + + public InterfaceDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new InterfaceDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); +} + +internal sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken keyword; + internal readonly SyntaxToken? classOrStructKeyword; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax? parameterList; + internal readonly BaseListSyntax? baseList; + internal readonly GreenNode? constraintClauses; + internal readonly SyntaxToken? openBraceToken; + internal readonly GreenNode? members; + internal readonly SyntaxToken? closeBraceToken; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 13; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (classOrStructKeyword != null) + { + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 13; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (classOrStructKeyword != null) + { + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } + + internal 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) + : base(kind) + { + this.SlotCount = 13; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (classOrStructKeyword != null) + { + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + if (parameterList != null) + { + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + } + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } + + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override SyntaxToken Keyword => this.keyword; + public SyntaxToken? ClassOrStructKeyword => this.classOrStructKeyword; + public override SyntaxToken Identifier => this.identifier; + public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public override ParameterListSyntax? ParameterList => this.parameterList; + public override BaseListSyntax? BaseList => this.baseList; + public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override SyntaxToken? OpenBraceToken => this.openBraceToken; + public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); + public override SyntaxToken? CloseBraceToken => this.closeBraceToken; + public override SyntaxToken? SemicolonToken => this.semicolonToken; - internal 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) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 13; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (classOrStructKeyword != null) - { - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.keyword, + 3 => this.classOrStructKeyword, + 4 => this.identifier, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.baseList, + 8 => this.constraintClauses, + 9 => this.openBraceToken, + 10 => this.members, + 11 => this.closeBraceToken, + 12 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecordDeclarationSyntax(this, parent, position); - internal 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) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); + + public RecordDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { - this.SlotCount = 13; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (classOrStructKeyword != null) - { - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - if (parameterList != null) - { - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - } - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.RecordDeclaration(this.Kind, attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public override SyntaxToken Keyword => this.keyword; - public SyntaxToken? ClassOrStructKeyword => this.classOrStructKeyword; - public override SyntaxToken Identifier => this.identifier; - public override TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public override ParameterListSyntax? ParameterList => this.parameterList; - public override BaseListSyntax? BaseList => this.baseList; - public override CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); - public override SyntaxToken? OpenBraceToken => this.openBraceToken; - public override CoreSyntax.SyntaxList Members => new CoreSyntax.SyntaxList(this.members); - public override SyntaxToken? CloseBraceToken => this.closeBraceToken; - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.keyword, - 3 => this.classOrStructKeyword, - 4 => this.identifier, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.baseList, - 8 => this.constraintClauses, - 9 => this.openBraceToken, - 10 => this.members, - 11 => this.closeBraceToken, - 12 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RecordDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); - - public RecordDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, BaseListSyntax baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.RecordDeclaration(this.Kind, attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + return this; + } - return this; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RecordDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.classOrStructKeyword, this.identifier, this.typeParameterList, this.parameterList, this.baseList, this.constraintClauses, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); - } +/// Enum type declaration syntax. +internal sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken enumKeyword; + internal readonly SyntaxToken identifier; + internal readonly BaseListSyntax? baseList; + internal readonly SyntaxToken? openBraceToken; + internal readonly GreenNode? members; + internal readonly SyntaxToken? closeBraceToken; + internal readonly SyntaxToken? semicolonToken; - /// Enum type declaration syntax. - internal sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax + internal 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) + : base(kind, diagnostics, annotations) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken enumKeyword; - internal readonly SyntaxToken identifier; - internal readonly BaseListSyntax? baseList; - internal readonly SyntaxToken? openBraceToken; - internal readonly GreenNode? members; - internal readonly SyntaxToken? closeBraceToken; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(enumKeyword); - this.enumKeyword = enumKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(enumKeyword); - this.enumKeyword = enumKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - : base(kind) + this.AdjustFlagsAndWidth(enumKeyword); + this.enumKeyword = enumKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (baseList != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(enumKeyword); - this.enumKeyword = enumKeyword; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (baseList != null) - { - this.AdjustFlagsAndWidth(baseList); - this.baseList = baseList; - } - if (openBraceToken != null) - { - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - } - if (members != null) - { - this.AdjustFlagsAndWidth(members); - this.members = members; - } - if (closeBraceToken != null) - { - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the enum keyword token. - public SyntaxToken EnumKeyword => this.enumKeyword; - public override SyntaxToken Identifier => this.identifier; - public override BaseListSyntax? BaseList => this.baseList; - public override SyntaxToken? OpenBraceToken => this.openBraceToken; - /// Gets the members declaration list. - public CoreSyntax.SeparatedSyntaxList Members => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.members)); - public override SyntaxToken? CloseBraceToken => this.closeBraceToken; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.enumKeyword, - 3 => this.identifier, - 4 => this.baseList, - 5 => this.openBraceToken, - 6 => this.members, - 7 => this.closeBraceToken, - 8 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); - - public EnumDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax baseList, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); - } - - /// Delegate declaration syntax. - internal sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken delegateKeyword; - internal readonly TypeSyntax returnType; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax parameterList; - internal readonly GreenNode? constraintClauses; - internal readonly SyntaxToken semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } this.AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; } + } - internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 9; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(enumKeyword); + this.enumKeyword = enumKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) { - this.SetFactoryContext(context); - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } this.AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; } + } - internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken) - : base(kind) + internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + : base(kind) + { + this.SlotCount = 9; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(enumKeyword); + this.enumKeyword = enumKeyword; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (baseList != null) + { + this.AdjustFlagsAndWidth(baseList); + this.baseList = baseList; + } + if (openBraceToken != null) + { + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + } + if (members != null) + { + this.AdjustFlagsAndWidth(members); + this.members = members; + } + if (closeBraceToken != null) + { + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } + if (semicolonToken != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(delegateKeyword); - this.delegateKeyword = delegateKeyword; - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } this.AdjustFlagsAndWidth(semicolonToken); this.semicolonToken = semicolonToken; } + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the "delegate" keyword. - public SyntaxToken DelegateKeyword => this.delegateKeyword; - /// Gets the return type. - public TypeSyntax ReturnType => this.returnType; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - /// Gets the parameter list. - public ParameterListSyntax ParameterList => this.parameterList; - /// Gets the constraint clause list. - public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); - /// Gets the semicolon token. - public SyntaxToken SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.delegateKeyword, - 3 => this.returnType, - 4 => this.identifier, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.constraintClauses, - 8 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DelegateDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); - - public DelegateDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the enum keyword token. + public SyntaxToken EnumKeyword => this.enumKeyword; + public override SyntaxToken Identifier => this.identifier; + public override BaseListSyntax? BaseList => this.baseList; + public override SyntaxToken? OpenBraceToken => this.openBraceToken; + /// Gets the members declaration list. + public CoreSyntax.SeparatedSyntaxList Members => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.members)); + public override SyntaxToken? CloseBraceToken => this.closeBraceToken; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; - return this; - } + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.enumKeyword, + 3 => this.identifier, + 4 => this.baseList, + 5 => this.openBraceToken, + 6 => this.members, + 7 => this.closeBraceToken, + 8 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumDeclarationSyntax(this, parent, position); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, diagnostics, GetAnnotations()); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); + + public EnumDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax baseList, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EnumDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.enumKeyword, this.identifier, this.baseList, this.openBraceToken, this.members, this.closeBraceToken, this.semicolonToken, GetDiagnostics(), annotations); +} + +/// Delegate declaration syntax. +internal sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken delegateKeyword; + internal readonly TypeSyntax returnType; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax parameterList; + internal readonly GreenNode? constraintClauses; + internal readonly SyntaxToken semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken identifier; - internal readonly EqualsValueClauseSyntax? equalsValue; + this.SlotCount = 9; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (equalsValue != null) - { - this.AdjustFlagsAndWidth(equalsValue); - this.equalsValue = equalsValue; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + + internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 9; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(delegateKeyword); + this.delegateKeyword = delegateKeyword; + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (equalsValue != null) - { - this.AdjustFlagsAndWidth(equalsValue); - this.equalsValue = equalsValue; - } + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; } - - internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) - : base(kind) + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (equalsValue != null) - { - this.AdjustFlagsAndWidth(equalsValue); - this.equalsValue = equalsValue; - } + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; } + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public EqualsValueClauseSyntax? EqualsValue => this.equalsValue; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the "delegate" keyword. + public SyntaxToken DelegateKeyword => this.delegateKeyword; + /// Gets the return type. + public TypeSyntax ReturnType => this.returnType; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + /// Gets the parameter list. + public ParameterListSyntax ParameterList => this.parameterList; + /// Gets the constraint clause list. + public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + /// Gets the semicolon token. + public SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.identifier, - 3 => this.equalsValue, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.delegateKeyword, + 3 => this.returnType, + 4 => this.identifier, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.constraintClauses, + 8 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumMemberDeclarationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DelegateDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); - public EnumMemberDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax equalsValue) + public DelegateDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) - { - var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, GetDiagnostics(), annotations); + return this; } - /// Base list syntax. - internal sealed partial class BaseListSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken colonToken; - internal readonly GreenNode? types; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DelegateDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.delegateKeyword, this.returnType, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.semicolonToken, GetDiagnostics(), annotations); +} + +internal sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken identifier; + internal readonly EqualsValueClauseSyntax? equalsValue; - internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (types != null) - { - this.AdjustFlagsAndWidth(types); - this.types = types; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (equalsValue != null) + { + this.AdjustFlagsAndWidth(equalsValue); + this.equalsValue = equalsValue; } + } - internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, SyntaxFactoryContext context) - : base(kind) + internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (types != null) - { - this.AdjustFlagsAndWidth(types); - this.types = types; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (equalsValue != null) + { + this.AdjustFlagsAndWidth(equalsValue); + this.equalsValue = equalsValue; } + } - internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types) - : base(kind) + internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + : base(kind) + { + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (types != null) - { - this.AdjustFlagsAndWidth(types); - this.types = types; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (equalsValue != null) + { + this.AdjustFlagsAndWidth(equalsValue); + this.equalsValue = equalsValue; } + } - /// Gets the colon token. - public SyntaxToken ColonToken => this.colonToken; - /// Gets the base type references. - public CoreSyntax.SeparatedSyntaxList Types => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.types)); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public EqualsValueClauseSyntax? EqualsValue => this.equalsValue; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.colonToken, - 1 => this.types, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.identifier, + 3 => this.equalsValue, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EnumMemberDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); - public BaseListSyntax Update(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) + public EnumMemberDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax equalsValue) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) { - if (colonToken != this.ColonToken || types != this.Types) - { - var newNode = SyntaxFactory.BaseList(colonToken, types); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BaseListSyntax(this.Kind, this.colonToken, this.types, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BaseListSyntax(this.Kind, this.colonToken, this.types, GetDiagnostics(), annotations); + return this; } - /// Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. - internal abstract partial class BaseTypeSyntax : CSharpSyntaxNode + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EnumMemberDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.equalsValue, GetDiagnostics(), annotations); +} + +/// Base list syntax. +internal sealed partial class BaseListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken colonToken; + internal readonly GreenNode? types; + + internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal BaseTypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (types != null) { + this.AdjustFlagsAndWidth(types); + this.types = types; } + } - internal BaseTypeSyntax(SyntaxKind kind) - : base(kind) + internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (types != null) { + this.AdjustFlagsAndWidth(types); + this.types = types; } - - public abstract TypeSyntax Type { get; } } - internal sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax + internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types) + : base(kind) { - internal readonly TypeSyntax type; - - internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 2; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (types != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(types); + this.types = types; } + } + + /// Gets the colon token. + public SyntaxToken ColonToken => this.colonToken; + /// Gets the base type references. + public CoreSyntax.SeparatedSyntaxList Types => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.types)); - internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + 0 => this.colonToken, + 1 => this.types, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BaseListSyntax(this, parent, position); - internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); + + public BaseListSyntax Update(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) + { + if (colonToken != this.ColonToken || types != this.Types) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; + var newNode = SyntaxFactory.BaseList(colonToken, types); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override TypeSyntax Type => this.type; + return this; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.type : null; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BaseListSyntax(this.Kind, this.colonToken, this.types, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleBaseTypeSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BaseListSyntax(this.Kind, this.colonToken, this.types, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); +/// Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. +internal abstract partial class BaseTypeSyntax : CSharpSyntaxNode +{ + internal BaseTypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public SimpleBaseTypeSyntax Update(TypeSyntax type) - { - if (type != this.Type) - { - var newNode = SyntaxFactory.SimpleBaseType(type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal BaseTypeSyntax(SyntaxKind kind) + : base(kind) + { + } - return this; - } + public abstract TypeSyntax Type { get; } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SimpleBaseTypeSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); +internal sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax +{ + internal readonly TypeSyntax type; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SimpleBaseTypeSyntax(this.Kind, this.type, GetDiagnostics(), annotations); + internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; } - internal sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax + internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) { - internal readonly TypeSyntax type; - internal readonly ArgumentListSyntax argumentList; + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; - } + public override TypeSyntax Type => this.type; + + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.type : null; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SimpleBaseTypeSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); - internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList) - : base(kind) + public SimpleBaseTypeSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + var newNode = SyntaxFactory.SimpleBaseType(type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override TypeSyntax Type => this.type; - public ArgumentListSyntax ArgumentList => this.argumentList; + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SimpleBaseTypeSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.argumentList, - _ => null, - }; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SimpleBaseTypeSyntax(this.Kind, this.type, GetDiagnostics(), annotations); +} + +internal sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax +{ + internal readonly TypeSyntax type; + internal readonly ArgumentListSyntax argumentList; + + internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } + + internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrimaryConstructorBaseTypeSyntax(this, parent, position); + internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); + public override TypeSyntax Type => this.type; + public ArgumentListSyntax ArgumentList => this.argumentList; - public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) + internal override GreenNode? GetSlot(int index) + => index switch { - if (type != this.Type || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.type, + 1 => this.argumentList, + _ => null, + }; - return this; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PrimaryConstructorBaseTypeSyntax(this, parent, position); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, diagnostics, GetAnnotations()); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); + + public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) + { + if (type != this.Type || argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, GetDiagnostics(), annotations); + return this; } - /// Type parameter constraint clause. - internal sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken whereKeyword; - internal readonly IdentifierNameSyntax name; - internal readonly SyntaxToken colonToken; - internal readonly GreenNode? constraints; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PrimaryConstructorBaseTypeSyntax(this.Kind, this.type, this.argumentList, GetDiagnostics(), annotations); +} + +/// Type parameter constraint clause. +internal sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken whereKeyword; + internal readonly IdentifierNameSyntax name; + internal readonly SyntaxToken colonToken; + internal readonly GreenNode? constraints; - internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (constraints != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (constraints != null) - { - this.AdjustFlagsAndWidth(constraints); - this.constraints = constraints; - } + this.AdjustFlagsAndWidth(constraints); + this.constraints = constraints; } + } - internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, SyntaxFactoryContext context) - : base(kind) + internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (constraints != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (constraints != null) - { - this.AdjustFlagsAndWidth(constraints); - this.constraints = constraints; - } + this.AdjustFlagsAndWidth(constraints); + this.constraints = constraints; } + } - internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints) - : base(kind) + internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(whereKeyword); + this.whereKeyword = whereKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + if (constraints != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(whereKeyword); - this.whereKeyword = whereKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - if (constraints != null) - { - this.AdjustFlagsAndWidth(constraints); - this.constraints = constraints; - } + this.AdjustFlagsAndWidth(constraints); + this.constraints = constraints; } + } - public SyntaxToken WhereKeyword => this.whereKeyword; - /// Gets the identifier. - public IdentifierNameSyntax Name => this.name; - /// Gets the colon token. - public SyntaxToken ColonToken => this.colonToken; - /// Gets the constraints list. - public CoreSyntax.SeparatedSyntaxList Constraints => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.constraints)); + public SyntaxToken WhereKeyword => this.whereKeyword; + /// Gets the identifier. + public IdentifierNameSyntax Name => this.name; + /// Gets the colon token. + public SyntaxToken ColonToken => this.colonToken; + /// Gets the constraints list. + public CoreSyntax.SeparatedSyntaxList Constraints => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.constraints)); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.whereKeyword, - 1 => this.name, - 2 => this.colonToken, - 3 => this.constraints, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.whereKeyword, + 1 => this.name, + 2 => this.colonToken, + 3 => this.constraints, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterConstraintClauseSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeParameterConstraintClauseSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); - public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) + public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) + { + if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) { - if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) - { - var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, GetDiagnostics(), annotations); +} + +/// Base type for type parameter constraint syntax. +internal abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode +{ + internal TypeParameterConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } + + internal TypeParameterConstraintSyntax(SyntaxKind kind) + : base(kind) + { + } +} + +/// Constructor constraint syntax. +internal sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax +{ + internal readonly SyntaxToken newKeyword; + internal readonly SyntaxToken openParenToken; + internal readonly SyntaxToken closeParenToken; + + internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeParameterConstraintClauseSyntax(this.Kind, this.whereKeyword, this.name, this.colonToken, this.constraints, GetDiagnostics(), annotations); + internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; } - /// Base type for type parameter constraint syntax. - internal abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode + internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + : base(kind) { - internal TypeParameterConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(newKeyword); + this.newKeyword = newKeyword; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + /// Gets the "new" keyword. + public SyntaxToken NewKeyword => this.newKeyword; + /// Gets the open paren keyword. + public SyntaxToken OpenParenToken => this.openParenToken; + /// Gets the close paren keyword. + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch { - } + 0 => this.newKeyword, + 1 => this.openParenToken, + 2 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorConstraintSyntax(this, parent, position); - internal TypeParameterConstraintSyntax(SyntaxKind kind) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); + + public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + { + if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } + + return this; } - /// Constructor constraint syntax. - internal sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax - { - internal readonly SyntaxToken newKeyword; - internal readonly SyntaxToken openParenToken; - internal readonly SyntaxToken closeParenToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, diagnostics, GetAnnotations()); - internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, GetDiagnostics(), annotations); +} + +/// Class or struct constraint syntax. +internal sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax +{ + internal readonly SyntaxToken classOrStructKeyword; + internal readonly SyntaxToken? questionToken; + + internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + if (questionToken != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; } + } - internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + if (questionToken != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; } + } - internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) - : base(kind) + internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(classOrStructKeyword); + this.classOrStructKeyword = classOrStructKeyword; + if (questionToken != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(newKeyword); - this.newKeyword = newKeyword; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(questionToken); + this.questionToken = questionToken; } + } - /// Gets the "new" keyword. - public SyntaxToken NewKeyword => this.newKeyword; - /// Gets the open paren keyword. - public SyntaxToken OpenParenToken => this.openParenToken; - /// Gets the close paren keyword. - public SyntaxToken CloseParenToken => this.closeParenToken; + /// Gets the constraint keyword ("class" or "struct"). + public SyntaxToken ClassOrStructKeyword => this.classOrStructKeyword; + /// SyntaxToken representing the question mark. + public SyntaxToken? QuestionToken => this.questionToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.newKeyword, - 1 => this.openParenToken, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.classOrStructKeyword, + 1 => this.questionToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorConstraintSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassOrStructConstraintSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); - public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken) + { + if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken) { - if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind, classOrStructKeyword, questionToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, GetDiagnostics(), annotations); +} + +/// Type constraint syntax. +internal sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax +{ + internal readonly TypeSyntax type; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConstructorConstraintSyntax(this.Kind, this.newKeyword, this.openParenToken, this.closeParenToken, GetDiagnostics(), annotations); + internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; } - /// Class or struct constraint syntax. - internal sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax + internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken classOrStructKeyword; - internal readonly SyntaxToken? questionToken; + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - if (questionToken != null) - { - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - } - } + internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type) + : base(kind) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - if (questionToken != null) - { - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - } - } + /// Gets the type syntax. + public TypeSyntax Type => this.type; - internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.type : null; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeConstraintSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); + + public TypeConstraintSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(classOrStructKeyword); - this.classOrStructKeyword = classOrStructKeyword; - if (questionToken != null) - { - this.AdjustFlagsAndWidth(questionToken); - this.questionToken = questionToken; - } + var newNode = SyntaxFactory.TypeConstraint(type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// Gets the constraint keyword ("class" or "struct"). - public SyntaxToken ClassOrStructKeyword => this.classOrStructKeyword; - /// SyntaxToken representing the question mark. - public SyntaxToken? QuestionToken => this.questionToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.classOrStructKeyword, - 1 => this.questionToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ClassOrStructConstraintSyntax(this, parent, position); + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeConstraintSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken) - { - if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken) - { - var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind, classOrStructKeyword, questionToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeConstraintSyntax(this.Kind, this.type, GetDiagnostics(), annotations); +} - return this; - } +/// Default constraint syntax. +internal sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax +{ + internal readonly SyntaxToken defaultKeyword; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, diagnostics, GetAnnotations()); + internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(defaultKeyword); + this.defaultKeyword = defaultKeyword; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ClassOrStructConstraintSyntax(this.Kind, this.classOrStructKeyword, this.questionToken, GetDiagnostics(), annotations); + internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(defaultKeyword); + this.defaultKeyword = defaultKeyword; } - /// Type constraint syntax. - internal sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax + internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword) + : base(kind) { - internal readonly TypeSyntax type; + this.SlotCount = 1; + this.AdjustFlagsAndWidth(defaultKeyword); + this.defaultKeyword = defaultKeyword; + } - internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + /// Gets the "default" keyword. + public SyntaxToken DefaultKeyword => this.defaultKeyword; - internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.defaultKeyword : null; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultConstraintSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); - internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type) - : base(kind) + public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword) + { + if (defaultKeyword != this.DefaultKeyword) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; + var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// Gets the type syntax. - public TypeSyntax Type => this.type; + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, diagnostics, GetAnnotations()); - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.type : null; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, GetDiagnostics(), annotations); +} - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeConstraintSyntax(this, parent, position); +internal abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseFieldDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); + internal BaseFieldDeclarationSyntax(SyntaxKind kind) + : base(kind) + { + } - public TypeConstraintSyntax Update(TypeSyntax type) - { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypeConstraint(type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public abstract VariableDeclarationSyntax Declaration { get; } - return this; - } + public abstract SyntaxToken SemicolonToken { get; } +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeConstraintSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); +internal sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly VariableDeclarationSyntax declaration; + internal readonly SyntaxToken semicolonToken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeConstraintSyntax(this.Kind, this.type, GetDiagnostics(), annotations); + internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - /// Default constraint syntax. - internal sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax + internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken defaultKeyword; - - internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 4; + if (attributeLists != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(defaultKeyword); - this.defaultKeyword = defaultKeyword; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(defaultKeyword); - this.defaultKeyword = defaultKeyword; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword) - : base(kind) + internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 4; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(defaultKeyword); - this.defaultKeyword = defaultKeyword; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - /// Gets the "default" keyword. - public SyntaxToken DefaultKeyword => this.defaultKeyword; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override VariableDeclarationSyntax Declaration => this.declaration; + public override SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.defaultKeyword : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.declaration, + 3 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefaultConstraintSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FieldDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); - public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword) + public FieldDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { - if (defaultKeyword != this.DefaultKeyword) - { - var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DefaultConstraintSyntax(this.Kind, this.defaultKeyword, GetDiagnostics(), annotations); + return this; } - internal abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); +} + +internal sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken eventKeyword; + internal readonly VariableDeclarationSyntax declaration; + internal readonly SyntaxToken semicolonToken; + + internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal BaseFieldDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseFieldDeclarationSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - public abstract VariableDeclarationSyntax Declaration { get; } - - public abstract SyntaxToken SemicolonToken { get; } + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - internal sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax + internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly VariableDeclarationSyntax declaration; - internal readonly SyntaxToken semicolonToken; - - internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - : base(kind) + internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + : base(kind) + { + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 4; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(declaration); + this.declaration = declaration; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public override VariableDeclarationSyntax Declaration => this.declaration; - public override SyntaxToken SemicolonToken => this.semicolonToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public SyntaxToken EventKeyword => this.eventKeyword; + public override VariableDeclarationSyntax Declaration => this.declaration; + public override SyntaxToken SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.declaration, - 3 => this.semicolonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.eventKeyword, + 3 => this.declaration, + 4 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FieldDeclarationSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventFieldDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); - public FieldDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public EventFieldDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); +} + +internal sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode +{ + internal readonly NameSyntax name; + internal readonly SyntaxToken dotToken; + + internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); + internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; } - internal sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax + internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken eventKeyword; - internal readonly VariableDeclarationSyntax declaration; - internal readonly SyntaxToken semicolonToken; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + } - internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + public NameSyntax Name => this.name; + public SyntaxToken DotToken => this.dotToken; - internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + 0 => this.name, + 1 => this.dotToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExplicitInterfaceSpecifierSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); - internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - : base(kind) + public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken) + { + if (name != this.Name || dotToken != this.DotToken) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(declaration); - this.declaration = declaration; - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; + var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public SyntaxToken EventKeyword => this.eventKeyword; - public override VariableDeclarationSyntax Declaration => this.declaration; - public override SyntaxToken SemicolonToken => this.semicolonToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.eventKeyword, - 3 => this.declaration, - 4 => this.semicolonToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventFieldDeclarationSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); +/// Base type for method declaration syntax. +internal abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseMethodDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public EventFieldDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal BaseMethodDeclarationSyntax(SyntaxKind kind) + : base(kind) + { + } - return this; - } + /// Gets the parameter list. + public abstract ParameterListSyntax ParameterList { get; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, diagnostics, GetAnnotations()); + public abstract BlockSyntax? Body { get; } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EventFieldDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.declaration, this.semicolonToken, GetDiagnostics(), annotations); - } + public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; } - internal sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode - { - internal readonly NameSyntax name; - internal readonly SyntaxToken dotToken; + /// Gets the optional semicolon token. + public abstract SyntaxToken? SemicolonToken { get; } +} - internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +/// Method declaration syntax. +internal sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax returnType; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken identifier; + internal readonly TypeParameterListSyntax? typeParameterList; + internal readonly ParameterListSyntax parameterList; + internal readonly GreenNode? constraintClauses; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken) - : base(kind) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - public NameSyntax Name => this.name; - public SyntaxToken DotToken => this.dotToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.dotToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ExplicitInterfaceSpecifierSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); - - public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) { - if (name != this.Name || dotToken != this.DotToken) - { - var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ExplicitInterfaceSpecifierSyntax(this.Kind, this.name, this.dotToken, GetDiagnostics(), annotations); } - /// Base type for method declaration syntax. - internal abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax + internal 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) + : base(kind) { - internal BaseMethodDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 11; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseMethodDeclarationSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) + { + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - /// Gets the parameter list. - public abstract ParameterListSyntax ParameterList { get; } - - public abstract BlockSyntax? Body { get; } - - public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; } - - /// Gets the optional semicolon token. - public abstract SyntaxToken? SemicolonToken { get; } } - /// Method declaration syntax. - internal sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax + internal 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) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax returnType; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken identifier; - internal readonly TypeParameterListSyntax? typeParameterList; - internal readonly ParameterListSyntax parameterList; - internal readonly GreenNode? constraintClauses; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - internal 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) - : base(kind) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (typeParameterList != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (typeParameterList != null) - { - this.AdjustFlagsAndWidth(typeParameterList); - this.typeParameterList = typeParameterList; - } - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (constraintClauses != null) - { - this.AdjustFlagsAndWidth(constraintClauses); - this.constraintClauses = constraintClauses; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(typeParameterList); + this.typeParameterList = typeParameterList; + } + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (constraintClauses != null) + { + this.AdjustFlagsAndWidth(constraintClauses); + this.constraintClauses = constraintClauses; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the return type syntax. - public TypeSyntax ReturnType => this.returnType; - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; - public override ParameterListSyntax ParameterList => this.parameterList; - /// Gets the constraint clause list. - public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); - public override BlockSyntax? Body => this.body; - public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.returnType, - 3 => this.explicitInterfaceSpecifier, - 4 => this.identifier, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.constraintClauses, - 8 => this.body, - 9 => this.expressionBody, - 10 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MethodDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); - - public MethodDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the return type syntax. + public TypeSyntax ReturnType => this.returnType; + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public TypeParameterListSyntax? TypeParameterList => this.typeParameterList; + public override ParameterListSyntax ParameterList => this.parameterList; + /// Gets the constraint clause list. + public CoreSyntax.SyntaxList ConstraintClauses => new CoreSyntax.SyntaxList(this.constraintClauses); + public override BlockSyntax? Body => this.body; + public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; - return this; - } + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.returnType, + 3 => this.explicitInterfaceSpecifier, + 4 => this.identifier, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.constraintClauses, + 8 => this.body, + 9 => this.expressionBody, + 10 => this.semicolonToken, + _ => null, + }; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.MethodDeclarationSyntax(this, parent, position); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); - /// Operator declaration syntax. - internal sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax + public MethodDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax returnType; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken operatorKeyword; - internal readonly SyntaxToken? checkedKeyword; - internal readonly SyntaxToken operatorToken; - internal readonly ParameterListSyntax parameterList; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal 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) - : base(kind) + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new MethodDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.identifier, this.typeParameterList, this.parameterList, this.constraintClauses, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +} + +/// Operator declaration syntax. +internal sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax returnType; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken operatorKeyword; + internal readonly SyntaxToken? checkedKeyword; + internal readonly SyntaxToken operatorToken; + internal readonly ParameterListSyntax parameterList; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 11; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (modifiers != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(returnType); - this.returnType = returnType; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the return type. - public TypeSyntax ReturnType => this.returnType; - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - /// Gets the "operator" keyword. - public SyntaxToken OperatorKeyword => this.operatorKeyword; - /// Gets the "checked" keyword. - public SyntaxToken? CheckedKeyword => this.checkedKeyword; - /// Gets the operator token. - public SyntaxToken OperatorToken => this.operatorToken; - public override ParameterListSyntax ParameterList => this.parameterList; - public override BlockSyntax? Body => this.body; - public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.returnType, - 3 => this.explicitInterfaceSpecifier, - 4 => this.operatorKeyword, - 5 => this.checkedKeyword, - 6 => this.operatorToken, - 7 => this.parameterList, - 8 => this.body, - 9 => this.expressionBody, - 10 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); - - public OperatorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); } - /// Conversion operator declaration syntax. - internal sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax + internal 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) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken implicitOrExplicitKeyword; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken operatorKeyword; - internal readonly SyntaxToken? checkedKeyword; - internal readonly TypeSyntax type; - internal readonly ParameterListSyntax parameterList; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal 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) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal 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) - : base(kind) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 11; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the "implicit" or "explicit" token. - public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - /// Gets the "operator" token. - public SyntaxToken OperatorKeyword => this.operatorKeyword; - /// Gets the "checked" keyword. - public SyntaxToken? CheckedKeyword => this.checkedKeyword; - /// Gets the type. - public TypeSyntax Type => this.type; - public override ParameterListSyntax ParameterList => this.parameterList; - public override BlockSyntax? Body => this.body; - public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.implicitOrExplicitKeyword, - 3 => this.explicitInterfaceSpecifier, - 4 => this.operatorKeyword, - 5 => this.checkedKeyword, - 6 => this.type, - 7 => this.parameterList, - 8 => this.body, - 9 => this.expressionBody, - 10 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); - - public ConversionOperatorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); } - /// Constructor declaration syntax. - internal sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax + internal 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) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken identifier; - internal readonly ParameterListSyntax parameterList; - internal readonly ConstructorInitializerSyntax? initializer; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - : base(kind) + this.AdjustFlagsAndWidth(returnType); + this.returnType = returnType; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public override ParameterListSyntax ParameterList => this.parameterList; - public ConstructorInitializerSyntax? Initializer => this.initializer; - public override BlockSyntax? Body => this.body; - public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.identifier, - 3 => this.parameterList, - 4 => this.initializer, - 5 => this.body, - 6 => this.expressionBody, - 7 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); - - public ConstructorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax initializer, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + if (expressionBody != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the return type. + public TypeSyntax ReturnType => this.returnType; + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + /// Gets the "operator" keyword. + public SyntaxToken OperatorKeyword => this.operatorKeyword; + /// Gets the "checked" keyword. + public SyntaxToken? CheckedKeyword => this.checkedKeyword; + /// Gets the operator token. + public SyntaxToken OperatorToken => this.operatorToken; + public override ParameterListSyntax ParameterList => this.parameterList; + public override BlockSyntax? Body => this.body; + public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.returnType, + 3 => this.explicitInterfaceSpecifier, + 4 => this.operatorKeyword, + 5 => this.checkedKeyword, + 6 => this.operatorToken, + 7 => this.parameterList, + 8 => this.body, + 9 => this.expressionBody, + 10 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); + + public OperatorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.returnType, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); - } +/// Conversion operator declaration syntax. +internal sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken implicitOrExplicitKeyword; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken operatorKeyword; + internal readonly SyntaxToken? checkedKeyword; + internal readonly TypeSyntax type; + internal readonly ParameterListSyntax parameterList; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - /// Constructor initializer syntax. - internal sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode + internal 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) + : base(kind, diagnostics, annotations) { - internal readonly SyntaxToken colonToken; - internal readonly SyntaxToken thisOrBaseKeyword; - internal readonly ArgumentListSyntax argumentList; - - internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(thisOrBaseKeyword); - this.thisOrBaseKeyword = thisOrBaseKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(thisOrBaseKeyword); - this.thisOrBaseKeyword = thisOrBaseKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) - : base(kind) + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; - this.AdjustFlagsAndWidth(thisOrBaseKeyword); - this.thisOrBaseKeyword = thisOrBaseKeyword; - this.AdjustFlagsAndWidth(argumentList); - this.argumentList = argumentList; + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - /// Gets the colon token. - public SyntaxToken ColonToken => this.colonToken; - /// Gets the "this" or "base" keyword. - public SyntaxToken ThisOrBaseKeyword => this.thisOrBaseKeyword; - public ArgumentListSyntax ArgumentList => this.argumentList; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.colonToken, - 1 => this.thisOrBaseKeyword, - 2 => this.argumentList, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorInitializerSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); - - public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ConstructorInitializer(this.Kind, colonToken, thisOrBaseKeyword, argumentList); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, GetDiagnostics(), annotations); } - /// Destructor declaration syntax. - internal sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax + internal 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) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken tildeToken; - internal readonly SyntaxToken identifier; - internal readonly ParameterListSyntax parameterList; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 11; + if (attributeLists != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(tildeToken); - this.tildeToken = tildeToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(tildeToken); - this.tildeToken = tildeToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - : base(kind) + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(tildeToken); - this.tildeToken = tildeToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the tilde token. - public SyntaxToken TildeToken => this.tildeToken; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public override ParameterListSyntax ParameterList => this.parameterList; - public override BlockSyntax? Body => this.body; - public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public override SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.tildeToken, - 3 => this.identifier, - 4 => this.parameterList, - 5 => this.body, - 6 => this.expressionBody, - 7 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DestructorDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); - - public DestructorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); } - /// Base type for property declaration syntax. - internal abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax + internal 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) + : base(kind) { - internal BasePropertyDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 11; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BasePropertyDeclarationSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - /// Gets the type syntax. - public abstract TypeSyntax Type { get; } + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the "implicit" or "explicit" token. + public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + /// Gets the "operator" token. + public SyntaxToken OperatorKeyword => this.operatorKeyword; + /// Gets the "checked" keyword. + public SyntaxToken? CheckedKeyword => this.checkedKeyword; + /// Gets the type. + public TypeSyntax Type => this.type; + public override ParameterListSyntax ParameterList => this.parameterList; + public override BlockSyntax? Body => this.body; + public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.implicitOrExplicitKeyword, + 3 => this.explicitInterfaceSpecifier, + 4 => this.operatorKeyword, + 5 => this.checkedKeyword, + 6 => this.type, + 7 => this.parameterList, + 8 => this.body, + 9 => this.expressionBody, + 10 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); + + public ConversionOperatorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConversionOperatorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.implicitOrExplicitKeyword, this.explicitInterfaceSpecifier, this.operatorKeyword, this.checkedKeyword, this.type, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +} - /// Gets the optional explicit interface specifier. - public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; } +/// Constructor declaration syntax. +internal sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken identifier; + internal readonly ParameterListSyntax parameterList; + internal readonly ConstructorInitializerSyntax? initializer; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - public abstract AccessorListSyntax? AccessorList { get; } + internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } } - internal sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax + internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax type; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken identifier; - internal readonly AccessorListSyntax? accessorList; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly EqualsValueClauseSyntax? initializer; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) - : base(kind) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (initializer != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (initializer != null) - { - this.AdjustFlagsAndWidth(initializer); - this.initializer = initializer; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public override TypeSyntax Type => this.type; - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public override AccessorListSyntax? AccessorList => this.accessorList; - public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - public EqualsValueClauseSyntax? Initializer => this.initializer; - public SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.type, - 3 => this.explicitInterfaceSpecifier, - 4 => this.identifier, - 5 => this.accessorList, - 6 => this.expressionBody, - 7 => this.initializer, - 8 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); - - public PropertyDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, EqualsValueClauseSyntax initializer, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, GetDiagnostics(), annotations); } - /// The syntax for the expression body of an expression-bodied member. - internal sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode + internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + : base(kind) { - internal readonly SyntaxToken arrowToken; - internal readonly ExpressionSyntax expression; - - internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression) - : base(kind) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (initializer != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(arrowToken); - this.arrowToken = arrowToken; - this.AdjustFlagsAndWidth(expression); - this.expression = expression; + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - public SyntaxToken ArrowToken => this.arrowToken; - public ExpressionSyntax Expression => this.expression; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public override ParameterListSyntax ParameterList => this.parameterList; + public ConstructorInitializerSyntax? Initializer => this.initializer; + public override BlockSyntax? Body => this.body; + public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.arrowToken, - 1 => this.expression, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.identifier, + 3 => this.parameterList, + 4 => this.initializer, + 5 => this.body, + 6 => this.expressionBody, + 7 => this.semicolonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); + + public ConstructorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax initializer, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrowExpressionClauseSyntax(this, parent, position); + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression) - { - if (arrowToken != this.ArrowToken || expression != this.Expression) - { - var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConstructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.identifier, this.parameterList, this.initializer, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +} - return this; - } +/// Constructor initializer syntax. +internal sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken colonToken; + internal readonly SyntaxToken thisOrBaseKeyword; + internal readonly ArgumentListSyntax argumentList; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, diagnostics, GetAnnotations()); + internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(thisOrBaseKeyword); + this.thisOrBaseKeyword = thisOrBaseKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, GetDiagnostics(), annotations); + internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(thisOrBaseKeyword); + this.thisOrBaseKeyword = thisOrBaseKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; } - internal sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax + internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken eventKeyword; - internal readonly TypeSyntax type; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken identifier; - internal readonly AccessorListSyntax? accessorList; - internal readonly SyntaxToken? semicolonToken; + this.SlotCount = 3; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + this.AdjustFlagsAndWidth(thisOrBaseKeyword); + this.thisOrBaseKeyword = thisOrBaseKeyword; + this.AdjustFlagsAndWidth(argumentList); + this.argumentList = argumentList; + } - internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + /// Gets the colon token. + public SyntaxToken ColonToken => this.colonToken; + /// Gets the "this" or "base" keyword. + public SyntaxToken ThisOrBaseKeyword => this.thisOrBaseKeyword; + public ArgumentListSyntax ArgumentList => this.argumentList; - internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } - } + 0 => this.colonToken, + 1 => this.thisOrBaseKeyword, + 2 => this.argumentList, + _ => null, + }; - internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) - : base(kind) + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConstructorInitializerSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); + + public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + { + if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList) { - this.SlotCount = 8; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(eventKeyword); - this.eventKeyword = eventKeyword; - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + var newNode = SyntaxFactory.ConstructorInitializer(this.Kind, colonToken, thisOrBaseKeyword, argumentList); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public SyntaxToken EventKeyword => this.eventKeyword; - public override TypeSyntax Type => this.type; - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public override AccessorListSyntax? AccessorList => this.accessorList; - public SyntaxToken? SemicolonToken => this.semicolonToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.eventKeyword, - 3 => this.type, - 4 => this.explicitInterfaceSpecifier, - 5 => this.identifier, - 6 => this.accessorList, - 7 => this.semicolonToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventDeclarationSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConstructorInitializerSyntax(this.Kind, this.colonToken, this.thisOrBaseKeyword, this.argumentList, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); +/// Destructor declaration syntax. +internal sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken tildeToken; + internal readonly SyntaxToken identifier; + internal readonly ParameterListSyntax parameterList; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - public EventDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, SyntaxToken semicolonToken) + internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(tildeToken); + this.tildeToken = tildeToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, GetDiagnostics(), annotations); } - internal sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax + internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax type; - internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - internal readonly SyntaxToken thisKeyword; - internal readonly BracketedParameterListSyntax parameterList; - internal readonly AccessorListSyntax? accessorList; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; - - internal 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) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - : base(kind) + this.AdjustFlagsAndWidth(tildeToken); + this.tildeToken = tildeToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) { - this.SlotCount = 9; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (explicitInterfaceSpecifier != null) - { - this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); - this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; - } - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - this.AdjustFlagsAndWidth(parameterList); - this.parameterList = parameterList; - if (accessorList != null) - { - this.AdjustFlagsAndWidth(accessorList); - this.accessorList = accessorList; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(body); + this.body = body; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public override TypeSyntax Type => this.type; - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; - public SyntaxToken ThisKeyword => this.thisKeyword; - /// Gets the parameter list. - public BracketedParameterListSyntax ParameterList => this.parameterList; - public override AccessorListSyntax? AccessorList => this.accessorList; - public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - public SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.type, - 3 => this.explicitInterfaceSpecifier, - 4 => this.thisKeyword, - 5 => this.parameterList, - 6 => this.accessorList, - 7 => this.expressionBody, - 8 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); - - public IndexerDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); } - internal sealed partial class AccessorListSyntax : CSharpSyntaxNode + internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + : base(kind) { - internal readonly SyntaxToken openBraceToken; - internal readonly GreenNode? accessors; - internal readonly SyntaxToken closeBraceToken; - - internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (accessors != null) - { - this.AdjustFlagsAndWidth(accessors); - this.accessors = accessors; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (accessors != null) - { - this.AdjustFlagsAndWidth(accessors); - this.accessors = accessors; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken) - : base(kind) + this.AdjustFlagsAndWidth(tildeToken); + this.tildeToken = tildeToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (body != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBraceToken); - this.openBraceToken = openBraceToken; - if (accessors != null) - { - this.AdjustFlagsAndWidth(accessors); - this.accessors = accessors; - } - this.AdjustFlagsAndWidth(closeBraceToken); - this.closeBraceToken = closeBraceToken; + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - public SyntaxToken OpenBraceToken => this.openBraceToken; - public CoreSyntax.SyntaxList Accessors => new CoreSyntax.SyntaxList(this.accessors); - public SyntaxToken CloseBraceToken => this.closeBraceToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the tilde token. + public SyntaxToken TildeToken => this.tildeToken; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public override ParameterListSyntax ParameterList => this.parameterList; + public override BlockSyntax? Body => this.body; + public override ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public override SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBraceToken, - 1 => this.accessors, - 2 => this.closeBraceToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.tildeToken, + 3 => this.identifier, + 4 => this.parameterList, + 5 => this.body, + 6 => this.expressionBody, + 7 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DestructorDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); - public AccessorListSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + public DestructorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DestructorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.tildeToken, this.identifier, this.parameterList, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, GetDiagnostics(), annotations); +/// Base type for property declaration syntax. +internal abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax +{ + internal BasePropertyDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - internal sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode + internal BasePropertyDeclarationSyntax(SyntaxKind kind) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly SyntaxToken keyword; - internal readonly BlockSyntax? body; - internal readonly ArrowExpressionClauseSyntax? expressionBody; - internal readonly SyntaxToken? semicolonToken; + } - internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + /// Gets the type syntax. + public abstract TypeSyntax Type { get; } + + /// Gets the optional explicit interface specifier. + public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; } + + public abstract AccessorListSyntax? AccessorList { get; } +} + +internal sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax type; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken identifier; + internal readonly AccessorListSyntax? accessorList; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly EqualsValueClauseSyntax? initializer; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; + } + } - internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - : base(kind) + internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 6; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(keyword); - this.keyword = keyword; - if (body != null) - { - this.AdjustFlagsAndWidth(body); - this.body = body; - } - if (expressionBody != null) - { - this.AdjustFlagsAndWidth(expressionBody); - this.expressionBody = expressionBody; - } - if (semicolonToken != null) - { - this.AdjustFlagsAndWidth(semicolonToken); - this.semicolonToken = semicolonToken; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; } - - /// Gets the attribute declaration list. - public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - /// Gets the modifier list. - public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - /// Gets the keyword token, or identifier if an erroneous accessor declaration. - public SyntaxToken Keyword => this.keyword; - /// Gets the optional body block which may be empty, but it is null if there are no braces. - public BlockSyntax? Body => this.body; - /// Gets the optional expression body. - public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; - /// Gets the optional semicolon token. - public SyntaxToken? SemicolonToken => this.semicolonToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.keyword, - 3 => this.body, - 4 => this.expressionBody, - 5 => this.semicolonToken, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorDeclarationSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); - - public AccessorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + if (semicolonToken != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.AccessorDeclaration(this.Kind, attributeLists, modifiers, keyword, body, expressionBody, semicolonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); } - /// Base type for parameter list syntax. - internal abstract partial class BaseParameterListSyntax : CSharpSyntaxNode + internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) + : base(kind) { - internal BaseParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 9; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseParameterListSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - /// Gets the parameter list. - public abstract CoreSyntax.SeparatedSyntaxList Parameters { get; } - } - - /// Parameter list syntax. - internal sealed partial class ParameterListSyntax : BaseParameterListSyntax - { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken closeParenToken; - - internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; } - - internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) - : base(kind) + if (expressionBody != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (initializer != null) + { + this.AdjustFlagsAndWidth(initializer); + this.initializer = initializer; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - /// Gets the open paren token. - public SyntaxToken OpenParenToken => this.openParenToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); - /// Gets the close paren token. - public SyntaxToken CloseParenToken => this.closeParenToken; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override TypeSyntax Type => this.type; + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public override AccessorListSyntax? AccessorList => this.accessorList; + public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + public EqualsValueClauseSyntax? Initializer => this.initializer; + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.parameters, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.type, + 3 => this.explicitInterfaceSpecifier, + 4 => this.identifier, + 5 => this.accessorList, + 6 => this.expressionBody, + 7 => this.initializer, + 8 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PropertyDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); - public ParameterListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public PropertyDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, EqualsValueClauseSyntax initializer, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) { - if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PropertyDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.expressionBody, this.initializer, this.semicolonToken, GetDiagnostics(), annotations); +} + +/// The syntax for the expression body of an expression-bodied member. +internal sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken arrowToken; + internal readonly ExpressionSyntax expression; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations); + internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; } - /// Parameter list syntax with surrounding brackets. - internal sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax + internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken closeBracketToken; + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } - internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(arrowToken); + this.arrowToken = arrowToken; + this.AdjustFlagsAndWidth(expression); + this.expression = expression; + } + + public SyntaxToken ArrowToken => this.arrowToken; + public ExpressionSyntax Expression => this.expression; - internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; - } + 0 => this.arrowToken, + 1 => this.expression, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ArrowExpressionClauseSyntax(this, parent, position); - internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); + + public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression) + { + if (arrowToken != this.ArrowToken || expression != this.Expression) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => this.openBracketToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => this.closeBracketToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.parameters, - 2 => this.closeBracketToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedParameterListSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ArrowExpressionClauseSyntax(this.Kind, this.arrowToken, this.expression, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); +internal sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken eventKeyword; + internal readonly TypeSyntax type; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken identifier; + internal readonly AccessorListSyntax? accessorList; + internal readonly SyntaxToken? semicolonToken; - public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + if (attributeLists != null) { - if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations); } - /// Base parameter syntax. - internal abstract partial class BaseParameterSyntax : CSharpSyntaxNode + internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal BaseParameterSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 8; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseParameterSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) + { + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - /// Gets the attribute declaration list. - public abstract CoreSyntax.SyntaxList AttributeLists { get; } - - /// Gets the modifier list. - public abstract CoreSyntax.SyntaxList Modifiers { get; } - - public abstract TypeSyntax? Type { get; } } - /// Parameter syntax. - internal sealed partial class ParameterSyntax : BaseParameterSyntax + internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax? type; - internal readonly SyntaxToken identifier; - internal readonly EqualsValueClauseSyntax? @default; - - internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 8; + if (attributeLists != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (@default != null) - { - this.AdjustFlagsAndWidth(@default); - this.@default = @default; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (@default != null) - { - this.AdjustFlagsAndWidth(@default); - this.@default = @default; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) - : base(kind) + this.AdjustFlagsAndWidth(eventKeyword); + this.eventKeyword = eventKeyword; + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 5; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - if (@default != null) - { - this.AdjustFlagsAndWidth(@default); - this.@default = @default; - } + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - /// Gets the attribute declaration list. - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - /// Gets the modifier list. - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public override TypeSyntax? Type => this.type; - /// Gets the identifier. - public SyntaxToken Identifier => this.identifier; - public EqualsValueClauseSyntax? Default => this.@default; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public SyntaxToken EventKeyword => this.eventKeyword; + public override TypeSyntax Type => this.type; + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public override AccessorListSyntax? AccessorList => this.accessorList; + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.type, - 3 => this.identifier, - 4 => this.@default, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.eventKeyword, + 3 => this.type, + 4 => this.explicitInterfaceSpecifier, + 5 => this.identifier, + 6 => this.accessorList, + 7 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EventDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); - public ParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, SyntaxToken identifier, EqualsValueClauseSyntax @default) + public EventDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) - { - var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, GetDiagnostics(), annotations); + return this; } - /// Parameter syntax. - internal sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax - { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax type; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EventDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.eventKeyword, this.type, this.explicitInterfaceSpecifier, this.identifier, this.accessorList, this.semicolonToken, GetDiagnostics(), annotations); +} - internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax type; + internal readonly ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + internal readonly SyntaxToken thisKeyword; + internal readonly BracketedParameterListSyntax parameterList; + internal readonly AccessorListSyntax? accessorList; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type) - : base(kind) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - this.AdjustFlagsAndWidth(type); - this.type = type; + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - /// Gets the attribute declaration list. - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - /// Gets the modifier list. - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public override TypeSyntax Type => this.type; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.type, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); - - public FunctionPointerParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (accessorList != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) - { - var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations); } - internal sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax + internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal readonly GreenNode? attributeLists; - internal readonly GreenNode? modifiers; - internal readonly TypeSyntax? type; - - internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type) - : base(kind) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 3; - if (attributeLists != null) - { - this.AdjustFlagsAndWidth(attributeLists); - this.attributeLists = attributeLists; - } - if (modifiers != null) - { - this.AdjustFlagsAndWidth(modifiers); - this.modifiers = modifiers; - } - if (type != null) - { - this.AdjustFlagsAndWidth(type); - this.type = type; - } + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); - public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); - public TypeSyntax? Type => this.type; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.modifiers, - 2 => this.type, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IncompleteMemberSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); - - public IncompleteMemberSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (accessorList != null) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) - { - var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations); } - internal sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax + internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + : base(kind) { - internal readonly GreenNode? tokens; - - internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 9; + if (attributeLists != null) { - this.SlotCount = 1; - if (tokens != null) - { - this.AdjustFlagsAndWidth(tokens); - this.tokens = tokens; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - if (tokens != null) - { - this.AdjustFlagsAndWidth(tokens); - this.tokens = tokens; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) - : base(kind) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (explicitInterfaceSpecifier != null) { - this.SlotCount = 1; - if (tokens != null) - { - this.AdjustFlagsAndWidth(tokens); - this.tokens = tokens; - } + this.AdjustFlagsAndWidth(explicitInterfaceSpecifier); + this.explicitInterfaceSpecifier = explicitInterfaceSpecifier; } - - public CoreSyntax.SyntaxList Tokens => new CoreSyntax.SyntaxList(this.tokens); - - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.tokens : null; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SkippedTokensTriviaSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); - - public SkippedTokensTriviaSyntax Update(CoreSyntax.SyntaxList tokens) + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + this.AdjustFlagsAndWidth(parameterList); + this.parameterList = parameterList; + if (accessorList != null) + { + this.AdjustFlagsAndWidth(accessorList); + this.accessorList = accessorList; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) { - if (tokens != this.Tokens) - { - var newNode = SyntaxFactory.SkippedTokensTrivia(tokens); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new SkippedTokensTriviaSyntax(this.Kind, this.tokens, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new SkippedTokensTriviaSyntax(this.Kind, this.tokens, GetDiagnostics(), annotations); } - internal sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax - { - internal readonly GreenNode? content; - internal readonly SyntaxToken endOfComment; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override TypeSyntax Type => this.type; + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => this.explicitInterfaceSpecifier; + public SyntaxToken ThisKeyword => this.thisKeyword; + /// Gets the parameter list. + public BracketedParameterListSyntax ParameterList => this.parameterList; + public override AccessorListSyntax? AccessorList => this.accessorList; + public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 2; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endOfComment); - this.endOfComment = endOfComment; - } + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.type, + 3 => this.explicitInterfaceSpecifier, + 4 => this.thisKeyword, + 5 => this.parameterList, + 6 => this.accessorList, + 7 => this.expressionBody, + 8 => this.semicolonToken, + _ => null, + }; - internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endOfComment); - this.endOfComment = endOfComment; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerDeclarationSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); - internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment) - : base(kind) + public IndexerDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - this.SlotCount = 2; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endOfComment); - this.endOfComment = endOfComment; + var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public CoreSyntax.SyntaxList Content => new CoreSyntax.SyntaxList(this.content); - public SyntaxToken EndOfComment => this.endOfComment; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.content, - 1 => this.endOfComment, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DocumentationCommentTriviaSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IndexerDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.explicitInterfaceSpecifier, this.thisKeyword, this.parameterList, this.accessorList, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); +internal sealed partial class AccessorListSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openBraceToken; + internal readonly GreenNode? accessors; + internal readonly SyntaxToken closeBraceToken; - public DocumentationCommentTriviaSyntax Update(CoreSyntax.SyntaxList content, SyntaxToken endOfComment) + internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (accessors != null) { - if (content != this.Content || endOfComment != this.EndOfComment) - { - var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind, content, endOfComment); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(accessors); + this.accessors = accessors; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - /// - /// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). - /// For example, the M in <see cref="M" />. - /// - internal abstract partial class CrefSyntax : CSharpSyntaxNode + internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, SyntaxFactoryContext context) + : base(kind) { - internal CrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (accessors != null) { + this.AdjustFlagsAndWidth(accessors); + this.accessors = accessors; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; + } - internal CrefSyntax(SyntaxKind kind) - : base(kind) + internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBraceToken); + this.openBraceToken = openBraceToken; + if (accessors != null) { + this.AdjustFlagsAndWidth(accessors); + this.accessors = accessors; } + this.AdjustFlagsAndWidth(closeBraceToken); + this.closeBraceToken = closeBraceToken; } - /// - /// A symbol reference that definitely refers to a type. - /// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - internal sealed partial class TypeCrefSyntax : CrefSyntax - { - internal readonly TypeSyntax type; + public SyntaxToken OpenBraceToken => this.openBraceToken; + public CoreSyntax.SyntaxList Accessors => new CoreSyntax.SyntaxList(this.accessors); + public SyntaxToken CloseBraceToken => this.closeBraceToken; - internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + 0 => this.openBraceToken, + 1 => this.accessors, + 2 => this.closeBraceToken, + _ => null, + }; - internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; - } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorListSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); - internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type) - : base(kind) + public AccessorListSyntax Update(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) { - this.SlotCount = 1; - this.AdjustFlagsAndWidth(type); - this.type = type; + var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public TypeSyntax Type => this.type; + return this; + } - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.type : null; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeCrefSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AccessorListSyntax(this.Kind, this.openBraceToken, this.accessors, this.closeBraceToken, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); +internal sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly SyntaxToken keyword; + internal readonly BlockSyntax? body; + internal readonly ArrowExpressionClauseSyntax? expressionBody; + internal readonly SyntaxToken? semicolonToken; - public TypeCrefSyntax Update(TypeSyntax type) + internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + if (attributeLists != null) { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypeCref(type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new TypeCrefSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new TypeCrefSyntax(this.Kind, this.type, GetDiagnostics(), annotations); - } - - /// - /// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. - /// For example, cref="System.String.ToString()". - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - internal sealed partial class QualifiedCrefSyntax : CrefSyntax - { - internal readonly TypeSyntax container; - internal readonly SyntaxToken dotToken; - internal readonly MemberCrefSyntax member; - - internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (modifiers != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(container); - this.container = container; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(member); - this.member = member; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context) - : base(kind) + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (body != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(container); - this.container = container; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(member); - this.member = member; + this.AdjustFlagsAndWidth(body); + this.body = body; } - - internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) - : base(kind) + if (expressionBody != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(container); - this.container = container; - this.AdjustFlagsAndWidth(dotToken); - this.dotToken = dotToken; - this.AdjustFlagsAndWidth(member); - this.member = member; + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; } - - public TypeSyntax Container => this.container; - public SyntaxToken DotToken => this.dotToken; - public MemberCrefSyntax Member => this.member; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.container, - 1 => this.dotToken, - 2 => this.member, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedCrefSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); - - public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + if (semicolonToken != null) { - if (container != this.Container || dotToken != this.DotToken || member != this.Member) - { - var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, GetDiagnostics(), annotations); } - /// - /// The unqualified part of a CrefSyntax. - /// For example, "ToString()" in "object.ToString()". - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - internal abstract partial class MemberCrefSyntax : CrefSyntax + internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) + : base(kind) { - internal MemberCrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 6; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal MemberCrefSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (body != null) + { + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } } - /// - /// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, - /// with an optional type parameter list) and an optional parameter list. - /// For example, "M", "M<T>" or "M(int)". - /// Also, "A::B()" or "string()". - /// - internal sealed partial class NameMemberCrefSyntax : MemberCrefSyntax + internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + : base(kind) { - internal readonly TypeSyntax name; - internal readonly CrefParameterListSyntax? parameters; - - internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 6; + if (attributeLists != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } - - internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters) - : base(kind) + this.AdjustFlagsAndWidth(keyword); + this.keyword = keyword; + if (body != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(body); + this.body = body; + } + if (expressionBody != null) + { + this.AdjustFlagsAndWidth(expressionBody); + this.expressionBody = expressionBody; + } + if (semicolonToken != null) + { + this.AdjustFlagsAndWidth(semicolonToken); + this.semicolonToken = semicolonToken; } + } - public TypeSyntax Name => this.name; - public CrefParameterListSyntax? Parameters => this.parameters; + /// Gets the attribute declaration list. + public CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// Gets the modifier list. + public CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + /// Gets the keyword token, or identifier if an erroneous accessor declaration. + public SyntaxToken Keyword => this.keyword; + /// Gets the optional body block which may be empty, but it is null if there are no braces. + public BlockSyntax? Body => this.body; + /// Gets the optional expression body. + public ArrowExpressionClauseSyntax? ExpressionBody => this.expressionBody; + /// Gets the optional semicolon token. + public SyntaxToken? SemicolonToken => this.semicolonToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.parameters, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.keyword, + 3 => this.body, + 4 => this.expressionBody, + 5 => this.semicolonToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameMemberCrefSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.AccessorDeclarationSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); - public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax parameters) + public AccessorDeclarationSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (name != this.Name || parameters != this.Parameters) - { - var newNode = SyntaxFactory.NameMemberCref(name, parameters); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.AccessorDeclaration(this.Kind, attributeLists, modifiers, keyword, body, expressionBody, semicolonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new AccessorDeclarationSyntax(this.Kind, this.attributeLists, this.modifiers, this.keyword, this.body, this.expressionBody, this.semicolonToken, GetDiagnostics(), annotations); +} + +/// Base type for parameter list syntax. +internal abstract partial class BaseParameterListSyntax : CSharpSyntaxNode +{ + internal BaseParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// - /// A MemberCrefSyntax specified by a this keyword and an optional parameter list. - /// For example, "this" or "this[int]". - /// - internal sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax + internal BaseParameterListSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken thisKeyword; - internal readonly CrefBracketedParameterListSyntax? parameters; + } + + /// Gets the parameter list. + public abstract CoreSyntax.SeparatedSyntaxList Parameters { get; } +} + +/// Parameter list syntax. +internal sealed partial class ParameterListSyntax : BaseParameterListSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken closeParenToken; - internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, SyntaxFactoryContext context) - : base(kind) + internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) - : base(kind) + internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(thisKeyword); - this.thisKeyword = thisKeyword; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public SyntaxToken ThisKeyword => this.thisKeyword; - public CrefBracketedParameterListSyntax? Parameters => this.parameters; + /// Gets the open paren token. + public SyntaxToken OpenParenToken => this.openParenToken; + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// Gets the close paren token. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.thisKeyword, - 1 => this.parameters, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.parameters, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerMemberCrefSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); - public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax parameters) + public ParameterListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) { - if (thisKeyword != this.ThisKeyword || parameters != this.Parameters) - { - var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, GetDiagnostics(), annotations); + return this; } - /// - /// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. - /// For example, "operator +" or "operator -[int]". - /// NOTE: the operator must be overloadable. - /// - internal sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax - { - internal readonly SyntaxToken operatorKeyword; - internal readonly SyntaxToken? checkedKeyword; - internal readonly SyntaxToken operatorToken; - internal readonly CrefParameterListSyntax? parameters; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations); +} + +/// Parameter list syntax with surrounding brackets. +internal sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken closeBracketToken; - internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) - : base(kind) + internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) - : base(kind) + internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(operatorToken); - this.operatorToken = operatorToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - public SyntaxToken OperatorKeyword => this.operatorKeyword; - public SyntaxToken? CheckedKeyword => this.checkedKeyword; - /// Gets the operator token. - public SyntaxToken OperatorToken => this.operatorToken; - public CrefParameterListSyntax? Parameters => this.parameters; + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => this.openBracketToken; + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.operatorKeyword, - 1 => this.checkedKeyword, - 2 => this.operatorToken, - 3 => this.parameters, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.parameters, + 2 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorMemberCrefSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BracketedParameterListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); - public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax parameters) + public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) { - if (operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters) - { - var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, operatorToken, parameters); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameters, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameters, GetDiagnostics(), annotations); +/// Base parameter syntax. +internal abstract partial class BaseParameterSyntax : CSharpSyntaxNode +{ + internal BaseParameterSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - /// - /// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. - /// For example, "implicit operator int" or "explicit operator MyType(int)". - /// - internal sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax - { - internal readonly SyntaxToken implicitOrExplicitKeyword; - internal readonly SyntaxToken operatorKeyword; - internal readonly SyntaxToken? checkedKeyword; - internal readonly TypeSyntax type; - internal readonly CrefParameterListSyntax? parameters; - - internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - } + internal BaseParameterSyntax(SyntaxKind kind) + : base(kind) + { + } + + /// Gets the attribute declaration list. + public abstract CoreSyntax.SyntaxList AttributeLists { get; } + + /// Gets the modifier list. + public abstract CoreSyntax.SyntaxList Modifiers { get; } - internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) - : base(kind) + public abstract TypeSyntax? Type { get; } +} + +/// Parameter syntax. +internal sealed partial class ParameterSyntax : BaseParameterSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax? type; + internal readonly SyntaxToken identifier; + internal readonly EqualsValueClauseSyntax? @default; + + internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } - this.AdjustFlagsAndWidth(type); - this.type = type; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) - : base(kind) + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + if (type != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); - this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; - this.AdjustFlagsAndWidth(operatorKeyword); - this.operatorKeyword = operatorKeyword; - if (checkedKeyword != null) - { - this.AdjustFlagsAndWidth(checkedKeyword); - this.checkedKeyword = checkedKeyword; - } this.AdjustFlagsAndWidth(type); this.type = type; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } } - - public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; - public SyntaxToken OperatorKeyword => this.operatorKeyword; - public SyntaxToken? CheckedKeyword => this.checkedKeyword; - public TypeSyntax Type => this.type; - public CrefParameterListSyntax? Parameters => this.parameters; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.implicitOrExplicitKeyword, - 1 => this.operatorKeyword, - 2 => this.checkedKeyword, - 3 => this.type, - 4 => this.parameters, - _ => null, - }; - - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorMemberCrefSyntax(this, parent, position); - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); - - public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax parameters) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (@default != null) { - if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameters != this.Parameters) - { - var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(@default); + this.@default = @default; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.checkedKeyword, this.type, this.parameters, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.checkedKeyword, this.type, this.parameters, GetDiagnostics(), annotations); } - /// - /// A list of cref parameters with surrounding punctuation. - /// Unlike regular parameters, cref parameters do not have names. - /// - internal abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode + internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default, SyntaxFactoryContext context) + : base(kind) { - internal BaseCrefParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + if (attributeLists != null) { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal BaseCrefParameterListSyntax(SyntaxKind kind) - : base(kind) + if (modifiers != null) { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + if (type != null) + { + this.AdjustFlagsAndWidth(type); + this.type = type; + } + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (@default != null) + { + this.AdjustFlagsAndWidth(@default); + this.@default = @default; } - - /// Gets the parameter list. - public abstract CoreSyntax.SeparatedSyntaxList Parameters { get; } } - /// - /// A parenthesized list of cref parameters. - /// - internal sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax + internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) + : base(kind) { - internal readonly SyntaxToken openParenToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken closeParenToken; - - internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } - - internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) + if (modifiers != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + if (type != null) + { + this.AdjustFlagsAndWidth(type); + this.type = type; } - - internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) - : base(kind) + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + if (@default != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; + this.AdjustFlagsAndWidth(@default); + this.@default = @default; } + } - /// Gets the open paren token. - public SyntaxToken OpenParenToken => this.openParenToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); - /// Gets the close paren token. - public SyntaxToken CloseParenToken => this.closeParenToken; + /// Gets the attribute declaration list. + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// Gets the modifier list. + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override TypeSyntax? Type => this.type; + /// Gets the identifier. + public SyntaxToken Identifier => this.identifier; + public EqualsValueClauseSyntax? Default => this.@default; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.parameters, - 2 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.type, + 3 => this.identifier, + 4 => this.@default, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ParameterSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); - public CrefParameterListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public ParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, SyntaxToken identifier, EqualsValueClauseSyntax @default) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) { - if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations); + return this; } - /// - /// A bracketed list of cref parameters. - /// - internal sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax - { - internal readonly SyntaxToken openBracketToken; - internal readonly GreenNode? parameters; - internal readonly SyntaxToken closeBracketToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, this.identifier, this.@default, GetDiagnostics(), annotations); +} + +/// Parameter syntax. +internal sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax type; - internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) - : base(kind) + internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) - : base(kind) + internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(openBracketToken); - this.openBracketToken = openBracketToken; - if (parameters != null) - { - this.AdjustFlagsAndWidth(parameters); - this.parameters = parameters; - } - this.AdjustFlagsAndWidth(closeBracketToken); - this.closeBracketToken = closeBracketToken; + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => this.openBracketToken; - public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => this.closeBracketToken; + /// Gets the attribute declaration list. + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + /// Gets the modifier list. + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public override TypeSyntax Type => this.type; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openBracketToken, - 1 => this.parameters, - 2 => this.closeBracketToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.type, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefBracketedParameterListSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.FunctionPointerParameterSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); - public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + public FunctionPointerParameterSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) { - if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations); + return this; } - /// - /// An element of a BaseCrefParameterListSyntax. - /// Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, - /// an optional readonly keyword, and a type - - /// there is no name and there are no attributes or other modifiers. - /// - internal sealed partial class CrefParameterSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken? refKindKeyword; - internal readonly SyntaxToken? readOnlyKeyword; - internal readonly TypeSyntax type; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new FunctionPointerParameterSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations); +} + +internal sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax +{ + internal readonly GreenNode? attributeLists; + internal readonly GreenNode? modifiers; + internal readonly TypeSyntax? type; - internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + if (type != null) { - this.SlotCount = 3; - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } this.AdjustFlagsAndWidth(type); this.type = type; } + } - internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) - : base(kind) + internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + if (type != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } this.AdjustFlagsAndWidth(type); this.type = type; } + } - internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - : base(kind) + internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type) + : base(kind) + { + this.SlotCount = 3; + if (attributeLists != null) + { + this.AdjustFlagsAndWidth(attributeLists); + this.attributeLists = attributeLists; + } + if (modifiers != null) + { + this.AdjustFlagsAndWidth(modifiers); + this.modifiers = modifiers; + } + if (type != null) { - this.SlotCount = 3; - if (refKindKeyword != null) - { - this.AdjustFlagsAndWidth(refKindKeyword); - this.refKindKeyword = refKindKeyword; - } - if (readOnlyKeyword != null) - { - this.AdjustFlagsAndWidth(readOnlyKeyword); - this.readOnlyKeyword = readOnlyKeyword; - } this.AdjustFlagsAndWidth(type); this.type = type; } + } - public SyntaxToken? RefKindKeyword => this.refKindKeyword; - public SyntaxToken? ReadOnlyKeyword => this.readOnlyKeyword; - public TypeSyntax Type => this.type; + public override CoreSyntax.SyntaxList AttributeLists => new CoreSyntax.SyntaxList(this.attributeLists); + public override CoreSyntax.SyntaxList Modifiers => new CoreSyntax.SyntaxList(this.modifiers); + public TypeSyntax? Type => this.type; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.refKindKeyword, - 1 => this.readOnlyKeyword, - 2 => this.type, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.modifiers, + 2 => this.type, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IncompleteMemberSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); - public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + public IncompleteMemberSyntax Update(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) { - if (refKindKeyword != this.RefKindKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) - { - var newNode = SyntaxFactory.CrefParameter(refKindKeyword, readOnlyKeyword, type); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.readOnlyKeyword, this.type, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.readOnlyKeyword, this.type, GetDiagnostics(), annotations); + return this; } - internal abstract partial class XmlNodeSyntax : CSharpSyntaxNode + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IncompleteMemberSyntax(this.Kind, this.attributeLists, this.modifiers, this.type, GetDiagnostics(), annotations); +} + +internal sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax +{ + internal readonly GreenNode? tokens; + + internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal XmlNodeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 1; + if (tokens != null) { + this.AdjustFlagsAndWidth(tokens); + this.tokens = tokens; } + } - internal XmlNodeSyntax(SyntaxKind kind) - : base(kind) + internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + if (tokens != null) { + this.AdjustFlagsAndWidth(tokens); + this.tokens = tokens; } } - internal sealed partial class XmlElementSyntax : XmlNodeSyntax + internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) + : base(kind) { - internal readonly XmlElementStartTagSyntax startTag; - internal readonly GreenNode? content; - internal readonly XmlElementEndTagSyntax endTag; - - internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 1; + if (tokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startTag); - this.startTag = startTag; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endTag); - this.endTag = endTag; + this.AdjustFlagsAndWidth(tokens); + this.tokens = tokens; } + } - internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startTag); - this.startTag = startTag; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endTag); - this.endTag = endTag; - } + public CoreSyntax.SyntaxList Tokens => new CoreSyntax.SyntaxList(this.tokens); + + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.tokens : null; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.SkippedTokensTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); - internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag) - : base(kind) + public SkippedTokensTriviaSyntax Update(CoreSyntax.SyntaxList tokens) + { + if (tokens != this.Tokens) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startTag); - this.startTag = startTag; - if (content != null) - { - this.AdjustFlagsAndWidth(content); - this.content = content; - } - this.AdjustFlagsAndWidth(endTag); - this.endTag = endTag; + var newNode = SyntaxFactory.SkippedTokensTrivia(tokens); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public XmlElementStartTagSyntax StartTag => this.startTag; - public CoreSyntax.SyntaxList Content => new CoreSyntax.SyntaxList(this.content); - public XmlElementEndTagSyntax EndTag => this.endTag; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.startTag, - 1 => this.content, - 2 => this.endTag, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new SkippedTokensTriviaSyntax(this.Kind, this.tokens, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new SkippedTokensTriviaSyntax(this.Kind, this.tokens, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); +internal sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax +{ + internal readonly GreenNode? content; + internal readonly SyntaxToken endOfComment; - public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (content != null) { - if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) - { - var newNode = SyntaxFactory.XmlElement(startTag, content, endTag); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(content); + this.content = content; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(endOfComment); + this.endOfComment = endOfComment; } - internal sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode + internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken lessThanToken; - internal readonly XmlNameSyntax name; - internal readonly GreenNode? attributes; - internal readonly SyntaxToken greaterThanToken; - - internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 2; + if (content != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(content); + this.content = content; } + this.AdjustFlagsAndWidth(endOfComment); + this.endOfComment = endOfComment; + } - internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, SyntaxFactoryContext context) - : base(kind) + internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment) + : base(kind) + { + this.SlotCount = 2; + if (content != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + this.AdjustFlagsAndWidth(content); + this.content = content; } + this.AdjustFlagsAndWidth(endOfComment); + this.endOfComment = endOfComment; + } + + public CoreSyntax.SyntaxList Content => new CoreSyntax.SyntaxList(this.content); + public SyntaxToken EndOfComment => this.endOfComment; - internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + 0 => this.content, + 1 => this.endOfComment, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DocumentationCommentTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); + + public DocumentationCommentTriviaSyntax Update(CoreSyntax.SyntaxList content, SyntaxToken endOfComment) + { + if (content != this.Content || endOfComment != this.EndOfComment) + { + var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind, content, endOfComment); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken LessThanToken => this.lessThanToken; - public XmlNameSyntax Name => this.name; - public CoreSyntax.SyntaxList Attributes => new CoreSyntax.SyntaxList(this.attributes); - public SyntaxToken GreaterThanToken => this.greaterThanToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanToken, - 1 => this.name, - 2 => this.attributes, - 3 => this.greaterThanToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementStartTagSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DocumentationCommentTriviaSyntax(this.Kind, this.content, this.endOfComment, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); +/// +/// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). +/// For example, the M in <see cref="M" />. +/// +internal abstract partial class CrefSyntax : CSharpSyntaxNode +{ + internal CrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) - { - if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal CrefSyntax(SyntaxKind kind) + : base(kind) + { + } +} - return this; - } +/// +/// A symbol reference that definitely refers to a type. +/// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +internal sealed partial class TypeCrefSyntax : CrefSyntax +{ + internal readonly TypeSyntax type; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, diagnostics, GetAnnotations()); + internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, GetDiagnostics(), annotations); + internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; } - internal sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode + internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type) + : base(kind) { - internal readonly SyntaxToken lessThanSlashToken; - internal readonly XmlNameSyntax name; - internal readonly SyntaxToken greaterThanToken; + this.SlotCount = 1; + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanSlashToken); - this.lessThanSlashToken = lessThanSlashToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } + public TypeSyntax Type => this.type; - internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanSlashToken); - this.lessThanSlashToken = lessThanSlashToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; - } + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.type : null; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.TypeCrefSyntax(this, parent, position); - internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); + + public TypeCrefSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanSlashToken); - this.lessThanSlashToken = lessThanSlashToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(greaterThanToken); - this.greaterThanToken = greaterThanToken; + var newNode = SyntaxFactory.TypeCref(type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public SyntaxToken LessThanSlashToken => this.lessThanSlashToken; - public XmlNameSyntax Name => this.name; - public SyntaxToken GreaterThanToken => this.greaterThanToken; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanSlashToken, - 1 => this.name, - 2 => this.greaterThanToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new TypeCrefSyntax(this.Kind, this.type, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new TypeCrefSyntax(this.Kind, this.type, GetDiagnostics(), annotations); +} + +/// +/// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. +/// For example, cref="System.String.ToString()". +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +internal sealed partial class QualifiedCrefSyntax : CrefSyntax +{ + internal readonly TypeSyntax container; + internal readonly SyntaxToken dotToken; + internal readonly MemberCrefSyntax member; + + internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(container); + this.container = container; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(member); + this.member = member; + } + + internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(container); + this.container = container; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(member); + this.member = member; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementEndTagSyntax(this, parent, position); + internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(container); + this.container = container; + this.AdjustFlagsAndWidth(dotToken); + this.dotToken = dotToken; + this.AdjustFlagsAndWidth(member); + this.member = member; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); + public TypeSyntax Container => this.container; + public SyntaxToken DotToken => this.dotToken; + public MemberCrefSyntax Member => this.member; - public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + internal override GreenNode? GetSlot(int index) + => index switch { - if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + 0 => this.container, + 1 => this.dotToken, + 2 => this.member, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.QualifiedCrefSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); - return this; + public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + { + if (container != this.Container || dotToken != this.DotToken || member != this.Member) + { + var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new QualifiedCrefSyntax(this.Kind, this.container, this.dotToken, this.member, GetDiagnostics(), annotations); +} + +/// +/// The unqualified part of a CrefSyntax. +/// For example, "ToString()" in "object.ToString()". +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +internal abstract partial class MemberCrefSyntax : CrefSyntax +{ + internal MemberCrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - internal sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax + internal MemberCrefSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken lessThanToken; - internal readonly XmlNameSyntax name; - internal readonly GreenNode? attributes; - internal readonly SyntaxToken slashGreaterThanToken; + } +} + +/// +/// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, +/// with an optional type parameter list) and an optional parameter list. +/// For example, "M", "M<T>" or "M(int)". +/// Also, "A::B()" or "string()". +/// +internal sealed partial class NameMemberCrefSyntax : MemberCrefSyntax +{ + internal readonly TypeSyntax name; + internal readonly CrefParameterListSyntax? parameters; - internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (parameters != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(slashGreaterThanToken); - this.slashGreaterThanToken = slashGreaterThanToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, SyntaxFactoryContext context) - : base(kind) + internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(slashGreaterThanToken); - this.slashGreaterThanToken = slashGreaterThanToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken) - : base(kind) + internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (parameters != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(lessThanToken); - this.lessThanToken = lessThanToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (attributes != null) - { - this.AdjustFlagsAndWidth(attributes); - this.attributes = attributes; - } - this.AdjustFlagsAndWidth(slashGreaterThanToken); - this.slashGreaterThanToken = slashGreaterThanToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - public SyntaxToken LessThanToken => this.lessThanToken; - public XmlNameSyntax Name => this.name; - public CoreSyntax.SyntaxList Attributes => new CoreSyntax.SyntaxList(this.attributes); - public SyntaxToken SlashGreaterThanToken => this.slashGreaterThanToken; + public TypeSyntax Name => this.name; + public CrefParameterListSyntax? Parameters => this.parameters; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanToken, - 1 => this.name, - 2 => this.attributes, - 3 => this.slashGreaterThanToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.parameters, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlEmptyElementSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NameMemberCrefSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); - public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) + public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax parameters) + { + if (name != this.Name || parameters != this.Parameters) { - if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) - { - var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.NameMemberCref(name, parameters); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class XmlNameSyntax : CSharpSyntaxNode - { - internal readonly XmlPrefixSyntax? prefix; - internal readonly SyntaxToken localName; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, diagnostics, GetAnnotations()); - internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NameMemberCrefSyntax(this.Kind, this.name, this.parameters, GetDiagnostics(), annotations); +} + +/// +/// A MemberCrefSyntax specified by a this keyword and an optional parameter list. +/// For example, "this" or "this[int]". +/// +internal sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax +{ + internal readonly SyntaxToken thisKeyword; + internal readonly CrefBracketedParameterListSyntax? parameters; + + internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + if (parameters != null) { - this.SlotCount = 2; - if (prefix != null) - { - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - } - this.AdjustFlagsAndWidth(localName); - this.localName = localName; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, SyntaxFactoryContext context) - : base(kind) + internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - if (prefix != null) - { - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - } - this.AdjustFlagsAndWidth(localName); - this.localName = localName; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName) - : base(kind) + internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + : base(kind) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(thisKeyword); + this.thisKeyword = thisKeyword; + if (parameters != null) { - this.SlotCount = 2; - if (prefix != null) - { - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - } - this.AdjustFlagsAndWidth(localName); - this.localName = localName; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - public XmlPrefixSyntax? Prefix => this.prefix; - public SyntaxToken LocalName => this.localName; + public SyntaxToken ThisKeyword => this.thisKeyword; + public CrefBracketedParameterListSyntax? Parameters => this.parameters; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.prefix, - 1 => this.localName, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.thisKeyword, + 1 => this.parameters, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IndexerMemberCrefSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); - public XmlNameSyntax Update(XmlPrefixSyntax prefix, SyntaxToken localName) + public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax parameters) + { + if (thisKeyword != this.ThisKeyword || parameters != this.Parameters) { - if (prefix != this.Prefix || localName != this.LocalName) - { - var newNode = SyntaxFactory.XmlName(prefix, localName); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlNameSyntax(this.Kind, this.prefix, this.localName, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlNameSyntax(this.Kind, this.prefix, this.localName, GetDiagnostics(), annotations); + return this; } - internal sealed partial class XmlPrefixSyntax : CSharpSyntaxNode + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IndexerMemberCrefSyntax(this.Kind, this.thisKeyword, this.parameters, GetDiagnostics(), annotations); +} + +/// +/// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. +/// For example, "operator +" or "operator -[int]". +/// NOTE: the operator must be overloadable. +/// +internal sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax +{ + internal readonly SyntaxToken operatorKeyword; + internal readonly SyntaxToken? checkedKeyword; + internal readonly SyntaxToken operatorToken; + internal readonly CrefParameterListSyntax? parameters; + + internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal readonly SyntaxToken prefix; - internal readonly SyntaxToken colonToken; + this.SlotCount = 4; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) + { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (parameters != null) + { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; + } + } - internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (parameters != null) + { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; + } + } - internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, SyntaxFactoryContext context) - : base(kind) + internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 2; - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } - - internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken) - : base(kind) + this.AdjustFlagsAndWidth(operatorToken); + this.operatorToken = operatorToken; + if (parameters != null) { - this.SlotCount = 2; - this.AdjustFlagsAndWidth(prefix); - this.prefix = prefix; - this.AdjustFlagsAndWidth(colonToken); - this.colonToken = colonToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - public SyntaxToken Prefix => this.prefix; - public SyntaxToken ColonToken => this.colonToken; + public SyntaxToken OperatorKeyword => this.operatorKeyword; + public SyntaxToken? CheckedKeyword => this.checkedKeyword; + /// Gets the operator token. + public SyntaxToken OperatorToken => this.operatorToken; + public CrefParameterListSyntax? Parameters => this.parameters; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.prefix, - 1 => this.colonToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.operatorKeyword, + 1 => this.checkedKeyword, + 2 => this.operatorToken, + 3 => this.parameters, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlPrefixSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.OperatorMemberCrefSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); - public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken) + public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax parameters) + { + if (operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters) { - if (prefix != this.Prefix || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, operatorToken, parameters); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, GetDiagnostics(), annotations); + return this; } - internal abstract partial class XmlAttributeSyntax : CSharpSyntaxNode + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameters, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new OperatorMemberCrefSyntax(this.Kind, this.operatorKeyword, this.checkedKeyword, this.operatorToken, this.parameters, GetDiagnostics(), annotations); +} + +/// +/// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. +/// For example, "implicit operator int" or "explicit operator MyType(int)". +/// +internal sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax +{ + internal readonly SyntaxToken implicitOrExplicitKeyword; + internal readonly SyntaxToken operatorKeyword; + internal readonly SyntaxToken? checkedKeyword; + internal readonly TypeSyntax type; + internal readonly CrefParameterListSyntax? parameters; + + internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal XmlAttributeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 5; + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } - - internal XmlAttributeSyntax(SyntaxKind kind) - : base(kind) + this.AdjustFlagsAndWidth(type); + this.type = type; + if (parameters != null) { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } - - public abstract XmlNameSyntax Name { get; } - - public abstract SyntaxToken EqualsToken { get; } - - public abstract SyntaxToken StartQuoteToken { get; } - - public abstract SyntaxToken EndQuoteToken { get; } } - internal sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax + internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) + : base(kind) { - internal readonly XmlNameSyntax name; - internal readonly SyntaxToken equalsToken; - internal readonly SyntaxToken startQuoteToken; - internal readonly GreenNode? textTokens; - internal readonly SyntaxToken endQuoteToken; - - internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } - - internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; } + this.AdjustFlagsAndWidth(type); + this.type = type; + if (parameters != null) + { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; + } + } - internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken) - : base(kind) + internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(implicitOrExplicitKeyword); + this.implicitOrExplicitKeyword = implicitOrExplicitKeyword; + this.AdjustFlagsAndWidth(operatorKeyword); + this.operatorKeyword = operatorKeyword; + if (checkedKeyword != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; + this.AdjustFlagsAndWidth(checkedKeyword); + this.checkedKeyword = checkedKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + if (parameters != null) + { + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + } - public override XmlNameSyntax Name => this.name; - public override SyntaxToken EqualsToken => this.equalsToken; - public override SyntaxToken StartQuoteToken => this.startQuoteToken; - public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); - public override SyntaxToken EndQuoteToken => this.endQuoteToken; + public SyntaxToken ImplicitOrExplicitKeyword => this.implicitOrExplicitKeyword; + public SyntaxToken OperatorKeyword => this.operatorKeyword; + public SyntaxToken? CheckedKeyword => this.checkedKeyword; + public TypeSyntax Type => this.type; + public CrefParameterListSyntax? Parameters => this.parameters; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.equalsToken, - 2 => this.startQuoteToken, - 3 => this.textTokens, - 4 => this.endQuoteToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.implicitOrExplicitKeyword, + 1 => this.operatorKeyword, + 2 => this.checkedKeyword, + 3 => this.type, + 4 => this.parameters, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextAttributeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ConversionOperatorMemberCrefSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); - public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) + public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax parameters) + { + if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameters != this.Parameters) { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, GetDiagnostics(), annotations); - } - - internal sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax - { - internal readonly XmlNameSyntax name; - internal readonly SyntaxToken equalsToken; - internal readonly SyntaxToken startQuoteToken; - internal readonly CrefSyntax cref; - internal readonly SyntaxToken endQuoteToken; - - internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(cref); - this.cref = cref; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } - - internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(cref); - this.cref = cref; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } - - internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(cref); - this.cref = cref; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; - } - - public override XmlNameSyntax Name => this.name; - public override SyntaxToken EqualsToken => this.equalsToken; - public override SyntaxToken StartQuoteToken => this.startQuoteToken; - public CrefSyntax Cref => this.cref; - public override SyntaxToken EndQuoteToken => this.endQuoteToken; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.equalsToken, - 2 => this.startQuoteToken, - 3 => this.cref, - 4 => this.endQuoteToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCrefAttributeSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.checkedKeyword, this.type, this.parameters, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ConversionOperatorMemberCrefSyntax(this.Kind, this.implicitOrExplicitKeyword, this.operatorKeyword, this.checkedKeyword, this.type, this.parameters, GetDiagnostics(), annotations); +} - public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) - { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +/// +/// A list of cref parameters with surrounding punctuation. +/// Unlike regular parameters, cref parameters do not have names. +/// +internal abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode +{ + internal BaseCrefParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - return this; - } + internal BaseCrefParameterListSyntax(SyntaxKind kind) + : base(kind) + { + } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, diagnostics, GetAnnotations()); + /// Gets the parameter list. + public abstract CoreSyntax.SeparatedSyntaxList Parameters { get; } +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, GetDiagnostics(), annotations); - } +/// +/// A parenthesized list of cref parameters. +/// +internal sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax +{ + internal readonly SyntaxToken openParenToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken closeParenToken; - internal sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax + internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal readonly XmlNameSyntax name; - internal readonly SyntaxToken equalsToken; - internal readonly SyntaxToken startQuoteToken; - internal readonly IdentifierNameSyntax identifier; - internal readonly SyntaxToken endQuoteToken; - - internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, SyntaxFactoryContext context) - : base(kind) + internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) - : base(kind) + internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + if (parameters != null) { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(equalsToken); - this.equalsToken = equalsToken; - this.AdjustFlagsAndWidth(startQuoteToken); - this.startQuoteToken = startQuoteToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endQuoteToken); - this.endQuoteToken = endQuoteToken; + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } - public override XmlNameSyntax Name => this.name; - public override SyntaxToken EqualsToken => this.equalsToken; - public override SyntaxToken StartQuoteToken => this.startQuoteToken; - public IdentifierNameSyntax Identifier => this.identifier; - public override SyntaxToken EndQuoteToken => this.endQuoteToken; + /// Gets the open paren token. + public SyntaxToken OpenParenToken => this.openParenToken; + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// Gets the close paren token. + public SyntaxToken CloseParenToken => this.closeParenToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.equalsToken, - 2 => this.startQuoteToken, - 3 => this.identifier, - 4 => this.endQuoteToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.parameters, + 2 => this.closeParenToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameAttributeSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); - public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + public CrefParameterListSyntax Update(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class XmlTextSyntax : XmlNodeSyntax - { - internal readonly GreenNode? textTokens; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CrefParameterListSyntax(this.Kind, this.openParenToken, this.parameters, this.closeParenToken, GetDiagnostics(), annotations); +} - internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +/// +/// A bracketed list of cref parameters. +/// +internal sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax +{ + internal readonly SyntaxToken openBracketToken; + internal readonly GreenNode? parameters; + internal readonly SyntaxToken closeBracketToken; + + internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - this.SlotCount = 1; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, SyntaxFactoryContext context) - : base(kind) + internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - this.SetFactoryContext(context); - this.SlotCount = 1; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) - : base(kind) + internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(openBracketToken); + this.openBracketToken = openBracketToken; + if (parameters != null) { - this.SlotCount = 1; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } + this.AdjustFlagsAndWidth(parameters); + this.parameters = parameters; } + this.AdjustFlagsAndWidth(closeBracketToken); + this.closeBracketToken = closeBracketToken; + } - public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => this.openBracketToken; + public override CoreSyntax.SeparatedSyntaxList Parameters => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.parameters)); + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => this.closeBracketToken; - internal override GreenNode? GetSlot(int index) - => index == 0 ? this.textTokens : null; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openBracketToken, + 1 => this.parameters, + 2 => this.closeBracketToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefBracketedParameterListSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); - public XmlTextSyntax Update(CoreSyntax.SyntaxList textTokens) + public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) { - if (textTokens != this.TextTokens) - { - var newNode = SyntaxFactory.XmlText(textTokens); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlTextSyntax(this.Kind, this.textTokens, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlTextSyntax(this.Kind, this.textTokens, GetDiagnostics(), annotations); + return this; } - internal sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax - { - internal readonly SyntaxToken startCDataToken; - internal readonly GreenNode? textTokens; - internal readonly SyntaxToken endCDataToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CrefBracketedParameterListSyntax(this.Kind, this.openBracketToken, this.parameters, this.closeBracketToken, GetDiagnostics(), annotations); +} + +/// +/// An element of a BaseCrefParameterListSyntax. +/// Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, +/// an optional readonly keyword, and a type - +/// there is no name and there are no attributes or other modifiers. +/// +internal sealed partial class CrefParameterSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken? refKindKeyword; + internal readonly SyntaxToken? readOnlyKeyword; + internal readonly TypeSyntax type; - internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + if (refKindKeyword != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startCDataToken); - this.startCDataToken = startCDataToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endCDataToken); - this.endCDataToken = endCDataToken; + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } + if (readOnlyKeyword != null) + { + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, SyntaxFactoryContext context) - : base(kind) + internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + if (refKindKeyword != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startCDataToken); - this.startCDataToken = startCDataToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endCDataToken); - this.endCDataToken = endCDataToken; + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; + } + if (readOnlyKeyword != null) + { + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken) - : base(kind) + internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + : base(kind) + { + this.SlotCount = 3; + if (refKindKeyword != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(startCDataToken); - this.startCDataToken = startCDataToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endCDataToken); - this.endCDataToken = endCDataToken; + this.AdjustFlagsAndWidth(refKindKeyword); + this.refKindKeyword = refKindKeyword; } + if (readOnlyKeyword != null) + { + this.AdjustFlagsAndWidth(readOnlyKeyword); + this.readOnlyKeyword = readOnlyKeyword; + } + this.AdjustFlagsAndWidth(type); + this.type = type; + } - public SyntaxToken StartCDataToken => this.startCDataToken; - public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); - public SyntaxToken EndCDataToken => this.endCDataToken; + public SyntaxToken? RefKindKeyword => this.refKindKeyword; + public SyntaxToken? ReadOnlyKeyword => this.readOnlyKeyword; + public TypeSyntax Type => this.type; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.startCDataToken, - 1 => this.textTokens, - 2 => this.endCDataToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.refKindKeyword, + 1 => this.readOnlyKeyword, + 2 => this.type, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCDataSectionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.CrefParameterSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); - public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + { + if (refKindKeyword != this.RefKindKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) { - if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) - { - var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.CrefParameter(refKindKeyword, readOnlyKeyword, type); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.readOnlyKeyword, this.type, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new CrefParameterSyntax(this.Kind, this.refKindKeyword, this.readOnlyKeyword, this.type, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, GetDiagnostics(), annotations); +internal abstract partial class XmlNodeSyntax : CSharpSyntaxNode +{ + internal XmlNodeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - internal sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax + internal XmlNodeSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken startProcessingInstructionToken; - internal readonly XmlNameSyntax name; - internal readonly GreenNode? textTokens; - internal readonly SyntaxToken endProcessingInstructionToken; + } +} + +internal sealed partial class XmlElementSyntax : XmlNodeSyntax +{ + internal readonly XmlElementStartTagSyntax startTag; + internal readonly GreenNode? content; + internal readonly XmlElementEndTagSyntax endTag; - internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startTag); + this.startTag = startTag; + if (content != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(startProcessingInstructionToken); - this.startProcessingInstructionToken = startProcessingInstructionToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endProcessingInstructionToken); - this.endProcessingInstructionToken = endProcessingInstructionToken; + this.AdjustFlagsAndWidth(content); + this.content = content; } + this.AdjustFlagsAndWidth(endTag); + this.endTag = endTag; + } - internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, SyntaxFactoryContext context) - : base(kind) + internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startTag); + this.startTag = startTag; + if (content != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(startProcessingInstructionToken); - this.startProcessingInstructionToken = startProcessingInstructionToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endProcessingInstructionToken); - this.endProcessingInstructionToken = endProcessingInstructionToken; + this.AdjustFlagsAndWidth(content); + this.content = content; } + this.AdjustFlagsAndWidth(endTag); + this.endTag = endTag; + } - internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken) - : base(kind) + internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startTag); + this.startTag = startTag; + if (content != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(startProcessingInstructionToken); - this.startProcessingInstructionToken = startProcessingInstructionToken; - this.AdjustFlagsAndWidth(name); - this.name = name; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(endProcessingInstructionToken); - this.endProcessingInstructionToken = endProcessingInstructionToken; + this.AdjustFlagsAndWidth(content); + this.content = content; } + this.AdjustFlagsAndWidth(endTag); + this.endTag = endTag; + } - public SyntaxToken StartProcessingInstructionToken => this.startProcessingInstructionToken; - public XmlNameSyntax Name => this.name; - public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); - public SyntaxToken EndProcessingInstructionToken => this.endProcessingInstructionToken; + public XmlElementStartTagSyntax StartTag => this.startTag; + public CoreSyntax.SyntaxList Content => new CoreSyntax.SyntaxList(this.content); + public XmlElementEndTagSyntax EndTag => this.endTag; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.startProcessingInstructionToken, - 1 => this.name, - 2 => this.textTokens, - 3 => this.endProcessingInstructionToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.startTag, + 1 => this.content, + 2 => this.endTag, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlProcessingInstructionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); - public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + { + if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) { - if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) - { - var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlElement(startTag, content, endTag); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, GetDiagnostics(), annotations); + return this; } - internal sealed partial class XmlCommentSyntax : XmlNodeSyntax - { - internal readonly SyntaxToken lessThanExclamationMinusMinusToken; - internal readonly GreenNode? textTokens; - internal readonly SyntaxToken minusMinusGreaterThanToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlElementSyntax(this.Kind, this.startTag, this.content, this.endTag, GetDiagnostics(), annotations); +} + +internal sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken lessThanToken; + internal readonly XmlNameSyntax name; + internal readonly GreenNode? attributes; + internal readonly SyntaxToken greaterThanToken; - internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); - this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); - this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, SyntaxFactoryContext context) - : base(kind) + internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); - this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); - this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken) - : base(kind) + internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); - this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; - if (textTokens != null) - { - this.AdjustFlagsAndWidth(textTokens); - this.textTokens = textTokens; - } - this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); - this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - public SyntaxToken LessThanExclamationMinusMinusToken => this.lessThanExclamationMinusMinusToken; - public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); - public SyntaxToken MinusMinusGreaterThanToken => this.minusMinusGreaterThanToken; + public SyntaxToken LessThanToken => this.lessThanToken; + public XmlNameSyntax Name => this.name; + public CoreSyntax.SyntaxList Attributes => new CoreSyntax.SyntaxList(this.attributes); + public SyntaxToken GreaterThanToken => this.greaterThanToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.lessThanExclamationMinusMinusToken, - 1 => this.textTokens, - 2 => this.minusMinusGreaterThanToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.lessThanToken, + 1 => this.name, + 2 => this.attributes, + 3 => this.greaterThanToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCommentSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementStartTagSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); - public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) + public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) { - if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) - { - var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlElementStartTagSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.greaterThanToken, GetDiagnostics(), annotations); +} + +internal sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken lessThanSlashToken; + internal readonly XmlNameSyntax name; + internal readonly SyntaxToken greaterThanToken; + + internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanSlashToken); + this.lessThanSlashToken = lessThanSlashToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, GetDiagnostics(), annotations); + internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanSlashToken); + this.lessThanSlashToken = lessThanSlashToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; } - internal abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax + internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + : base(kind) { - internal DirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanSlashToken); + this.lessThanSlashToken = lessThanSlashToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(greaterThanToken); + this.greaterThanToken = greaterThanToken; + } + + public SyntaxToken LessThanSlashToken => this.lessThanSlashToken; + public XmlNameSyntax Name => this.name; + public SyntaxToken GreaterThanToken => this.greaterThanToken; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.flags |= NodeFlags.ContainsDirectives; - } + 0 => this.lessThanSlashToken, + 1 => this.name, + 2 => this.greaterThanToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlElementEndTagSyntax(this, parent, position); - internal DirectiveTriviaSyntax(SyntaxKind kind) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); + + public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + { + if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken) { - this.flags |= NodeFlags.ContainsDirectives; + var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public abstract SyntaxToken HashToken { get; } + return this; + } - public abstract SyntaxToken EndOfDirectiveToken { get; } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, diagnostics, GetAnnotations()); - public abstract bool IsActive { get; } - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlElementEndTagSyntax(this.Kind, this.lessThanSlashToken, this.name, this.greaterThanToken, GetDiagnostics(), annotations); +} + +internal sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax +{ + internal readonly SyntaxToken lessThanToken; + internal readonly XmlNameSyntax name; + internal readonly GreenNode? attributes; + internal readonly SyntaxToken slashGreaterThanToken; - internal abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) { - internal BranchingDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(slashGreaterThanToken); + this.slashGreaterThanToken = slashGreaterThanToken; + } - internal BranchingDirectiveTriviaSyntax(SyntaxKind kind) - : base(kind) + internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } - - public abstract bool BranchTaken { get; } + this.AdjustFlagsAndWidth(slashGreaterThanToken); + this.slashGreaterThanToken = slashGreaterThanToken; } - internal abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax + internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken) + : base(kind) { - internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SlotCount = 4; + this.AdjustFlagsAndWidth(lessThanToken); + this.lessThanToken = lessThanToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (attributes != null) { + this.AdjustFlagsAndWidth(attributes); + this.attributes = attributes; } + this.AdjustFlagsAndWidth(slashGreaterThanToken); + this.slashGreaterThanToken = slashGreaterThanToken; + } + + public SyntaxToken LessThanToken => this.lessThanToken; + public XmlNameSyntax Name => this.name; + public CoreSyntax.SyntaxList Attributes => new CoreSyntax.SyntaxList(this.attributes); + public SyntaxToken SlashGreaterThanToken => this.slashGreaterThanToken; - internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - } + 0 => this.lessThanToken, + 1 => this.name, + 2 => this.attributes, + 3 => this.slashGreaterThanToken, + _ => null, + }; - public abstract ExpressionSyntax Condition { get; } + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlEmptyElementSyntax(this, parent, position); - public abstract bool ConditionValue { get; } - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); - internal sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax + public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken ifKeyword; - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; - internal readonly bool branchTaken; - internal readonly bool conditionValue; - - internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; - } - - internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; + var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - : base(kind) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(ifKeyword); - this.ifKeyword = ifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; - } - - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken IfKeyword => this.ifKeyword; - public override ExpressionSyntax Condition => this.condition; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - public override bool BranchTaken => this.branchTaken; - public override bool ConditionValue => this.conditionValue; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.ifKeyword, - 2 => this.condition, - 3 => this.endOfDirectiveToken, - _ => null, - }; + return this; + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfDirectiveTriviaSyntax(this, parent, position); + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, diagnostics, GetAnnotations()); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlEmptyElementSyntax(this.Kind, this.lessThanToken, this.name, this.attributes, this.slashGreaterThanToken, GetDiagnostics(), annotations); +} - public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { - if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +internal sealed partial class XmlNameSyntax : CSharpSyntaxNode +{ + internal readonly XmlPrefixSyntax? prefix; + internal readonly SyntaxToken localName; - return this; + internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + if (prefix != null) + { + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(localName); + this.localName = localName; } - internal sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax + internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken elifKeyword; - internal readonly ExpressionSyntax condition; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; - internal readonly bool branchTaken; - internal readonly bool conditionValue; + this.SetFactoryContext(context); + this.SlotCount = 2; + if (prefix != null) + { + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; + } + this.AdjustFlagsAndWidth(localName); + this.localName = localName; + } - internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName) + : base(kind) + { + this.SlotCount = 2; + if (prefix != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elifKeyword); - this.elifKeyword = elifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; - } - - internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elifKeyword); - this.elifKeyword = elifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; } + this.AdjustFlagsAndWidth(localName); + this.localName = localName; + } - internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - : base(kind) + public XmlPrefixSyntax? Prefix => this.prefix; + public SyntaxToken LocalName => this.localName; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elifKeyword); - this.elifKeyword = elifKeyword; - this.AdjustFlagsAndWidth(condition); - this.condition = condition; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - this.conditionValue = conditionValue; - } - - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken ElifKeyword => this.elifKeyword; - public override ExpressionSyntax Condition => this.condition; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - public override bool BranchTaken => this.branchTaken; - public override bool ConditionValue => this.conditionValue; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.elifKeyword, - 2 => this.condition, - 3 => this.endOfDirectiveToken, - _ => null, - }; + 0 => this.prefix, + 1 => this.localName, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElifDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); - public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + public XmlNameSyntax Update(XmlPrefixSyntax prefix, SyntaxToken localName) + { + if (prefix != this.Prefix || localName != this.LocalName) { - if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + var newNode = SyntaxFactory.XmlName(prefix, localName); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlNameSyntax(this.Kind, this.prefix, this.localName, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlNameSyntax(this.Kind, this.prefix, this.localName, GetDiagnostics(), annotations); +} - return this; - } +internal sealed partial class XmlPrefixSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken prefix; + internal readonly SyntaxToken colonToken; - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations()); + internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 2; + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations); + internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 2; + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; } - internal sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax + internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken elseKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; - internal readonly bool branchTaken; + this.SlotCount = 2; + this.AdjustFlagsAndWidth(prefix); + this.prefix = prefix; + this.AdjustFlagsAndWidth(colonToken); + this.colonToken = colonToken; + } - internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - } + public SyntaxToken Prefix => this.prefix; + public SyntaxToken ColonToken => this.colonToken; - internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; - } + 0 => this.prefix, + 1 => this.colonToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlPrefixSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); - internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) - : base(kind) + public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken) + { + if (prefix != this.Prefix || colonToken != this.ColonToken) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(elseKeyword); - this.elseKeyword = elseKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - this.branchTaken = branchTaken; + var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken ElseKeyword => this.elseKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - public override bool BranchTaken => this.branchTaken; + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, diagnostics, GetAnnotations()); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.elseKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlPrefixSyntax(this.Kind, this.prefix, this.colonToken, GetDiagnostics(), annotations); +} - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseDirectiveTriviaSyntax(this, parent, position); +internal abstract partial class XmlAttributeSyntax : CSharpSyntaxNode +{ + internal XmlAttributeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); + internal XmlAttributeSyntax(SyntaxKind kind) + : base(kind) + { + } - public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) - { - if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public abstract XmlNameSyntax Name { get; } - return this; - } + public abstract SyntaxToken EqualsToken { get; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, diagnostics, GetAnnotations()); + public abstract SyntaxToken StartQuoteToken { get; } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, GetDiagnostics(), annotations); - } + public abstract SyntaxToken EndQuoteToken { get; } +} - internal sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken endIfKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; +internal sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax +{ + internal readonly XmlNameSyntax name; + internal readonly SyntaxToken equalsToken; + internal readonly SyntaxToken startQuoteToken; + internal readonly GreenNode? textTokens; + internal readonly SyntaxToken endQuoteToken; - internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endIfKeyword); - this.endIfKeyword = endIfKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } - internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + if (textTokens != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endIfKeyword); - this.endIfKeyword = endIfKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } - internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endIfKeyword); - this.endIfKeyword = endIfKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken EndIfKeyword => this.endIfKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public override XmlNameSyntax Name => this.name; + public override SyntaxToken EqualsToken => this.equalsToken; + public override SyntaxToken StartQuoteToken => this.startQuoteToken; + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public override SyntaxToken EndQuoteToken => this.endQuoteToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.endIfKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.equalsToken, + 2 => this.startQuoteToken, + 3 => this.textTokens, + 4 => this.endQuoteToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndIfDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextAttributeSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); - public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) + { + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) { - if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + return this; } - internal sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken regionKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlTextAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.textTokens, this.endQuoteToken, GetDiagnostics(), annotations); +} + +internal sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax +{ + internal readonly XmlNameSyntax name; + internal readonly SyntaxToken equalsToken; + internal readonly SyntaxToken startQuoteToken; + internal readonly CrefSyntax cref; + internal readonly SyntaxToken endQuoteToken; + + internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(cref); + this.cref = cref; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(cref); + this.cref = cref; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(cref); + this.cref = cref; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + public override XmlNameSyntax Name => this.name; + public override SyntaxToken EqualsToken => this.equalsToken; + public override SyntaxToken StartQuoteToken => this.startQuoteToken; + public CrefSyntax Cref => this.cref; + public override SyntaxToken EndQuoteToken => this.endQuoteToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.equalsToken, + 2 => this.startQuoteToken, + 3 => this.cref, + 4 => this.endQuoteToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCrefAttributeSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); + + public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + { + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken) + { + var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlCrefAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.cref, this.endQuoteToken, GetDiagnostics(), annotations); +} + +internal sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax +{ + internal readonly XmlNameSyntax name; + internal readonly SyntaxToken equalsToken; + internal readonly SyntaxToken startQuoteToken; + internal readonly IdentifierNameSyntax identifier; + internal readonly SyntaxToken endQuoteToken; + + internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(equalsToken); + this.equalsToken = equalsToken; + this.AdjustFlagsAndWidth(startQuoteToken); + this.startQuoteToken = startQuoteToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endQuoteToken); + this.endQuoteToken = endQuoteToken; + } + + public override XmlNameSyntax Name => this.name; + public override SyntaxToken EqualsToken => this.equalsToken; + public override SyntaxToken StartQuoteToken => this.startQuoteToken; + public IdentifierNameSyntax Identifier => this.identifier; + public override SyntaxToken EndQuoteToken => this.endQuoteToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.equalsToken, + 2 => this.startQuoteToken, + 3 => this.identifier, + 4 => this.endQuoteToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlNameAttributeSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); + + public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + { + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken) + { + var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlNameAttributeSyntax(this.Kind, this.name, this.equalsToken, this.startQuoteToken, this.identifier, this.endQuoteToken, GetDiagnostics(), annotations); +} - internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) +internal sealed partial class XmlTextSyntax : XmlNodeSyntax +{ + internal readonly GreenNode? textTokens; + + internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 1; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(regionKeyword); - this.regionKeyword = regionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + } - internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 1; + if (textTokens != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(regionKeyword); - this.regionKeyword = regionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + } - internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) + : base(kind) + { + this.SlotCount = 1; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(regionKeyword); - this.regionKeyword = regionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken RegionKeyword => this.regionKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.regionKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index == 0 ? this.textTokens : null; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RegionDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlTextSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); - public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + public XmlTextSyntax Update(CoreSyntax.SyntaxList textTokens) + { + if (textTokens != this.TextTokens) { - if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlText(textTokens); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + return this; } - internal sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken endRegionKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlTextSyntax(this.Kind, this.textTokens, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlTextSyntax(this.Kind, this.textTokens, GetDiagnostics(), annotations); +} + +internal sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax +{ + internal readonly SyntaxToken startCDataToken; + internal readonly GreenNode? textTokens; + internal readonly SyntaxToken endCDataToken; - internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startCDataToken); + this.startCDataToken = startCDataToken; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endRegionKeyword); - this.endRegionKeyword = endRegionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endCDataToken); + this.endCDataToken = endCDataToken; + } - internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startCDataToken); + this.startCDataToken = startCDataToken; + if (textTokens != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endRegionKeyword); - this.endRegionKeyword = endRegionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endCDataToken); + this.endCDataToken = endCDataToken; + } - internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(startCDataToken); + this.startCDataToken = startCDataToken; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(endRegionKeyword); - this.endRegionKeyword = endRegionKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endCDataToken); + this.endCDataToken = endCDataToken; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken EndRegionKeyword => this.endRegionKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public SyntaxToken StartCDataToken => this.startCDataToken; + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public SyntaxToken EndCDataToken => this.endCDataToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.endRegionKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.startCDataToken, + 1 => this.textTokens, + 2 => this.endCDataToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndRegionDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCDataSectionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); - public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + { + if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) { - if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + return this; } - internal sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken errorKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlCDataSectionSyntax(this.Kind, this.startCDataToken, this.textTokens, this.endCDataToken, GetDiagnostics(), annotations); +} + +internal sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax +{ + internal readonly SyntaxToken startProcessingInstructionToken; + internal readonly XmlNameSyntax name; + internal readonly GreenNode? textTokens; + internal readonly SyntaxToken endProcessingInstructionToken; - internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(startProcessingInstructionToken); + this.startProcessingInstructionToken = startProcessingInstructionToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(errorKeyword); - this.errorKeyword = errorKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endProcessingInstructionToken); + this.endProcessingInstructionToken = endProcessingInstructionToken; + } - internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(startProcessingInstructionToken); + this.startProcessingInstructionToken = startProcessingInstructionToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (textTokens != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(errorKeyword); - this.errorKeyword = errorKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endProcessingInstructionToken); + this.endProcessingInstructionToken = endProcessingInstructionToken; + } - internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(startProcessingInstructionToken); + this.startProcessingInstructionToken = startProcessingInstructionToken; + this.AdjustFlagsAndWidth(name); + this.name = name; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(errorKeyword); - this.errorKeyword = errorKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(endProcessingInstructionToken); + this.endProcessingInstructionToken = endProcessingInstructionToken; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken ErrorKeyword => this.errorKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public SyntaxToken StartProcessingInstructionToken => this.startProcessingInstructionToken; + public XmlNameSyntax Name => this.name; + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public SyntaxToken EndProcessingInstructionToken => this.endProcessingInstructionToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.errorKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.startProcessingInstructionToken, + 1 => this.name, + 2 => this.textTokens, + 3 => this.endProcessingInstructionToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ErrorDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlProcessingInstructionSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); - public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + { + if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) { - if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + return this; } - internal sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken warningKeyword; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlProcessingInstructionSyntax(this.Kind, this.startProcessingInstructionToken, this.name, this.textTokens, this.endProcessingInstructionToken, GetDiagnostics(), annotations); +} + +internal sealed partial class XmlCommentSyntax : XmlNodeSyntax +{ + internal readonly SyntaxToken lessThanExclamationMinusMinusToken; + internal readonly GreenNode? textTokens; + internal readonly SyntaxToken minusMinusGreaterThanToken; - internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); + this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); + this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; + } - internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); + this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; + if (textTokens != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); + this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; + } - internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(lessThanExclamationMinusMinusToken); + this.lessThanExclamationMinusMinusToken = lessThanExclamationMinusMinusToken; + if (textTokens != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(textTokens); + this.textTokens = textTokens; } + this.AdjustFlagsAndWidth(minusMinusGreaterThanToken); + this.minusMinusGreaterThanToken = minusMinusGreaterThanToken; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken WarningKeyword => this.warningKeyword; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public SyntaxToken LessThanExclamationMinusMinusToken => this.lessThanExclamationMinusMinusToken; + public CoreSyntax.SyntaxList TextTokens => new CoreSyntax.SyntaxList(this.textTokens); + public SyntaxToken MinusMinusGreaterThanToken => this.minusMinusGreaterThanToken; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.warningKeyword, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.lessThanExclamationMinusMinusToken, + 1 => this.textTokens, + 2 => this.minusMinusGreaterThanToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WarningDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.XmlCommentSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); - public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) + { + if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) { - if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new XmlCommentSyntax(this.Kind, this.lessThanExclamationMinusMinusToken, this.textTokens, this.minusMinusGreaterThanToken, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +internal abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax +{ + internal DirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.flags |= NodeFlags.ContainsDirectives; } - internal sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal DirectiveTriviaSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken identifier; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + this.flags |= NodeFlags.ContainsDirectives; + } - internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + public abstract SyntaxToken HashToken { get; } - internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + public abstract SyntaxToken EndOfDirectiveToken { get; } - internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(identifier); - this.identifier = identifier; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + public abstract bool IsActive { get; } +} - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken Identifier => this.identifier; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; +internal abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal BranchingDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.identifier, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal BranchingDirectiveTriviaSyntax(SyntaxKind kind) + : base(kind) + { + } - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BadDirectiveTriviaSyntax(this, parent, position); + public abstract bool BranchTaken { get; } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); +internal abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax +{ + internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + } - public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind) + : base(kind) + { + } - return this; - } + public abstract ExpressionSyntax Condition { get; } + + public abstract bool ConditionValue { get; } +} + +internal sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken ifKeyword; + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + internal readonly bool branchTaken; + internal readonly bool conditionValue; + + internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(ifKeyword); + this.ifKeyword = ifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken IfKeyword => this.ifKeyword; + public override ExpressionSyntax Condition => this.condition; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + public override bool BranchTaken => this.branchTaken; + public override bool ConditionValue => this.conditionValue; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.ifKeyword, + 2 => this.condition, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.IfDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); + + public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { + if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new IfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.ifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); +internal sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken elifKeyword; + internal readonly ExpressionSyntax condition; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + internal readonly bool branchTaken; + internal readonly bool conditionValue; + + internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elifKeyword); + this.elifKeyword = elifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elifKeyword); + this.elifKeyword = elifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elifKeyword); + this.elifKeyword = elifKeyword; + this.AdjustFlagsAndWidth(condition); + this.condition = condition; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + this.conditionValue = conditionValue; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken ElifKeyword => this.elifKeyword; + public override ExpressionSyntax Condition => this.condition; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + public override bool BranchTaken => this.branchTaken; + public override bool ConditionValue => this.conditionValue; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.elifKeyword, + 2 => this.condition, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElifDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); + + public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { + if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ElifDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elifKeyword, this.condition, this.endOfDirectiveToken, this.isActive, this.branchTaken, this.conditionValue, GetDiagnostics(), annotations); +} + +internal sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken elseKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + internal readonly bool branchTaken; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; } - internal sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken defineKeyword; - internal readonly SyntaxToken name; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + } - internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(defineKeyword); - this.defineKeyword = defineKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(elseKeyword); + this.elseKeyword = elseKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + this.branchTaken = branchTaken; + } - internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(defineKeyword); - this.defineKeyword = defineKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken ElseKeyword => this.elseKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + public override bool BranchTaken => this.branchTaken; - internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(defineKeyword); - this.defineKeyword = defineKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + 0 => this.hashToken, + 1 => this.elseKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken DefineKeyword => this.defineKeyword; - public SyntaxToken Name => this.name; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ElseDirectiveTriviaSyntax(this, parent, position); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.defineKeyword, - 2 => this.name, - 3 => this.endOfDirectiveToken, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefineDirectiveTriviaSyntax(this, parent, position); + public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + { + if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); + return this; + } - public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, diagnostics, GetAnnotations()); - return this; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ElseDirectiveTriviaSyntax(this.Kind, this.hashToken, this.elseKeyword, this.endOfDirectiveToken, this.isActive, this.branchTaken, GetDiagnostics(), annotations); +} - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); +internal sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken endIfKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endIfKeyword); + this.endIfKeyword = endIfKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; } - internal sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken undefKeyword; - internal readonly SyntaxToken name; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endIfKeyword); + this.endIfKeyword = endIfKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(undefKeyword); - this.undefKeyword = undefKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endIfKeyword); + this.endIfKeyword = endIfKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(undefKeyword); - this.undefKeyword = undefKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken EndIfKeyword => this.endIfKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(undefKeyword); - this.undefKeyword = undefKeyword; - this.AdjustFlagsAndWidth(name); - this.name = name; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken UndefKeyword => this.undefKeyword; - public SyntaxToken Name => this.name; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.undefKeyword, - 2 => this.name, - 3 => this.endOfDirectiveToken, - _ => null, - }; + 0 => this.hashToken, + 1 => this.endIfKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UndefDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndIfDirectiveTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); - public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + return this; } - internal abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - } + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind) - : base(kind) - { - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EndIfDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endIfKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} - public abstract SyntaxToken LineKeyword { get; } +internal sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken regionKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - public abstract SyntaxToken? File { get; } + internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(regionKeyword); + this.regionKeyword = regionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; } - internal sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax + internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken lineKeyword; - internal readonly SyntaxToken line; - internal readonly SyntaxToken? file; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(regionKeyword); + this.regionKeyword = regionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(line); - this.line = line; - if (file != null) - { - this.AdjustFlagsAndWidth(file); - this.file = file; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(line); - this.line = line; - if (file != null) - { - this.AdjustFlagsAndWidth(file); - this.file = file; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(line); - this.line = line; - if (file != null) - { - this.AdjustFlagsAndWidth(file); - this.file = file; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(regionKeyword); + this.regionKeyword = regionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override SyntaxToken HashToken => this.hashToken; - public override SyntaxToken LineKeyword => this.lineKeyword; - public SyntaxToken Line => this.line; - public override SyntaxToken? File => this.file; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken RegionKeyword => this.regionKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.lineKeyword, - 2 => this.line, - 3 => this.file, - 4 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.regionKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.RegionDirectiveTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); - public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + return this; } - internal sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode - { - internal readonly SyntaxToken openParenToken; - internal readonly SyntaxToken line; - internal readonly SyntaxToken commaToken; - internal readonly SyntaxToken character; - internal readonly SyntaxToken closeParenToken; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(line); - this.line = line; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(character); - this.character = character; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new RegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.regionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} - internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(line); - this.line = line; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(character); - this.character = character; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } +internal sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken endRegionKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(openParenToken); - this.openParenToken = openParenToken; - this.AdjustFlagsAndWidth(line); - this.line = line; - this.AdjustFlagsAndWidth(commaToken); - this.commaToken = commaToken; - this.AdjustFlagsAndWidth(character); - this.character = character; - this.AdjustFlagsAndWidth(closeParenToken); - this.closeParenToken = closeParenToken; - } + internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endRegionKeyword); + this.endRegionKeyword = endRegionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endRegionKeyword); + this.endRegionKeyword = endRegionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(endRegionKeyword); + this.endRegionKeyword = endRegionKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public SyntaxToken OpenParenToken => this.openParenToken; - public SyntaxToken Line => this.line; - public SyntaxToken CommaToken => this.commaToken; - public SyntaxToken Character => this.character; - public SyntaxToken CloseParenToken => this.closeParenToken; + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken EndRegionKeyword => this.endRegionKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.openParenToken, - 1 => this.line, - 2 => this.commaToken, - 3 => this.character, - 4 => this.closeParenToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.endRegionKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectivePositionSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.EndRegionDirectiveTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); - public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, GetDiagnostics(), annotations); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new EndRegionDirectiveTriviaSyntax(this.Kind, this.hashToken, this.endRegionKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken errorKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(errorKeyword); + this.errorKeyword = errorKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(errorKeyword); + this.errorKeyword = errorKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; } - internal sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax + internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken lineKeyword; - internal readonly LineDirectivePositionSyntax start; - internal readonly SyntaxToken minusToken; - internal readonly LineDirectivePositionSyntax end; - internal readonly SyntaxToken? characterOffset; - internal readonly SyntaxToken file; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(errorKeyword); + this.errorKeyword = errorKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken ErrorKeyword => this.errorKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal 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) - : base(kind, diagnostics, annotations) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 8; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(start); - this.start = start; - this.AdjustFlagsAndWidth(minusToken); - this.minusToken = minusToken; - this.AdjustFlagsAndWidth(end); - this.end = end; - if (characterOffset != null) - { - this.AdjustFlagsAndWidth(characterOffset); - this.characterOffset = characterOffset; - } - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 8; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(start); - this.start = start; - this.AdjustFlagsAndWidth(minusToken); - this.minusToken = minusToken; - this.AdjustFlagsAndWidth(end); - this.end = end; - if (characterOffset != null) - { - this.AdjustFlagsAndWidth(characterOffset); - this.characterOffset = characterOffset; - } - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 8; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(lineKeyword); - this.lineKeyword = lineKeyword; - this.AdjustFlagsAndWidth(start); - this.start = start; - this.AdjustFlagsAndWidth(minusToken); - this.minusToken = minusToken; - this.AdjustFlagsAndWidth(end); - this.end = end; - if (characterOffset != null) - { - this.AdjustFlagsAndWidth(characterOffset); - this.characterOffset = characterOffset; - } - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - public override SyntaxToken HashToken => this.hashToken; - public override SyntaxToken LineKeyword => this.lineKeyword; - public LineDirectivePositionSyntax Start => this.start; - public SyntaxToken MinusToken => this.minusToken; - public LineDirectivePositionSyntax End => this.end; - public SyntaxToken? CharacterOffset => this.characterOffset; - public override SyntaxToken File => this.file; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.lineKeyword, - 2 => this.start, - 3 => this.minusToken, - 4 => this.end, - 5 => this.characterOffset, - 6 => this.file, - 7 => this.endOfDirectiveToken, - _ => null, - }; + 0 => this.hashToken, + 1 => this.errorKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineSpanDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ErrorDirectiveTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); - public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ErrorDirectiveTriviaSyntax(this.Kind, this.hashToken, this.errorKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken warningKeyword; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; } - internal sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken pragmaKeyword; - internal readonly SyntaxToken warningKeyword; - internal readonly SyntaxToken disableOrRestoreKeyword; - internal readonly GreenNode? errorCodes; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 6; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(disableOrRestoreKeyword); - this.disableOrRestoreKeyword = disableOrRestoreKeyword; - if (errorCodes != null) - { - this.AdjustFlagsAndWidth(errorCodes); - this.errorCodes = errorCodes; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 6; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(disableOrRestoreKeyword); - this.disableOrRestoreKeyword = disableOrRestoreKeyword; - if (errorCodes != null) - { - this.AdjustFlagsAndWidth(errorCodes); - this.errorCodes = errorCodes; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 6; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(warningKeyword); - this.warningKeyword = warningKeyword; - this.AdjustFlagsAndWidth(disableOrRestoreKeyword); - this.disableOrRestoreKeyword = disableOrRestoreKeyword; - if (errorCodes != null) - { - this.AdjustFlagsAndWidth(errorCodes); - this.errorCodes = errorCodes; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken PragmaKeyword => this.pragmaKeyword; - public SyntaxToken WarningKeyword => this.warningKeyword; - public SyntaxToken DisableOrRestoreKeyword => this.disableOrRestoreKeyword; - public CoreSyntax.SeparatedSyntaxList ErrorCodes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.errorCodes)); - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken WarningKeyword => this.warningKeyword; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.pragmaKeyword, - 2 => this.warningKeyword, - 3 => this.disableOrRestoreKeyword, - 4 => this.errorCodes, - 5 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.warningKeyword, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaWarningDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.WarningDirectiveTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); - public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new WarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.warningKeyword, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken identifier; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; } - internal sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken pragmaKeyword; - internal readonly SyntaxToken checksumKeyword; - internal readonly SyntaxToken file; - internal readonly SyntaxToken guid; - internal readonly SyntaxToken bytes; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(identifier); + this.identifier = identifier; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken Identifier => this.identifier; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch { - this.SlotCount = 7; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(checksumKeyword); - this.checksumKeyword = checksumKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(guid); - this.guid = guid; - this.AdjustFlagsAndWidth(bytes); - this.bytes = bytes; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 7; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(checksumKeyword); - this.checksumKeyword = checksumKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(guid); - this.guid = guid; - this.AdjustFlagsAndWidth(bytes); - this.bytes = bytes; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 7; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(pragmaKeyword); - this.pragmaKeyword = pragmaKeyword; - this.AdjustFlagsAndWidth(checksumKeyword); - this.checksumKeyword = checksumKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(guid); - this.guid = guid; - this.AdjustFlagsAndWidth(bytes); - this.bytes = bytes; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken PragmaKeyword => this.pragmaKeyword; - public SyntaxToken ChecksumKeyword => this.checksumKeyword; - public SyntaxToken File => this.file; - public SyntaxToken Guid => this.guid; - public SyntaxToken Bytes => this.bytes; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; - - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.pragmaKeyword, - 2 => this.checksumKeyword, - 3 => this.file, - 4 => this.guid, - 5 => this.bytes, - 6 => this.endOfDirectiveToken, - _ => null, - }; + 0 => this.hashToken, + 1 => this.identifier, + 2 => this.endOfDirectiveToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaChecksumDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.BadDirectiveTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); - public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new BadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.identifier, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken defineKeyword; + internal readonly SyntaxToken name; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(defineKeyword); + this.defineKeyword = defineKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(defineKeyword); + this.defineKeyword = defineKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(defineKeyword); + this.defineKeyword = defineKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken DefineKeyword => this.defineKeyword; + public SyntaxToken Name => this.name; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.defineKeyword, + 2 => this.name, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.DefineDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); + + public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new DefineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.defineKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken undefKeyword; + internal readonly SyntaxToken name; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(undefKeyword); + this.undefKeyword = undefKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(undefKeyword); + this.undefKeyword = undefKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(undefKeyword); + this.undefKeyword = undefKeyword; + this.AdjustFlagsAndWidth(name); + this.name = name; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken UndefKeyword => this.undefKeyword; + public SyntaxToken Name => this.name; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.undefKeyword, + 2 => this.name, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.UndefDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); + + public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new UndefDirectiveTriviaSyntax(this.Kind, this.hashToken, this.undefKeyword, this.name, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +internal abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { } - internal sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken referenceKeyword; - internal readonly SyntaxToken file; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + } + + public abstract SyntaxToken LineKeyword { get; } - internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + public abstract SyntaxToken? File { get; } +} + +internal sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken lineKeyword; + internal readonly SyntaxToken line; + internal readonly SyntaxToken? file; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(line); + this.line = line; + if (file != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(referenceKeyword); - this.referenceKeyword = referenceKeyword; this.AdjustFlagsAndWidth(file); this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(line); + this.line = line; + if (file != null) { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(referenceKeyword); - this.referenceKeyword = referenceKeyword; this.AdjustFlagsAndWidth(file); this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(line); + this.line = line; + if (file != null) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(referenceKeyword); - this.referenceKeyword = referenceKeyword; this.AdjustFlagsAndWidth(file); this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken ReferenceKeyword => this.referenceKeyword; - public SyntaxToken File => this.file; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public override SyntaxToken HashToken => this.hashToken; + public override SyntaxToken LineKeyword => this.lineKeyword; + public SyntaxToken Line => this.line; + public override SyntaxToken? File => this.file; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.referenceKeyword, - 2 => this.file, - 3 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.lineKeyword, + 2 => this.line, + 3 => this.file, + 4 => this.endOfDirectiveToken, + _ => null, + }; - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReferenceDirectiveTriviaSyntax(this, parent, position); + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectiveTriviaSyntax(this, parent, position); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); - public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LineDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.line, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode +{ + internal readonly SyntaxToken openParenToken; + internal readonly SyntaxToken line; + internal readonly SyntaxToken commaToken; + internal readonly SyntaxToken character; + internal readonly SyntaxToken closeParenToken; + + internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(line); + this.line = line; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(character); + this.character = character; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(line); + this.line = line; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(character); + this.character = character; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(openParenToken); + this.openParenToken = openParenToken; + this.AdjustFlagsAndWidth(line); + this.line = line; + this.AdjustFlagsAndWidth(commaToken); + this.commaToken = commaToken; + this.AdjustFlagsAndWidth(character); + this.character = character; + this.AdjustFlagsAndWidth(closeParenToken); + this.closeParenToken = closeParenToken; + } + + public SyntaxToken OpenParenToken => this.openParenToken; + public SyntaxToken Line => this.line; + public SyntaxToken CommaToken => this.commaToken; + public SyntaxToken Character => this.character; + public SyntaxToken CloseParenToken => this.closeParenToken; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.openParenToken, + 1 => this.line, + 2 => this.commaToken, + 3 => this.character, + 4 => this.closeParenToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineDirectivePositionSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); + + public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LineDirectivePositionSyntax(this.Kind, this.openParenToken, this.line, this.commaToken, this.character, this.closeParenToken, GetDiagnostics(), annotations); +} + +internal sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken lineKeyword; + internal readonly LineDirectivePositionSyntax start; + internal readonly SyntaxToken minusToken; + internal readonly LineDirectivePositionSyntax end; + internal readonly SyntaxToken? characterOffset; + internal readonly SyntaxToken file; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal 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) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 8; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(start); + this.start = start; + this.AdjustFlagsAndWidth(minusToken); + this.minusToken = minusToken; + this.AdjustFlagsAndWidth(end); + this.end = end; + if (characterOffset != null) + { + this.AdjustFlagsAndWidth(characterOffset); + this.characterOffset = characterOffset; + } + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 8; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(start); + this.start = start; + this.AdjustFlagsAndWidth(minusToken); + this.minusToken = minusToken; + this.AdjustFlagsAndWidth(end); + this.end = end; + if (characterOffset != null) + { + this.AdjustFlagsAndWidth(characterOffset); + this.characterOffset = characterOffset; + } + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 8; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(lineKeyword); + this.lineKeyword = lineKeyword; + this.AdjustFlagsAndWidth(start); + this.start = start; + this.AdjustFlagsAndWidth(minusToken); + this.minusToken = minusToken; + this.AdjustFlagsAndWidth(end); + this.end = end; + if (characterOffset != null) + { + this.AdjustFlagsAndWidth(characterOffset); + this.characterOffset = characterOffset; + } + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public override SyntaxToken LineKeyword => this.lineKeyword; + public LineDirectivePositionSyntax Start => this.start; + public SyntaxToken MinusToken => this.minusToken; + public LineDirectivePositionSyntax End => this.end; + public SyntaxToken? CharacterOffset => this.characterOffset; + public override SyntaxToken File => this.file; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.lineKeyword, + 2 => this.start, + 3 => this.minusToken, + 4 => this.end, + 5 => this.characterOffset, + 6 => this.file, + 7 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LineSpanDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); + + public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LineSpanDirectiveTriviaSyntax(this.Kind, this.hashToken, this.lineKeyword, this.start, this.minusToken, this.end, this.characterOffset, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken pragmaKeyword; + internal readonly SyntaxToken warningKeyword; + internal readonly SyntaxToken disableOrRestoreKeyword; + internal readonly GreenNode? errorCodes; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 6; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(disableOrRestoreKeyword); + this.disableOrRestoreKeyword = disableOrRestoreKeyword; + if (errorCodes != null) + { + this.AdjustFlagsAndWidth(errorCodes); + this.errorCodes = errorCodes; + } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 6; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(disableOrRestoreKeyword); + this.disableOrRestoreKeyword = disableOrRestoreKeyword; + if (errorCodes != null) + { + this.AdjustFlagsAndWidth(errorCodes); + this.errorCodes = errorCodes; + } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 6; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(warningKeyword); + this.warningKeyword = warningKeyword; + this.AdjustFlagsAndWidth(disableOrRestoreKeyword); + this.disableOrRestoreKeyword = disableOrRestoreKeyword; + if (errorCodes != null) + { + this.AdjustFlagsAndWidth(errorCodes); + this.errorCodes = errorCodes; + } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken PragmaKeyword => this.pragmaKeyword; + public SyntaxToken WarningKeyword => this.warningKeyword; + public SyntaxToken DisableOrRestoreKeyword => this.disableOrRestoreKeyword; + public CoreSyntax.SeparatedSyntaxList ErrorCodes => new CoreSyntax.SeparatedSyntaxList(new CoreSyntax.SyntaxList(this.errorCodes)); + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.pragmaKeyword, + 2 => this.warningKeyword, + 3 => this.disableOrRestoreKeyword, + 4 => this.errorCodes, + 5 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaWarningDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); + + public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PragmaWarningDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.warningKeyword, this.disableOrRestoreKeyword, this.errorCodes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken pragmaKeyword; + internal readonly SyntaxToken checksumKeyword; + internal readonly SyntaxToken file; + internal readonly SyntaxToken guid; + internal readonly SyntaxToken bytes; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 7; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(checksumKeyword); + this.checksumKeyword = checksumKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(guid); + this.guid = guid; + this.AdjustFlagsAndWidth(bytes); + this.bytes = bytes; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 7; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(checksumKeyword); + this.checksumKeyword = checksumKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(guid); + this.guid = guid; + this.AdjustFlagsAndWidth(bytes); + this.bytes = bytes; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 7; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(pragmaKeyword); + this.pragmaKeyword = pragmaKeyword; + this.AdjustFlagsAndWidth(checksumKeyword); + this.checksumKeyword = checksumKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(guid); + this.guid = guid; + this.AdjustFlagsAndWidth(bytes); + this.bytes = bytes; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken PragmaKeyword => this.pragmaKeyword; + public SyntaxToken ChecksumKeyword => this.checksumKeyword; + public SyntaxToken File => this.file; + public SyntaxToken Guid => this.guid; + public SyntaxToken Bytes => this.bytes; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.pragmaKeyword, + 2 => this.checksumKeyword, + 3 => this.file, + 4 => this.guid, + 5 => this.bytes, + 6 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.PragmaChecksumDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); + + public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new PragmaChecksumDirectiveTriviaSyntax(this.Kind, this.hashToken, this.pragmaKeyword, this.checksumKeyword, this.file, this.guid, this.bytes, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken referenceKeyword; + internal readonly SyntaxToken file; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(referenceKeyword); + this.referenceKeyword = referenceKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(referenceKeyword); + this.referenceKeyword = referenceKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(referenceKeyword); + this.referenceKeyword = referenceKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken ReferenceKeyword => this.referenceKeyword; + public SyntaxToken File => this.file; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.referenceKeyword, + 2 => this.file, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ReferenceDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); + + public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken loadKeyword; + internal readonly SyntaxToken file; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; + + internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(loadKeyword); + this.loadKeyword = loadKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) + { + this.SetFactoryContext(context); + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(loadKeyword); + this.loadKeyword = loadKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 4; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(loadKeyword); + this.loadKeyword = loadKeyword; + this.AdjustFlagsAndWidth(file); + this.file = file; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken LoadKeyword => this.loadKeyword; + public SyntaxToken File => this.file; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.loadKeyword, + 2 => this.file, + 3 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LoadDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); + + public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} + +internal sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken exclamationToken; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ReferenceDirectiveTriviaSyntax(this.Kind, this.hashToken, this.referenceKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(exclamationToken); + this.exclamationToken = exclamationToken; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; } - internal sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken loadKeyword; - internal readonly SyntaxToken file; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + this.SetFactoryContext(context); + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(exclamationToken); + this.exclamationToken = exclamationToken; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(loadKeyword); - this.loadKeyword = loadKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 3; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(exclamationToken); + this.exclamationToken = exclamationToken; + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } + + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken ExclamationToken => this.exclamationToken; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; - internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal override GreenNode? GetSlot(int index) + => index switch { - this.SetFactoryContext(context); - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(loadKeyword); - this.loadKeyword = loadKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + 0 => this.hashToken, + 1 => this.exclamationToken, + 2 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ShebangDirectiveTriviaSyntax(this, parent, position); - internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); + + public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken) { - this.SlotCount = 4; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(loadKeyword); - this.loadKeyword = loadKeyword; - this.AdjustFlagsAndWidth(file); - this.file = file; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken LoadKeyword => this.loadKeyword; - public SyntaxToken File => this.file; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.loadKeyword, - 2 => this.file, - 3 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.LoadDirectiveTriviaSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); +internal sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal readonly SyntaxToken hashToken; + internal readonly SyntaxToken nullableKeyword; + internal readonly SyntaxToken settingToken; + internal readonly SyntaxToken? targetToken; + internal readonly SyntaxToken endOfDirectiveToken; + internal readonly bool isActive; - public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) + : base(kind, diagnostics, annotations) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(nullableKeyword); + this.nullableKeyword = nullableKeyword; + this.AdjustFlagsAndWidth(settingToken); + this.settingToken = settingToken; + if (targetToken != null) { - if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } - - return this; + this.AdjustFlagsAndWidth(targetToken); + this.targetToken = targetToken; } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new LoadDirectiveTriviaSyntax(this.Kind, this.hashToken, this.loadKeyword, this.file, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; } - internal sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax + internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) + : base(kind) { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken exclamationToken; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; - - internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) + this.SetFactoryContext(context); + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(nullableKeyword); + this.nullableKeyword = nullableKeyword; + this.AdjustFlagsAndWidth(settingToken); + this.settingToken = settingToken; + if (targetToken != null) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(exclamationToken); - this.exclamationToken = exclamationToken; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(targetToken); + this.targetToken = targetToken; } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) + internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + : base(kind) + { + this.SlotCount = 5; + this.AdjustFlagsAndWidth(hashToken); + this.hashToken = hashToken; + this.AdjustFlagsAndWidth(nullableKeyword); + this.nullableKeyword = nullableKeyword; + this.AdjustFlagsAndWidth(settingToken); + this.settingToken = settingToken; + if (targetToken != null) { - this.SetFactoryContext(context); - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(exclamationToken); - this.exclamationToken = exclamationToken; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + this.AdjustFlagsAndWidth(targetToken); + this.targetToken = targetToken; } + this.AdjustFlagsAndWidth(endOfDirectiveToken); + this.endOfDirectiveToken = endOfDirectiveToken; + this.isActive = isActive; + } - internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) + public override SyntaxToken HashToken => this.hashToken; + public SyntaxToken NullableKeyword => this.nullableKeyword; + public SyntaxToken SettingToken => this.settingToken; + public SyntaxToken? TargetToken => this.targetToken; + public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; + public override bool IsActive => this.isActive; + + internal override GreenNode? GetSlot(int index) + => index switch + { + 0 => this.hashToken, + 1 => this.nullableKeyword, + 2 => this.settingToken, + 3 => this.targetToken, + 4 => this.endOfDirectiveToken, + _ => null, + }; + + internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableDirectiveTriviaSyntax(this, parent, position); + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); + public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); + + public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken) { - this.SlotCount = 3; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(exclamationToken); - this.exclamationToken = exclamationToken; - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; + var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); + var diags = GetDiagnostics(); + if (diags?.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations?.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; } - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken ExclamationToken => this.exclamationToken; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + return this; + } - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.exclamationToken, - 2 => this.endOfDirectiveToken, - _ => null, - }; + internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) + => new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.ShebangDirectiveTriviaSyntax(this, parent, position); + internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) + => new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); +internal partial class CSharpSyntaxVisitor +{ + public virtual TResult VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBlock(BlockSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual TResult VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); +} - public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } +internal partial class CSharpSyntaxVisitor +{ + public virtual void VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); + public virtual void VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); + public virtual void VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); + public virtual void VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); + public virtual void VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); + public virtual void VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); + public virtual void VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); + public virtual void VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); + public virtual void VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); + public virtual void VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); + public virtual void VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); + public virtual void VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); + public virtual void VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); + public virtual void VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); + public virtual void VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); + public virtual void VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); + public virtual void VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); + public virtual void VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); + public virtual void VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); + public virtual void VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); + public virtual void VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitBlock(BlockSyntax node) => this.DefaultVisit(node); + public virtual void VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); + public virtual void VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); + public virtual void VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); + public virtual void VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); + public virtual void VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); + public virtual void VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual void VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual void VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); + public virtual void VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); + public virtual void VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); + public virtual void VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); + public virtual void VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); + public virtual void VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); + public virtual void VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); + public virtual void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); + public virtual void VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); + public virtual void VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); + public virtual void VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); + public virtual void VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); + public virtual void VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); + public virtual void VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); + public virtual void VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); + public virtual void VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); + public virtual void VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); + public virtual void VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); + public virtual void VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); + public virtual void VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); + public virtual void VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); + public virtual void VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); + public virtual void VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); + public virtual void VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); + public virtual void VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); + public virtual void VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); + public virtual void VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); + public virtual void VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); + public virtual void VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); + public virtual void VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); + public virtual void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); + public virtual void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); +} - return this; - } +internal partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor +{ + public override CSharpSyntaxNode VisitIdentifierName(IdentifierNameSyntax node) + => node.Update((SyntaxToken)Visit(node.Identifier)); - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); + public override CSharpSyntaxNode VisitQualifiedName(QualifiedNameSyntax node) + => node.Update((NameSyntax)Visit(node.Left), (SyntaxToken)Visit(node.DotToken), (SimpleNameSyntax)Visit(node.Right)); - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new ShebangDirectiveTriviaSyntax(this.Kind, this.hashToken, this.exclamationToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); - } + public override CSharpSyntaxNode VisitGenericName(GenericNameSyntax node) + => node.Update((SyntaxToken)Visit(node.Identifier), (TypeArgumentListSyntax)Visit(node.TypeArgumentList)); - internal sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - internal readonly SyntaxToken hashToken; - internal readonly SyntaxToken nullableKeyword; - internal readonly SyntaxToken settingToken; - internal readonly SyntaxToken? targetToken; - internal readonly SyntaxToken endOfDirectiveToken; - internal readonly bool isActive; + public override CSharpSyntaxNode VisitTypeArgumentList(TypeArgumentListSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.GreaterThanToken)); - internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) - : base(kind, diagnostics, annotations) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(nullableKeyword); - this.nullableKeyword = nullableKeyword; - this.AdjustFlagsAndWidth(settingToken); - this.settingToken = settingToken; - if (targetToken != null) - { - this.AdjustFlagsAndWidth(targetToken); - this.targetToken = targetToken; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) - : base(kind) - { - this.SetFactoryContext(context); - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(nullableKeyword); - this.nullableKeyword = nullableKeyword; - this.AdjustFlagsAndWidth(settingToken); - this.settingToken = settingToken; - if (targetToken != null) - { - this.AdjustFlagsAndWidth(targetToken); - this.targetToken = targetToken; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } - - internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) - : base(kind) - { - this.SlotCount = 5; - this.AdjustFlagsAndWidth(hashToken); - this.hashToken = hashToken; - this.AdjustFlagsAndWidth(nullableKeyword); - this.nullableKeyword = nullableKeyword; - this.AdjustFlagsAndWidth(settingToken); - this.settingToken = settingToken; - if (targetToken != null) - { - this.AdjustFlagsAndWidth(targetToken); - this.targetToken = targetToken; - } - this.AdjustFlagsAndWidth(endOfDirectiveToken); - this.endOfDirectiveToken = endOfDirectiveToken; - this.isActive = isActive; - } + public override CSharpSyntaxNode VisitAliasQualifiedName(AliasQualifiedNameSyntax node) + => node.Update((IdentifierNameSyntax)Visit(node.Alias), (SyntaxToken)Visit(node.ColonColonToken), (SimpleNameSyntax)Visit(node.Name)); - public override SyntaxToken HashToken => this.hashToken; - public SyntaxToken NullableKeyword => this.nullableKeyword; - public SyntaxToken SettingToken => this.settingToken; - public SyntaxToken? TargetToken => this.targetToken; - public override SyntaxToken EndOfDirectiveToken => this.endOfDirectiveToken; - public override bool IsActive => this.isActive; + public override CSharpSyntaxNode VisitPredefinedType(PredefinedTypeSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword)); - internal override GreenNode? GetSlot(int index) - => index switch - { - 0 => this.hashToken, - 1 => this.nullableKeyword, - 2 => this.settingToken, - 3 => this.targetToken, - 4 => this.endOfDirectiveToken, - _ => null, - }; + public override CSharpSyntaxNode VisitArrayType(ArrayTypeSyntax node) + => node.Update((TypeSyntax)Visit(node.ElementType), VisitList(node.RankSpecifiers)); - internal override SyntaxNode CreateRed(SyntaxNode? parent, int position) => new CSharp.Syntax.NullableDirectiveTriviaSyntax(this, parent, position); + public override CSharpSyntaxNode VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Sizes), (SyntaxToken)Visit(node.CloseBracketToken)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); - public override TResult Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); + public override CSharpSyntaxNode VisitPointerType(PointerTypeSyntax node) + => node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.AsteriskToken)); - public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); - var diags = GetDiagnostics(); - if (diags?.Length > 0) - newNode = newNode.WithDiagnosticsGreen(diags); - var annotations = GetAnnotations(); - if (annotations?.Length > 0) - newNode = newNode.WithAnnotationsGreen(annotations); - return newNode; - } + public override CSharpSyntaxNode VisitFunctionPointerType(FunctionPointerTypeSyntax node) + => node.Update((SyntaxToken)Visit(node.DelegateKeyword), (SyntaxToken)Visit(node.AsteriskToken), (FunctionPointerCallingConventionSyntax)Visit(node.CallingConvention), (FunctionPointerParameterListSyntax)Visit(node.ParameterList)); - return this; - } - - internal override GreenNode SetDiagnostics(DiagnosticInfo[]? diagnostics) - => new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, diagnostics, GetAnnotations()); - - internal override GreenNode SetAnnotations(SyntaxAnnotation[]? annotations) - => new NullableDirectiveTriviaSyntax(this.Kind, this.hashToken, this.nullableKeyword, this.settingToken, this.targetToken, this.endOfDirectiveToken, this.isActive, GetDiagnostics(), annotations); - } - - internal partial class CSharpSyntaxVisitor - { - public virtual TResult VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBlock(BlockSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual TResult VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); - } - - internal partial class CSharpSyntaxVisitor - { - public virtual void VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); - public virtual void VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); - public virtual void VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); - public virtual void VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); - public virtual void VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); - public virtual void VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); - public virtual void VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); - public virtual void VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); - public virtual void VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); - public virtual void VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); - public virtual void VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); - public virtual void VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); - public virtual void VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); - public virtual void VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); - public virtual void VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); - public virtual void VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); - public virtual void VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); - public virtual void VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); - public virtual void VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); - public virtual void VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); - public virtual void VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitBlock(BlockSyntax node) => this.DefaultVisit(node); - public virtual void VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); - public virtual void VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); - public virtual void VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); - public virtual void VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); - public virtual void VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); - public virtual void VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual void VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual void VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); - public virtual void VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); - public virtual void VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); - public virtual void VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); - public virtual void VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); - public virtual void VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); - public virtual void VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); - public virtual void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); - public virtual void VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); - public virtual void VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); - public virtual void VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); - public virtual void VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); - public virtual void VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); - public virtual void VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); - public virtual void VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); - public virtual void VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); - public virtual void VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); - public virtual void VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); - public virtual void VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); - public virtual void VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); - public virtual void VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); - public virtual void VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); - public virtual void VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); - public virtual void VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); - public virtual void VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); - public virtual void VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); - public virtual void VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); - public virtual void VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); - public virtual void VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); - public virtual void VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); - public virtual void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); - public virtual void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); - } - - internal partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor - { - public override CSharpSyntaxNode VisitIdentifierName(IdentifierNameSyntax node) - => node.Update((SyntaxToken)Visit(node.Identifier)); - - public override CSharpSyntaxNode VisitQualifiedName(QualifiedNameSyntax node) - => node.Update((NameSyntax)Visit(node.Left), (SyntaxToken)Visit(node.DotToken), (SimpleNameSyntax)Visit(node.Right)); - - public override CSharpSyntaxNode VisitGenericName(GenericNameSyntax node) - => node.Update((SyntaxToken)Visit(node.Identifier), (TypeArgumentListSyntax)Visit(node.TypeArgumentList)); - - public override CSharpSyntaxNode VisitTypeArgumentList(TypeArgumentListSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.GreaterThanToken)); - - public override CSharpSyntaxNode VisitAliasQualifiedName(AliasQualifiedNameSyntax node) - => node.Update((IdentifierNameSyntax)Visit(node.Alias), (SyntaxToken)Visit(node.ColonColonToken), (SimpleNameSyntax)Visit(node.Name)); - - public override CSharpSyntaxNode VisitPredefinedType(PredefinedTypeSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword)); - - public override CSharpSyntaxNode VisitArrayType(ArrayTypeSyntax node) - => node.Update((TypeSyntax)Visit(node.ElementType), VisitList(node.RankSpecifiers)); - - public override CSharpSyntaxNode VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Sizes), (SyntaxToken)Visit(node.CloseBracketToken)); - - public override CSharpSyntaxNode VisitPointerType(PointerTypeSyntax node) - => node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.AsteriskToken)); - - public override CSharpSyntaxNode VisitFunctionPointerType(FunctionPointerTypeSyntax node) - => node.Update((SyntaxToken)Visit(node.DelegateKeyword), (SyntaxToken)Visit(node.AsteriskToken), (FunctionPointerCallingConventionSyntax)Visit(node.CallingConvention), (FunctionPointerParameterListSyntax)Visit(node.ParameterList)); - - public override CSharpSyntaxNode VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken)); - - public override CSharpSyntaxNode VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) - => node.Update((SyntaxToken)Visit(node.ManagedOrUnmanagedKeyword), (FunctionPointerUnmanagedCallingConventionListSyntax)Visit(node.UnmanagedCallingConventionList)); - - public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.CallingConventions), (SyntaxToken)Visit(node.CloseBracketToken)); - - public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) - => node.Update((SyntaxToken)Visit(node.Name)); + public override CSharpSyntaxNode VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken)); - public override CSharpSyntaxNode VisitNullableType(NullableTypeSyntax node) - => node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.QuestionToken)); + public override CSharpSyntaxNode VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) + => node.Update((SyntaxToken)Visit(node.ManagedOrUnmanagedKeyword), (FunctionPointerUnmanagedCallingConventionListSyntax)Visit(node.UnmanagedCallingConventionList)); - public override CSharpSyntaxNode VisitTupleType(TupleTypeSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Elements), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.CallingConventions), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitTupleElement(TupleElementSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier)); + public override CSharpSyntaxNode VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) + => node.Update((SyntaxToken)Visit(node.Name)); - public override CSharpSyntaxNode VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) - => node.Update((SyntaxToken)Visit(node.OmittedTypeArgumentToken)); + public override CSharpSyntaxNode VisitNullableType(NullableTypeSyntax node) + => node.Update((TypeSyntax)Visit(node.ElementType), (SyntaxToken)Visit(node.QuestionToken)); - public override CSharpSyntaxNode VisitRefType(RefTypeSyntax node) - => node.Update((SyntaxToken)Visit(node.RefKeyword), (SyntaxToken)Visit(node.ReadOnlyKeyword), (TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitTupleType(TupleTypeSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Elements), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitScopedType(ScopedTypeSyntax node) - => node.Update((SyntaxToken)Visit(node.ScopedKeyword), (TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitTupleElement(TupleElementSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier)); - public override CSharpSyntaxNode VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) + => node.Update((SyntaxToken)Visit(node.OmittedTypeArgumentToken)); - public override CSharpSyntaxNode VisitTupleExpression(TupleExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitRefType(RefTypeSyntax node) + => node.Update((SyntaxToken)Visit(node.RefKeyword), (SyntaxToken)Visit(node.ReadOnlyKeyword), (TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Operand)); + public override CSharpSyntaxNode VisitScopedType(ScopedTypeSyntax node) + => node.Update((SyntaxToken)Visit(node.ScopedKeyword), (TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitAwaitExpression(AwaitExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.AwaitKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Operand), (SyntaxToken)Visit(node.OperatorToken)); + public override CSharpSyntaxNode VisitTupleExpression(TupleExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name)); + public override CSharpSyntaxNode VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Operand)); - public override CSharpSyntaxNode VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.WhenNotNull)); + public override CSharpSyntaxNode VisitAwaitExpression(AwaitExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.AwaitKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitMemberBindingExpression(MemberBindingExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name)); + public override CSharpSyntaxNode VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Operand), (SyntaxToken)Visit(node.OperatorToken)); - public override CSharpSyntaxNode VisitElementBindingExpression(ElementBindingExpressionSyntax node) - => node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name)); - public override CSharpSyntaxNode VisitRangeExpression(RangeExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.LeftOperand), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.RightOperand)); + public override CSharpSyntaxNode VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.WhenNotNull)); - public override CSharpSyntaxNode VisitImplicitElementAccess(ImplicitElementAccessSyntax node) - => node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitMemberBindingExpression(MemberBindingExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorToken), (SimpleNameSyntax)Visit(node.Name)); - public override CSharpSyntaxNode VisitBinaryExpression(BinaryExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right)); + public override CSharpSyntaxNode VisitElementBindingExpression(ElementBindingExpressionSyntax node) + => node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitAssignmentExpression(AssignmentExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right)); + public override CSharpSyntaxNode VisitRangeExpression(RangeExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.LeftOperand), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.RightOperand)); - public override CSharpSyntaxNode VisitConditionalExpression(ConditionalExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.QuestionToken), (ExpressionSyntax)Visit(node.WhenTrue), (SyntaxToken)Visit(node.ColonToken), (ExpressionSyntax)Visit(node.WhenFalse)); + public override CSharpSyntaxNode VisitImplicitElementAccess(ImplicitElementAccessSyntax node) + => node.Update((BracketedArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitThisExpression(ThisExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Token)); + public override CSharpSyntaxNode VisitBinaryExpression(BinaryExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right)); - public override CSharpSyntaxNode VisitBaseExpression(BaseExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Token)); + public override CSharpSyntaxNode VisitAssignmentExpression(AssignmentExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Right)); - public override CSharpSyntaxNode VisitLiteralExpression(LiteralExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Token)); + public override CSharpSyntaxNode VisitConditionalExpression(ConditionalExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.QuestionToken), (ExpressionSyntax)Visit(node.WhenTrue), (SyntaxToken)Visit(node.ColonToken), (ExpressionSyntax)Visit(node.WhenFalse)); - public override CSharpSyntaxNode VisitMakeRefExpression(MakeRefExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitThisExpression(ThisExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Token)); - public override CSharpSyntaxNode VisitRefTypeExpression(RefTypeExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitBaseExpression(BaseExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Token)); - public override CSharpSyntaxNode VisitRefValueExpression(RefValueExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.Comma), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitLiteralExpression(LiteralExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Token)); - public override CSharpSyntaxNode VisitCheckedExpression(CheckedExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitMakeRefExpression(MakeRefExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitDefaultExpression(DefaultExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitRefTypeExpression(RefTypeExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitTypeOfExpression(TypeOfExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitRefValueExpression(RefValueExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.Comma), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitSizeOfExpression(SizeOfExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitCheckedExpression(CheckedExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitInvocationExpression(InvocationExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (ArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitDefaultExpression(DefaultExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitElementAccessExpression(ElementAccessExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (BracketedArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitTypeOfExpression(TypeOfExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitArgumentList(ArgumentListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitSizeOfExpression(SizeOfExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitBracketedArgumentList(BracketedArgumentListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseBracketToken)); + public override CSharpSyntaxNode VisitInvocationExpression(InvocationExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (ArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitArgument(ArgumentSyntax node) - => node.Update((NameColonSyntax)Visit(node.NameColon), (SyntaxToken)Visit(node.RefKindKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitElementAccessExpression(ElementAccessExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (BracketedArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitExpressionColon(ExpressionColonSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitArgumentList(ArgumentListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitNameColon(NameColonSyntax node) - => node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitBracketedArgumentList(BracketedArgumentListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitDeclarationExpression(DeclarationExpressionSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation)); + public override CSharpSyntaxNode VisitArgument(ArgumentSyntax node) + => node.Update((NameColonSyntax)Visit(node.NameColon), (SyntaxToken)Visit(node.RefKindKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitCastExpression(CastExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitExpressionColon(ExpressionColonSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) - => node.Update(VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); + public override CSharpSyntaxNode VisitNameColon(NameColonSyntax node) + => node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (ParameterSyntax)Visit(node.Parameter), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); + public override CSharpSyntaxNode VisitDeclarationExpression(DeclarationExpressionSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation)); - public override CSharpSyntaxNode VisitRefExpression(RefExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.RefKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitCastExpression(CastExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.CloseParenToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ParameterListSyntax)Visit(node.ParameterList), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); + public override CSharpSyntaxNode VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) + => node.Update(VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); - public override CSharpSyntaxNode VisitInitializerExpression(InitializerExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Expressions), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (ParameterSyntax)Visit(node.Parameter), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); - public override CSharpSyntaxNode VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitRefExpression(RefExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.RefKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ParameterListSyntax)Visit(node.ParameterList), (SyntaxToken)Visit(node.ArrowToken), (BlockSyntax)Visit(node.Block), (ExpressionSyntax)Visit(node.ExpressionBody)); - public override CSharpSyntaxNode VisitWithExpression(WithExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.WithKeyword), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitInitializerExpression(InitializerExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Expressions), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) - => node.Update((NameEqualsSyntax)Visit(node.NameEquals), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Initializers), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (ArrayTypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitWithExpression(WithExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.WithKeyword), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Commas), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) + => node.Update((NameEqualsSyntax)Visit(node.NameEquals), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (TypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Initializers), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (SyntaxToken)Visit(node.OpenBracketToken), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (ArrayTypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitCollectionExpression(CollectionExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Elements), (SyntaxToken)Visit(node.CloseBracketToken)); + public override CSharpSyntaxNode VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Commas), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitExpressionElement(ExpressionElementSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (TypeSyntax)Visit(node.Type), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitSpreadElement(SpreadElementSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.StackAllocKeyword), (SyntaxToken)Visit(node.OpenBracketToken), (SyntaxToken)Visit(node.CloseBracketToken), (InitializerExpressionSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitQueryExpression(QueryExpressionSyntax node) - => node.Update((FromClauseSyntax)Visit(node.FromClause), (QueryBodySyntax)Visit(node.Body)); + public override CSharpSyntaxNode VisitCollectionExpression(CollectionExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Elements), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitQueryBody(QueryBodySyntax node) - => node.Update(VisitList(node.Clauses), (SelectOrGroupClauseSyntax)Visit(node.SelectOrGroup), (QueryContinuationSyntax)Visit(node.Continuation)); + public override CSharpSyntaxNode VisitExpressionElement(ExpressionElementSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitFromClause(FromClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.FromKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitSpreadElement(SpreadElementSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitLetClause(LetClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.LetKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitQueryExpression(QueryExpressionSyntax node) + => node.Update((FromClauseSyntax)Visit(node.FromClause), (QueryBodySyntax)Visit(node.Body)); - public override CSharpSyntaxNode VisitJoinClause(JoinClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.JoinKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.InExpression), (SyntaxToken)Visit(node.OnKeyword), (ExpressionSyntax)Visit(node.LeftExpression), (SyntaxToken)Visit(node.EqualsKeyword), (ExpressionSyntax)Visit(node.RightExpression), (JoinIntoClauseSyntax)Visit(node.Into)); + public override CSharpSyntaxNode VisitQueryBody(QueryBodySyntax node) + => node.Update(VisitList(node.Clauses), (SelectOrGroupClauseSyntax)Visit(node.SelectOrGroup), (QueryContinuationSyntax)Visit(node.Continuation)); - public override CSharpSyntaxNode VisitJoinIntoClause(JoinIntoClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier)); + public override CSharpSyntaxNode VisitFromClause(FromClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.FromKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitWhereClause(WhereClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.WhereKeyword), (ExpressionSyntax)Visit(node.Condition)); + public override CSharpSyntaxNode VisitLetClause(LetClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.LetKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitOrderByClause(OrderByClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.OrderByKeyword), VisitList(node.Orderings)); + public override CSharpSyntaxNode VisitJoinClause(JoinClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.JoinKeyword), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.InExpression), (SyntaxToken)Visit(node.OnKeyword), (ExpressionSyntax)Visit(node.LeftExpression), (SyntaxToken)Visit(node.EqualsKeyword), (ExpressionSyntax)Visit(node.RightExpression), (JoinIntoClauseSyntax)Visit(node.Into)); - public override CSharpSyntaxNode VisitOrdering(OrderingSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.AscendingOrDescendingKeyword)); + public override CSharpSyntaxNode VisitJoinIntoClause(JoinIntoClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier)); - public override CSharpSyntaxNode VisitSelectClause(SelectClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.SelectKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitWhereClause(WhereClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.WhereKeyword), (ExpressionSyntax)Visit(node.Condition)); - public override CSharpSyntaxNode VisitGroupClause(GroupClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.GroupKeyword), (ExpressionSyntax)Visit(node.GroupExpression), (SyntaxToken)Visit(node.ByKeyword), (ExpressionSyntax)Visit(node.ByExpression)); + public override CSharpSyntaxNode VisitOrderByClause(OrderByClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.OrderByKeyword), VisitList(node.Orderings)); - public override CSharpSyntaxNode VisitQueryContinuation(QueryContinuationSyntax node) - => node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier), (QueryBodySyntax)Visit(node.Body)); + public override CSharpSyntaxNode VisitOrdering(OrderingSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.AscendingOrDescendingKeyword)); - public override CSharpSyntaxNode VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.OmittedArraySizeExpressionToken)); + public override CSharpSyntaxNode VisitSelectClause(SelectClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.SelectKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.StringStartToken), VisitList(node.Contents), (SyntaxToken)Visit(node.StringEndToken)); + public override CSharpSyntaxNode VisitGroupClause(GroupClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.GroupKeyword), (ExpressionSyntax)Visit(node.GroupExpression), (SyntaxToken)Visit(node.ByKeyword), (ExpressionSyntax)Visit(node.ByExpression)); - public override CSharpSyntaxNode VisitIsPatternExpression(IsPatternExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.IsKeyword), (PatternSyntax)Visit(node.Pattern)); + public override CSharpSyntaxNode VisitQueryContinuation(QueryContinuationSyntax node) + => node.Update((SyntaxToken)Visit(node.IntoKeyword), (SyntaxToken)Visit(node.Identifier), (QueryBodySyntax)Visit(node.Body)); - public override CSharpSyntaxNode VisitThrowExpression(ThrowExpressionSyntax node) - => node.Update((SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.OmittedArraySizeExpressionToken)); - public override CSharpSyntaxNode VisitWhenClause(WhenClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.WhenKeyword), (ExpressionSyntax)Visit(node.Condition)); + public override CSharpSyntaxNode VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.StringStartToken), VisitList(node.Contents), (SyntaxToken)Visit(node.StringEndToken)); - public override CSharpSyntaxNode VisitDiscardPattern(DiscardPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.UnderscoreToken)); + public override CSharpSyntaxNode VisitIsPatternExpression(IsPatternExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.IsKeyword), (PatternSyntax)Visit(node.Pattern)); - public override CSharpSyntaxNode VisitDeclarationPattern(DeclarationPatternSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation)); + public override CSharpSyntaxNode VisitThrowExpression(ThrowExpressionSyntax node) + => node.Update((SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitVarPattern(VarPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.VarKeyword), (VariableDesignationSyntax)Visit(node.Designation)); + public override CSharpSyntaxNode VisitWhenClause(WhenClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.WhenKeyword), (ExpressionSyntax)Visit(node.Condition)); - public override CSharpSyntaxNode VisitRecursivePattern(RecursivePatternSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), (PositionalPatternClauseSyntax)Visit(node.PositionalPatternClause), (PropertyPatternClauseSyntax)Visit(node.PropertyPatternClause), (VariableDesignationSyntax)Visit(node.Designation)); + public override CSharpSyntaxNode VisitDiscardPattern(DiscardPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.UnderscoreToken)); - public override CSharpSyntaxNode VisitPositionalPatternClause(PositionalPatternClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitDeclarationPattern(DeclarationPatternSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), (VariableDesignationSyntax)Visit(node.Designation)); - public override CSharpSyntaxNode VisitPropertyPatternClause(PropertyPatternClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitVarPattern(VarPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.VarKeyword), (VariableDesignationSyntax)Visit(node.Designation)); - public override CSharpSyntaxNode VisitSubpattern(SubpatternSyntax node) - => node.Update((BaseExpressionColonSyntax)Visit(node.ExpressionColon), (PatternSyntax)Visit(node.Pattern)); + public override CSharpSyntaxNode VisitRecursivePattern(RecursivePatternSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), (PositionalPatternClauseSyntax)Visit(node.PositionalPatternClause), (PropertyPatternClauseSyntax)Visit(node.PropertyPatternClause), (VariableDesignationSyntax)Visit(node.Designation)); - public override CSharpSyntaxNode VisitConstantPattern(ConstantPatternSyntax node) - => node.Update((ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitPositionalPatternClause(PositionalPatternClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitParenthesizedPattern(ParenthesizedPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), (PatternSyntax)Visit(node.Pattern), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitPropertyPatternClause(PropertyPatternClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Subpatterns), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitRelationalPattern(RelationalPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitSubpattern(SubpatternSyntax node) + => node.Update((BaseExpressionColonSyntax)Visit(node.ExpressionColon), (PatternSyntax)Visit(node.Pattern)); - public override CSharpSyntaxNode VisitTypePattern(TypePatternSyntax node) - => node.Update((TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitConstantPattern(ConstantPatternSyntax node) + => node.Update((ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitBinaryPattern(BinaryPatternSyntax node) - => node.Update((PatternSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Right)); + public override CSharpSyntaxNode VisitParenthesizedPattern(ParenthesizedPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), (PatternSyntax)Visit(node.Pattern), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitUnaryPattern(UnaryPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Pattern)); + public override CSharpSyntaxNode VisitRelationalPattern(RelationalPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitListPattern(ListPatternSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Patterns), (SyntaxToken)Visit(node.CloseBracketToken), (VariableDesignationSyntax)Visit(node.Designation)); + public override CSharpSyntaxNode VisitTypePattern(TypePatternSyntax node) + => node.Update((TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitSlicePattern(SlicePatternSyntax node) - => node.Update((SyntaxToken)Visit(node.DotDotToken), (PatternSyntax)Visit(node.Pattern)); + public override CSharpSyntaxNode VisitBinaryPattern(BinaryPatternSyntax node) + => node.Update((PatternSyntax)Visit(node.Left), (SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Right)); - public override CSharpSyntaxNode VisitInterpolatedStringText(InterpolatedStringTextSyntax node) - => node.Update((SyntaxToken)Visit(node.TextToken)); + public override CSharpSyntaxNode VisitUnaryPattern(UnaryPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorToken), (PatternSyntax)Visit(node.Pattern)); - public override CSharpSyntaxNode VisitInterpolation(InterpolationSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBraceToken), (ExpressionSyntax)Visit(node.Expression), (InterpolationAlignmentClauseSyntax)Visit(node.AlignmentClause), (InterpolationFormatClauseSyntax)Visit(node.FormatClause), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitListPattern(ListPatternSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Patterns), (SyntaxToken)Visit(node.CloseBracketToken), (VariableDesignationSyntax)Visit(node.Designation)); - public override CSharpSyntaxNode VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.CommaToken), (ExpressionSyntax)Visit(node.Value)); + public override CSharpSyntaxNode VisitSlicePattern(SlicePatternSyntax node) + => node.Update((SyntaxToken)Visit(node.DotDotToken), (PatternSyntax)Visit(node.Pattern)); - public override CSharpSyntaxNode VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.FormatStringToken)); + public override CSharpSyntaxNode VisitInterpolatedStringText(InterpolatedStringTextSyntax node) + => node.Update((SyntaxToken)Visit(node.TextToken)); - public override CSharpSyntaxNode VisitGlobalStatement(GlobalStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitInterpolation(InterpolationSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBraceToken), (ExpressionSyntax)Visit(node.Expression), (InterpolationAlignmentClauseSyntax)Visit(node.AlignmentClause), (InterpolationFormatClauseSyntax)Visit(node.FormatClause), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitBlock(BlockSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Statements), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.CommaToken), (ExpressionSyntax)Visit(node.Value)); - public override CSharpSyntaxNode VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.FormatStringToken)); - public override CSharpSyntaxNode VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitGlobalStatement(GlobalStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitVariableDeclaration(VariableDeclarationSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), VisitList(node.Variables)); + public override CSharpSyntaxNode VisitBlock(BlockSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Statements), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitVariableDeclarator(VariableDeclaratorSyntax node) - => node.Update((SyntaxToken)Visit(node.Identifier), (BracketedArgumentListSyntax)Visit(node.ArgumentList), (EqualsValueClauseSyntax)Visit(node.Initializer)); + public override CSharpSyntaxNode VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitEqualsValueClause(EqualsValueClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Value)); + public override CSharpSyntaxNode VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) - => node.Update((SyntaxToken)Visit(node.Identifier)); + public override CSharpSyntaxNode VisitVariableDeclaration(VariableDeclarationSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), VisitList(node.Variables)); - public override CSharpSyntaxNode VisitDiscardDesignation(DiscardDesignationSyntax node) - => node.Update((SyntaxToken)Visit(node.UnderscoreToken)); + public override CSharpSyntaxNode VisitVariableDeclarator(VariableDeclaratorSyntax node) + => node.Update((SyntaxToken)Visit(node.Identifier), (BracketedArgumentListSyntax)Visit(node.ArgumentList), (EqualsValueClauseSyntax)Visit(node.Initializer)); - public override CSharpSyntaxNode VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Variables), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitEqualsValueClause(EqualsValueClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.EqualsToken), (ExpressionSyntax)Visit(node.Value)); - public override CSharpSyntaxNode VisitExpressionStatement(ExpressionStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) + => node.Update((SyntaxToken)Visit(node.Identifier)); - public override CSharpSyntaxNode VisitEmptyStatement(EmptyStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitDiscardDesignation(DiscardDesignationSyntax node) + => node.Update((SyntaxToken)Visit(node.UnderscoreToken)); - public override CSharpSyntaxNode VisitLabeledStatement(LabeledStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Variables), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitGotoStatement(GotoStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.GotoKeyword), (SyntaxToken)Visit(node.CaseOrDefaultKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitExpressionStatement(ExpressionStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitBreakStatement(BreakStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.BreakKeyword), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitEmptyStatement(EmptyStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitContinueStatement(ContinueStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ContinueKeyword), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitLabeledStatement(LabeledStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitReturnStatement(ReturnStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ReturnKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitGotoStatement(GotoStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.GotoKeyword), (SyntaxToken)Visit(node.CaseOrDefaultKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitThrowStatement(ThrowStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitBreakStatement(BreakStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.BreakKeyword), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitYieldStatement(YieldStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.YieldKeyword), (SyntaxToken)Visit(node.ReturnOrBreakKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitContinueStatement(ContinueStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ContinueKeyword), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitWhileStatement(WhileStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitReturnStatement(ReturnStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ReturnKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitDoStatement(DoStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.DoKeyword), (StatementSyntax)Visit(node.Statement), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitThrowStatement(ThrowStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ThrowKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitForStatement(ForStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ForKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), VisitList(node.Initializers), (SyntaxToken)Visit(node.FirstSemicolonToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.SecondSemicolonToken), VisitList(node.Incrementors), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitYieldStatement(YieldStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.YieldKeyword), (SyntaxToken)Visit(node.ReturnOrBreakKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitForEachStatement(ForEachStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitWhileStatement(WhileStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitForEachVariableStatement(ForEachVariableStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Variable), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitDoStatement(DoStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.DoKeyword), (StatementSyntax)Visit(node.Statement), (SyntaxToken)Visit(node.WhileKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitUsingStatement(UsingStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitForStatement(ForStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.ForKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), VisitList(node.Initializers), (SyntaxToken)Visit(node.FirstSemicolonToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.SecondSemicolonToken), VisitList(node.Incrementors), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitFixedStatement(FixedStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.FixedKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitForEachStatement(ForEachStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitCheckedStatement(CheckedStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Block)); + public override CSharpSyntaxNode VisitForEachVariableStatement(ForEachVariableStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.ForEachKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Variable), (SyntaxToken)Visit(node.InKeyword), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitUnsafeStatement(UnsafeStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.UnsafeKeyword), (BlockSyntax)Visit(node.Block)); + public override CSharpSyntaxNode VisitUsingStatement(UsingStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.AwaitKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitLockStatement(LockStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.LockKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitFixedStatement(FixedStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.FixedKeyword), (SyntaxToken)Visit(node.OpenParenToken), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitIfStatement(IfStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.IfKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement), (ElseClauseSyntax)Visit(node.Else)); + public override CSharpSyntaxNode VisitCheckedStatement(CheckedStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Block)); - public override CSharpSyntaxNode VisitElseClause(ElseClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.ElseKeyword), (StatementSyntax)Visit(node.Statement)); + public override CSharpSyntaxNode VisitUnsafeStatement(UnsafeStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.UnsafeKeyword), (BlockSyntax)Visit(node.Block)); - public override CSharpSyntaxNode VisitSwitchStatement(SwitchStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Sections), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitLockStatement(LockStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.LockKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitSwitchSection(SwitchSectionSyntax node) - => node.Update(VisitList(node.Labels), VisitList(node.Statements)); + public override CSharpSyntaxNode VisitIfStatement(IfStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.IfKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.CloseParenToken), (StatementSyntax)Visit(node.Statement), (ElseClauseSyntax)Visit(node.Else)); - public override CSharpSyntaxNode VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitElseClause(ElseClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.ElseKeyword), (StatementSyntax)Visit(node.Statement)); - public override CSharpSyntaxNode VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (ExpressionSyntax)Visit(node.Value), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitSwitchStatement(SwitchStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.Expression), (SyntaxToken)Visit(node.CloseParenToken), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Sections), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) - => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitSwitchSection(SwitchSectionSyntax node) + => node.Update(VisitList(node.Labels), VisitList(node.Statements)); - public override CSharpSyntaxNode VisitSwitchExpression(SwitchExpressionSyntax node) - => node.Update((ExpressionSyntax)Visit(node.GoverningExpression), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Arms), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) - => node.Update((PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.EqualsGreaterThanToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (ExpressionSyntax)Visit(node.Value), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitTryStatement(TryStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.TryKeyword), (BlockSyntax)Visit(node.Block), VisitList(node.Catches), (FinallyClauseSyntax)Visit(node.Finally)); + public override CSharpSyntaxNode VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) + => node.Update((SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitCatchClause(CatchClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.CatchKeyword), (CatchDeclarationSyntax)Visit(node.Declaration), (CatchFilterClauseSyntax)Visit(node.Filter), (BlockSyntax)Visit(node.Block)); + public override CSharpSyntaxNode VisitSwitchExpression(SwitchExpressionSyntax node) + => node.Update((ExpressionSyntax)Visit(node.GoverningExpression), (SyntaxToken)Visit(node.SwitchKeyword), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Arms), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitCatchDeclaration(CatchDeclarationSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) + => node.Update((PatternSyntax)Visit(node.Pattern), (WhenClauseSyntax)Visit(node.WhenClause), (SyntaxToken)Visit(node.EqualsGreaterThanToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitCatchFilterClause(CatchFilterClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.WhenKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.FilterExpression), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitTryStatement(TryStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.TryKeyword), (BlockSyntax)Visit(node.Block), VisitList(node.Catches), (FinallyClauseSyntax)Visit(node.Finally)); - public override CSharpSyntaxNode VisitFinallyClause(FinallyClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.FinallyKeyword), (BlockSyntax)Visit(node.Block)); + public override CSharpSyntaxNode VisitCatchClause(CatchClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.CatchKeyword), (CatchDeclarationSyntax)Visit(node.Declaration), (CatchFilterClauseSyntax)Visit(node.Filter), (BlockSyntax)Visit(node.Block)); - public override CSharpSyntaxNode VisitCompilationUnit(CompilationUnitSyntax node) - => node.Update(VisitList(node.Externs), VisitList(node.Usings), VisitList(node.AttributeLists), VisitList(node.Members), (SyntaxToken)Visit(node.EndOfFileToken)); + public override CSharpSyntaxNode VisitCatchDeclaration(CatchDeclarationSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitExternAliasDirective(ExternAliasDirectiveSyntax node) - => node.Update((SyntaxToken)Visit(node.ExternKeyword), (SyntaxToken)Visit(node.AliasKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitCatchFilterClause(CatchFilterClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.WhenKeyword), (SyntaxToken)Visit(node.OpenParenToken), (ExpressionSyntax)Visit(node.FilterExpression), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitUsingDirective(UsingDirectiveSyntax node) - => node.Update((SyntaxToken)Visit(node.GlobalKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.StaticKeyword), (SyntaxToken)Visit(node.UnsafeKeyword), (NameEqualsSyntax)Visit(node.Alias), (TypeSyntax)Visit(node.NamespaceOrType), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitFinallyClause(FinallyClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.FinallyKeyword), (BlockSyntax)Visit(node.Block)); - public override CSharpSyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitCompilationUnit(CompilationUnitSyntax node) + => node.Update(VisitList(node.Externs), VisitList(node.Usings), VisitList(node.AttributeLists), VisitList(node.Members), (SyntaxToken)Visit(node.EndOfFileToken)); - public override CSharpSyntaxNode VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.SemicolonToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members)); + public override CSharpSyntaxNode VisitExternAliasDirective(ExternAliasDirectiveSyntax node) + => node.Update((SyntaxToken)Visit(node.ExternKeyword), (SyntaxToken)Visit(node.AliasKeyword), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitAttributeList(AttributeListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), (AttributeTargetSpecifierSyntax)Visit(node.Target), VisitList(node.Attributes), (SyntaxToken)Visit(node.CloseBracketToken)); + public override CSharpSyntaxNode VisitUsingDirective(UsingDirectiveSyntax node) + => node.Update((SyntaxToken)Visit(node.GlobalKeyword), (SyntaxToken)Visit(node.UsingKeyword), (SyntaxToken)Visit(node.StaticKeyword), (SyntaxToken)Visit(node.UnsafeKeyword), (NameEqualsSyntax)Visit(node.Alias), (TypeSyntax)Visit(node.NamespaceOrType), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) - => node.Update((SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitAttribute(AttributeSyntax node) - => node.Update((NameSyntax)Visit(node.Name), (AttributeArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.NamespaceKeyword), (NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.SemicolonToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members)); - public override CSharpSyntaxNode VisitAttributeArgumentList(AttributeArgumentListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitAttributeList(AttributeListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), (AttributeTargetSpecifierSyntax)Visit(node.Target), VisitList(node.Attributes), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitAttributeArgument(AttributeArgumentSyntax node) - => node.Update((NameEqualsSyntax)Visit(node.NameEquals), (NameColonSyntax)Visit(node.NameColon), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) + => node.Update((SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitNameEquals(NameEqualsSyntax node) - => node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken)); + public override CSharpSyntaxNode VisitAttribute(AttributeSyntax node) + => node.Update((NameSyntax)Visit(node.Name), (AttributeArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitTypeParameterList(TypeParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken)); + public override CSharpSyntaxNode VisitAttributeArgumentList(AttributeArgumentListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Arguments), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitTypeParameter(TypeParameterSyntax node) - => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.VarianceKeyword), (SyntaxToken)Visit(node.Identifier)); + public override CSharpSyntaxNode VisitAttributeArgument(AttributeArgumentSyntax node) + => node.Update((NameEqualsSyntax)Visit(node.NameEquals), (NameColonSyntax)Visit(node.NameColon), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitNameEquals(NameEqualsSyntax node) + => node.Update((IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken)); - public override CSharpSyntaxNode VisitStructDeclaration(StructDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitTypeParameterList(TypeParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.GreaterThanToken)); - public override CSharpSyntaxNode VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitTypeParameter(TypeParameterSyntax node) + => node.Update(VisitList(node.AttributeLists), (SyntaxToken)Visit(node.VarianceKeyword), (SyntaxToken)Visit(node.Identifier)); - public override CSharpSyntaxNode VisitRecordDeclaration(RecordDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitEnumDeclaration(EnumDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EnumKeyword), (SyntaxToken)Visit(node.Identifier), (BaseListSyntax)Visit(node.BaseList), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitStructDeclaration(StructDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitDelegateDeclaration(DelegateDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.EqualsValue)); + public override CSharpSyntaxNode VisitRecordDeclaration(RecordDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), (BaseListSyntax)Visit(node.BaseList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitBaseList(BaseListSyntax node) - => node.Update((SyntaxToken)Visit(node.ColonToken), VisitList(node.Types)); + public override CSharpSyntaxNode VisitEnumDeclaration(EnumDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EnumKeyword), (SyntaxToken)Visit(node.Identifier), (BaseListSyntax)Visit(node.BaseList), (SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Members), (SyntaxToken)Visit(node.CloseBraceToken), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitSimpleBaseType(SimpleBaseTypeSyntax node) - => node.Update((TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitDelegateDeclaration(DelegateDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.DelegateKeyword), (TypeSyntax)Visit(node.ReturnType), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) - => node.Update((TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.EqualsValue)); - public override CSharpSyntaxNode VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.WhereKeyword), (IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken), VisitList(node.Constraints)); + public override CSharpSyntaxNode VisitBaseList(BaseListSyntax node) + => node.Update((SyntaxToken)Visit(node.ColonToken), VisitList(node.Types)); - public override CSharpSyntaxNode VisitConstructorConstraint(ConstructorConstraintSyntax node) - => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitSimpleBaseType(SimpleBaseTypeSyntax node) + => node.Update((TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) - => node.Update((SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.QuestionToken)); + public override CSharpSyntaxNode VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) + => node.Update((TypeSyntax)Visit(node.Type), (ArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitTypeConstraint(TypeConstraintSyntax node) - => node.Update((TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.WhereKeyword), (IdentifierNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.ColonToken), VisitList(node.Constraints)); - public override CSharpSyntaxNode VisitDefaultConstraint(DefaultConstraintSyntax node) - => node.Update((SyntaxToken)Visit(node.DefaultKeyword)); + public override CSharpSyntaxNode VisitConstructorConstraint(ConstructorConstraintSyntax node) + => node.Update((SyntaxToken)Visit(node.NewKeyword), (SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitFieldDeclaration(FieldDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) + => node.Update((SyntaxToken)Visit(node.ClassOrStructKeyword), (SyntaxToken)Visit(node.QuestionToken)); - public override CSharpSyntaxNode VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitTypeConstraint(TypeConstraintSyntax node) + => node.Update((TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) - => node.Update((NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.DotToken)); + public override CSharpSyntaxNode VisitDefaultConstraint(DefaultConstraintSyntax node) + => node.Update((SyntaxToken)Visit(node.DefaultKeyword)); - public override CSharpSyntaxNode VisitMethodDeclaration(MethodDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitFieldDeclaration(FieldDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitOperatorDeclaration(OperatorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (SyntaxToken)Visit(node.OperatorToken), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (VariableDeclarationSyntax)Visit(node.Declaration), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (TypeSyntax)Visit(node.Type), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) + => node.Update((NameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.DotToken)); - public override CSharpSyntaxNode VisitConstructorDeclaration(ConstructorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (ConstructorInitializerSyntax)Visit(node.Initializer), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitMethodDeclaration(MethodDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (TypeParameterListSyntax)Visit(node.TypeParameterList), (ParameterListSyntax)Visit(node.ParameterList), VisitList(node.ConstraintClauses), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitConstructorInitializer(ConstructorInitializerSyntax node) - => node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.ThisOrBaseKeyword), (ArgumentListSyntax)Visit(node.ArgumentList)); + public override CSharpSyntaxNode VisitOperatorDeclaration(OperatorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.ReturnType), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (SyntaxToken)Visit(node.OperatorToken), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitDestructorDeclaration(DestructorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.TildeToken), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (TypeSyntax)Visit(node.Type), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (EqualsValueClauseSyntax)Visit(node.Initializer), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitConstructorDeclaration(ConstructorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (ConstructorInitializerSyntax)Visit(node.Initializer), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) - => node.Update((SyntaxToken)Visit(node.ArrowToken), (ExpressionSyntax)Visit(node.Expression)); + public override CSharpSyntaxNode VisitConstructorInitializer(ConstructorInitializerSyntax node) + => node.Update((SyntaxToken)Visit(node.ColonToken), (SyntaxToken)Visit(node.ThisOrBaseKeyword), (ArgumentListSyntax)Visit(node.ArgumentList)); - public override CSharpSyntaxNode VisitEventDeclaration(EventDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitDestructorDeclaration(DestructorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.TildeToken), (SyntaxToken)Visit(node.Identifier), (ParameterListSyntax)Visit(node.ParameterList), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitIndexerDeclaration(IndexerDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.ThisKeyword), (BracketedParameterListSyntax)Visit(node.ParameterList), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (EqualsValueClauseSyntax)Visit(node.Initializer), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitAccessorList(AccessorListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Accessors), (SyntaxToken)Visit(node.CloseBraceToken)); + public override CSharpSyntaxNode VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) + => node.Update((SyntaxToken)Visit(node.ArrowToken), (ExpressionSyntax)Visit(node.Expression)); - public override CSharpSyntaxNode VisitAccessorDeclaration(AccessorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); + public override CSharpSyntaxNode VisitEventDeclaration(EventDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.EventKeyword), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.Identifier), (AccessorListSyntax)Visit(node.AccessorList), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitParameterList(ParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitIndexerDeclaration(IndexerDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (ExplicitInterfaceSpecifierSyntax)Visit(node.ExplicitInterfaceSpecifier), (SyntaxToken)Visit(node.ThisKeyword), (BracketedParameterListSyntax)Visit(node.ParameterList), (AccessorListSyntax)Visit(node.AccessorList), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitBracketedParameterList(BracketedParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken)); + public override CSharpSyntaxNode VisitAccessorList(AccessorListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBraceToken), VisitList(node.Accessors), (SyntaxToken)Visit(node.CloseBraceToken)); - public override CSharpSyntaxNode VisitParameter(ParameterSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.Default)); + public override CSharpSyntaxNode VisitAccessorDeclaration(AccessorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (SyntaxToken)Visit(node.Keyword), (BlockSyntax)Visit(node.Body), (ArrowExpressionClauseSyntax)Visit(node.ExpressionBody), (SyntaxToken)Visit(node.SemicolonToken)); - public override CSharpSyntaxNode VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitParameterList(ParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitIncompleteMember(IncompleteMemberSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitBracketedParameterList(BracketedParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) - => node.Update(VisitList(node.Tokens)); + public override CSharpSyntaxNode VisitParameter(ParameterSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type), (SyntaxToken)Visit(node.Identifier), (EqualsValueClauseSyntax)Visit(node.Default)); - public override CSharpSyntaxNode VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) - => node.Update(VisitList(node.Content), (SyntaxToken)Visit(node.EndOfComment)); + public override CSharpSyntaxNode VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitTypeCref(TypeCrefSyntax node) - => node.Update((TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitIncompleteMember(IncompleteMemberSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitQualifiedCref(QualifiedCrefSyntax node) - => node.Update((TypeSyntax)Visit(node.Container), (SyntaxToken)Visit(node.DotToken), (MemberCrefSyntax)Visit(node.Member)); + public override CSharpSyntaxNode VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) + => node.Update(VisitList(node.Tokens)); - public override CSharpSyntaxNode VisitNameMemberCref(NameMemberCrefSyntax node) - => node.Update((TypeSyntax)Visit(node.Name), (CrefParameterListSyntax)Visit(node.Parameters)); + public override CSharpSyntaxNode VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) + => node.Update(VisitList(node.Content), (SyntaxToken)Visit(node.EndOfComment)); - public override CSharpSyntaxNode VisitIndexerMemberCref(IndexerMemberCrefSyntax node) - => node.Update((SyntaxToken)Visit(node.ThisKeyword), (CrefBracketedParameterListSyntax)Visit(node.Parameters)); + public override CSharpSyntaxNode VisitTypeCref(TypeCrefSyntax node) + => node.Update((TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitOperatorMemberCref(OperatorMemberCrefSyntax node) - => node.Update((SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (SyntaxToken)Visit(node.OperatorToken), (CrefParameterListSyntax)Visit(node.Parameters)); + public override CSharpSyntaxNode VisitQualifiedCref(QualifiedCrefSyntax node) + => node.Update((TypeSyntax)Visit(node.Container), (SyntaxToken)Visit(node.DotToken), (MemberCrefSyntax)Visit(node.Member)); - public override CSharpSyntaxNode VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) - => node.Update((SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (TypeSyntax)Visit(node.Type), (CrefParameterListSyntax)Visit(node.Parameters)); + public override CSharpSyntaxNode VisitNameMemberCref(NameMemberCrefSyntax node) + => node.Update((TypeSyntax)Visit(node.Name), (CrefParameterListSyntax)Visit(node.Parameters)); - public override CSharpSyntaxNode VisitCrefParameterList(CrefParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitIndexerMemberCref(IndexerMemberCrefSyntax node) + => node.Update((SyntaxToken)Visit(node.ThisKeyword), (CrefBracketedParameterListSyntax)Visit(node.Parameters)); - public override CSharpSyntaxNode VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken)); + public override CSharpSyntaxNode VisitOperatorMemberCref(OperatorMemberCrefSyntax node) + => node.Update((SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (SyntaxToken)Visit(node.OperatorToken), (CrefParameterListSyntax)Visit(node.Parameters)); - public override CSharpSyntaxNode VisitCrefParameter(CrefParameterSyntax node) - => node.Update((SyntaxToken)Visit(node.RefKindKeyword), (SyntaxToken)Visit(node.ReadOnlyKeyword), (TypeSyntax)Visit(node.Type)); + public override CSharpSyntaxNode VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) + => node.Update((SyntaxToken)Visit(node.ImplicitOrExplicitKeyword), (SyntaxToken)Visit(node.OperatorKeyword), (SyntaxToken)Visit(node.CheckedKeyword), (TypeSyntax)Visit(node.Type), (CrefParameterListSyntax)Visit(node.Parameters)); - public override CSharpSyntaxNode VisitXmlElement(XmlElementSyntax node) - => node.Update((XmlElementStartTagSyntax)Visit(node.StartTag), VisitList(node.Content), (XmlElementEndTagSyntax)Visit(node.EndTag)); + public override CSharpSyntaxNode VisitCrefParameterList(CrefParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitXmlElementStartTag(XmlElementStartTagSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.GreaterThanToken)); + public override CSharpSyntaxNode VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenBracketToken), VisitList(node.Parameters), (SyntaxToken)Visit(node.CloseBracketToken)); - public override CSharpSyntaxNode VisitXmlElementEndTag(XmlElementEndTagSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanSlashToken), (XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.GreaterThanToken)); + public override CSharpSyntaxNode VisitCrefParameter(CrefParameterSyntax node) + => node.Update((SyntaxToken)Visit(node.RefKindKeyword), (SyntaxToken)Visit(node.ReadOnlyKeyword), (TypeSyntax)Visit(node.Type)); - public override CSharpSyntaxNode VisitXmlEmptyElement(XmlEmptyElementSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.SlashGreaterThanToken)); + public override CSharpSyntaxNode VisitXmlElement(XmlElementSyntax node) + => node.Update((XmlElementStartTagSyntax)Visit(node.StartTag), VisitList(node.Content), (XmlElementEndTagSyntax)Visit(node.EndTag)); - public override CSharpSyntaxNode VisitXmlName(XmlNameSyntax node) - => node.Update((XmlPrefixSyntax)Visit(node.Prefix), (SyntaxToken)Visit(node.LocalName)); + public override CSharpSyntaxNode VisitXmlElementStartTag(XmlElementStartTagSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.GreaterThanToken)); - public override CSharpSyntaxNode VisitXmlPrefix(XmlPrefixSyntax node) - => node.Update((SyntaxToken)Visit(node.Prefix), (SyntaxToken)Visit(node.ColonToken)); + public override CSharpSyntaxNode VisitXmlElementEndTag(XmlElementEndTagSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanSlashToken), (XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.GreaterThanToken)); - public override CSharpSyntaxNode VisitXmlTextAttribute(XmlTextAttributeSyntax node) - => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndQuoteToken)); + public override CSharpSyntaxNode VisitXmlEmptyElement(XmlEmptyElementSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.Attributes), (SyntaxToken)Visit(node.SlashGreaterThanToken)); - public override CSharpSyntaxNode VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) - => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (CrefSyntax)Visit(node.Cref), (SyntaxToken)Visit(node.EndQuoteToken)); + public override CSharpSyntaxNode VisitXmlName(XmlNameSyntax node) + => node.Update((XmlPrefixSyntax)Visit(node.Prefix), (SyntaxToken)Visit(node.LocalName)); - public override CSharpSyntaxNode VisitXmlNameAttribute(XmlNameAttributeSyntax node) - => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (IdentifierNameSyntax)Visit(node.Identifier), (SyntaxToken)Visit(node.EndQuoteToken)); + public override CSharpSyntaxNode VisitXmlPrefix(XmlPrefixSyntax node) + => node.Update((SyntaxToken)Visit(node.Prefix), (SyntaxToken)Visit(node.ColonToken)); - public override CSharpSyntaxNode VisitXmlText(XmlTextSyntax node) - => node.Update(VisitList(node.TextTokens)); + public override CSharpSyntaxNode VisitXmlTextAttribute(XmlTextAttributeSyntax node) + => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndQuoteToken)); - public override CSharpSyntaxNode VisitXmlCDataSection(XmlCDataSectionSyntax node) - => node.Update((SyntaxToken)Visit(node.StartCDataToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndCDataToken)); + public override CSharpSyntaxNode VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) + => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (CrefSyntax)Visit(node.Cref), (SyntaxToken)Visit(node.EndQuoteToken)); - public override CSharpSyntaxNode VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) - => node.Update((SyntaxToken)Visit(node.StartProcessingInstructionToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndProcessingInstructionToken)); + public override CSharpSyntaxNode VisitXmlNameAttribute(XmlNameAttributeSyntax node) + => node.Update((XmlNameSyntax)Visit(node.Name), (SyntaxToken)Visit(node.EqualsToken), (SyntaxToken)Visit(node.StartQuoteToken), (IdentifierNameSyntax)Visit(node.Identifier), (SyntaxToken)Visit(node.EndQuoteToken)); - public override CSharpSyntaxNode VisitXmlComment(XmlCommentSyntax node) - => node.Update((SyntaxToken)Visit(node.LessThanExclamationMinusMinusToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.MinusMinusGreaterThanToken)); + public override CSharpSyntaxNode VisitXmlText(XmlTextSyntax node) + => node.Update(VisitList(node.TextTokens)); - public override CSharpSyntaxNode VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.IfKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); + public override CSharpSyntaxNode VisitXmlCDataSection(XmlCDataSectionSyntax node) + => node.Update((SyntaxToken)Visit(node.StartCDataToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndCDataToken)); - public override CSharpSyntaxNode VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElifKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); + public override CSharpSyntaxNode VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) + => node.Update((SyntaxToken)Visit(node.StartProcessingInstructionToken), (XmlNameSyntax)Visit(node.Name), VisitList(node.TextTokens), (SyntaxToken)Visit(node.EndProcessingInstructionToken)); - public override CSharpSyntaxNode VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElseKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken); + public override CSharpSyntaxNode VisitXmlComment(XmlCommentSyntax node) + => node.Update((SyntaxToken)Visit(node.LessThanExclamationMinusMinusToken), VisitList(node.TextTokens), (SyntaxToken)Visit(node.MinusMinusGreaterThanToken)); - public override CSharpSyntaxNode VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndIfKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.IfKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); - public override CSharpSyntaxNode VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.RegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElifKeyword), (ExpressionSyntax)Visit(node.Condition), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); - public override CSharpSyntaxNode VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndRegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ElseKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken); - public override CSharpSyntaxNode VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ErrorKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndIfKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.RegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.EndRegionKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.DefineKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ErrorKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.UndefKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.Identifier), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitLineDirectivePosition(LineDirectivePositionSyntax node) - => node.Update((SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.CommaToken), (SyntaxToken)Visit(node.Character), (SyntaxToken)Visit(node.CloseParenToken)); + public override CSharpSyntaxNode VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.DefineKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (LineDirectivePositionSyntax)Visit(node.Start), (SyntaxToken)Visit(node.MinusToken), (LineDirectivePositionSyntax)Visit(node.End), (SyntaxToken)Visit(node.CharacterOffset), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.UndefKeyword), (SyntaxToken)Visit(node.Name), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.DisableOrRestoreKeyword), VisitList(node.ErrorCodes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.ChecksumKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.Guid), (SyntaxToken)Visit(node.Bytes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitLineDirectivePosition(LineDirectivePositionSyntax node) + => node.Update((SyntaxToken)Visit(node.OpenParenToken), (SyntaxToken)Visit(node.Line), (SyntaxToken)Visit(node.CommaToken), (SyntaxToken)Visit(node.Character), (SyntaxToken)Visit(node.CloseParenToken)); - public override CSharpSyntaxNode VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ReferenceKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LineKeyword), (LineDirectivePositionSyntax)Visit(node.Start), (SyntaxToken)Visit(node.MinusToken), (LineDirectivePositionSyntax)Visit(node.End), (SyntaxToken)Visit(node.CharacterOffset), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LoadKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.WarningKeyword), (SyntaxToken)Visit(node.DisableOrRestoreKeyword), VisitList(node.ErrorCodes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ExclamationToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); + public override CSharpSyntaxNode VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.PragmaKeyword), (SyntaxToken)Visit(node.ChecksumKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.Guid), (SyntaxToken)Visit(node.Bytes), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public override CSharpSyntaxNode VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) - => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.NullableKeyword), (SyntaxToken)Visit(node.SettingToken), (SyntaxToken)Visit(node.TargetToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - } + public override CSharpSyntaxNode VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ReferenceKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - internal partial class ContextAwareSyntax - { + public override CSharpSyntaxNode VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.LoadKeyword), (SyntaxToken)Visit(node.File), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - private SyntaxFactoryContext context; + public override CSharpSyntaxNode VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.ExclamationToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); - public ContextAwareSyntax(SyntaxFactoryContext context) - => this.context = context; + public override CSharpSyntaxNode VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) + => node.Update((SyntaxToken)Visit(node.HashToken), (SyntaxToken)Visit(node.NullableKeyword), (SyntaxToken)Visit(node.SettingToken), (SyntaxToken)Visit(node.TargetToken), (SyntaxToken)Visit(node.EndOfDirectiveToken), node.IsActive); +} - public IdentifierNameSyntax IdentifierName(SyntaxToken identifier) - { -#if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.GlobalKeyword: break; - default: throw new ArgumentException(nameof(identifier)); - } -#endif +internal partial class ContextAwareSyntax +{ - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, this.context, out hash); - if (cached != null) return (IdentifierNameSyntax)cached; + private SyntaxFactoryContext context; - var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + public ContextAwareSyntax(SyntaxFactoryContext context) + => this.context = context; - return result; + public IdentifierNameSyntax IdentifierName(SyntaxToken identifier) + { +#if DEBUG + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + switch (identifier.Kind) + { + case SyntaxKind.IdentifierToken: + case SyntaxKind.GlobalKeyword: break; + default: throw new ArgumentException(nameof(identifier)); } +#endif - public QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, this.context, out hash); + if (cached != null) return (IdentifierNameSyntax)cached; + + var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier, this.context); + if (hash >= 0) { + SyntaxNodeCache.AddNode(result, hash); + } + + return result; + } + + public QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + { #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, this.context, out hash); - if (cached != null) return (QualifiedNameSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, this.context, out hash); + if (cached != null) return (QualifiedNameSyntax)cached; - var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) - { + return result; + } + + public GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, this.context, out hash); - if (cached != null) return (GenericNameSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, this.context, out hash); + if (cached != null) return (GenericNameSyntax)cached; - var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) - { + return result; + } + + public TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context, out hash); - if (cached != null) return (TypeArgumentListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context, out hash); + if (cached != null) return (TypeArgumentListSyntax)cached; - var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) - { + return result; + } + + public AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + { #if DEBUG - if (alias == null) throw new ArgumentNullException(nameof(alias)); - if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken)); - if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); + if (alias == null) throw new ArgumentNullException(nameof(alias)); + if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken)); + if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context, out hash); - if (cached != null) return (AliasQualifiedNameSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context, out hash); + if (cached != null) return (AliasQualifiedNameSyntax)cached; - var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) - { + return result; + } + + public PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.BoolKeyword: - case SyntaxKind.ByteKeyword: - case SyntaxKind.SByteKeyword: - case SyntaxKind.IntKeyword: - case SyntaxKind.UIntKeyword: - case SyntaxKind.ShortKeyword: - case SyntaxKind.UShortKeyword: - case SyntaxKind.LongKeyword: - case SyntaxKind.ULongKeyword: - case SyntaxKind.FloatKeyword: - case SyntaxKind.DoubleKeyword: - case SyntaxKind.DecimalKeyword: - case SyntaxKind.StringKeyword: - case SyntaxKind.CharKeyword: - case SyntaxKind.ObjectKeyword: - case SyntaxKind.VoidKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.BoolKeyword: + case SyntaxKind.ByteKeyword: + case SyntaxKind.SByteKeyword: + case SyntaxKind.IntKeyword: + case SyntaxKind.UIntKeyword: + case SyntaxKind.ShortKeyword: + case SyntaxKind.UShortKeyword: + case SyntaxKind.LongKeyword: + case SyntaxKind.ULongKeyword: + case SyntaxKind.FloatKeyword: + case SyntaxKind.DoubleKeyword: + case SyntaxKind.DecimalKeyword: + case SyntaxKind.StringKeyword: + case SyntaxKind.CharKeyword: + case SyntaxKind.ObjectKeyword: + case SyntaxKind.VoidKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, this.context, out hash); - if (cached != null) return (PredefinedTypeSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, this.context, out hash); + if (cached != null) return (PredefinedTypeSyntax)cached; - var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ArrayTypeSyntax ArrayType(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) - { + return result; + } + + public ArrayTypeSyntax ArrayType(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context, out hash); - if (cached != null) return (ArrayTypeSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context, out hash); + if (cached != null) return (ArrayTypeSyntax)cached; - var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) - { + return result; + } + + public ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (ArrayRankSpecifierSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (ArrayRankSpecifierSyntax)cached; - var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) - { + return result; + } + + public PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); - if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); + if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, this.context, out hash); - if (cached != null) return (PointerTypeSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, this.context, out hash); + if (cached != null) return (PointerTypeSyntax)cached; - var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) - { + return result; + } + + public FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); - if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); + if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); #endif - return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList, this.context); - } + return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList, this.context); + } - public FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { + public FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); - if (cached != null) return (FunctionPointerParameterListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); + if (cached != null) return (FunctionPointerParameterListSyntax)cached; - var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) - { + return result; + } + + public FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + { #if DEBUG - if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword)); - switch (managedOrUnmanagedKeyword.Kind) - { - case SyntaxKind.ManagedKeyword: - case SyntaxKind.UnmanagedKeyword: break; - default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword)); - } + if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword)); + switch (managedOrUnmanagedKeyword.Kind) + { + case SyntaxKind.ManagedKeyword: + case SyntaxKind.UnmanagedKeyword: break; + default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword)); + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context, out hash); - if (cached != null) return (FunctionPointerCallingConventionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context, out hash); + if (cached != null) return (FunctionPointerCallingConventionSyntax)cached; - var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) - { + return result; + } + + public FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached; - var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name) - { + return result; + } + + public FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context, out hash); - if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context, out hash); + if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached; - var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) - { + return result; + } + + public NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); - if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); + if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, this.context, out hash); - if (cached != null) return (NullableTypeSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, this.context, out hash); + if (cached != null) return (NullableTypeSyntax)cached; - var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TupleTypeSyntax TupleType(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) - { + return result; + } + + public TupleTypeSyntax TupleType(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context, out hash); - if (cached != null) return (TupleTypeSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context, out hash); + if (cached != null) return (TupleTypeSyntax)cached; - var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier) - { + return result; + } + + public TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier != null) + { + switch (identifier.Kind) { - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(identifier)); - } + case SyntaxKind.IdentifierToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(identifier)); } + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, this.context, out hash); - if (cached != null) return (TupleElementSyntax)cached; - - var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, this.context, out hash); + if (cached != null) return (TupleElementSyntax)cached; - return result; + var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken) - { + return result; + } + + public OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken) + { #if DEBUG - if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken)); - if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); + if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken)); + if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context, out hash); - if (cached != null) return (OmittedTypeArgumentSyntax)cached; - - var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context, out hash); + if (cached != null) return (OmittedTypeArgumentSyntax)cached; - return result; + var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - { + return result; + } + + public RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + { #if DEBUG - if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); - if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); - if (readOnlyKeyword != null) + if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); + if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); + if (readOnlyKeyword != null) + { + switch (readOnlyKeyword.Kind) { - switch (readOnlyKeyword.Kind) - { - case SyntaxKind.ReadOnlyKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(readOnlyKeyword)); - } + case SyntaxKind.ReadOnlyKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(readOnlyKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context, out hash); - if (cached != null) return (RefTypeSyntax)cached; - - var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context, out hash); + if (cached != null) return (RefTypeSyntax)cached; - return result; + var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) - { + return result; + } + + public ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) + { #if DEBUG - if (scopedKeyword == null) throw new ArgumentNullException(nameof(scopedKeyword)); - if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (scopedKeyword == null) throw new ArgumentNullException(nameof(scopedKeyword)); + if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, this.context, out hash); - if (cached != null) return (ScopedTypeSyntax)cached; - - var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, this.context, out hash); + if (cached != null) return (ScopedTypeSyntax)cached; - return result; + var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + return result; + } + + public ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context, out hash); - if (cached != null) return (ParenthesizedExpressionSyntax)cached; - - var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context, out hash); + if (cached != null) return (ParenthesizedExpressionSyntax)cached; - return result; + var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context, out hash); - if (cached != null) return (TupleExpressionSyntax)cached; - - var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context, out hash); + if (cached != null) return (TupleExpressionSyntax)cached; - return result; + var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + return result; + } + + public PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.UnaryPlusExpression: - case SyntaxKind.UnaryMinusExpression: - case SyntaxKind.BitwiseNotExpression: - case SyntaxKind.LogicalNotExpression: - case SyntaxKind.PreIncrementExpression: - case SyntaxKind.PreDecrementExpression: - case SyntaxKind.AddressOfExpression: - case SyntaxKind.PointerIndirectionExpression: - case SyntaxKind.IndexExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.UnaryPlusExpression: + case SyntaxKind.UnaryMinusExpression: + case SyntaxKind.BitwiseNotExpression: + case SyntaxKind.LogicalNotExpression: + case SyntaxKind.PreIncrementExpression: + case SyntaxKind.PreDecrementExpression: + case SyntaxKind.AddressOfExpression: + case SyntaxKind.PointerIndirectionExpression: + case SyntaxKind.IndexExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.TildeToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.CaretToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (operand == null) throw new ArgumentNullException(nameof(operand)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.TildeToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.CaretToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (operand == null) throw new ArgumentNullException(nameof(operand)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, this.context, out hash); - if (cached != null) return (PrefixUnaryExpressionSyntax)cached; - - var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, this.context, out hash); + if (cached != null) return (PrefixUnaryExpressionSyntax)cached; - return result; + var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression) - { + return result; + } + + public AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression) + { #if DEBUG - if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword)); - if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword)); + if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context, out hash); - if (cached != null) return (AwaitExpressionSyntax)cached; - - var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context, out hash); + if (cached != null) return (AwaitExpressionSyntax)cached; - return result; + var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + return result; + } + + public PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.PostIncrementExpression: - case SyntaxKind.PostDecrementExpression: - case SyntaxKind.SuppressNullableWarningExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.PostIncrementExpression: + case SyntaxKind.PostDecrementExpression: + case SyntaxKind.SuppressNullableWarningExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (operand == null) throw new ArgumentNullException(nameof(operand)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.ExclamationToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } + if (operand == null) throw new ArgumentNullException(nameof(operand)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.ExclamationToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, this.context, out hash); - if (cached != null) return (PostfixUnaryExpressionSyntax)cached; - - var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, this.context, out hash); + if (cached != null) return (PostfixUnaryExpressionSyntax)cached; - return result; + var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + return result; + } + + public MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SimpleMemberAccessExpression: - case SyntaxKind.PointerMemberAccessExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SimpleMemberAccessExpression: + case SyntaxKind.PointerMemberAccessExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.DotToken: - case SyntaxKind.MinusGreaterThanToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (name == null) throw new ArgumentNullException(nameof(name)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.DotToken: + case SyntaxKind.MinusGreaterThanToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, this.context, out hash); - if (cached != null) return (MemberAccessExpressionSyntax)cached; - - var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, this.context, out hash); + if (cached != null) return (MemberAccessExpressionSyntax)cached; - return result; + var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) - { + return result; + } + + public ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); - if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); + if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context, out hash); - if (cached != null) return (ConditionalAccessExpressionSyntax)cached; - - var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context, out hash); + if (cached != null) return (ConditionalAccessExpressionSyntax)cached; - return result; + var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name) - { + return result; + } + + public MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, this.context, out hash); - if (cached != null) return (MemberBindingExpressionSyntax)cached; - - var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, this.context, out hash); + if (cached != null) return (MemberBindingExpressionSyntax)cached; - return result; + var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList) - { + return result; + } + + public ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, this.context, out hash); - if (cached != null) return (ElementBindingExpressionSyntax)cached; - - var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, this.context, out hash); + if (cached != null) return (ElementBindingExpressionSyntax)cached; - return result; + var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) - { + return result; + } + + public RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context, out hash); - if (cached != null) return (RangeExpressionSyntax)cached; - - var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context, out hash); + if (cached != null) return (RangeExpressionSyntax)cached; - return result; + var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList) - { + return result; + } + + public ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, this.context, out hash); - if (cached != null) return (ImplicitElementAccessSyntax)cached; - - var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, this.context, out hash); + if (cached != null) return (ImplicitElementAccessSyntax)cached; - return result; + var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + return result; + } + + public BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.AddExpression: - case SyntaxKind.SubtractExpression: - case SyntaxKind.MultiplyExpression: - case SyntaxKind.DivideExpression: - case SyntaxKind.ModuloExpression: - case SyntaxKind.LeftShiftExpression: - case SyntaxKind.RightShiftExpression: - case SyntaxKind.UnsignedRightShiftExpression: - case SyntaxKind.LogicalOrExpression: - case SyntaxKind.LogicalAndExpression: - case SyntaxKind.BitwiseOrExpression: - case SyntaxKind.BitwiseAndExpression: - case SyntaxKind.ExclusiveOrExpression: - case SyntaxKind.EqualsExpression: - case SyntaxKind.NotEqualsExpression: - case SyntaxKind.LessThanExpression: - case SyntaxKind.LessThanOrEqualExpression: - case SyntaxKind.GreaterThanExpression: - case SyntaxKind.GreaterThanOrEqualExpression: - case SyntaxKind.IsExpression: - case SyntaxKind.AsExpression: - case SyntaxKind.CoalesceExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.AddExpression: + case SyntaxKind.SubtractExpression: + case SyntaxKind.MultiplyExpression: + case SyntaxKind.DivideExpression: + case SyntaxKind.ModuloExpression: + case SyntaxKind.LeftShiftExpression: + case SyntaxKind.RightShiftExpression: + case SyntaxKind.UnsignedRightShiftExpression: + case SyntaxKind.LogicalOrExpression: + case SyntaxKind.LogicalAndExpression: + case SyntaxKind.BitwiseOrExpression: + case SyntaxKind.BitwiseAndExpression: + case SyntaxKind.ExclusiveOrExpression: + case SyntaxKind.EqualsExpression: + case SyntaxKind.NotEqualsExpression: + case SyntaxKind.LessThanExpression: + case SyntaxKind.LessThanOrEqualExpression: + case SyntaxKind.GreaterThanExpression: + case SyntaxKind.GreaterThanOrEqualExpression: + case SyntaxKind.IsExpression: + case SyntaxKind.AsExpression: + case SyntaxKind.CoalesceExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarBarToken: - case SyntaxKind.AmpersandAmpersandToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.IsKeyword: - case SyntaxKind.AsKeyword: - case SyntaxKind.QuestionQuestionToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarBarToken: + case SyntaxKind.AmpersandAmpersandToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.IsKeyword: + case SyntaxKind.AsKeyword: + case SyntaxKind.QuestionQuestionToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); - if (cached != null) return (BinaryExpressionSyntax)cached; - - var result = new BinaryExpressionSyntax(kind, left, operatorToken, right, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); + if (cached != null) return (BinaryExpressionSyntax)cached; - return result; + var result = new BinaryExpressionSyntax(kind, left, operatorToken, right, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + return result; + } + + public AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SimpleAssignmentExpression: - case SyntaxKind.AddAssignmentExpression: - case SyntaxKind.SubtractAssignmentExpression: - case SyntaxKind.MultiplyAssignmentExpression: - case SyntaxKind.DivideAssignmentExpression: - case SyntaxKind.ModuloAssignmentExpression: - case SyntaxKind.AndAssignmentExpression: - case SyntaxKind.ExclusiveOrAssignmentExpression: - case SyntaxKind.OrAssignmentExpression: - case SyntaxKind.LeftShiftAssignmentExpression: - case SyntaxKind.RightShiftAssignmentExpression: - case SyntaxKind.UnsignedRightShiftAssignmentExpression: - case SyntaxKind.CoalesceAssignmentExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SimpleAssignmentExpression: + case SyntaxKind.AddAssignmentExpression: + case SyntaxKind.SubtractAssignmentExpression: + case SyntaxKind.MultiplyAssignmentExpression: + case SyntaxKind.DivideAssignmentExpression: + case SyntaxKind.ModuloAssignmentExpression: + case SyntaxKind.AndAssignmentExpression: + case SyntaxKind.ExclusiveOrAssignmentExpression: + case SyntaxKind.OrAssignmentExpression: + case SyntaxKind.LeftShiftAssignmentExpression: + case SyntaxKind.RightShiftAssignmentExpression: + case SyntaxKind.UnsignedRightShiftAssignmentExpression: + case SyntaxKind.CoalesceAssignmentExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.EqualsToken: - case SyntaxKind.PlusEqualsToken: - case SyntaxKind.MinusEqualsToken: - case SyntaxKind.AsteriskEqualsToken: - case SyntaxKind.SlashEqualsToken: - case SyntaxKind.PercentEqualsToken: - case SyntaxKind.AmpersandEqualsToken: - case SyntaxKind.CaretEqualsToken: - case SyntaxKind.BarEqualsToken: - case SyntaxKind.LessThanLessThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: - case SyntaxKind.QuestionQuestionEqualsToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.EqualsToken: + case SyntaxKind.PlusEqualsToken: + case SyntaxKind.MinusEqualsToken: + case SyntaxKind.AsteriskEqualsToken: + case SyntaxKind.SlashEqualsToken: + case SyntaxKind.PercentEqualsToken: + case SyntaxKind.AmpersandEqualsToken: + case SyntaxKind.CaretEqualsToken: + case SyntaxKind.BarEqualsToken: + case SyntaxKind.LessThanLessThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + case SyntaxKind.QuestionQuestionEqualsToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); - if (cached != null) return (AssignmentExpressionSyntax)cached; - - var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); + if (cached != null) return (AssignmentExpressionSyntax)cached; - return result; + var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) - { + return result; + } + + public ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + { #if DEBUG - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); - if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); - if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); + if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); + if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse)); #endif - return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse, this.context); - } + return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse, this.context); + } - public ThisExpressionSyntax ThisExpression(SyntaxToken token) - { + public ThisExpressionSyntax ThisExpression(SyntaxToken token) + { #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); + if (token == null) throw new ArgumentNullException(nameof(token)); + if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, this.context, out hash); - if (cached != null) return (ThisExpressionSyntax)cached; - - var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, this.context, out hash); + if (cached != null) return (ThisExpressionSyntax)cached; - return result; + var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BaseExpressionSyntax BaseExpression(SyntaxToken token) - { + return result; + } + + public BaseExpressionSyntax BaseExpression(SyntaxToken token) + { #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); + if (token == null) throw new ArgumentNullException(nameof(token)); + if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, this.context, out hash); - if (cached != null) return (BaseExpressionSyntax)cached; - - var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, this.context, out hash); + if (cached != null) return (BaseExpressionSyntax)cached; - return result; + var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) + return result; + } + + public LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ArgListExpression: - case SyntaxKind.NumericLiteralExpression: - case SyntaxKind.StringLiteralExpression: - case SyntaxKind.Utf8StringLiteralExpression: - case SyntaxKind.CharacterLiteralExpression: - case SyntaxKind.TrueLiteralExpression: - case SyntaxKind.FalseLiteralExpression: - case SyntaxKind.NullLiteralExpression: - case SyntaxKind.DefaultLiteralExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ArgListExpression: + case SyntaxKind.NumericLiteralExpression: + case SyntaxKind.StringLiteralExpression: + case SyntaxKind.Utf8StringLiteralExpression: + case SyntaxKind.CharacterLiteralExpression: + case SyntaxKind.TrueLiteralExpression: + case SyntaxKind.FalseLiteralExpression: + case SyntaxKind.NullLiteralExpression: + case SyntaxKind.DefaultLiteralExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - switch (token.Kind) - { - case SyntaxKind.ArgListKeyword: - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.StringLiteralToken: - case SyntaxKind.Utf8StringLiteralToken: - case SyntaxKind.MultiLineRawStringLiteralToken: - case SyntaxKind.Utf8MultiLineRawStringLiteralToken: - case SyntaxKind.SingleLineRawStringLiteralToken: - case SyntaxKind.Utf8SingleLineRawStringLiteralToken: - case SyntaxKind.CharacterLiteralToken: - case SyntaxKind.TrueKeyword: - case SyntaxKind.FalseKeyword: - case SyntaxKind.NullKeyword: - case SyntaxKind.DefaultKeyword: break; - default: throw new ArgumentException(nameof(token)); - } + if (token == null) throw new ArgumentNullException(nameof(token)); + switch (token.Kind) + { + case SyntaxKind.ArgListKeyword: + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.StringLiteralToken: + case SyntaxKind.Utf8StringLiteralToken: + case SyntaxKind.MultiLineRawStringLiteralToken: + case SyntaxKind.Utf8MultiLineRawStringLiteralToken: + case SyntaxKind.SingleLineRawStringLiteralToken: + case SyntaxKind.Utf8SingleLineRawStringLiteralToken: + case SyntaxKind.CharacterLiteralToken: + case SyntaxKind.TrueKeyword: + case SyntaxKind.FalseKeyword: + case SyntaxKind.NullKeyword: + case SyntaxKind.DefaultKeyword: break; + default: throw new ArgumentException(nameof(token)); + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, token, this.context, out hash); - if (cached != null) return (LiteralExpressionSyntax)cached; - - var result = new LiteralExpressionSyntax(kind, token, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, token, this.context, out hash); + if (cached != null) return (LiteralExpressionSyntax)cached; - return result; + var result = new LiteralExpressionSyntax(kind, token, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + return result; + } + + public MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken, this.context); - } + return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken, this.context); + } - public RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + public RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken, this.context); - } + return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken, this.context); + } - public RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) - { + public RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (comma == null) throw new ArgumentNullException(nameof(comma)); - if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (comma == null) throw new ArgumentNullException(nameof(comma)); + if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken, this.context); - } + return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken, this.context); + } - public CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + public CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.CheckedExpression: - case SyntaxKind.UncheckedExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.CheckedExpression: + case SyntaxKind.UncheckedExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.UncheckedKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.CheckedKeyword: + case SyntaxKind.UncheckedKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken, this.context); - } + return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken, this.context); + } - public DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken, this.context); - } + return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken, this.context); + } - public TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); - } + return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); + } - public SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); - } + return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); + } - public InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList) - { + public InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, this.context, out hash); - if (cached != null) return (InvocationExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, this.context, out hash); + if (cached != null) return (InvocationExpressionSyntax)cached; - var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - { + return result; + } + + public ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, this.context, out hash); - if (cached != null) return (ElementAccessExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, this.context, out hash); + if (cached != null) return (ElementAccessExpressionSyntax)cached; - var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); - if (cached != null) return (ArgumentListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); + if (cached != null) return (ArgumentListSyntax)cached; - var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) - { + return result; + } + + public BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (BracketedArgumentListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (BracketedArgumentListSyntax)cached; - var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) - { + return result; + } + + public ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) + { #if DEBUG - if (refKindKeyword != null) + if (refKindKeyword != null) + { + switch (refKindKeyword.Kind) { - switch (refKindKeyword.Kind) - { - case SyntaxKind.RefKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.InKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(refKindKeyword)); - } + case SyntaxKind.RefKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.InKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(refKindKeyword)); } - if (expression == null) throw new ArgumentNullException(nameof(expression)); + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context, out hash); - if (cached != null) return (ArgumentSyntax)cached; - - var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context, out hash); + if (cached != null) return (ArgumentSyntax)cached; - return result; + var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken) - { + return result; + } + + public ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, this.context, out hash); - if (cached != null) return (ExpressionColonSyntax)cached; - - var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, this.context, out hash); + if (cached != null) return (ExpressionColonSyntax)cached; - return result; + var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken) - { + return result; + } + + public NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, this.context, out hash); - if (cached != null) return (NameColonSyntax)cached; - - var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, this.context, out hash); + if (cached != null) return (NameColonSyntax)cached; - return result; + var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) - { + return result; + } + + public DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, this.context, out hash); - if (cached != null) return (DeclarationExpressionSyntax)cached; - - var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, this.context, out hash); + if (cached != null) return (DeclarationExpressionSyntax)cached; - return result; + var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) - { + return result; + } + + public CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression, this.context); - } + return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression, this.context); + } - public AnonymousMethodExpressionSyntax AnonymousMethodExpression(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) - { + public AnonymousMethodExpressionSyntax AnonymousMethodExpression(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody, this.context); - } + return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody, this.context); + } - public SimpleLambdaExpressionSyntax SimpleLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { + public SimpleLambdaExpressionSyntax SimpleLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (parameter == null) throw new ArgumentNullException(nameof(parameter)); - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (parameter == null) throw new ArgumentNullException(nameof(parameter)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); #endif - return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody, this.context); - } + return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody, this.context); + } - public RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression) - { + public RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression) + { #if DEBUG - if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); - if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); + if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, this.context, out hash); - if (cached != null) return (RefExpressionSyntax)cached; - - var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, this.context, out hash); + if (cached != null) return (RefExpressionSyntax)cached; - return result; + var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { + return result; + } + + public ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); #endif - return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody, this.context); - } + return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody, this.context); + } - public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ObjectInitializerExpression: - case SyntaxKind.CollectionInitializerExpression: - case SyntaxKind.ArrayInitializerExpression: - case SyntaxKind.ComplexElementInitializerExpression: - case SyntaxKind.WithInitializerExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ObjectInitializerExpression: + case SyntaxKind.CollectionInitializerExpression: + case SyntaxKind.ArrayInitializerExpression: + case SyntaxKind.ComplexElementInitializerExpression: + case SyntaxKind.WithInitializerExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, this.context, out hash); - if (cached != null) return (InitializerExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, this.context, out hash); + if (cached != null) return (InitializerExpressionSyntax)cached; - var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) - { + return result; + } + + public ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context, out hash); - if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context, out hash); + if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached; - var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) - { + return result; + } + + public ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer, this.context); - } + return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer, this.context); + } - public WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) - { + public WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword)); - if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword)); + if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context, out hash); - if (cached != null) return (WithExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context, out hash); + if (cached != null) return (WithExpressionSyntax)cached; - var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) - { + return result; + } + + public AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context, out hash); - if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context, out hash); + if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached; - var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) - { + return result; + } + + public AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken, this.context); - } + return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken, this.context); + } - public ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) - { + public ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context, out hash); - if (cached != null) return (ArrayCreationExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context, out hash); + if (cached != null) return (ArrayCreationExpressionSyntax)cached; - var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { + return result; + } + + public ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer, this.context); - } + return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer, this.context); + } - public StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) - { + public StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); - if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); + if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context, out hash); - if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context, out hash); + if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached; - var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { + return result; + } + + public ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { #if DEBUG - if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); - if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); + if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer, this.context); - } + return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer, this.context); + } - public CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) - { + public CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (CollectionExpressionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (CollectionExpressionSyntax)cached; - var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ExpressionElementSyntax ExpressionElement(ExpressionSyntax expression) - { + return result; + } + + public ExpressionElementSyntax ExpressionElement(ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, this.context, out hash); - if (cached != null) return (ExpressionElementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, this.context, out hash); + if (cached != null) return (ExpressionElementSyntax)cached; - var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SpreadElementSyntax SpreadElement(SyntaxToken operatorToken, ExpressionSyntax expression) - { + return result; + } + + public SpreadElementSyntax SpreadElement(SyntaxToken operatorToken, ExpressionSyntax expression) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, this.context, out hash); - if (cached != null) return (SpreadElementSyntax)cached; - - var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, this.context, out hash); + if (cached != null) return (SpreadElementSyntax)cached; - public QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body) + var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression, this.context); + if (hash >= 0) { + SyntaxNodeCache.AddNode(result, hash); + } + + return result; + } + + public QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body) + { #if DEBUG - if (fromClause == null) throw new ArgumentNullException(nameof(fromClause)); - if (body == null) throw new ArgumentNullException(nameof(body)); + if (fromClause == null) throw new ArgumentNullException(nameof(fromClause)); + if (body == null) throw new ArgumentNullException(nameof(body)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, this.context, out hash); - if (cached != null) return (QueryExpressionSyntax)cached; - - var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, this.context, out hash); + if (cached != null) return (QueryExpressionSyntax)cached; - return result; + var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public QueryBodySyntax QueryBody(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) - { + return result; + } + + public QueryBodySyntax QueryBody(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + { #if DEBUG - if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); + if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context, out hash); - if (cached != null) return (QueryBodySyntax)cached; - - var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context, out hash); + if (cached != null) return (QueryBodySyntax)cached; - return result; + var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) - { + return result; + } + + public FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + { #if DEBUG - if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword)); - if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword)); + if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression, this.context); - } + return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression, this.context); + } - public LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) - { + public LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + { #if DEBUG - if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword)); - if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword)); + if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression, this.context); - } + return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression, this.context); + } - public JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) - { + public JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + { #if DEBUG - if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword)); - if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (inExpression == null) throw new ArgumentNullException(nameof(inExpression)); - if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword)); - if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); - if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression)); - if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword)); - if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); - if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression)); + if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword)); + if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (inExpression == null) throw new ArgumentNullException(nameof(inExpression)); + if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword)); + if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); + if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression)); + if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword)); + if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); + if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression)); #endif - return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into, this.context); - } + return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into, this.context); + } - public JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier) - { + public JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier) + { #if DEBUG - if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); - if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); + if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context, out hash); - if (cached != null) return (JoinIntoClauseSyntax)cached; - - var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context, out hash); + if (cached != null) return (JoinIntoClauseSyntax)cached; - return result; + var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition) - { + return result; + } + + public WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition) + { #if DEBUG - if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); - if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); + if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, this.context, out hash); - if (cached != null) return (WhereClauseSyntax)cached; - - var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, this.context, out hash); + if (cached != null) return (WhereClauseSyntax)cached; - return result; + var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) - { + return result; + } + + public OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) + { #if DEBUG - if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword)); - if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); + if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword)); + if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context, out hash); - if (cached != null) return (OrderByClauseSyntax)cached; - - var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context, out hash); + if (cached != null) return (OrderByClauseSyntax)cached; - return result; + var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) + return result; + } + + public OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.AscendingOrdering: - case SyntaxKind.DescendingOrdering: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.AscendingOrdering: + case SyntaxKind.DescendingOrdering: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (ascendingOrDescendingKeyword != null) + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (ascendingOrDescendingKeyword != null) + { + switch (ascendingOrDescendingKeyword.Kind) { - switch (ascendingOrDescendingKeyword.Kind) - { - case SyntaxKind.AscendingKeyword: - case SyntaxKind.DescendingKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword)); - } + case SyntaxKind.AscendingKeyword: + case SyntaxKind.DescendingKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword)); } + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, this.context, out hash); - if (cached != null) return (OrderingSyntax)cached; - - var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, this.context, out hash); + if (cached != null) return (OrderingSyntax)cached; - return result; + var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression) - { + return result; + } + + public SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression) + { #if DEBUG - if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword)); - if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword)); + if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, this.context, out hash); - if (cached != null) return (SelectClauseSyntax)cached; - - var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, this.context, out hash); + if (cached != null) return (SelectClauseSyntax)cached; - return result; + var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) - { + return result; + } + + public GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + { #if DEBUG - if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword)); - if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); - if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression)); - if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword)); - if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); - if (byExpression == null) throw new ArgumentNullException(nameof(byExpression)); + if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword)); + if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); + if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression)); + if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword)); + if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); + if (byExpression == null) throw new ArgumentNullException(nameof(byExpression)); #endif - return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression, this.context); - } + return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression, this.context); + } - public QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) - { + public QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + { #if DEBUG - if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); - if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (body == null) throw new ArgumentNullException(nameof(body)); + if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); + if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (body == null) throw new ArgumentNullException(nameof(body)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context, out hash); - if (cached != null) return (QueryContinuationSyntax)cached; - - var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context, out hash); + if (cached != null) return (QueryContinuationSyntax)cached; - return result; + var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken) - { + return result; + } + + public OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken) + { #if DEBUG - if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken)); - if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); + if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken)); + if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context, out hash); - if (cached != null) return (OmittedArraySizeExpressionSyntax)cached; - - var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context, out hash); + if (cached != null) return (OmittedArraySizeExpressionSyntax)cached; - return result; + var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) - { + return result; + } + + public InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) + { #if DEBUG - if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken)); - switch (stringStartToken.Kind) - { - case SyntaxKind.InterpolatedStringStartToken: - case SyntaxKind.InterpolatedVerbatimStringStartToken: - case SyntaxKind.InterpolatedSingleLineRawStringStartToken: - case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; - default: throw new ArgumentException(nameof(stringStartToken)); - } - if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken)); - switch (stringEndToken.Kind) - { - case SyntaxKind.InterpolatedStringEndToken: - case SyntaxKind.InterpolatedRawStringEndToken: break; - default: throw new ArgumentException(nameof(stringEndToken)); - } + if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken)); + switch (stringStartToken.Kind) + { + case SyntaxKind.InterpolatedStringStartToken: + case SyntaxKind.InterpolatedVerbatimStringStartToken: + case SyntaxKind.InterpolatedSingleLineRawStringStartToken: + case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; + default: throw new ArgumentException(nameof(stringStartToken)); + } + if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken)); + switch (stringEndToken.Kind) + { + case SyntaxKind.InterpolatedStringEndToken: + case SyntaxKind.InterpolatedRawStringEndToken: break; + default: throw new ArgumentException(nameof(stringEndToken)); + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context, out hash); - if (cached != null) return (InterpolatedStringExpressionSyntax)cached; - - var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context, out hash); + if (cached != null) return (InterpolatedStringExpressionSyntax)cached; - return result; + var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) - { + return result; + } + + public IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword)); - if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword)); + if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context, out hash); - if (cached != null) return (IsPatternExpressionSyntax)cached; - - var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context, out hash); + if (cached != null) return (IsPatternExpressionSyntax)cached; - return result; + var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression) - { + return result; + } + + public ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression) + { #if DEBUG - if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); - if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); + if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, this.context, out hash); - if (cached != null) return (ThrowExpressionSyntax)cached; - - var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, this.context, out hash); + if (cached != null) return (ThrowExpressionSyntax)cached; - return result; + var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition) - { + return result; + } + + public WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition) + { #if DEBUG - if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); - if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); + if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, this.context, out hash); - if (cached != null) return (WhenClauseSyntax)cached; - - var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, this.context, out hash); + if (cached != null) return (WhenClauseSyntax)cached; - return result; + var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken) - { + return result; + } + + public DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken) + { #if DEBUG - if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); - if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); + if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); + if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, this.context, out hash); - if (cached != null) return (DiscardPatternSyntax)cached; - - var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, this.context, out hash); + if (cached != null) return (DiscardPatternSyntax)cached; - return result; + var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) - { + return result; + } + + public DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, this.context, out hash); - if (cached != null) return (DeclarationPatternSyntax)cached; - - var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, this.context, out hash); + if (cached != null) return (DeclarationPatternSyntax)cached; - return result; + var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation) - { + return result; + } + + public VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation) + { #if DEBUG - if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword)); - if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword)); + if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, this.context, out hash); - if (cached != null) return (VarPatternSyntax)cached; - - var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, this.context, out hash); + if (cached != null) return (VarPatternSyntax)cached; - return result; + var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) - { + return result; + } + + public RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) + { #if DEBUG #endif - return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation, this.context); - } + return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation, this.context); + } - public PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) - { + public PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context, out hash); - if (cached != null) return (PositionalPatternClauseSyntax)cached; - - var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context, out hash); + if (cached != null) return (PositionalPatternClauseSyntax)cached; - return result; + var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) - { + return result; + } + + public PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context, out hash); - if (cached != null) return (PropertyPatternClauseSyntax)cached; - - var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context, out hash); + if (cached != null) return (PropertyPatternClauseSyntax)cached; - return result; + var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) - { + return result; + } + + public SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) + { #if DEBUG - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, this.context, out hash); - if (cached != null) return (SubpatternSyntax)cached; - - var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, this.context, out hash); + if (cached != null) return (SubpatternSyntax)cached; - return result; + var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression) - { + return result; + } + + public ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, this.context, out hash); - if (cached != null) return (ConstantPatternSyntax)cached; - - var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, this.context, out hash); + if (cached != null) return (ConstantPatternSyntax)cached; - return result; + var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) - { + return result; + } + + public ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context, out hash); - if (cached != null) return (ParenthesizedPatternSyntax)cached; - - var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context, out hash); + if (cached != null) return (ParenthesizedPatternSyntax)cached; - return result; + var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression) - { + return result; + } + + public RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, this.context, out hash); - if (cached != null) return (RelationalPatternSyntax)cached; - - var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, this.context, out hash); + if (cached != null) return (RelationalPatternSyntax)cached; - return result; + var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypePatternSyntax TypePattern(TypeSyntax type) - { + return result; + } + + public TypePatternSyntax TypePattern(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, this.context, out hash); - if (cached != null) return (TypePatternSyntax)cached; - - var result = new TypePatternSyntax(SyntaxKind.TypePattern, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, this.context, out hash); + if (cached != null) return (TypePatternSyntax)cached; - return result; + var result = new TypePatternSyntax(SyntaxKind.TypePattern, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + return result; + } + + public BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.OrPattern: - case SyntaxKind.AndPattern: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.OrPattern: + case SyntaxKind.AndPattern: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.OrKeyword: - case SyntaxKind.AndKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.OrKeyword: + case SyntaxKind.AndKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); - if (cached != null) return (BinaryPatternSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, this.context, out hash); + if (cached != null) return (BinaryPatternSyntax)cached; - var result = new BinaryPatternSyntax(kind, left, operatorToken, right, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new BinaryPatternSyntax(kind, left, operatorToken, right, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern) - { + return result; + } + + public UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, this.context, out hash); - if (cached != null) return (UnaryPatternSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, this.context, out hash); + if (cached != null) return (UnaryPatternSyntax)cached; - var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ListPatternSyntax ListPattern(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) - { + return result; + } + + public ListPatternSyntax ListPattern(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation, this.context); - } + return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation, this.context); + } - public SlicePatternSyntax SlicePattern(SyntaxToken dotDotToken, PatternSyntax? pattern) - { + public SlicePatternSyntax SlicePattern(SyntaxToken dotDotToken, PatternSyntax? pattern) + { #if DEBUG - if (dotDotToken == null) throw new ArgumentNullException(nameof(dotDotToken)); - if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); + if (dotDotToken == null) throw new ArgumentNullException(nameof(dotDotToken)); + if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, this.context, out hash); - if (cached != null) return (SlicePatternSyntax)cached; - - var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, this.context, out hash); + if (cached != null) return (SlicePatternSyntax)cached; - public InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken) + var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern, this.context); + if (hash >= 0) { + SyntaxNodeCache.AddNode(result, hash); + } + + return result; + } + + public InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken) + { #if DEBUG - if (textToken == null) throw new ArgumentNullException(nameof(textToken)); - if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); + if (textToken == null) throw new ArgumentNullException(nameof(textToken)); + if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, this.context, out hash); - if (cached != null) return (InterpolatedStringTextSyntax)cached; - - var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, this.context, out hash); + if (cached != null) return (InterpolatedStringTextSyntax)cached; - return result; + var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) - { + return result; + } + + public InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken, this.context); - } + return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken, this.context); + } - public InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value) - { + public InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value) + { #if DEBUG - if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); - if (value == null) throw new ArgumentNullException(nameof(value)); + if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); + if (value == null) throw new ArgumentNullException(nameof(value)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context, out hash); - if (cached != null) return (InterpolationAlignmentClauseSyntax)cached; - - var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context, out hash); + if (cached != null) return (InterpolationAlignmentClauseSyntax)cached; - return result; + var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken) - { + return result; + } + + public InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken) + { #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken)); - if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken)); + if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context, out hash); - if (cached != null) return (InterpolationFormatClauseSyntax)cached; - - var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context, out hash); + if (cached != null) return (InterpolationFormatClauseSyntax)cached; - return result; + var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public GlobalStatementSyntax GlobalStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) - { + return result; + } + + public GlobalStatementSyntax GlobalStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) + { #if DEBUG - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context, out hash); - if (cached != null) return (GlobalStatementSyntax)cached; - - var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context, out hash); + if (cached != null) return (GlobalStatementSyntax)cached; - return result; + var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BlockSyntax Block(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) - { + return result; + } + + public BlockSyntax Block(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken, this.context); - } + return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken, this.context); + } - public LocalFunctionStatementSyntax LocalFunctionStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public LocalFunctionStatementSyntax LocalFunctionStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); - } + return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); + } - public LocalDeclarationStatementSyntax LocalDeclarationStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + public LocalDeclarationStatementSyntax LocalDeclarationStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (usingKeyword != null) + } + if (usingKeyword != null) + { + switch (usingKeyword.Kind) { - switch (usingKeyword.Kind) - { - case SyntaxKind.UsingKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(usingKeyword)); - } + case SyntaxKind.UsingKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(usingKeyword)); } - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken, this.context); - } + return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken, this.context); + } - public VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) - { + public VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, this.context, out hash); - if (cached != null) return (VariableDeclarationSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, this.context, out hash); + if (cached != null) return (VariableDeclarationSyntax)cached; - var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) - { + return result; + } + + public VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context, out hash); - if (cached != null) return (VariableDeclaratorSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context, out hash); + if (cached != null) return (VariableDeclaratorSyntax)cached; - var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value) - { + return result; + } + + public EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value) + { #if DEBUG - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (value == null) throw new ArgumentNullException(nameof(value)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (value == null) throw new ArgumentNullException(nameof(value)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, this.context, out hash); - if (cached != null) return (EqualsValueClauseSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, this.context, out hash); + if (cached != null) return (EqualsValueClauseSyntax)cached; - var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier) - { + return result; + } + + public SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, this.context, out hash); - if (cached != null) return (SingleVariableDesignationSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, this.context, out hash); + if (cached != null) return (SingleVariableDesignationSyntax)cached; - var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) - { + return result; + } + + public DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) + { #if DEBUG - if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); - if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); + if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); + if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, this.context, out hash); - if (cached != null) return (DiscardDesignationSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, this.context, out hash); + if (cached != null) return (DiscardDesignationSyntax)cached; - var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) - { + return result; + } + + public ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context, out hash); - if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context, out hash); + if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached; - var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ExpressionStatementSyntax ExpressionStatement(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) - { + return result; + } + + public ExpressionStatementSyntax ExpressionStatement(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context, out hash); - if (cached != null) return (ExpressionStatementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context, out hash); + if (cached != null) return (ExpressionStatementSyntax)cached; - var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public EmptyStatementSyntax EmptyStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) - { + return result; + } + + public EmptyStatementSyntax EmptyStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + { #if DEBUG - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context, out hash); - if (cached != null) return (EmptyStatementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context, out hash); + if (cached != null) return (EmptyStatementSyntax)cached; - var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public LabeledStatementSyntax LabeledStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) - { + return result; + } + + public LabeledStatementSyntax LabeledStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement, this.context); - } + return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement, this.context); + } - public GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.GotoStatement: - case SyntaxKind.GotoCaseStatement: - case SyntaxKind.GotoDefaultStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.GotoStatement: + case SyntaxKind.GotoCaseStatement: + case SyntaxKind.GotoDefaultStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword)); - if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); - if (caseOrDefaultKeyword != null) + if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword)); + if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); + if (caseOrDefaultKeyword != null) + { + switch (caseOrDefaultKeyword.Kind) { - switch (caseOrDefaultKeyword.Kind) - { - case SyntaxKind.CaseKeyword: - case SyntaxKind.DefaultKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(caseOrDefaultKeyword)); - } + case SyntaxKind.CaseKeyword: + case SyntaxKind.DefaultKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(caseOrDefaultKeyword)); } - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken, this.context); - } + return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken, this.context); + } - public BreakStatementSyntax BreakStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) - { + public BreakStatementSyntax BreakStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + { #if DEBUG - if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword)); - if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword)); + if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context, out hash); - if (cached != null) return (BreakStatementSyntax)cached; - - var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context, out hash); + if (cached != null) return (BreakStatementSyntax)cached; - return result; + var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ContinueStatementSyntax ContinueStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) - { + return result; + } + + public ContinueStatementSyntax ContinueStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + { #if DEBUG - if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword)); - if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword)); + if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context, out hash); - if (cached != null) return (ContinueStatementSyntax)cached; - - var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context, out hash); + if (cached != null) return (ContinueStatementSyntax)cached; - return result; + var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ReturnStatementSyntax ReturnStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { + return result; + } + + public ReturnStatementSyntax ReturnStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { #if DEBUG - if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword)); - if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword)); + if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken, this.context); - } + return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken, this.context); + } - public ThrowStatementSyntax ThrowStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { + public ThrowStatementSyntax ThrowStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { #if DEBUG - if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); - if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); + if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken, this.context); - } + return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken, this.context); + } - public YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.YieldReturnStatement: - case SyntaxKind.YieldBreakStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.YieldReturnStatement: + case SyntaxKind.YieldBreakStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword)); - if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); - if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword)); - switch (returnOrBreakKeyword.Kind) - { - case SyntaxKind.ReturnKeyword: - case SyntaxKind.BreakKeyword: break; - default: throw new ArgumentException(nameof(returnOrBreakKeyword)); - } - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword)); + if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); + if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword)); + switch (returnOrBreakKeyword.Kind) + { + case SyntaxKind.ReturnKeyword: + case SyntaxKind.BreakKeyword: break; + default: throw new ArgumentException(nameof(returnOrBreakKeyword)); + } + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken, this.context); - } + return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken, this.context); + } - public WhileStatementSyntax WhileStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) - { + public WhileStatementSyntax WhileStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); - if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); + if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement, this.context); - } + return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement, this.context); + } - public DoStatementSyntax DoStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) - { + public DoStatementSyntax DoStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + { #if DEBUG - if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword)); - if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); - if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword)); + if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); + if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.context); - } + return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.context); + } - public ForStatementSyntax ForStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) - { + public ForStatementSyntax ForStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword)); - if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken)); - if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); - if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken)); - if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword)); + if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken)); + if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); + if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken)); + if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement, this.context); - } + return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement, this.context); + } - public ForEachStatementSyntax ForEachStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public ForEachStatementSyntax ForEachStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); - if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); + if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement, this.context); - } + return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement, this.context); + } - public ForEachVariableStatementSyntax ForEachVariableStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public ForEachVariableStatementSyntax ForEachVariableStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); - if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (variable == null) throw new ArgumentNullException(nameof(variable)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); + if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (variable == null) throw new ArgumentNullException(nameof(variable)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement, this.context); - } + return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement, this.context); + } - public UsingStatementSyntax UsingStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public UsingStatementSyntax UsingStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); - if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); + if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement, this.context); - } + return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement, this.context); + } - public FixedStatementSyntax FixedStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) - { + public FixedStatementSyntax FixedStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword)); - if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword)); + if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement, this.context); - } + return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement, this.context); + } - public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.CheckedStatement: - case SyntaxKind.UncheckedStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.CheckedStatement: + case SyntaxKind.UncheckedStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.UncheckedKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (block == null) throw new ArgumentNullException(nameof(block)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.CheckedKeyword: + case SyntaxKind.UncheckedKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, this.context, out hash); - if (cached != null) return (CheckedStatementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, this.context, out hash); + if (cached != null) return (CheckedStatementSyntax)cached; - var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public UnsafeStatementSyntax UnsafeStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) - { + return result; + } + + public UnsafeStatementSyntax UnsafeStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + { #if DEBUG - if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword)); - if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword)); + if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context, out hash); - if (cached != null) return (UnsafeStatementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context, out hash); + if (cached != null) return (UnsafeStatementSyntax)cached; - var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public LockStatementSyntax LockStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + return result; + } + + public LockStatementSyntax LockStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword)); - if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword)); + if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement, this.context); - } + return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement, this.context); + } - public IfStatementSyntax IfStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) - { + public IfStatementSyntax IfStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + { #if DEBUG - if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); - if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); + if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else, this.context); - } + return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else, this.context); + } - public ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement) - { + public ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement) + { #if DEBUG - if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); - if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); + if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, this.context, out hash); - if (cached != null) return (ElseClauseSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, this.context, out hash); + if (cached != null) return (ElseClauseSyntax)cached; - var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SwitchStatementSyntax SwitchStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) - { + return result; + } + + public SwitchStatementSyntax SwitchStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + { #if DEBUG - if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); - if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); - if (openParenToken != null) + if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); + if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); + if (openParenToken != null) + { + switch (openParenToken.Kind) { - switch (openParenToken.Kind) - { - case SyntaxKind.OpenParenToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openParenToken)); - } + case SyntaxKind.OpenParenToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openParenToken)); } - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken != null) + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken != null) + { + switch (closeParenToken.Kind) { - switch (closeParenToken.Kind) - { - case SyntaxKind.CloseParenToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeParenToken)); - } + case SyntaxKind.CloseParenToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeParenToken)); } - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + } + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken, this.context); - } + return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken, this.context); + } - public SwitchSectionSyntax SwitchSection(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) - { + public SwitchSectionSyntax SwitchSection(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) + { #if DEBUG #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context, out hash); - if (cached != null) return (SwitchSectionSyntax)cached; - - var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context, out hash); + if (cached != null) return (SwitchSectionSyntax)cached; - public CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context); + if (hash >= 0) { + SyntaxNodeCache.AddNode(result, hash); + } + + return result; + } + + public CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken, this.context); - } + return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken, this.context); + } - public CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) - { + public CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); - if (value == null) throw new ArgumentNullException(nameof(value)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); + if (value == null) throw new ArgumentNullException(nameof(value)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context, out hash); - if (cached != null) return (CaseSwitchLabelSyntax)cached; - - var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context, out hash); + if (cached != null) return (CaseSwitchLabelSyntax)cached; - return result; + var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken) - { + return result; + } + + public DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context, out hash); - if (cached != null) return (DefaultSwitchLabelSyntax)cached; - - var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context, out hash); + if (cached != null) return (DefaultSwitchLabelSyntax)cached; - return result; + var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) - { + return result; + } + + public SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + { #if DEBUG - if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); - if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); - if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); + if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); + if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken, this.context); - } + return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken, this.context); + } - public SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) - { + public SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + { #if DEBUG - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken)); - if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken)); + if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression, this.context); - } + return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression, this.context); + } - public TryStatementSyntax TryStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) - { + public TryStatementSyntax TryStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) + { #if DEBUG - if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword)); - if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword)); + if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally, this.context); - } + return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally, this.context); + } - public CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - { + public CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) + { #if DEBUG - if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword)); - if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword)); + if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block, this.context); - } + return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block, this.context); + } - public CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) - { + public CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier != null) + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier != null) + { + switch (identifier.Kind) { - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(identifier)); - } + case SyntaxKind.IdentifierToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(identifier)); } - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + } + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken, this.context); - } + return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken, this.context); + } - public CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) - { + public CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + { #if DEBUG - if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); - if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); + if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken, this.context); - } + return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken, this.context); + } - public FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block) - { + public FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block) + { #if DEBUG - if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword)); - if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword)); + if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, this.context, out hash); - if (cached != null) return (FinallyClauseSyntax)cached; - - var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, this.context, out hash); + if (cached != null) return (FinallyClauseSyntax)cached; - return result; + var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public CompilationUnitSyntax CompilationUnit(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) - { + return result; + } + + public CompilationUnitSyntax CompilationUnit(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) + { #if DEBUG - if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken)); - if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); + if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken)); + if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); #endif - return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken, this.context); - } + return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken, this.context); + } - public ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) - { + public ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + { #if DEBUG - if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword)); - if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); - if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword)); - if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword)); + if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); + if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword)); + if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken, this.context); - } + return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken, this.context); + } - public UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) - { + public UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + { #if DEBUG - if (globalKeyword != null) + if (globalKeyword != null) + { + switch (globalKeyword.Kind) { - switch (globalKeyword.Kind) - { - case SyntaxKind.GlobalKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(globalKeyword)); - } + case SyntaxKind.GlobalKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(globalKeyword)); } - if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); - if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); - if (staticKeyword != null) + } + if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); + if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); + if (staticKeyword != null) + { + switch (staticKeyword.Kind) { - switch (staticKeyword.Kind) - { - case SyntaxKind.StaticKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(staticKeyword)); - } + case SyntaxKind.StaticKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(staticKeyword)); } - if (unsafeKeyword != null) + } + if (unsafeKeyword != null) + { + switch (unsafeKeyword.Kind) { - switch (unsafeKeyword.Kind) - { - case SyntaxKind.UnsafeKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(unsafeKeyword)); - } + case SyntaxKind.UnsafeKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(unsafeKeyword)); } - if (namespaceOrType == null) throw new ArgumentNullException(nameof(namespaceOrType)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (namespaceOrType == null) throw new ArgumentNullException(nameof(namespaceOrType)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken, this.context); - } + return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken, this.context); + } - public NamespaceDeclarationSyntax NamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) - { + public NamespaceDeclarationSyntax NamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); - if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - if (semicolonToken != null) + if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); + if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken, this.context); + } - public FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) - { + public FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) + { #if DEBUG - if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); - if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); + if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node, this.context); - } + return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node, this.context); + } - public AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) - { + public AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken, this.context); - } + return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken, this.context); + } - public AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken) - { + public AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context, out hash); - if (cached != null) return (AttributeTargetSpecifierSyntax)cached; - - var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context, out hash); + if (cached != null) return (AttributeTargetSpecifierSyntax)cached; - return result; + var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList) - { + return result; + } + + public AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, this.context, out hash); - if (cached != null) return (AttributeSyntax)cached; - - var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, this.context, out hash); + if (cached != null) return (AttributeSyntax)cached; - return result; + var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); - if (cached != null) return (AttributeArgumentListSyntax)cached; - - var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); + if (cached != null) return (AttributeArgumentListSyntax)cached; - return result; + var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) - { + return result; + } + + public AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context, out hash); - if (cached != null) return (AttributeArgumentSyntax)cached; - - var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context, out hash); + if (cached != null) return (AttributeArgumentSyntax)cached; - return result; + var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken) - { + return result; + } + + public NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, this.context, out hash); - if (cached != null) return (NameEqualsSyntax)cached; - - var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, this.context, out hash); + if (cached != null) return (NameEqualsSyntax)cached; - return result; + var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { + return result; + } + + public TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); - if (cached != null) return (TypeParameterListSyntax)cached; - - var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); + if (cached != null) return (TypeParameterListSyntax)cached; - return result; + var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypeParameterSyntax TypeParameter(CoreSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) - { + return result; + } + + public TypeParameterSyntax TypeParameter(CoreSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) + { #if DEBUG - if (varianceKeyword != null) + if (varianceKeyword != null) + { + switch (varianceKeyword.Kind) { - switch (varianceKeyword.Kind) - { - case SyntaxKind.InKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(varianceKeyword)); - } + case SyntaxKind.InKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(varianceKeyword)); } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context, out hash); - if (cached != null) return (TypeParameterSyntax)cached; - - var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context, out hash); + if (cached != null) return (TypeParameterSyntax)cached; - return result; + var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ClassDeclarationSyntax ClassDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + return result; + } + + public ClassDeclarationSyntax ClassDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); + } - public StructDeclarationSyntax StructDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public StructDeclarationSyntax StructDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); + } - public InterfaceDeclarationSyntax InterfaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public InterfaceDeclarationSyntax InterfaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); + } - public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.RecordDeclaration: - case SyntaxKind.RecordStructDeclaration: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.RecordDeclaration: + case SyntaxKind.RecordStructDeclaration: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (classOrStructKeyword != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (classOrStructKeyword != null) + { + switch (classOrStructKeyword.Kind) { - switch (classOrStructKeyword.Kind) - { - case SyntaxKind.ClassKeyword: - case SyntaxKind.StructKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(classOrStructKeyword)); - } + case SyntaxKind.ClassKeyword: + case SyntaxKind.StructKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(classOrStructKeyword)); } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); + } - public EnumDeclarationSyntax EnumDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public EnumDeclarationSyntax EnumDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword)); - if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword)); + if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); - } + return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); + } - public DelegateDeclarationSyntax DelegateDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) - { + public DelegateDeclarationSyntax DelegateDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken, this.context); - } + return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken, this.context); + } - public EnumMemberDeclarationSyntax EnumMemberDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) - { + public EnumMemberDeclarationSyntax EnumMemberDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue, this.context); - } + return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue, this.context); + } - public BaseListSyntax BaseList(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) - { + public BaseListSyntax BaseList(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) + { #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, this.context, out hash); - if (cached != null) return (BaseListSyntax)cached; - - var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, this.context, out hash); + if (cached != null) return (BaseListSyntax)cached; - return result; + var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) - { + return result; + } + + public SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, this.context, out hash); - if (cached != null) return (SimpleBaseTypeSyntax)cached; - - var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, this.context, out hash); + if (cached != null) return (SimpleBaseTypeSyntax)cached; - return result; + var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) - { + return result; + } + + public PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context, out hash); - if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached; - - var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context, out hash); + if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached; - return result; + var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) - { + return result; + } + + public TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) + { #if DEBUG - if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); - if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); + if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node, this.context); - } + return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node, this.context); + } - public ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) - { + public ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context, out hash); - if (cached != null) return (ConstructorConstraintSyntax)cached; - - var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context, out hash); + if (cached != null) return (ConstructorConstraintSyntax)cached; - return result; + var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) + return result; + } + + public ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ClassConstraint: - case SyntaxKind.StructConstraint: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ClassConstraint: + case SyntaxKind.StructConstraint: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword)); - switch (classOrStructKeyword.Kind) - { - case SyntaxKind.ClassKeyword: - case SyntaxKind.StructKeyword: break; - default: throw new ArgumentException(nameof(classOrStructKeyword)); - } - if (questionToken != null) + if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword)); + switch (classOrStructKeyword.Kind) + { + case SyntaxKind.ClassKeyword: + case SyntaxKind.StructKeyword: break; + default: throw new ArgumentException(nameof(classOrStructKeyword)); + } + if (questionToken != null) + { + switch (questionToken.Kind) { - switch (questionToken.Kind) - { - case SyntaxKind.QuestionToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(questionToken)); - } + case SyntaxKind.QuestionToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(questionToken)); } + } #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, this.context, out hash); - if (cached != null) return (ClassOrStructConstraintSyntax)cached; - - var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, this.context, out hash); + if (cached != null) return (ClassOrStructConstraintSyntax)cached; - return result; + var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public TypeConstraintSyntax TypeConstraint(TypeSyntax type) - { + return result; + } + + public TypeConstraintSyntax TypeConstraint(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, this.context, out hash); - if (cached != null) return (TypeConstraintSyntax)cached; - - var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, this.context, out hash); + if (cached != null) return (TypeConstraintSyntax)cached; - return result; + var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) - { + return result; + } + + public DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) + { #if DEBUG - if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword)); - if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); + if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword)); + if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, this.context, out hash); - if (cached != null) return (DefaultConstraintSyntax)cached; - - var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, this.context, out hash); + if (cached != null) return (DefaultConstraintSyntax)cached; - return result; + var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public FieldDeclarationSyntax FieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + return result; + } + + public FieldDeclarationSyntax FieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken, this.context); - } + return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken, this.context); + } - public EventFieldDeclarationSyntax EventFieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + public EventFieldDeclarationSyntax EventFieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); - if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); + if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken, this.context); - } + return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken, this.context); + } - public ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken) - { + public ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context, out hash); - if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached; - - var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context, out hash); + if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached; - return result; + var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public MethodDeclarationSyntax MethodDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + return result; + } + + public MethodDeclarationSyntax MethodDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); - } + return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); + } - public OperatorDeclarationSyntax OperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public OperatorDeclarationSyntax OperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) - { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - } - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.TildeToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.FalseKeyword: - case SyntaxKind.TrueKeyword: - case SyntaxKind.IsKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + } + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.TildeToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: + case SyntaxKind.IsKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken, this.context); - } + return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken, this.context); + } - public ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); - switch (implicitOrExplicitKeyword.Kind) - { - case SyntaxKind.ImplicitKeyword: - case SyntaxKind.ExplicitKeyword: break; - default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); - } - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) + if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); + switch (implicitOrExplicitKeyword.Kind) + { + case SyntaxKind.ImplicitKeyword: + case SyntaxKind.ExplicitKeyword: break; + default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); + } + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + } + if (type == null) throw new ArgumentNullException(nameof(type)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken, this.context); - } + return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken, this.context); + } - public ConstructorDeclarationSyntax ConstructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public ConstructorDeclarationSyntax ConstructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken, this.context); - } + return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken, this.context); + } - public ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + public ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.BaseConstructorInitializer: - case SyntaxKind.ThisConstructorInitializer: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.BaseConstructorInitializer: + case SyntaxKind.ThisConstructorInitializer: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword)); - switch (thisOrBaseKeyword.Kind) - { - case SyntaxKind.BaseKeyword: - case SyntaxKind.ThisKeyword: break; - default: throw new ArgumentException(nameof(thisOrBaseKeyword)); - } - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword)); + switch (thisOrBaseKeyword.Kind) + { + case SyntaxKind.BaseKeyword: + case SyntaxKind.ThisKeyword: break; + default: throw new ArgumentException(nameof(thisOrBaseKeyword)); + } + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, this.context, out hash); - if (cached != null) return (ConstructorInitializerSyntax)cached; - - var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, this.context, out hash); + if (cached != null) return (ConstructorInitializerSyntax)cached; - return result; + var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public DestructorDeclarationSyntax DestructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + return result; + } + + public DestructorDeclarationSyntax DestructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken)); - if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken)); + if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken, this.context); - } + return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken, this.context); + } - public PropertyDeclarationSyntax PropertyDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) - { + public PropertyDeclarationSyntax PropertyDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, this.context); - } + return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, this.context); + } - public ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression) - { + public ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression) + { #if DEBUG - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context, out hash); - if (cached != null) return (ArrowExpressionClauseSyntax)cached; - - var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context, out hash); + if (cached != null) return (ArrowExpressionClauseSyntax)cached; - return result; + var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public EventDeclarationSyntax EventDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) - { + return result; + } + + public EventDeclarationSyntax EventDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) + { #if DEBUG - if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); - if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken != null) + if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); + if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, this.context); - } + return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, this.context); + } - public IndexerDeclarationSyntax IndexerDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public IndexerDeclarationSyntax IndexerDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); - if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); + if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, this.context); - } + return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, this.context); + } - public AccessorListSyntax AccessorList(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) - { + public AccessorListSyntax AccessorList(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context, out hash); - if (cached != null) return (AccessorListSyntax)cached; - - var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context, out hash); + if (cached != null) return (AccessorListSyntax)cached; - return result; + var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + return result; + } + + public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.GetAccessorDeclaration: - case SyntaxKind.SetAccessorDeclaration: - case SyntaxKind.InitAccessorDeclaration: - case SyntaxKind.AddAccessorDeclaration: - case SyntaxKind.RemoveAccessorDeclaration: - case SyntaxKind.UnknownAccessorDeclaration: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.GetAccessorDeclaration: + case SyntaxKind.SetAccessorDeclaration: + case SyntaxKind.InitAccessorDeclaration: + case SyntaxKind.AddAccessorDeclaration: + case SyntaxKind.RemoveAccessorDeclaration: + case SyntaxKind.UnknownAccessorDeclaration: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - case SyntaxKind.InitKeyword: - case SyntaxKind.AddKeyword: - case SyntaxKind.RemoveKeyword: - case SyntaxKind.IdentifierToken: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (semicolonToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + case SyntaxKind.InitKeyword: + case SyntaxKind.AddKeyword: + case SyntaxKind.RemoveKeyword: + case SyntaxKind.IdentifierToken: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken, this.context); - } + return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken, this.context); + } - public ParameterListSyntax ParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { + public ParameterListSyntax ParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); - if (cached != null) return (ParameterListSyntax)cached; - - var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); + if (cached != null) return (ParameterListSyntax)cached; - return result; + var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { + return result; + } + + public BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (BracketedParameterListSyntax)cached; - - var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (BracketedParameterListSyntax)cached; - return result; + var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public ParameterSyntax Parameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) - { + return result; + } + + public ParameterSyntax Parameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.ArgListKeyword: break; - default: throw new ArgumentException(nameof(identifier)); - } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + switch (identifier.Kind) + { + case SyntaxKind.IdentifierToken: + case SyntaxKind.ArgListKeyword: break; + default: throw new ArgumentException(nameof(identifier)); + } #endif - return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default, this.context); - } + return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default, this.context); + } - public FunctionPointerParameterSyntax FunctionPointerParameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) - { + public FunctionPointerParameterSyntax FunctionPointerParameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context, out hash); - if (cached != null) return (FunctionPointerParameterSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context, out hash); + if (cached != null) return (FunctionPointerParameterSyntax)cached; - var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public IncompleteMemberSyntax IncompleteMember(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type) - { + return result; + } + + public IncompleteMemberSyntax IncompleteMember(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type) + { #if DEBUG #endif - return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type, this.context); - } + return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type, this.context); + } - public SkippedTokensTriviaSyntax SkippedTokensTrivia(CoreSyntax.SyntaxList tokens) - { + public SkippedTokensTriviaSyntax SkippedTokensTrivia(CoreSyntax.SyntaxList tokens) + { #if DEBUG #endif - return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node, this.context); - } + return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node, this.context); + } - public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList content, SyntaxToken endOfComment) + public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList content, SyntaxToken endOfComment) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SingleLineDocumentationCommentTrivia: - case SyntaxKind.MultiLineDocumentationCommentTrivia: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SingleLineDocumentationCommentTrivia: + case SyntaxKind.MultiLineDocumentationCommentTrivia: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment)); - if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); + if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment)); + if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); #endif - return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment, this.context); - } + return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment, this.context); + } - public TypeCrefSyntax TypeCref(TypeSyntax type) - { + public TypeCrefSyntax TypeCref(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, this.context, out hash); - if (cached != null) return (TypeCrefSyntax)cached; - - var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, this.context, out hash); + if (cached != null) return (TypeCrefSyntax)cached; - return result; + var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) - { + return result; + } + + public QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + { #if DEBUG - if (container == null) throw new ArgumentNullException(nameof(container)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - if (member == null) throw new ArgumentNullException(nameof(member)); + if (container == null) throw new ArgumentNullException(nameof(container)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (member == null) throw new ArgumentNullException(nameof(member)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, this.context, out hash); - if (cached != null) return (QualifiedCrefSyntax)cached; - - var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, this.context, out hash); + if (cached != null) return (QualifiedCrefSyntax)cached; - return result; + var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) - { + return result; + } + + public NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, this.context, out hash); - if (cached != null) return (NameMemberCrefSyntax)cached; - - var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, this.context, out hash); + if (cached != null) return (NameMemberCrefSyntax)cached; - return result; + var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) - { + return result; + } + + public IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + { #if DEBUG - if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); - if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); + if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); + if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context, out hash); - if (cached != null) return (IndexerMemberCrefSyntax)cached; - - var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context, out hash); + if (cached != null) return (IndexerMemberCrefSyntax)cached; - return result; + var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) - { + return result; + } + + public OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + { #if DEBUG - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) - { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - } - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.TildeToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.FalseKeyword: - case SyntaxKind.TrueKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } + } + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.TildeToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } #endif - return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters, this.context); - } + return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters, this.context); + } - public ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) - { + public ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + { #if DEBUG - if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); - switch (implicitOrExplicitKeyword.Kind) - { - case SyntaxKind.ImplicitKeyword: - case SyntaxKind.ExplicitKeyword: break; - default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); - } - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) + if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); + switch (implicitOrExplicitKeyword.Kind) + { + case SyntaxKind.ImplicitKeyword: + case SyntaxKind.ExplicitKeyword: break; + default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); + } + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters, this.context); - } + return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters, this.context); + } - public CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { + public CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); - if (cached != null) return (CrefParameterListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); + if (cached != null) return (CrefParameterListSyntax)cached; - var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { + return result; + } + + public CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); - if (cached != null) return (CrefBracketedParameterListSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); + if (cached != null) return (CrefBracketedParameterListSyntax)cached; - var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - { + return result; + } + + public CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + { #if DEBUG - if (refKindKeyword != null) + if (refKindKeyword != null) + { + switch (refKindKeyword.Kind) { - switch (refKindKeyword.Kind) - { - case SyntaxKind.RefKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.InKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(refKindKeyword)); - } + case SyntaxKind.RefKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.InKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(refKindKeyword)); } - if (readOnlyKeyword != null) + } + if (readOnlyKeyword != null) + { + switch (readOnlyKeyword.Kind) { - switch (readOnlyKeyword.Kind) - { - case SyntaxKind.ReadOnlyKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(readOnlyKeyword)); - } + case SyntaxKind.ReadOnlyKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(readOnlyKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context, out hash); - if (cached != null) return (CrefParameterSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context, out hash); + if (cached != null) return (CrefParameterSyntax)cached; - var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) - { + return result; + } + + public XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + { #if DEBUG - if (startTag == null) throw new ArgumentNullException(nameof(startTag)); - if (endTag == null) throw new ArgumentNullException(nameof(endTag)); + if (startTag == null) throw new ArgumentNullException(nameof(startTag)); + if (endTag == null) throw new ArgumentNullException(nameof(endTag)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context, out hash); - if (cached != null) return (XmlElementSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context, out hash); + if (cached != null) return (XmlElementSyntax)cached; - var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) - { + return result; + } + + public XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken, this.context); - } + return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken, this.context); + } - public XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) - { + public XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken)); - if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken)); + if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context, out hash); - if (cached != null) return (XmlElementEndTagSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context, out hash); + if (cached != null) return (XmlElementEndTagSyntax)cached; - var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) - { + return result; + } + + public XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken)); - if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken)); + if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); #endif - return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken, this.context); - } + return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken, this.context); + } - public XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName) - { + public XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName) + { #if DEBUG - if (localName == null) throw new ArgumentNullException(nameof(localName)); - if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); + if (localName == null) throw new ArgumentNullException(nameof(localName)); + if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, this.context, out hash); - if (cached != null) return (XmlNameSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, this.context, out hash); + if (cached != null) return (XmlNameSyntax)cached; - var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) - { + return result; + } + + public XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) + { #if DEBUG - if (prefix == null) throw new ArgumentNullException(nameof(prefix)); - if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (prefix == null) throw new ArgumentNullException(nameof(prefix)); + if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, this.context, out hash); - if (cached != null) return (XmlPrefixSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, this.context, out hash); + if (cached != null) return (XmlPrefixSyntax)cached; - var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) - { + return result; + } + + public XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken, this.context); - } + return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken, this.context); + } - public XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) - { + public XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (cref == null) throw new ArgumentNullException(nameof(cref)); - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (cref == null) throw new ArgumentNullException(nameof(cref)); + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken, this.context); - } + return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken, this.context); + } - public XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) - { + public XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken, this.context); - } + return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken, this.context); + } - public XmlTextSyntax XmlText(CoreSyntax.SyntaxList textTokens) - { + public XmlTextSyntax XmlText(CoreSyntax.SyntaxList textTokens) + { #if DEBUG #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, this.context, out hash); - if (cached != null) return (XmlTextSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, this.context, out hash); + if (cached != null) return (XmlTextSyntax)cached; - var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) - { + return result; + } + + public XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + { #if DEBUG - if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken)); - if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); - if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken)); - if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); + if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken)); + if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); + if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken)); + if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context, out hash); - if (cached != null) return (XmlCDataSectionSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context, out hash); + if (cached != null) return (XmlCDataSectionSyntax)cached; - var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) - { + return result; + } + + public XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + { #if DEBUG - if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken)); - if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken)); - if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); + if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken)); + if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken)); + if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); #endif - return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken, this.context); - } + return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken, this.context); + } - public XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) - { + public XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) + { #if DEBUG - if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken)); - if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); - if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken)); - if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); + if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken)); + if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); + if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken)); + if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); #endif - int hash; - var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context, out hash); - if (cached != null) return (XmlCommentSyntax)cached; + int hash; + var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context, out hash); + if (cached != null) return (XmlCommentSyntax)cached; - var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { + return result; + } + + public IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); - if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); + if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); - } + return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); + } - public ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { + public ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword)); - if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword)); + if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); - } + return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); + } - public ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) - { + public ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); - if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); + if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken, this.context); - } + return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken, this.context); + } - public EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword)); - if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword)); + if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive, this.context); - } + return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive, this.context); + } - public RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword)); - if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword)); + if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive, this.context); - } + return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive, this.context); + } - public EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword)); - if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword)); + if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive, this.context); - } + return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive, this.context); + } - public ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword)); - if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword)); + if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive, this.context); - } + return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive, this.context); + } - public WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); - if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); + if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive, this.context); - } + return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive, this.context); + } - public BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - { + public BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive, this.context); - } + return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive, this.context); + } - public DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { + public DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword)); - if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword)); + if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive, this.context); - } + return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive, this.context); + } - public UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { + public UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword)); - if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword)); + if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive, this.context); - } + return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive, this.context); + } - public LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); - if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); - if (line == null) throw new ArgumentNullException(nameof(line)); - switch (line.Kind) - { - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.DefaultKeyword: - case SyntaxKind.HiddenKeyword: break; - default: throw new ArgumentException(nameof(line)); - } - if (file != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); + if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); + if (line == null) throw new ArgumentNullException(nameof(line)); + switch (line.Kind) + { + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.DefaultKeyword: + case SyntaxKind.HiddenKeyword: break; + default: throw new ArgumentException(nameof(line)); + } + if (file != null) + { + switch (file.Kind) { - switch (file.Kind) - { - case SyntaxKind.StringLiteralToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(file)); - } + case SyntaxKind.StringLiteralToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(file)); } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive, this.context); - } + return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive, this.context); + } - public LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) - { + public LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (line == null) throw new ArgumentNullException(nameof(line)); - if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); - if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); - if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); - if (character == null) throw new ArgumentNullException(nameof(character)); - if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (line == null) throw new ArgumentNullException(nameof(line)); + if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); + if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); + if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); + if (character == null) throw new ArgumentNullException(nameof(character)); + if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken, this.context); - } + return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken, this.context); + } - public LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); - if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); - if (start == null) throw new ArgumentNullException(nameof(start)); - if (minusToken == null) throw new ArgumentNullException(nameof(minusToken)); - if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); - if (end == null) throw new ArgumentNullException(nameof(end)); - if (characterOffset != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); + if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); + if (start == null) throw new ArgumentNullException(nameof(start)); + if (minusToken == null) throw new ArgumentNullException(nameof(minusToken)); + if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); + if (end == null) throw new ArgumentNullException(nameof(end)); + if (characterOffset != null) + { + switch (characterOffset.Kind) { - switch (characterOffset.Kind) - { - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(characterOffset)); - } + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(characterOffset)); } - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive, this.context); - } + return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive, this.context); + } - public PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) - { + public PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); - if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); - if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); - if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); - if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword)); - switch (disableOrRestoreKeyword.Kind) - { - case SyntaxKind.DisableKeyword: - case SyntaxKind.RestoreKeyword: break; - default: throw new ArgumentException(nameof(disableOrRestoreKeyword)); - } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); + if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); + if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); + if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); + if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword)); + switch (disableOrRestoreKeyword.Kind) + { + case SyntaxKind.DisableKeyword: + case SyntaxKind.RestoreKeyword: break; + default: throw new ArgumentException(nameof(disableOrRestoreKeyword)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive, this.context); - } + return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive, this.context); + } - public PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) - { + public PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); - if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); - if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword)); - if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (guid == null) throw new ArgumentNullException(nameof(guid)); - if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); - if (bytes == null) throw new ArgumentNullException(nameof(bytes)); - if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); + if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); + if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword)); + if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (guid == null) throw new ArgumentNullException(nameof(guid)); + if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); + if (bytes == null) throw new ArgumentNullException(nameof(bytes)); + if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive, this.context); - } + return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive, this.context); + } - public ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword)); - if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword)); + if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive, this.context); - } + return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive, this.context); + } - public LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword)); - if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword)); + if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive, this.context); - } + return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive, this.context); + } - public ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) - { + public ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken)); - if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken)); + if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context); - } + return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context); + } - public NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) - { + public NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword)); - if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); - if (settingToken == null) throw new ArgumentNullException(nameof(settingToken)); - switch (settingToken.Kind) - { - case SyntaxKind.EnableKeyword: - case SyntaxKind.DisableKeyword: - case SyntaxKind.RestoreKeyword: break; - default: throw new ArgumentException(nameof(settingToken)); - } - if (targetToken != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword)); + if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); + if (settingToken == null) throw new ArgumentNullException(nameof(settingToken)); + switch (settingToken.Kind) + { + case SyntaxKind.EnableKeyword: + case SyntaxKind.DisableKeyword: + case SyntaxKind.RestoreKeyword: break; + default: throw new ArgumentException(nameof(settingToken)); + } + if (targetToken != null) + { + switch (targetToken.Kind) { - switch (targetToken.Kind) - { - case SyntaxKind.WarningsKeyword: - case SyntaxKind.AnnotationsKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(targetToken)); - } + case SyntaxKind.WarningsKeyword: + case SyntaxKind.AnnotationsKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(targetToken)); } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive, this.context); - } + return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive, this.context); } +} - internal static partial class SyntaxFactory - { +internal static partial class SyntaxFactory +{ - public static IdentifierNameSyntax IdentifierName(SyntaxToken identifier) - { + public static IdentifierNameSyntax IdentifierName(SyntaxToken identifier) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.GlobalKeyword: break; - default: throw new ArgumentException(nameof(identifier)); - } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + switch (identifier.Kind) + { + case SyntaxKind.IdentifierToken: + case SyntaxKind.GlobalKeyword: break; + default: throw new ArgumentException(nameof(identifier)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, out hash); - if (cached != null) return (IdentifierNameSyntax)cached; - - var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, out hash); + if (cached != null) return (IdentifierNameSyntax)cached; - return result; + var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) - { + return result; + } + + public static QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + { #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, out hash); - if (cached != null) return (QualifiedNameSyntax)cached; - - var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, out hash); + if (cached != null) return (QualifiedNameSyntax)cached; - return result; + var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) - { + return result; + } + + public static GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, out hash); - if (cached != null) return (GenericNameSyntax)cached; - - var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, out hash); + if (cached != null) return (GenericNameSyntax)cached; - return result; + var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) - { + return result; + } + + public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, out hash); - if (cached != null) return (TypeArgumentListSyntax)cached; - - var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, out hash); + if (cached != null) return (TypeArgumentListSyntax)cached; - return result; + var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) - { + return result; + } + + public static AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + { #if DEBUG - if (alias == null) throw new ArgumentNullException(nameof(alias)); - if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken)); - if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); + if (alias == null) throw new ArgumentNullException(nameof(alias)); + if (colonColonToken == null) throw new ArgumentNullException(nameof(colonColonToken)); + if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, out hash); - if (cached != null) return (AliasQualifiedNameSyntax)cached; - - var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, out hash); + if (cached != null) return (AliasQualifiedNameSyntax)cached; - return result; + var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) - { + return result; + } + + public static PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.BoolKeyword: - case SyntaxKind.ByteKeyword: - case SyntaxKind.SByteKeyword: - case SyntaxKind.IntKeyword: - case SyntaxKind.UIntKeyword: - case SyntaxKind.ShortKeyword: - case SyntaxKind.UShortKeyword: - case SyntaxKind.LongKeyword: - case SyntaxKind.ULongKeyword: - case SyntaxKind.FloatKeyword: - case SyntaxKind.DoubleKeyword: - case SyntaxKind.DecimalKeyword: - case SyntaxKind.StringKeyword: - case SyntaxKind.CharKeyword: - case SyntaxKind.ObjectKeyword: - case SyntaxKind.VoidKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.BoolKeyword: + case SyntaxKind.ByteKeyword: + case SyntaxKind.SByteKeyword: + case SyntaxKind.IntKeyword: + case SyntaxKind.UIntKeyword: + case SyntaxKind.ShortKeyword: + case SyntaxKind.UShortKeyword: + case SyntaxKind.LongKeyword: + case SyntaxKind.ULongKeyword: + case SyntaxKind.FloatKeyword: + case SyntaxKind.DoubleKeyword: + case SyntaxKind.DecimalKeyword: + case SyntaxKind.StringKeyword: + case SyntaxKind.CharKeyword: + case SyntaxKind.ObjectKeyword: + case SyntaxKind.VoidKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, out hash); - if (cached != null) return (PredefinedTypeSyntax)cached; - - var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, out hash); + if (cached != null) return (PredefinedTypeSyntax)cached; - return result; + var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) - { + return result; + } + + public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, CoreSyntax.SyntaxList rankSpecifiers) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, out hash); - if (cached != null) return (ArrayTypeSyntax)cached; - - var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, out hash); + if (cached != null) return (ArrayTypeSyntax)cached; - return result; + var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) - { + return result; + } + + public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, out hash); - if (cached != null) return (ArrayRankSpecifierSyntax)cached; - - var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, out hash); + if (cached != null) return (ArrayRankSpecifierSyntax)cached; - return result; + var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) - { + return result; + } + + public static PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); - if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); + if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, out hash); - if (cached != null) return (PointerTypeSyntax)cached; - - var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, out hash); + if (cached != null) return (PointerTypeSyntax)cached; - return result; + var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) - { + return result; + } + + public static FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); - if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (asteriskToken == null) throw new ArgumentNullException(nameof(asteriskToken)); + if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); #endif - return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList); - } + return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList); + } - public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { + public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); - if (cached != null) return (FunctionPointerParameterListSyntax)cached; - - var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); + if (cached != null) return (FunctionPointerParameterListSyntax)cached; - return result; + var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) - { + return result; + } + + public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + { #if DEBUG - if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword)); - switch (managedOrUnmanagedKeyword.Kind) - { - case SyntaxKind.ManagedKeyword: - case SyntaxKind.UnmanagedKeyword: break; - default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword)); - } + if (managedOrUnmanagedKeyword == null) throw new ArgumentNullException(nameof(managedOrUnmanagedKeyword)); + switch (managedOrUnmanagedKeyword.Kind) + { + case SyntaxKind.ManagedKeyword: + case SyntaxKind.UnmanagedKeyword: break; + default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, out hash); - if (cached != null) return (FunctionPointerCallingConventionSyntax)cached; - - var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, out hash); + if (cached != null) return (FunctionPointerCallingConventionSyntax)cached; - return result; + var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) - { + return result; + } + + public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, out hash); - if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached; - - var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, out hash); + if (cached != null) return (FunctionPointerUnmanagedCallingConventionListSyntax)cached; - return result; + var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name) - { + return result; + } + + public static FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, out hash); - if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached; - - var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, out hash); + if (cached != null) return (FunctionPointerUnmanagedCallingConventionSyntax)cached; - return result; + var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) - { + return result; + } + + public static NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) + { #if DEBUG - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); - if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); + if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, out hash); - if (cached != null) return (NullableTypeSyntax)cached; - - var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, out hash); + if (cached != null) return (NullableTypeSyntax)cached; - return result; + var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TupleTypeSyntax TupleType(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) - { + return result; + } + + public static TupleTypeSyntax TupleType(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, out hash); - if (cached != null) return (TupleTypeSyntax)cached; - - var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, out hash); + if (cached != null) return (TupleTypeSyntax)cached; - return result; + var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier) - { + return result; + } + + public static TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken? identifier) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier != null) + { + switch (identifier.Kind) { - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(identifier)); - } + case SyntaxKind.IdentifierToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(identifier)); } + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, out hash); - if (cached != null) return (TupleElementSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, out hash); + if (cached != null) return (TupleElementSyntax)cached; - var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken) - { + return result; + } + + public static OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken) + { #if DEBUG - if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken)); - if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); + if (omittedTypeArgumentToken == null) throw new ArgumentNullException(nameof(omittedTypeArgumentToken)); + if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, out hash); - if (cached != null) return (OmittedTypeArgumentSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, out hash); + if (cached != null) return (OmittedTypeArgumentSyntax)cached; - var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - { + return result; + } + + public static RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + { #if DEBUG - if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); - if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); - if (readOnlyKeyword != null) + if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); + if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); + if (readOnlyKeyword != null) + { + switch (readOnlyKeyword.Kind) { - switch (readOnlyKeyword.Kind) - { - case SyntaxKind.ReadOnlyKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(readOnlyKeyword)); - } + case SyntaxKind.ReadOnlyKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(readOnlyKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, out hash); - if (cached != null) return (RefTypeSyntax)cached; - - var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, out hash); + if (cached != null) return (RefTypeSyntax)cached; - return result; + var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) - { + return result; + } + + public static ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) + { #if DEBUG - if (scopedKeyword == null) throw new ArgumentNullException(nameof(scopedKeyword)); - if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (scopedKeyword == null) throw new ArgumentNullException(nameof(scopedKeyword)); + if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, out hash); - if (cached != null) return (ScopedTypeSyntax)cached; - - var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, out hash); + if (cached != null) return (ScopedTypeSyntax)cached; - return result; + var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + return result; + } + + public static ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, out hash); - if (cached != null) return (ParenthesizedExpressionSyntax)cached; - - var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, out hash); + if (cached != null) return (ParenthesizedExpressionSyntax)cached; - return result; + var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public static TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, out hash); - if (cached != null) return (TupleExpressionSyntax)cached; - - var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, out hash); + if (cached != null) return (TupleExpressionSyntax)cached; - return result; + var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + return result; + } + + public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.UnaryPlusExpression: - case SyntaxKind.UnaryMinusExpression: - case SyntaxKind.BitwiseNotExpression: - case SyntaxKind.LogicalNotExpression: - case SyntaxKind.PreIncrementExpression: - case SyntaxKind.PreDecrementExpression: - case SyntaxKind.AddressOfExpression: - case SyntaxKind.PointerIndirectionExpression: - case SyntaxKind.IndexExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.UnaryPlusExpression: + case SyntaxKind.UnaryMinusExpression: + case SyntaxKind.BitwiseNotExpression: + case SyntaxKind.LogicalNotExpression: + case SyntaxKind.PreIncrementExpression: + case SyntaxKind.PreDecrementExpression: + case SyntaxKind.AddressOfExpression: + case SyntaxKind.PointerIndirectionExpression: + case SyntaxKind.IndexExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.TildeToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.CaretToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (operand == null) throw new ArgumentNullException(nameof(operand)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.TildeToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.CaretToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (operand == null) throw new ArgumentNullException(nameof(operand)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, out hash); - if (cached != null) return (PrefixUnaryExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, operatorToken, operand, out hash); + if (cached != null) return (PrefixUnaryExpressionSyntax)cached; - var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new PrefixUnaryExpressionSyntax(kind, operatorToken, operand); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression) - { + return result; + } + + public static AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression) + { #if DEBUG - if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword)); - if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (awaitKeyword == null) throw new ArgumentNullException(nameof(awaitKeyword)); + if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, out hash); - if (cached != null) return (AwaitExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, out hash); + if (cached != null) return (AwaitExpressionSyntax)cached; - var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + return result; + } + + public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.PostIncrementExpression: - case SyntaxKind.PostDecrementExpression: - case SyntaxKind.SuppressNullableWarningExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.PostIncrementExpression: + case SyntaxKind.PostDecrementExpression: + case SyntaxKind.SuppressNullableWarningExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (operand == null) throw new ArgumentNullException(nameof(operand)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.ExclamationToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } + if (operand == null) throw new ArgumentNullException(nameof(operand)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.ExclamationToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, out hash); - if (cached != null) return (PostfixUnaryExpressionSyntax)cached; - - var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, operand, operatorToken, out hash); + if (cached != null) return (PostfixUnaryExpressionSyntax)cached; - return result; + var result = new PostfixUnaryExpressionSyntax(kind, operand, operatorToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + return result; + } + + public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SimpleMemberAccessExpression: - case SyntaxKind.PointerMemberAccessExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SimpleMemberAccessExpression: + case SyntaxKind.PointerMemberAccessExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.DotToken: - case SyntaxKind.MinusGreaterThanToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (name == null) throw new ArgumentNullException(nameof(name)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.DotToken: + case SyntaxKind.MinusGreaterThanToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, out hash); - if (cached != null) return (MemberAccessExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, operatorToken, name, out hash); + if (cached != null) return (MemberAccessExpressionSyntax)cached; - var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new MemberAccessExpressionSyntax(kind, expression, operatorToken, name); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) - { + return result; + } + + public static ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); - if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); + if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, out hash); - if (cached != null) return (ConditionalAccessExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, out hash); + if (cached != null) return (ConditionalAccessExpressionSyntax)cached; - var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name) - { + return result; + } + + public static MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, out hash); - if (cached != null) return (MemberBindingExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, out hash); + if (cached != null) return (MemberBindingExpressionSyntax)cached; - var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList) - { + return result; + } + + public static ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, out hash); - if (cached != null) return (ElementBindingExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, out hash); + if (cached != null) return (ElementBindingExpressionSyntax)cached; - var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) - { + return result; + } + + public static RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, out hash); - if (cached != null) return (RangeExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, out hash); + if (cached != null) return (RangeExpressionSyntax)cached; - var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList) - { + return result; + } + + public static ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, out hash); - if (cached != null) return (ImplicitElementAccessSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, out hash); + if (cached != null) return (ImplicitElementAccessSyntax)cached; - var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + return result; + } + + public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.AddExpression: - case SyntaxKind.SubtractExpression: - case SyntaxKind.MultiplyExpression: - case SyntaxKind.DivideExpression: - case SyntaxKind.ModuloExpression: - case SyntaxKind.LeftShiftExpression: - case SyntaxKind.RightShiftExpression: - case SyntaxKind.UnsignedRightShiftExpression: - case SyntaxKind.LogicalOrExpression: - case SyntaxKind.LogicalAndExpression: - case SyntaxKind.BitwiseOrExpression: - case SyntaxKind.BitwiseAndExpression: - case SyntaxKind.ExclusiveOrExpression: - case SyntaxKind.EqualsExpression: - case SyntaxKind.NotEqualsExpression: - case SyntaxKind.LessThanExpression: - case SyntaxKind.LessThanOrEqualExpression: - case SyntaxKind.GreaterThanExpression: - case SyntaxKind.GreaterThanOrEqualExpression: - case SyntaxKind.IsExpression: - case SyntaxKind.AsExpression: - case SyntaxKind.CoalesceExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.AddExpression: + case SyntaxKind.SubtractExpression: + case SyntaxKind.MultiplyExpression: + case SyntaxKind.DivideExpression: + case SyntaxKind.ModuloExpression: + case SyntaxKind.LeftShiftExpression: + case SyntaxKind.RightShiftExpression: + case SyntaxKind.UnsignedRightShiftExpression: + case SyntaxKind.LogicalOrExpression: + case SyntaxKind.LogicalAndExpression: + case SyntaxKind.BitwiseOrExpression: + case SyntaxKind.BitwiseAndExpression: + case SyntaxKind.ExclusiveOrExpression: + case SyntaxKind.EqualsExpression: + case SyntaxKind.NotEqualsExpression: + case SyntaxKind.LessThanExpression: + case SyntaxKind.LessThanOrEqualExpression: + case SyntaxKind.GreaterThanExpression: + case SyntaxKind.GreaterThanOrEqualExpression: + case SyntaxKind.IsExpression: + case SyntaxKind.AsExpression: + case SyntaxKind.CoalesceExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarBarToken: - case SyntaxKind.AmpersandAmpersandToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.IsKeyword: - case SyntaxKind.AsKeyword: - case SyntaxKind.QuestionQuestionToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarBarToken: + case SyntaxKind.AmpersandAmpersandToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.IsKeyword: + case SyntaxKind.AsKeyword: + case SyntaxKind.QuestionQuestionToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); - if (cached != null) return (BinaryExpressionSyntax)cached; - - var result = new BinaryExpressionSyntax(kind, left, operatorToken, right); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); + if (cached != null) return (BinaryExpressionSyntax)cached; - return result; + var result = new BinaryExpressionSyntax(kind, left, operatorToken, right); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + return result; + } + + public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SimpleAssignmentExpression: - case SyntaxKind.AddAssignmentExpression: - case SyntaxKind.SubtractAssignmentExpression: - case SyntaxKind.MultiplyAssignmentExpression: - case SyntaxKind.DivideAssignmentExpression: - case SyntaxKind.ModuloAssignmentExpression: - case SyntaxKind.AndAssignmentExpression: - case SyntaxKind.ExclusiveOrAssignmentExpression: - case SyntaxKind.OrAssignmentExpression: - case SyntaxKind.LeftShiftAssignmentExpression: - case SyntaxKind.RightShiftAssignmentExpression: - case SyntaxKind.UnsignedRightShiftAssignmentExpression: - case SyntaxKind.CoalesceAssignmentExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SimpleAssignmentExpression: + case SyntaxKind.AddAssignmentExpression: + case SyntaxKind.SubtractAssignmentExpression: + case SyntaxKind.MultiplyAssignmentExpression: + case SyntaxKind.DivideAssignmentExpression: + case SyntaxKind.ModuloAssignmentExpression: + case SyntaxKind.AndAssignmentExpression: + case SyntaxKind.ExclusiveOrAssignmentExpression: + case SyntaxKind.OrAssignmentExpression: + case SyntaxKind.LeftShiftAssignmentExpression: + case SyntaxKind.RightShiftAssignmentExpression: + case SyntaxKind.UnsignedRightShiftAssignmentExpression: + case SyntaxKind.CoalesceAssignmentExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.EqualsToken: - case SyntaxKind.PlusEqualsToken: - case SyntaxKind.MinusEqualsToken: - case SyntaxKind.AsteriskEqualsToken: - case SyntaxKind.SlashEqualsToken: - case SyntaxKind.PercentEqualsToken: - case SyntaxKind.AmpersandEqualsToken: - case SyntaxKind.CaretEqualsToken: - case SyntaxKind.BarEqualsToken: - case SyntaxKind.LessThanLessThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: - case SyntaxKind.QuestionQuestionEqualsToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.EqualsToken: + case SyntaxKind.PlusEqualsToken: + case SyntaxKind.MinusEqualsToken: + case SyntaxKind.AsteriskEqualsToken: + case SyntaxKind.SlashEqualsToken: + case SyntaxKind.PercentEqualsToken: + case SyntaxKind.AmpersandEqualsToken: + case SyntaxKind.CaretEqualsToken: + case SyntaxKind.BarEqualsToken: + case SyntaxKind.LessThanLessThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + case SyntaxKind.QuestionQuestionEqualsToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); - if (cached != null) return (AssignmentExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); + if (cached != null) return (AssignmentExpressionSyntax)cached; - var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AssignmentExpressionSyntax(kind, left, operatorToken, right); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) - { + return result; + } + + public static ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + { #if DEBUG - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); - if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); - if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (questionToken == null) throw new ArgumentNullException(nameof(questionToken)); + if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); + if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse)); #endif - return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse); - } + return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse); + } - public static ThisExpressionSyntax ThisExpression(SyntaxToken token) - { + public static ThisExpressionSyntax ThisExpression(SyntaxToken token) + { #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); + if (token == null) throw new ArgumentNullException(nameof(token)); + if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, out hash); - if (cached != null) return (ThisExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, out hash); + if (cached != null) return (ThisExpressionSyntax)cached; - var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BaseExpressionSyntax BaseExpression(SyntaxToken token) - { + return result; + } + + public static BaseExpressionSyntax BaseExpression(SyntaxToken token) + { #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); + if (token == null) throw new ArgumentNullException(nameof(token)); + if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, out hash); - if (cached != null) return (BaseExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, out hash); + if (cached != null) return (BaseExpressionSyntax)cached; - var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) + return result; + } + + public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ArgListExpression: - case SyntaxKind.NumericLiteralExpression: - case SyntaxKind.StringLiteralExpression: - case SyntaxKind.Utf8StringLiteralExpression: - case SyntaxKind.CharacterLiteralExpression: - case SyntaxKind.TrueLiteralExpression: - case SyntaxKind.FalseLiteralExpression: - case SyntaxKind.NullLiteralExpression: - case SyntaxKind.DefaultLiteralExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ArgListExpression: + case SyntaxKind.NumericLiteralExpression: + case SyntaxKind.StringLiteralExpression: + case SyntaxKind.Utf8StringLiteralExpression: + case SyntaxKind.CharacterLiteralExpression: + case SyntaxKind.TrueLiteralExpression: + case SyntaxKind.FalseLiteralExpression: + case SyntaxKind.NullLiteralExpression: + case SyntaxKind.DefaultLiteralExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (token == null) throw new ArgumentNullException(nameof(token)); - switch (token.Kind) - { - case SyntaxKind.ArgListKeyword: - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.StringLiteralToken: - case SyntaxKind.Utf8StringLiteralToken: - case SyntaxKind.MultiLineRawStringLiteralToken: - case SyntaxKind.Utf8MultiLineRawStringLiteralToken: - case SyntaxKind.SingleLineRawStringLiteralToken: - case SyntaxKind.Utf8SingleLineRawStringLiteralToken: - case SyntaxKind.CharacterLiteralToken: - case SyntaxKind.TrueKeyword: - case SyntaxKind.FalseKeyword: - case SyntaxKind.NullKeyword: - case SyntaxKind.DefaultKeyword: break; - default: throw new ArgumentException(nameof(token)); - } + if (token == null) throw new ArgumentNullException(nameof(token)); + switch (token.Kind) + { + case SyntaxKind.ArgListKeyword: + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.StringLiteralToken: + case SyntaxKind.Utf8StringLiteralToken: + case SyntaxKind.MultiLineRawStringLiteralToken: + case SyntaxKind.Utf8MultiLineRawStringLiteralToken: + case SyntaxKind.SingleLineRawStringLiteralToken: + case SyntaxKind.Utf8SingleLineRawStringLiteralToken: + case SyntaxKind.CharacterLiteralToken: + case SyntaxKind.TrueKeyword: + case SyntaxKind.FalseKeyword: + case SyntaxKind.NullKeyword: + case SyntaxKind.DefaultKeyword: break; + default: throw new ArgumentException(nameof(token)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, token, out hash); - if (cached != null) return (LiteralExpressionSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, token, out hash); + if (cached != null) return (LiteralExpressionSyntax)cached; - var result = new LiteralExpressionSyntax(kind, token); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new LiteralExpressionSyntax(kind, token); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + return result; + } + + public static MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken); - } + return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken); + } - public static RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { + public static RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken); - } + return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken); + } - public static RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) - { + public static RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (comma == null) throw new ArgumentNullException(nameof(comma)); - if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (comma == null) throw new ArgumentNullException(nameof(comma)); + if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken); - } + return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken); + } - public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.CheckedExpression: - case SyntaxKind.UncheckedExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.CheckedExpression: + case SyntaxKind.UncheckedExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.UncheckedKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.CheckedKeyword: + case SyntaxKind.UncheckedKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken); - } + return new CheckedExpressionSyntax(kind, keyword, openParenToken, expression, closeParenToken); + } - public static DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public static DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken); - } + return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken); + } - public static TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public static TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken); - } + return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken); + } - public static SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { + public static SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken); - } + return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken); + } - public static InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList) - { + public static InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, out hash); - if (cached != null) return (InvocationExpressionSyntax)cached; - - var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, out hash); + if (cached != null) return (InvocationExpressionSyntax)cached; - return result; + var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - { + return result; + } + + public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, out hash); - if (cached != null) return (ElementAccessExpressionSyntax)cached; - - var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, out hash); + if (cached != null) return (ElementAccessExpressionSyntax)cached; - return result; + var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); - if (cached != null) return (ArgumentListSyntax)cached; - - var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); + if (cached != null) return (ArgumentListSyntax)cached; - return result; + var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) - { + return result; + } + + public static BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, out hash); - if (cached != null) return (BracketedArgumentListSyntax)cached; - - var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, out hash); + if (cached != null) return (BracketedArgumentListSyntax)cached; - return result; + var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) - { + return result; + } + + public static ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) + { #if DEBUG - if (refKindKeyword != null) + if (refKindKeyword != null) + { + switch (refKindKeyword.Kind) { - switch (refKindKeyword.Kind) - { - case SyntaxKind.RefKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.InKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(refKindKeyword)); - } + case SyntaxKind.RefKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.InKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(refKindKeyword)); } - if (expression == null) throw new ArgumentNullException(nameof(expression)); + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, out hash); - if (cached != null) return (ArgumentSyntax)cached; - - var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, out hash); + if (cached != null) return (ArgumentSyntax)cached; - return result; + var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken) - { + return result; + } + + public static ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, out hash); - if (cached != null) return (ExpressionColonSyntax)cached; - - var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, out hash); + if (cached != null) return (ExpressionColonSyntax)cached; - return result; + var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken) - { + return result; + } + + public static NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, out hash); - if (cached != null) return (NameColonSyntax)cached; - - var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, out hash); + if (cached != null) return (NameColonSyntax)cached; - return result; + var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) - { + return result; + } + + public static DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, out hash); - if (cached != null) return (DeclarationExpressionSyntax)cached; - - var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, out hash); + if (cached != null) return (DeclarationExpressionSyntax)cached; - return result; + var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) - { + return result; + } + + public static CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression); - } + return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression); + } - public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) - { + public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody); - } + return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody); + } - public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { + public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (parameter == null) throw new ArgumentNullException(nameof(parameter)); - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (parameter == null) throw new ArgumentNullException(nameof(parameter)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); #endif - return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody); - } + return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody); + } - public static RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression) - { + public static RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression) + { #if DEBUG - if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); - if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (refKeyword == null) throw new ArgumentNullException(nameof(refKeyword)); + if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, out hash); - if (cached != null) return (RefExpressionSyntax)cached; - - var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, out hash); + if (cached != null) return (RefExpressionSyntax)cached; - return result; + var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { + return result; + } + + public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { #if DEBUG - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); #endif - return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody); - } + return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody); + } - public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ObjectInitializerExpression: - case SyntaxKind.CollectionInitializerExpression: - case SyntaxKind.ArrayInitializerExpression: - case SyntaxKind.ComplexElementInitializerExpression: - case SyntaxKind.WithInitializerExpression: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ObjectInitializerExpression: + case SyntaxKind.CollectionInitializerExpression: + case SyntaxKind.ArrayInitializerExpression: + case SyntaxKind.ComplexElementInitializerExpression: + case SyntaxKind.WithInitializerExpression: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, out hash); - if (cached != null) return (InitializerExpressionSyntax)cached; - - var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, openBraceToken, expressions.Node, closeBraceToken, out hash); + if (cached != null) return (InitializerExpressionSyntax)cached; - return result; + var result = new InitializerExpressionSyntax(kind, openBraceToken, expressions.Node, closeBraceToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) - { + return result; + } + + public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, out hash); - if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached; - - var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, out hash); + if (cached != null) return (ImplicitObjectCreationExpressionSyntax)cached; - return result; + var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) - { + return result; + } + + public static ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer); - } + return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer); + } - public static WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) - { + public static WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword)); - if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (withKeyword == null) throw new ArgumentNullException(nameof(withKeyword)); + if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, out hash); - if (cached != null) return (WithExpressionSyntax)cached; - - var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, out hash); + if (cached != null) return (WithExpressionSyntax)cached; - return result; + var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) - { + return result; + } + + public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, out hash); - if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached; - - var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, out hash); + if (cached != null) return (AnonymousObjectMemberDeclaratorSyntax)cached; - return result; + var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) - { + return result; + } + + public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken); - } + return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken); + } - public static ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) - { + public static ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, out hash); - if (cached != null) return (ArrayCreationExpressionSyntax)cached; - - var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, out hash); + if (cached != null) return (ArrayCreationExpressionSyntax)cached; - return result; + var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { + return result; + } + + public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, CoreSyntax.SyntaxList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer); - } + return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer); + } - public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) - { + public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) + { #if DEBUG - if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); - if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); + if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); + if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, out hash); - if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached; - - var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, out hash); + if (cached != null) return (StackAllocArrayCreationExpressionSyntax)cached; - return result; + var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { + return result; + } + + public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { #if DEBUG - if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); - if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + if (stackAllocKeyword == null) throw new ArgumentNullException(nameof(stackAllocKeyword)); + if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); #endif - return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer); - } + return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer); + } - public static CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) - { + public static CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, out hash); - if (cached != null) return (CollectionExpressionSyntax)cached; - - var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, out hash); + if (cached != null) return (CollectionExpressionSyntax)cached; - return result; + var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ExpressionElementSyntax ExpressionElement(ExpressionSyntax expression) - { + return result; + } + + public static ExpressionElementSyntax ExpressionElement(ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, out hash); - if (cached != null) return (ExpressionElementSyntax)cached; - - var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, out hash); + if (cached != null) return (ExpressionElementSyntax)cached; - return result; + var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SpreadElementSyntax SpreadElement(SyntaxToken operatorToken, ExpressionSyntax expression) - { + return result; + } + + public static SpreadElementSyntax SpreadElement(SyntaxToken operatorToken, ExpressionSyntax expression) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, out hash); - if (cached != null) return (SpreadElementSyntax)cached; - - var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, out hash); + if (cached != null) return (SpreadElementSyntax)cached; - return result; + var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body) - { + return result; + } + + public static QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body) + { #if DEBUG - if (fromClause == null) throw new ArgumentNullException(nameof(fromClause)); - if (body == null) throw new ArgumentNullException(nameof(body)); + if (fromClause == null) throw new ArgumentNullException(nameof(fromClause)); + if (body == null) throw new ArgumentNullException(nameof(body)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, out hash); - if (cached != null) return (QueryExpressionSyntax)cached; - - var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, out hash); + if (cached != null) return (QueryExpressionSyntax)cached; - return result; + var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static QueryBodySyntax QueryBody(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) - { + return result; + } + + public static QueryBodySyntax QueryBody(CoreSyntax.SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + { #if DEBUG - if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); + if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, out hash); - if (cached != null) return (QueryBodySyntax)cached; - - var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, out hash); + if (cached != null) return (QueryBodySyntax)cached; - return result; + var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) - { + return result; + } + + public static FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + { #if DEBUG - if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword)); - if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (fromKeyword == null) throw new ArgumentNullException(nameof(fromKeyword)); + if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression); - } + return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression); + } - public static LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) - { + public static LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + { #if DEBUG - if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword)); - if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (letKeyword == null) throw new ArgumentNullException(nameof(letKeyword)); + if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression); - } + return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression); + } - public static JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) - { + public static JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + { #if DEBUG - if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword)); - if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (inExpression == null) throw new ArgumentNullException(nameof(inExpression)); - if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword)); - if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); - if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression)); - if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword)); - if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); - if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression)); + if (joinKeyword == null) throw new ArgumentNullException(nameof(joinKeyword)); + if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (inExpression == null) throw new ArgumentNullException(nameof(inExpression)); + if (onKeyword == null) throw new ArgumentNullException(nameof(onKeyword)); + if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); + if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression)); + if (equalsKeyword == null) throw new ArgumentNullException(nameof(equalsKeyword)); + if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); + if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression)); #endif - return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); - } + return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); + } - public static JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier) - { + public static JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier) + { #if DEBUG - if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); - if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); + if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, out hash); - if (cached != null) return (JoinIntoClauseSyntax)cached; - - var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, out hash); + if (cached != null) return (JoinIntoClauseSyntax)cached; - return result; + var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition) - { + return result; + } + + public static WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition) + { #if DEBUG - if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); - if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); + if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, out hash); - if (cached != null) return (WhereClauseSyntax)cached; - - var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, out hash); + if (cached != null) return (WhereClauseSyntax)cached; - return result; + var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) - { + return result; + } + + public static OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, CoreSyntax.SeparatedSyntaxList orderings) + { #if DEBUG - if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword)); - if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); + if (orderByKeyword == null) throw new ArgumentNullException(nameof(orderByKeyword)); + if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, out hash); - if (cached != null) return (OrderByClauseSyntax)cached; - - var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, out hash); + if (cached != null) return (OrderByClauseSyntax)cached; - return result; + var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) + return result; + } + + public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.AscendingOrdering: - case SyntaxKind.DescendingOrdering: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.AscendingOrdering: + case SyntaxKind.DescendingOrdering: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (ascendingOrDescendingKeyword != null) + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (ascendingOrDescendingKeyword != null) + { + switch (ascendingOrDescendingKeyword.Kind) { - switch (ascendingOrDescendingKeyword.Kind) - { - case SyntaxKind.AscendingKeyword: - case SyntaxKind.DescendingKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword)); - } + case SyntaxKind.AscendingKeyword: + case SyntaxKind.DescendingKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword)); } + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, out hash); - if (cached != null) return (OrderingSyntax)cached; - - var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, expression, ascendingOrDescendingKeyword, out hash); + if (cached != null) return (OrderingSyntax)cached; - return result; + var result = new OrderingSyntax(kind, expression, ascendingOrDescendingKeyword); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression) - { + return result; + } + + public static SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression) + { #if DEBUG - if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword)); - if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (selectKeyword == null) throw new ArgumentNullException(nameof(selectKeyword)); + if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, out hash); - if (cached != null) return (SelectClauseSyntax)cached; - - var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, out hash); + if (cached != null) return (SelectClauseSyntax)cached; - return result; + var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) - { + return result; + } + + public static GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + { #if DEBUG - if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword)); - if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); - if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression)); - if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword)); - if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); - if (byExpression == null) throw new ArgumentNullException(nameof(byExpression)); + if (groupKeyword == null) throw new ArgumentNullException(nameof(groupKeyword)); + if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); + if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression)); + if (byKeyword == null) throw new ArgumentNullException(nameof(byKeyword)); + if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); + if (byExpression == null) throw new ArgumentNullException(nameof(byExpression)); #endif - return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression); - } + return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression); + } - public static QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) - { + public static QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + { #if DEBUG - if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); - if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (body == null) throw new ArgumentNullException(nameof(body)); + if (intoKeyword == null) throw new ArgumentNullException(nameof(intoKeyword)); + if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (body == null) throw new ArgumentNullException(nameof(body)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, out hash); - if (cached != null) return (QueryContinuationSyntax)cached; - - var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, out hash); + if (cached != null) return (QueryContinuationSyntax)cached; - return result; + var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken) - { + return result; + } + + public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken) + { #if DEBUG - if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken)); - if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); + if (omittedArraySizeExpressionToken == null) throw new ArgumentNullException(nameof(omittedArraySizeExpressionToken)); + if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, out hash); - if (cached != null) return (OmittedArraySizeExpressionSyntax)cached; - - var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, out hash); + if (cached != null) return (OmittedArraySizeExpressionSyntax)cached; - return result; + var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) - { + return result; + } + + public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, CoreSyntax.SyntaxList contents, SyntaxToken stringEndToken) + { #if DEBUG - if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken)); - switch (stringStartToken.Kind) - { - case SyntaxKind.InterpolatedStringStartToken: - case SyntaxKind.InterpolatedVerbatimStringStartToken: - case SyntaxKind.InterpolatedSingleLineRawStringStartToken: - case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; - default: throw new ArgumentException(nameof(stringStartToken)); - } - if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken)); - switch (stringEndToken.Kind) - { - case SyntaxKind.InterpolatedStringEndToken: - case SyntaxKind.InterpolatedRawStringEndToken: break; - default: throw new ArgumentException(nameof(stringEndToken)); - } + if (stringStartToken == null) throw new ArgumentNullException(nameof(stringStartToken)); + switch (stringStartToken.Kind) + { + case SyntaxKind.InterpolatedStringStartToken: + case SyntaxKind.InterpolatedVerbatimStringStartToken: + case SyntaxKind.InterpolatedSingleLineRawStringStartToken: + case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; + default: throw new ArgumentException(nameof(stringStartToken)); + } + if (stringEndToken == null) throw new ArgumentNullException(nameof(stringEndToken)); + switch (stringEndToken.Kind) + { + case SyntaxKind.InterpolatedStringEndToken: + case SyntaxKind.InterpolatedRawStringEndToken: break; + default: throw new ArgumentException(nameof(stringEndToken)); + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, out hash); - if (cached != null) return (InterpolatedStringExpressionSyntax)cached; - - var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, out hash); + if (cached != null) return (InterpolatedStringExpressionSyntax)cached; - return result; + var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) - { + return result; + } + + public static IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword)); - if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (isKeyword == null) throw new ArgumentNullException(nameof(isKeyword)); + if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, out hash); - if (cached != null) return (IsPatternExpressionSyntax)cached; - - var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, out hash); + if (cached != null) return (IsPatternExpressionSyntax)cached; - return result; + var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression) - { + return result; + } + + public static ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression) + { #if DEBUG - if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); - if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); + if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, out hash); - if (cached != null) return (ThrowExpressionSyntax)cached; - - var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, out hash); + if (cached != null) return (ThrowExpressionSyntax)cached; - return result; + var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition) - { + return result; + } + + public static WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition) + { #if DEBUG - if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); - if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); + if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, out hash); - if (cached != null) return (WhenClauseSyntax)cached; - - var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, out hash); + if (cached != null) return (WhenClauseSyntax)cached; - return result; + var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken) - { + return result; + } + + public static DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken) + { #if DEBUG - if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); - if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); + if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); + if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, out hash); - if (cached != null) return (DiscardPatternSyntax)cached; - - var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, out hash); + if (cached != null) return (DiscardPatternSyntax)cached; - return result; + var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) - { + return result; + } + + public static DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, out hash); - if (cached != null) return (DeclarationPatternSyntax)cached; - - var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, out hash); + if (cached != null) return (DeclarationPatternSyntax)cached; - return result; + var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation) - { + return result; + } + + public static VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation) + { #if DEBUG - if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword)); - if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); + if (varKeyword == null) throw new ArgumentNullException(nameof(varKeyword)); + if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, out hash); - if (cached != null) return (VarPatternSyntax)cached; - - var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, out hash); + if (cached != null) return (VarPatternSyntax)cached; - return result; + var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) - { + return result; + } + + public static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) + { #if DEBUG #endif - return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation); - } + return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation); + } - public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) - { + public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, out hash); - if (cached != null) return (PositionalPatternClauseSyntax)cached; - - var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, out hash); + if (cached != null) return (PositionalPatternClauseSyntax)cached; - return result; + var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) - { + return result; + } + + public static PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, out hash); - if (cached != null) return (PropertyPatternClauseSyntax)cached; - - var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, out hash); + if (cached != null) return (PropertyPatternClauseSyntax)cached; - return result; + var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) - { + return result; + } + + public static SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) + { #if DEBUG - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, out hash); - if (cached != null) return (SubpatternSyntax)cached; - - var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, out hash); + if (cached != null) return (SubpatternSyntax)cached; - return result; + var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression) - { + return result; + } + + public static ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, out hash); - if (cached != null) return (ConstantPatternSyntax)cached; - - var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, out hash); + if (cached != null) return (ConstantPatternSyntax)cached; - return result; + var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) - { + return result; + } + + public static ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, out hash); - if (cached != null) return (ParenthesizedPatternSyntax)cached; - - var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, out hash); + if (cached != null) return (ParenthesizedPatternSyntax)cached; - return result; + var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression) - { + return result; + } + + public static RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, out hash); - if (cached != null) return (RelationalPatternSyntax)cached; - - var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, out hash); + if (cached != null) return (RelationalPatternSyntax)cached; - return result; + var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypePatternSyntax TypePattern(TypeSyntax type) - { + return result; + } + + public static TypePatternSyntax TypePattern(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, out hash); - if (cached != null) return (TypePatternSyntax)cached; - - var result = new TypePatternSyntax(SyntaxKind.TypePattern, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, out hash); + if (cached != null) return (TypePatternSyntax)cached; - return result; + var result = new TypePatternSyntax(SyntaxKind.TypePattern, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + return result; + } + + public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.OrPattern: - case SyntaxKind.AndPattern: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.OrPattern: + case SyntaxKind.AndPattern: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (left == null) throw new ArgumentNullException(nameof(left)); - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) - { - case SyntaxKind.OrKeyword: - case SyntaxKind.AndKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); + if (left == null) throw new ArgumentNullException(nameof(left)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.OrKeyword: + case SyntaxKind.AndKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); - if (cached != null) return (BinaryPatternSyntax)cached; - - var result = new BinaryPatternSyntax(kind, left, operatorToken, right); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, left, operatorToken, right, out hash); + if (cached != null) return (BinaryPatternSyntax)cached; - return result; + var result = new BinaryPatternSyntax(kind, left, operatorToken, right); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern) - { + return result; + } + + public static UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern) + { #if DEBUG - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, out hash); - if (cached != null) return (UnaryPatternSyntax)cached; - - var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, out hash); + if (cached != null) return (UnaryPatternSyntax)cached; - return result; + var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ListPatternSyntax ListPattern(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) - { + return result; + } + + public static ListPatternSyntax ListPattern(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation); - } + return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation); + } - public static SlicePatternSyntax SlicePattern(SyntaxToken dotDotToken, PatternSyntax? pattern) - { + public static SlicePatternSyntax SlicePattern(SyntaxToken dotDotToken, PatternSyntax? pattern) + { #if DEBUG - if (dotDotToken == null) throw new ArgumentNullException(nameof(dotDotToken)); - if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); + if (dotDotToken == null) throw new ArgumentNullException(nameof(dotDotToken)); + if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, out hash); - if (cached != null) return (SlicePatternSyntax)cached; - - var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, out hash); + if (cached != null) return (SlicePatternSyntax)cached; - return result; + var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken) - { + return result; + } + + public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken) + { #if DEBUG - if (textToken == null) throw new ArgumentNullException(nameof(textToken)); - if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); + if (textToken == null) throw new ArgumentNullException(nameof(textToken)); + if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, out hash); - if (cached != null) return (InterpolatedStringTextSyntax)cached; - - var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, out hash); + if (cached != null) return (InterpolatedStringTextSyntax)cached; - return result; + var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) - { + return result; + } + + public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); - } + return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); + } - public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value) - { + public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value) + { #if DEBUG - if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); - if (value == null) throw new ArgumentNullException(nameof(value)); + if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); + if (value == null) throw new ArgumentNullException(nameof(value)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, out hash); - if (cached != null) return (InterpolationAlignmentClauseSyntax)cached; - - var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, out hash); + if (cached != null) return (InterpolationAlignmentClauseSyntax)cached; - return result; + var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken) - { + return result; + } + + public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken) + { #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken)); - if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (formatStringToken == null) throw new ArgumentNullException(nameof(formatStringToken)); + if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, out hash); - if (cached != null) return (InterpolationFormatClauseSyntax)cached; - - var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, out hash); + if (cached != null) return (InterpolationFormatClauseSyntax)cached; - return result; + var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static GlobalStatementSyntax GlobalStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) - { + return result; + } + + public static GlobalStatementSyntax GlobalStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, StatementSyntax statement) + { #if DEBUG - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, out hash); - if (cached != null) return (GlobalStatementSyntax)cached; - - var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, out hash); + if (cached != null) return (GlobalStatementSyntax)cached; - return result; + var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BlockSyntax Block(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) - { + return result; + } + + public static BlockSyntax Block(CoreSyntax.SyntaxList attributeLists, SyntaxToken openBraceToken, CoreSyntax.SyntaxList statements, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken); - } + return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken); + } - public static LocalFunctionStatementSyntax LocalFunctionStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public static LocalFunctionStatementSyntax LocalFunctionStatement(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); - } + return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); + } - public static LocalDeclarationStatementSyntax LocalDeclarationStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + public static LocalDeclarationStatementSyntax LocalDeclarationStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (usingKeyword != null) + } + if (usingKeyword != null) + { + switch (usingKeyword.Kind) { - switch (usingKeyword.Kind) - { - case SyntaxKind.UsingKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(usingKeyword)); - } + case SyntaxKind.UsingKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(usingKeyword)); } - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken); - } + return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken); + } - public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) - { + public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, CoreSyntax.SeparatedSyntaxList variables) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, out hash); - if (cached != null) return (VariableDeclarationSyntax)cached; - - var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, out hash); + if (cached != null) return (VariableDeclarationSyntax)cached; - return result; + var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) - { + return result; + } + + public static VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, out hash); - if (cached != null) return (VariableDeclaratorSyntax)cached; - - var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, out hash); + if (cached != null) return (VariableDeclaratorSyntax)cached; - return result; + var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value) - { + return result; + } + + public static EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value) + { #if DEBUG - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (value == null) throw new ArgumentNullException(nameof(value)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (value == null) throw new ArgumentNullException(nameof(value)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, out hash); - if (cached != null) return (EqualsValueClauseSyntax)cached; - - var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, out hash); + if (cached != null) return (EqualsValueClauseSyntax)cached; - return result; + var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier) - { + return result; + } + + public static SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, out hash); - if (cached != null) return (SingleVariableDesignationSyntax)cached; - - var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, out hash); + if (cached != null) return (SingleVariableDesignationSyntax)cached; - return result; + var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) - { + return result; + } + + public static DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) + { #if DEBUG - if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); - if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); + if (underscoreToken == null) throw new ArgumentNullException(nameof(underscoreToken)); + if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, out hash); - if (cached != null) return (DiscardDesignationSyntax)cached; - - var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, out hash); + if (cached != null) return (DiscardDesignationSyntax)cached; - return result; + var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) - { + return result; + } + + public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList variables, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, out hash); - if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached; - - var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, out hash); + if (cached != null) return (ParenthesizedVariableDesignationSyntax)cached; - return result; + var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ExpressionStatementSyntax ExpressionStatement(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) - { + return result; + } + + public static ExpressionStatementSyntax ExpressionStatement(CoreSyntax.SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, out hash); - if (cached != null) return (ExpressionStatementSyntax)cached; - - var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, out hash); + if (cached != null) return (ExpressionStatementSyntax)cached; - return result; + var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static EmptyStatementSyntax EmptyStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) - { + return result; + } + + public static EmptyStatementSyntax EmptyStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken semicolonToken) + { #if DEBUG - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, out hash); - if (cached != null) return (EmptyStatementSyntax)cached; - - var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, out hash); + if (cached != null) return (EmptyStatementSyntax)cached; - return result; + var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static LabeledStatementSyntax LabeledStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) - { + return result; + } + + public static LabeledStatementSyntax LabeledStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement); - } + return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement); + } - public static GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public static GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.GotoStatement: - case SyntaxKind.GotoCaseStatement: - case SyntaxKind.GotoDefaultStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.GotoStatement: + case SyntaxKind.GotoCaseStatement: + case SyntaxKind.GotoDefaultStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword)); - if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); - if (caseOrDefaultKeyword != null) + if (gotoKeyword == null) throw new ArgumentNullException(nameof(gotoKeyword)); + if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); + if (caseOrDefaultKeyword != null) + { + switch (caseOrDefaultKeyword.Kind) { - switch (caseOrDefaultKeyword.Kind) - { - case SyntaxKind.CaseKeyword: - case SyntaxKind.DefaultKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(caseOrDefaultKeyword)); - } + case SyntaxKind.CaseKeyword: + case SyntaxKind.DefaultKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(caseOrDefaultKeyword)); } - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); - } + return new GotoStatementSyntax(kind, attributeLists.Node, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); + } - public static BreakStatementSyntax BreakStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) - { + public static BreakStatementSyntax BreakStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + { #if DEBUG - if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword)); - if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (breakKeyword == null) throw new ArgumentNullException(nameof(breakKeyword)); + if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, out hash); - if (cached != null) return (BreakStatementSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, out hash); + if (cached != null) return (BreakStatementSyntax)cached; - var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ContinueStatementSyntax ContinueStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) - { + return result; + } + + public static ContinueStatementSyntax ContinueStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + { #if DEBUG - if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword)); - if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (continueKeyword == null) throw new ArgumentNullException(nameof(continueKeyword)); + if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, out hash); - if (cached != null) return (ContinueStatementSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, out hash); + if (cached != null) return (ContinueStatementSyntax)cached; - var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ReturnStatementSyntax ReturnStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { + return result; + } + + public static ReturnStatementSyntax ReturnStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { #if DEBUG - if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword)); - if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (returnKeyword == null) throw new ArgumentNullException(nameof(returnKeyword)); + if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken); - } + return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken); + } - public static ThrowStatementSyntax ThrowStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { + public static ThrowStatementSyntax ThrowStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { #if DEBUG - if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); - if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (throwKeyword == null) throw new ArgumentNullException(nameof(throwKeyword)); + if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken); - } + return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken); + } - public static YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public static YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.YieldReturnStatement: - case SyntaxKind.YieldBreakStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.YieldReturnStatement: + case SyntaxKind.YieldBreakStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword)); - if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); - if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword)); - switch (returnOrBreakKeyword.Kind) - { - case SyntaxKind.ReturnKeyword: - case SyntaxKind.BreakKeyword: break; - default: throw new ArgumentException(nameof(returnOrBreakKeyword)); - } - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (yieldKeyword == null) throw new ArgumentNullException(nameof(yieldKeyword)); + if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); + if (returnOrBreakKeyword == null) throw new ArgumentNullException(nameof(returnOrBreakKeyword)); + switch (returnOrBreakKeyword.Kind) + { + case SyntaxKind.ReturnKeyword: + case SyntaxKind.BreakKeyword: break; + default: throw new ArgumentException(nameof(returnOrBreakKeyword)); + } + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); - } + return new YieldStatementSyntax(kind, attributeLists.Node, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); + } - public static WhileStatementSyntax WhileStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static WhileStatementSyntax WhileStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); - if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); + if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement); - } + return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement); + } - public static DoStatementSyntax DoStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) - { + public static DoStatementSyntax DoStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + { #if DEBUG - if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword)); - if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); - if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (doKeyword == null) throw new ArgumentNullException(nameof(doKeyword)); + if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (whileKeyword == null) throw new ArgumentNullException(nameof(whileKeyword)); + if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); - } + return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); + } - public static ForStatementSyntax ForStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static ForStatementSyntax ForStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, CoreSyntax.SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, CoreSyntax.SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword)); - if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken)); - if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); - if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken)); - if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (forKeyword == null) throw new ArgumentNullException(nameof(forKeyword)); + if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (firstSemicolonToken == null) throw new ArgumentNullException(nameof(firstSemicolonToken)); + if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); + if (secondSemicolonToken == null) throw new ArgumentNullException(nameof(secondSemicolonToken)); + if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement); - } + return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement); + } - public static ForEachStatementSyntax ForEachStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static ForEachStatementSyntax ForEachStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); - if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); + if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); - } + return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); + } - public static ForEachVariableStatementSyntax ForEachVariableStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static ForEachVariableStatementSyntax ForEachVariableStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); - if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (variable == null) throw new ArgumentNullException(nameof(variable)); - if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); - if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (forEachKeyword == null) throw new ArgumentNullException(nameof(forEachKeyword)); + if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (variable == null) throw new ArgumentNullException(nameof(variable)); + if (inKeyword == null) throw new ArgumentNullException(nameof(inKeyword)); + if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); - } + return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); + } - public static UsingStatementSyntax UsingStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static UsingStatementSyntax UsingStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (awaitKeyword != null) + if (awaitKeyword != null) + { + switch (awaitKeyword.Kind) { - switch (awaitKeyword.Kind) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } - if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); - if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + } + if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); + if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); - } + return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); + } - public static FixedStatementSyntax FixedStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) - { + public static FixedStatementSyntax FixedStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + { #if DEBUG - if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword)); - if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (fixedKeyword == null) throw new ArgumentNullException(nameof(fixedKeyword)); + if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement); - } + return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement); + } - public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.CheckedStatement: - case SyntaxKind.UncheckedStatement: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.CheckedStatement: + case SyntaxKind.UncheckedStatement: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.UncheckedKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (block == null) throw new ArgumentNullException(nameof(block)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.CheckedKeyword: + case SyntaxKind.UncheckedKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, out hash); - if (cached != null) return (CheckedStatementSyntax)cached; - - var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, attributeLists.Node, keyword, block, out hash); + if (cached != null) return (CheckedStatementSyntax)cached; - return result; + var result = new CheckedStatementSyntax(kind, attributeLists.Node, keyword, block); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static UnsafeStatementSyntax UnsafeStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) - { + return result; + } + + public static UnsafeStatementSyntax UnsafeStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + { #if DEBUG - if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword)); - if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (unsafeKeyword == null) throw new ArgumentNullException(nameof(unsafeKeyword)); + if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, out hash); - if (cached != null) return (UnsafeStatementSyntax)cached; - - var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, out hash); + if (cached != null) return (UnsafeStatementSyntax)cached; - return result; + var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static LockStatementSyntax LockStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { + return result; + } + + public static LockStatementSyntax LockStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { +#if DEBUG + if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword)); + if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); +#endif + + return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement); + } + + public static IfStatementSyntax IfStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + { #if DEBUG - if (lockKeyword == null) throw new ArgumentNullException(nameof(lockKeyword)); - if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); + if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement); - } + return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); + } - public static IfStatementSyntax IfStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) - { + public static ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement) + { #if DEBUG - if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); - if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); + if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); #endif - return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, out hash); + if (cached != null) return (ElseClauseSyntax)cached; - public static ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement) + var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement); + if (hash >= 0) { -#if DEBUG - if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); - if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); -#endif + SyntaxNodeCache.AddNode(result, hash); + } - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, out hash); - if (cached != null) return (ElseClauseSyntax)cached; + return result; + } - var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement); - if (hash >= 0) + public static SwitchStatementSyntax SwitchStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + { +#if DEBUG + if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); + if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); + if (openParenToken != null) + { + switch (openParenToken.Kind) { - SyntaxNodeCache.AddNode(result, hash); + case SyntaxKind.OpenParenToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openParenToken)); } - - return result; } - - public static SwitchStatementSyntax SwitchStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, CoreSyntax.SyntaxList sections, SyntaxToken closeBraceToken) + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken != null) { -#if DEBUG - if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); - if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); - if (openParenToken != null) + switch (closeParenToken.Kind) { - switch (openParenToken.Kind) - { - case SyntaxKind.OpenParenToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openParenToken)); - } + case SyntaxKind.CloseParenToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeParenToken)); } - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken != null) - { - switch (closeParenToken.Kind) - { - case SyntaxKind.CloseParenToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeParenToken)); - } - } - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + } + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken); - } + return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken); + } - public static SwitchSectionSyntax SwitchSection(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) - { + public static SwitchSectionSyntax SwitchSection(CoreSyntax.SyntaxList labels, CoreSyntax.SyntaxList statements) + { #if DEBUG #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, out hash); - if (cached != null) return (SwitchSectionSyntax)cached; - - var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, out hash); + if (cached != null) return (SwitchSectionSyntax)cached; - return result; + var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) - { + return result; + } + + public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken); - } + return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken); + } - public static CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) - { + public static CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); - if (value == null) throw new ArgumentNullException(nameof(value)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); + if (value == null) throw new ArgumentNullException(nameof(value)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, out hash); - if (cached != null) return (CaseSwitchLabelSyntax)cached; - - var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, out hash); + if (cached != null) return (CaseSwitchLabelSyntax)cached; - return result; + var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken) - { + return result; + } + + public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, out hash); - if (cached != null) return (DefaultSwitchLabelSyntax)cached; - - var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, out hash); + if (cached != null) return (DefaultSwitchLabelSyntax)cached; - return result; + var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) - { + return result; + } + + public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + { #if DEBUG - if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); - if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); - if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); + if (switchKeyword == null) throw new ArgumentNullException(nameof(switchKeyword)); + if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken); - } + return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken); + } - public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) - { + public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + { #if DEBUG - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken)); - if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (equalsGreaterThanToken == null) throw new ArgumentNullException(nameof(equalsGreaterThanToken)); + if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression); - } + return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression); + } - public static TryStatementSyntax TryStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) - { + public static TryStatementSyntax TryStatement(CoreSyntax.SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, CoreSyntax.SyntaxList catches, FinallyClauseSyntax? @finally) + { #if DEBUG - if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword)); - if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (tryKeyword == null) throw new ArgumentNullException(nameof(tryKeyword)); + if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally); - } + return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally); + } - public static CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - { + public static CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) + { #if DEBUG - if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword)); - if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (catchKeyword == null) throw new ArgumentNullException(nameof(catchKeyword)); + if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block); - } + return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block); + } - public static CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) - { + public static CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier != null) + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier != null) + { + switch (identifier.Kind) { - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(identifier)); - } + case SyntaxKind.IdentifierToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(identifier)); } - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + } + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken); - } + return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken); + } - public static CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) - { + public static CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + { #if DEBUG - if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); - if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (whenKeyword == null) throw new ArgumentNullException(nameof(whenKeyword)); + if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken); - } + return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken); + } - public static FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block) - { + public static FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block) + { #if DEBUG - if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword)); - if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); + if (finallyKeyword == null) throw new ArgumentNullException(nameof(finallyKeyword)); + if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, out hash); - if (cached != null) return (FinallyClauseSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, out hash); + if (cached != null) return (FinallyClauseSyntax)cached; - var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static CompilationUnitSyntax CompilationUnit(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) - { + return result; + } + + public static CompilationUnitSyntax CompilationUnit(CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList members, SyntaxToken endOfFileToken) + { #if DEBUG - if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken)); - if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); + if (endOfFileToken == null) throw new ArgumentNullException(nameof(endOfFileToken)); + if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); #endif - return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken); - } + return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken); + } - public static ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) - { + public static ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + { #if DEBUG - if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword)); - if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); - if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword)); - if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (externKeyword == null) throw new ArgumentNullException(nameof(externKeyword)); + if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); + if (aliasKeyword == null) throw new ArgumentNullException(nameof(aliasKeyword)); + if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken); - } + return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken); + } - public static UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) - { + public static UsingDirectiveSyntax UsingDirective(SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + { #if DEBUG - if (globalKeyword != null) + if (globalKeyword != null) + { + switch (globalKeyword.Kind) { - switch (globalKeyword.Kind) - { - case SyntaxKind.GlobalKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(globalKeyword)); - } + case SyntaxKind.GlobalKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(globalKeyword)); } - if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); - if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); - if (staticKeyword != null) + } + if (usingKeyword == null) throw new ArgumentNullException(nameof(usingKeyword)); + if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); + if (staticKeyword != null) + { + switch (staticKeyword.Kind) { - switch (staticKeyword.Kind) - { - case SyntaxKind.StaticKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(staticKeyword)); - } + case SyntaxKind.StaticKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(staticKeyword)); } - if (unsafeKeyword != null) + } + if (unsafeKeyword != null) + { + switch (unsafeKeyword.Kind) { - switch (unsafeKeyword.Kind) - { - case SyntaxKind.UnsafeKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(unsafeKeyword)); - } + case SyntaxKind.UnsafeKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(unsafeKeyword)); } - if (namespaceOrType == null) throw new ArgumentNullException(nameof(namespaceOrType)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + } + if (namespaceOrType == null) throw new ArgumentNullException(nameof(namespaceOrType)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); - } + return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); + } - public static NamespaceDeclarationSyntax NamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) - { + public static NamespaceDeclarationSyntax NamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); - if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - if (semicolonToken != null) + if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); + if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken); - } + return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken); + } - public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) - { + public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, CoreSyntax.SyntaxList externs, CoreSyntax.SyntaxList usings, CoreSyntax.SyntaxList members) + { #if DEBUG - if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); - if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (namespaceKeyword == null) throw new ArgumentNullException(nameof(namespaceKeyword)); + if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node); - } + return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node); + } - public static AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) - { + public static AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, CoreSyntax.SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken); - } + return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken); + } - public static AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken) - { + public static AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, out hash); - if (cached != null) return (AttributeTargetSpecifierSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, out hash); + if (cached != null) return (AttributeTargetSpecifierSyntax)cached; - var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList) - { + return result; + } + + public static AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, out hash); - if (cached != null) return (AttributeSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Attribute, name, argumentList, out hash); + if (cached != null) return (AttributeSyntax)cached; - var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AttributeSyntax(SyntaxKind.Attribute, name, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { + return result; + } + + public static AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); - if (cached != null) return (AttributeArgumentListSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); + if (cached != null) return (AttributeArgumentListSyntax)cached; - var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) - { + return result; + } + + public static AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + { #if DEBUG - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, out hash); - if (cached != null) return (AttributeArgumentSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, out hash); + if (cached != null) return (AttributeArgumentSyntax)cached; - var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken) - { + return result; + } + + public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, out hash); - if (cached != null) return (NameEqualsSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, out hash); + if (cached != null) return (NameEqualsSyntax)cached; - var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { + return result; + } + + public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); - if (cached != null) return (TypeParameterListSyntax)cached; + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); + if (cached != null) return (TypeParameterListSyntax)cached; - var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } - - return result; + var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypeParameterSyntax TypeParameter(CoreSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) - { + return result; + } + + public static TypeParameterSyntax TypeParameter(CoreSyntax.SyntaxList attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) + { #if DEBUG - if (varianceKeyword != null) + if (varianceKeyword != null) + { + switch (varianceKeyword.Kind) { - switch (varianceKeyword.Kind) - { - case SyntaxKind.InKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(varianceKeyword)); - } + case SyntaxKind.InKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(varianceKeyword)); } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, out hash); - if (cached != null) return (TypeParameterSyntax)cached; - - var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, out hash); + if (cached != null) return (TypeParameterSyntax)cached; - return result; + var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ClassDeclarationSyntax ClassDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + return result; + } + + public static ClassDeclarationSyntax ClassDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); - } + return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); + } - public static StructDeclarationSyntax StructDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public static StructDeclarationSyntax StructDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); - } + return new StructDeclarationSyntax(SyntaxKind.StructDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); + } - public static InterfaceDeclarationSyntax InterfaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public static InterfaceDeclarationSyntax InterfaceDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); - } + return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); + } - public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, SyntaxToken? classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.RecordDeclaration: - case SyntaxKind.RecordStructDeclaration: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.RecordDeclaration: + case SyntaxKind.RecordStructDeclaration: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - if (classOrStructKeyword != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + if (classOrStructKeyword != null) + { + switch (classOrStructKeyword.Kind) { - switch (classOrStructKeyword.Kind) - { - case SyntaxKind.ClassKeyword: - case SyntaxKind.StructKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(classOrStructKeyword)); - } + case SyntaxKind.ClassKeyword: + case SyntaxKind.StructKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(classOrStructKeyword)); } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); - } + return new RecordDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); + } - public static EnumDeclarationSyntax EnumDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) - { + public static EnumDeclarationSyntax EnumDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, CoreSyntax.SeparatedSyntaxList members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) + { #if DEBUG - if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword)); - if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (openBraceToken != null) + if (enumKeyword == null) throw new ArgumentNullException(nameof(enumKeyword)); + if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (openBraceToken != null) + { + switch (openBraceToken.Kind) { - switch (openBraceToken.Kind) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } - if (closeBraceToken != null) + } + if (closeBraceToken != null) + { + switch (closeBraceToken.Kind) { - switch (closeBraceToken.Kind) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); } - if (semicolonToken != null) + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken); - } + return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken); + } - public static DelegateDeclarationSyntax DelegateDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) - { + public static DelegateDeclarationSyntax DelegateDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, SyntaxToken semicolonToken) + { #if DEBUG - if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); - if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (delegateKeyword == null) throw new ArgumentNullException(nameof(delegateKeyword)); + if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken); - } + return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken); + } - public static EnumMemberDeclarationSyntax EnumMemberDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) - { + public static EnumMemberDeclarationSyntax EnumMemberDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); #endif - return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue); - } + return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue); + } - public static BaseListSyntax BaseList(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) - { + public static BaseListSyntax BaseList(SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList types) + { #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, out hash); - if (cached != null) return (BaseListSyntax)cached; - - var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, out hash); + if (cached != null) return (BaseListSyntax)cached; - return result; + var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) - { + return result; + } + + public static SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, out hash); - if (cached != null) return (SimpleBaseTypeSyntax)cached; - - var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, out hash); + if (cached != null) return (SimpleBaseTypeSyntax)cached; - return result; + var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) - { + return result; + } + + public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, out hash); - if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached; - - var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, out hash); + if (cached != null) return (PrimaryConstructorBaseTypeSyntax)cached; - return result; + var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) - { + return result; + } + + public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, CoreSyntax.SeparatedSyntaxList constraints) + { #if DEBUG - if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); - if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (whereKeyword == null) throw new ArgumentNullException(nameof(whereKeyword)); + if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node); - } + return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node); + } - public static ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) - { + public static ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + { #if DEBUG - if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); - if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (newKeyword == null) throw new ArgumentNullException(nameof(newKeyword)); + if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, out hash); - if (cached != null) return (ConstructorConstraintSyntax)cached; - - var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, out hash); + if (cached != null) return (ConstructorConstraintSyntax)cached; - return result; + var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) + return result; + } + + public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.ClassConstraint: - case SyntaxKind.StructConstraint: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.ClassConstraint: + case SyntaxKind.StructConstraint: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword)); - switch (classOrStructKeyword.Kind) - { - case SyntaxKind.ClassKeyword: - case SyntaxKind.StructKeyword: break; - default: throw new ArgumentException(nameof(classOrStructKeyword)); - } - if (questionToken != null) + if (classOrStructKeyword == null) throw new ArgumentNullException(nameof(classOrStructKeyword)); + switch (classOrStructKeyword.Kind) + { + case SyntaxKind.ClassKeyword: + case SyntaxKind.StructKeyword: break; + default: throw new ArgumentException(nameof(classOrStructKeyword)); + } + if (questionToken != null) + { + switch (questionToken.Kind) { - switch (questionToken.Kind) - { - case SyntaxKind.QuestionToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(questionToken)); - } + case SyntaxKind.QuestionToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(questionToken)); } + } #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, out hash); - if (cached != null) return (ClassOrStructConstraintSyntax)cached; - - var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, classOrStructKeyword, questionToken, out hash); + if (cached != null) return (ClassOrStructConstraintSyntax)cached; - return result; + var result = new ClassOrStructConstraintSyntax(kind, classOrStructKeyword, questionToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static TypeConstraintSyntax TypeConstraint(TypeSyntax type) - { + return result; + } + + public static TypeConstraintSyntax TypeConstraint(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, out hash); - if (cached != null) return (TypeConstraintSyntax)cached; - - var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, out hash); + if (cached != null) return (TypeConstraintSyntax)cached; - return result; + var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) - { + return result; + } + + public static DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) + { #if DEBUG - if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword)); - if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); + if (defaultKeyword == null) throw new ArgumentNullException(nameof(defaultKeyword)); + if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, out hash); - if (cached != null) return (DefaultConstraintSyntax)cached; - - var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, out hash); + if (cached != null) return (DefaultConstraintSyntax)cached; - return result; + var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static FieldDeclarationSyntax FieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + return result; + } + + public static FieldDeclarationSyntax FieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken); - } + return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken); + } - public static EventFieldDeclarationSyntax EventFieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { + public static EventFieldDeclarationSyntax EventFieldDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { #if DEBUG - if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); - if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); - if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); + if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken == null) throw new ArgumentNullException(nameof(semicolonToken)); + if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); #endif - return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken); - } + return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken); + } - public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken) - { + public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, out hash); - if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached; - - var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, out hash); + if (cached != null) return (ExplicitInterfaceSpecifierSyntax)cached; - return result; + var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static MethodDeclarationSyntax MethodDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + return result; + } + + public static MethodDeclarationSyntax MethodDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, CoreSyntax.SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); - } + return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); + } - public static OperatorDeclarationSyntax OperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public static OperatorDeclarationSyntax OperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) - { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - } - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.TildeToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.FalseKeyword: - case SyntaxKind.TrueKeyword: - case SyntaxKind.IsKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + } + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.TildeToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: + case SyntaxKind.IsKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); - } + return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); + } - public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); - switch (implicitOrExplicitKeyword.Kind) - { - case SyntaxKind.ImplicitKeyword: - case SyntaxKind.ExplicitKeyword: break; - default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); - } - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) + if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); + switch (implicitOrExplicitKeyword.Kind) + { + case SyntaxKind.ImplicitKeyword: + case SyntaxKind.ExplicitKeyword: break; + default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); + } + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + } + if (type == null) throw new ArgumentNullException(nameof(type)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); - } + return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); + } - public static ConstructorDeclarationSyntax ConstructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public static ConstructorDeclarationSyntax ConstructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken); - } + return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken); + } - public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.BaseConstructorInitializer: - case SyntaxKind.ThisConstructorInitializer: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.BaseConstructorInitializer: + case SyntaxKind.ThisConstructorInitializer: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword)); - switch (thisOrBaseKeyword.Kind) - { - case SyntaxKind.BaseKeyword: - case SyntaxKind.ThisKeyword: break; - default: throw new ArgumentException(nameof(thisOrBaseKeyword)); - } - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (thisOrBaseKeyword == null) throw new ArgumentNullException(nameof(thisOrBaseKeyword)); + switch (thisOrBaseKeyword.Kind) + { + case SyntaxKind.BaseKeyword: + case SyntaxKind.ThisKeyword: break; + default: throw new ArgumentException(nameof(thisOrBaseKeyword)); + } + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, out hash); - if (cached != null) return (ConstructorInitializerSyntax)cached; - - var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)kind, colonToken, thisOrBaseKeyword, argumentList, out hash); + if (cached != null) return (ConstructorInitializerSyntax)cached; - return result; + var result = new ConstructorInitializerSyntax(kind, colonToken, thisOrBaseKeyword, argumentList); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static DestructorDeclarationSyntax DestructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + return result; + } + + public static DestructorDeclarationSyntax DestructorDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken)); - if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (tildeToken == null) throw new ArgumentNullException(nameof(tildeToken)); + if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); - } + return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); + } - public static PropertyDeclarationSyntax PropertyDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) - { + public static PropertyDeclarationSyntax PropertyDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); - } + return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); + } - public static ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression) - { + public static ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression) + { #if DEBUG - if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); - if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (arrowToken == null) throw new ArgumentNullException(nameof(arrowToken)); + if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, out hash); - if (cached != null) return (ArrowExpressionClauseSyntax)cached; - - var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, out hash); + if (cached != null) return (ArrowExpressionClauseSyntax)cached; - return result; + var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static EventDeclarationSyntax EventDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) - { + return result; + } + + public static EventDeclarationSyntax EventDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) + { #if DEBUG - if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); - if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken != null) + if (eventKeyword == null) throw new ArgumentNullException(nameof(eventKeyword)); + if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); - } + return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); + } - public static IndexerDeclarationSyntax IndexerDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) - { + public static IndexerDeclarationSyntax IndexerDeclaration(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); - if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); - if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken != null) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); + if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); - } + return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); + } - public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) - { + public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, CoreSyntax.SyntaxList accessors, SyntaxToken closeBraceToken) + { #if DEBUG - if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); - if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); - if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + if (openBraceToken == null) throw new ArgumentNullException(nameof(openBraceToken)); + if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken == null) throw new ArgumentNullException(nameof(closeBraceToken)); + if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, out hash); - if (cached != null) return (AccessorListSyntax)cached; - - var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, out hash); + if (cached != null) return (AccessorListSyntax)cached; - return result; + var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + return result; + } + + public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.GetAccessorDeclaration: - case SyntaxKind.SetAccessorDeclaration: - case SyntaxKind.InitAccessorDeclaration: - case SyntaxKind.AddAccessorDeclaration: - case SyntaxKind.RemoveAccessorDeclaration: - case SyntaxKind.UnknownAccessorDeclaration: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.GetAccessorDeclaration: + case SyntaxKind.SetAccessorDeclaration: + case SyntaxKind.InitAccessorDeclaration: + case SyntaxKind.AddAccessorDeclaration: + case SyntaxKind.RemoveAccessorDeclaration: + case SyntaxKind.UnknownAccessorDeclaration: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (keyword == null) throw new ArgumentNullException(nameof(keyword)); - switch (keyword.Kind) - { - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - case SyntaxKind.InitKeyword: - case SyntaxKind.AddKeyword: - case SyntaxKind.RemoveKeyword: - case SyntaxKind.IdentifierToken: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (semicolonToken != null) + if (keyword == null) throw new ArgumentNullException(nameof(keyword)); + switch (keyword.Kind) + { + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + case SyntaxKind.InitKeyword: + case SyntaxKind.AddKeyword: + case SyntaxKind.RemoveKeyword: + case SyntaxKind.IdentifierToken: break; + default: throw new ArgumentException(nameof(keyword)); + } + if (semicolonToken != null) + { + switch (semicolonToken.Kind) { - switch (semicolonToken.Kind) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + } #endif - return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken); - } + return new AccessorDeclarationSyntax(kind, attributeLists.Node, modifiers.Node, keyword, body, expressionBody, semicolonToken); + } - public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { + public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, out hash); - if (cached != null) return (ParameterListSyntax)cached; - - var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, out hash); + if (cached != null) return (ParameterListSyntax)cached; - return result; + var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { + return result; + } + + public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); - if (cached != null) return (BracketedParameterListSyntax)cached; - - var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); + if (cached != null) return (BracketedParameterListSyntax)cached; - return result; + var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static ParameterSyntax Parameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) - { + return result; + } + + public static ParameterSyntax Parameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) + { #if DEBUG - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - switch (identifier.Kind) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.ArgListKeyword: break; - default: throw new ArgumentException(nameof(identifier)); - } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + switch (identifier.Kind) + { + case SyntaxKind.IdentifierToken: + case SyntaxKind.ArgListKeyword: break; + default: throw new ArgumentException(nameof(identifier)); + } #endif - return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default); - } + return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default); + } - public static FunctionPointerParameterSyntax FunctionPointerParameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) - { + public static FunctionPointerParameterSyntax FunctionPointerParameter(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, out hash); - if (cached != null) return (FunctionPointerParameterSyntax)cached; - - var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, out hash); + if (cached != null) return (FunctionPointerParameterSyntax)cached; - return result; + var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static IncompleteMemberSyntax IncompleteMember(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type) - { + return result; + } + + public static IncompleteMemberSyntax IncompleteMember(CoreSyntax.SyntaxList attributeLists, CoreSyntax.SyntaxList modifiers, TypeSyntax? type) + { #if DEBUG #endif - return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type); - } + return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type); + } - public static SkippedTokensTriviaSyntax SkippedTokensTrivia(CoreSyntax.SyntaxList tokens) - { + public static SkippedTokensTriviaSyntax SkippedTokensTrivia(CoreSyntax.SyntaxList tokens) + { #if DEBUG #endif - return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node); - } + return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node); + } - public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList content, SyntaxToken endOfComment) + public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList content, SyntaxToken endOfComment) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.SingleLineDocumentationCommentTrivia: - case SyntaxKind.MultiLineDocumentationCommentTrivia: break; - default: throw new ArgumentException(nameof(kind)); - } + case SyntaxKind.SingleLineDocumentationCommentTrivia: + case SyntaxKind.MultiLineDocumentationCommentTrivia: break; + default: throw new ArgumentException(nameof(kind)); + } #if DEBUG - if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment)); - if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); + if (endOfComment == null) throw new ArgumentNullException(nameof(endOfComment)); + if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); #endif - return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment); - } + return new DocumentationCommentTriviaSyntax(kind, content.Node, endOfComment); + } - public static TypeCrefSyntax TypeCref(TypeSyntax type) - { + public static TypeCrefSyntax TypeCref(TypeSyntax type) + { #if DEBUG - if (type == null) throw new ArgumentNullException(nameof(type)); + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, out hash); - if (cached != null) return (TypeCrefSyntax)cached; - - var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, out hash); + if (cached != null) return (TypeCrefSyntax)cached; - return result; + var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) - { + return result; + } + + public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + { #if DEBUG - if (container == null) throw new ArgumentNullException(nameof(container)); - if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); - if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - if (member == null) throw new ArgumentNullException(nameof(member)); + if (container == null) throw new ArgumentNullException(nameof(container)); + if (dotToken == null) throw new ArgumentNullException(nameof(dotToken)); + if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (member == null) throw new ArgumentNullException(nameof(member)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, out hash); - if (cached != null) return (QualifiedCrefSyntax)cached; - - var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, out hash); + if (cached != null) return (QualifiedCrefSyntax)cached; - return result; + var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) - { + return result; + } + + public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); + if (name == null) throw new ArgumentNullException(nameof(name)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, out hash); - if (cached != null) return (NameMemberCrefSyntax)cached; - - var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, out hash); + if (cached != null) return (NameMemberCrefSyntax)cached; - return result; + var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) - { + return result; + } + + public static IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + { #if DEBUG - if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); - if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); + if (thisKeyword == null) throw new ArgumentNullException(nameof(thisKeyword)); + if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, out hash); - if (cached != null) return (IndexerMemberCrefSyntax)cached; - - var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, out hash); + if (cached != null) return (IndexerMemberCrefSyntax)cached; - return result; + var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) - { + return result; + } + + public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + { #if DEBUG - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) - { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - } - if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); - switch (operatorToken.Kind) + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.TildeToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.FalseKeyword: - case SyntaxKind.TrueKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } + } + if (operatorToken == null) throw new ArgumentNullException(nameof(operatorToken)); + switch (operatorToken.Kind) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.TildeToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } #endif - return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters); - } + return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters); + } - public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) - { + public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + { #if DEBUG - if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); - switch (implicitOrExplicitKeyword.Kind) - { - case SyntaxKind.ImplicitKeyword: - case SyntaxKind.ExplicitKeyword: break; - default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); - } - if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); - if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - if (checkedKeyword != null) + if (implicitOrExplicitKeyword == null) throw new ArgumentNullException(nameof(implicitOrExplicitKeyword)); + switch (implicitOrExplicitKeyword.Kind) + { + case SyntaxKind.ImplicitKeyword: + case SyntaxKind.ExplicitKeyword: break; + default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); + } + if (operatorKeyword == null) throw new ArgumentNullException(nameof(operatorKeyword)); + if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + if (checkedKeyword != null) + { + switch (checkedKeyword.Kind) { - switch (checkedKeyword.Kind) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); - } + return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); + } - public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { + public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, out hash); - if (cached != null) return (CrefParameterListSyntax)cached; - - var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, out hash); + if (cached != null) return (CrefParameterListSyntax)cached; - return result; + var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { + return result; + } + + public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, CoreSyntax.SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { #if DEBUG - if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); - if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); - if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (openBracketToken == null) throw new ArgumentNullException(nameof(openBracketToken)); + if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken == null) throw new ArgumentNullException(nameof(closeBracketToken)); + if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); - if (cached != null) return (CrefBracketedParameterListSyntax)cached; - - var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); + if (cached != null) return (CrefBracketedParameterListSyntax)cached; - return result; + var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) - { + return result; + } + + public static CrefParameterSyntax CrefParameter(SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) + { #if DEBUG - if (refKindKeyword != null) + if (refKindKeyword != null) + { + switch (refKindKeyword.Kind) { - switch (refKindKeyword.Kind) - { - case SyntaxKind.RefKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.InKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(refKindKeyword)); - } + case SyntaxKind.RefKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.InKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(refKindKeyword)); } - if (readOnlyKeyword != null) + } + if (readOnlyKeyword != null) + { + switch (readOnlyKeyword.Kind) { - switch (readOnlyKeyword.Kind) - { - case SyntaxKind.ReadOnlyKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(readOnlyKeyword)); - } + case SyntaxKind.ReadOnlyKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(readOnlyKeyword)); } - if (type == null) throw new ArgumentNullException(nameof(type)); + } + if (type == null) throw new ArgumentNullException(nameof(type)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, out hash); - if (cached != null) return (CrefParameterSyntax)cached; - - var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, out hash); + if (cached != null) return (CrefParameterSyntax)cached; - return result; + var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) - { + return result; + } + + public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, CoreSyntax.SyntaxList content, XmlElementEndTagSyntax endTag) + { #if DEBUG - if (startTag == null) throw new ArgumentNullException(nameof(startTag)); - if (endTag == null) throw new ArgumentNullException(nameof(endTag)); + if (startTag == null) throw new ArgumentNullException(nameof(startTag)); + if (endTag == null) throw new ArgumentNullException(nameof(endTag)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, out hash); - if (cached != null) return (XmlElementSyntax)cached; - - var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, out hash); + if (cached != null) return (XmlElementSyntax)cached; - return result; + var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) - { + return result; + } + + public static XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken); - } + return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken); + } - public static XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) - { + public static XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + { #if DEBUG - if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken)); - if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); - if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + if (lessThanSlashToken == null) throw new ArgumentNullException(nameof(lessThanSlashToken)); + if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (greaterThanToken == null) throw new ArgumentNullException(nameof(greaterThanToken)); + if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, out hash); - if (cached != null) return (XmlElementEndTagSyntax)cached; - - var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, out hash); + if (cached != null) return (XmlElementEndTagSyntax)cached; - return result; + var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) - { + return result; + } + + public static XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, CoreSyntax.SyntaxList attributes, SyntaxToken slashGreaterThanToken) + { #if DEBUG - if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); - if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken)); - if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); + if (lessThanToken == null) throw new ArgumentNullException(nameof(lessThanToken)); + if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (slashGreaterThanToken == null) throw new ArgumentNullException(nameof(slashGreaterThanToken)); + if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); #endif - return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken); - } + return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken); + } - public static XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName) - { + public static XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName) + { #if DEBUG - if (localName == null) throw new ArgumentNullException(nameof(localName)); - if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); + if (localName == null) throw new ArgumentNullException(nameof(localName)); + if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, out hash); - if (cached != null) return (XmlNameSyntax)cached; - - var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, out hash); + if (cached != null) return (XmlNameSyntax)cached; - return result; + var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) - { + return result; + } + + public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) + { #if DEBUG - if (prefix == null) throw new ArgumentNullException(nameof(prefix)); - if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); - if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); - if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (prefix == null) throw new ArgumentNullException(nameof(prefix)); + if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); + if (colonToken == null) throw new ArgumentNullException(nameof(colonToken)); + if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, out hash); - if (cached != null) return (XmlPrefixSyntax)cached; - - var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, out hash); + if (cached != null) return (XmlPrefixSyntax)cached; - return result; + var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) - { + return result; + } + + public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken); - } + return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken); + } - public static XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) - { + public static XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (cref == null) throw new ArgumentNullException(nameof(cref)); - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (cref == null) throw new ArgumentNullException(nameof(cref)); + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken); - } + return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken); + } - public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) - { + public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + { #if DEBUG - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); - if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); - switch (startQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); - switch (endQuoteToken.Kind) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken == null) throw new ArgumentNullException(nameof(equalsToken)); + if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (startQuoteToken == null) throw new ArgumentNullException(nameof(startQuoteToken)); + switch (startQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); + } + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (endQuoteToken == null) throw new ArgumentNullException(nameof(endQuoteToken)); + switch (endQuoteToken.Kind) + { + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); + } #endif - return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken); - } + return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken); + } - public static XmlTextSyntax XmlText(CoreSyntax.SyntaxList textTokens) - { + public static XmlTextSyntax XmlText(CoreSyntax.SyntaxList textTokens) + { #if DEBUG #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, out hash); - if (cached != null) return (XmlTextSyntax)cached; - - var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, out hash); + if (cached != null) return (XmlTextSyntax)cached; - return result; + var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) - { + return result; + } + + public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, CoreSyntax.SyntaxList textTokens, SyntaxToken endCDataToken) + { #if DEBUG - if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken)); - if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); - if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken)); - if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); + if (startCDataToken == null) throw new ArgumentNullException(nameof(startCDataToken)); + if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); + if (endCDataToken == null) throw new ArgumentNullException(nameof(endCDataToken)); + if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, out hash); - if (cached != null) return (XmlCDataSectionSyntax)cached; - - var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, out hash); + if (cached != null) return (XmlCDataSectionSyntax)cached; - return result; + var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) - { + return result; + } + + public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, CoreSyntax.SyntaxList textTokens, SyntaxToken endProcessingInstructionToken) + { #if DEBUG - if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken)); - if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken)); - if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); + if (startProcessingInstructionToken == null) throw new ArgumentNullException(nameof(startProcessingInstructionToken)); + if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (endProcessingInstructionToken == null) throw new ArgumentNullException(nameof(endProcessingInstructionToken)); + if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); #endif - return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken); - } + return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken); + } - public static XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) - { + public static XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, CoreSyntax.SyntaxList textTokens, SyntaxToken minusMinusGreaterThanToken) + { #if DEBUG - if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken)); - if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); - if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken)); - if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); + if (lessThanExclamationMinusMinusToken == null) throw new ArgumentNullException(nameof(lessThanExclamationMinusMinusToken)); + if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); + if (minusMinusGreaterThanToken == null) throw new ArgumentNullException(nameof(minusMinusGreaterThanToken)); + if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); #endif - int hash; - var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, out hash); - if (cached != null) return (XmlCommentSyntax)cached; - - var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken); - if (hash >= 0) - { - SyntaxNodeCache.AddNode(result, hash); - } + int hash; + var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, out hash); + if (cached != null) return (XmlCommentSyntax)cached; - return result; + var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken); + if (hash >= 0) + { + SyntaxNodeCache.AddNode(result, hash); } - public static IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { + return result; + } + + public static IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); - if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (ifKeyword == null) throw new ArgumentNullException(nameof(ifKeyword)); + if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - } + return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + } - public static ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { + public static ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword)); - if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (elifKeyword == null) throw new ArgumentNullException(nameof(elifKeyword)); + if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - } + return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + } - public static ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) - { + public static ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); - if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (elseKeyword == null) throw new ArgumentNullException(nameof(elseKeyword)); + if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); - } + return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); + } - public static EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword)); - if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endIfKeyword == null) throw new ArgumentNullException(nameof(endIfKeyword)); + if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive); - } + return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive); + } - public static RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword)); - if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (regionKeyword == null) throw new ArgumentNullException(nameof(regionKeyword)); + if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive); - } + return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive); + } - public static EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword)); - if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endRegionKeyword == null) throw new ArgumentNullException(nameof(endRegionKeyword)); + if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive); - } + return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive); + } - public static ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword)); - if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (errorKeyword == null) throw new ArgumentNullException(nameof(errorKeyword)); + if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive); - } + return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive); + } - public static WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); - if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); + if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive); - } + return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive); + } - public static BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive); - } + return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive); + } - public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword)); - if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (defineKeyword == null) throw new ArgumentNullException(nameof(defineKeyword)); + if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive); - } + return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive); + } - public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword)); - if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (undefKeyword == null) throw new ArgumentNullException(nameof(undefKeyword)); + if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive); - } + return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive); + } - public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); - if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); - if (line == null) throw new ArgumentNullException(nameof(line)); - switch (line.Kind) - { - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.DefaultKeyword: - case SyntaxKind.HiddenKeyword: break; - default: throw new ArgumentException(nameof(line)); - } - if (file != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); + if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); + if (line == null) throw new ArgumentNullException(nameof(line)); + switch (line.Kind) + { + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.DefaultKeyword: + case SyntaxKind.HiddenKeyword: break; + default: throw new ArgumentException(nameof(line)); + } + if (file != null) + { + switch (file.Kind) { - switch (file.Kind) - { - case SyntaxKind.StringLiteralToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(file)); - } + case SyntaxKind.StringLiteralToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(file)); } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); - } + return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); + } - public static LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) - { + public static LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + { #if DEBUG - if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); - if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (line == null) throw new ArgumentNullException(nameof(line)); - if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); - if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); - if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); - if (character == null) throw new ArgumentNullException(nameof(character)); - if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); - if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); - if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (openParenToken == null) throw new ArgumentNullException(nameof(openParenToken)); + if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (line == null) throw new ArgumentNullException(nameof(line)); + if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); + if (commaToken == null) throw new ArgumentNullException(nameof(commaToken)); + if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); + if (character == null) throw new ArgumentNullException(nameof(character)); + if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); + if (closeParenToken == null) throw new ArgumentNullException(nameof(closeParenToken)); + if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); #endif - return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken); - } + return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken); + } - public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); - if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); - if (start == null) throw new ArgumentNullException(nameof(start)); - if (minusToken == null) throw new ArgumentNullException(nameof(minusToken)); - if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); - if (end == null) throw new ArgumentNullException(nameof(end)); - if (characterOffset != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (lineKeyword == null) throw new ArgumentNullException(nameof(lineKeyword)); + if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); + if (start == null) throw new ArgumentNullException(nameof(start)); + if (minusToken == null) throw new ArgumentNullException(nameof(minusToken)); + if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); + if (end == null) throw new ArgumentNullException(nameof(end)); + if (characterOffset != null) + { + switch (characterOffset.Kind) { - switch (characterOffset.Kind) - { - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(characterOffset)); - } + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(characterOffset)); } - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); - } + return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); + } - public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, CoreSyntax.SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); - if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); - if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); - if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); - if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword)); - switch (disableOrRestoreKeyword.Kind) - { - case SyntaxKind.DisableKeyword: - case SyntaxKind.RestoreKeyword: break; - default: throw new ArgumentException(nameof(disableOrRestoreKeyword)); - } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); + if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); + if (warningKeyword == null) throw new ArgumentNullException(nameof(warningKeyword)); + if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); + if (disableOrRestoreKeyword == null) throw new ArgumentNullException(nameof(disableOrRestoreKeyword)); + switch (disableOrRestoreKeyword.Kind) + { + case SyntaxKind.DisableKeyword: + case SyntaxKind.RestoreKeyword: break; + default: throw new ArgumentException(nameof(disableOrRestoreKeyword)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive); - } + return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive); + } - public static PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); - if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); - if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword)); - if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (guid == null) throw new ArgumentNullException(nameof(guid)); - if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); - if (bytes == null) throw new ArgumentNullException(nameof(bytes)); - if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (pragmaKeyword == null) throw new ArgumentNullException(nameof(pragmaKeyword)); + if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); + if (checksumKeyword == null) throw new ArgumentNullException(nameof(checksumKeyword)); + if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (guid == null) throw new ArgumentNullException(nameof(guid)); + if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); + if (bytes == null) throw new ArgumentNullException(nameof(bytes)); + if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); - } + return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); + } - public static ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword)); - if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (referenceKeyword == null) throw new ArgumentNullException(nameof(referenceKeyword)); + if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); - } + return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); + } - public static LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword)); - if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); - if (file == null) throw new ArgumentNullException(nameof(file)); - if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (loadKeyword == null) throw new ArgumentNullException(nameof(loadKeyword)); + if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); + if (file == null) throw new ArgumentNullException(nameof(file)); + if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive); - } + return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive); + } - public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken)); - if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (exclamationToken == null) throw new ArgumentNullException(nameof(exclamationToken)); + if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive); - } + return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive); + } - public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) - { + public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + { #if DEBUG - if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); - if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword)); - if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); - if (settingToken == null) throw new ArgumentNullException(nameof(settingToken)); - switch (settingToken.Kind) - { - case SyntaxKind.EnableKeyword: - case SyntaxKind.DisableKeyword: - case SyntaxKind.RestoreKeyword: break; - default: throw new ArgumentException(nameof(settingToken)); - } - if (targetToken != null) + if (hashToken == null) throw new ArgumentNullException(nameof(hashToken)); + if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (nullableKeyword == null) throw new ArgumentNullException(nameof(nullableKeyword)); + if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); + if (settingToken == null) throw new ArgumentNullException(nameof(settingToken)); + switch (settingToken.Kind) + { + case SyntaxKind.EnableKeyword: + case SyntaxKind.DisableKeyword: + case SyntaxKind.RestoreKeyword: break; + default: throw new ArgumentException(nameof(settingToken)); + } + if (targetToken != null) + { + switch (targetToken.Kind) { - switch (targetToken.Kind) - { - case SyntaxKind.WarningsKeyword: - case SyntaxKind.AnnotationsKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(targetToken)); - } + case SyntaxKind.WarningsKeyword: + case SyntaxKind.AnnotationsKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(targetToken)); } - if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); - if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + } + if (endOfDirectiveToken == null) throw new ArgumentNullException(nameof(endOfDirectiveToken)); + if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); #endif - return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); - } + return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); } } diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs index 5fb422e45ba3f..69db879f93ae3 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Main.Generated.cs @@ -9,6446 +9,6444 @@ using Roslyn.Utilities; using CoreSyntax = Microsoft.CodeAnalysis.Syntax.InternalSyntax; -namespace Microsoft.CodeAnalysis.CSharp +namespace Microsoft.CodeAnalysis.CSharp; +using System.Diagnostics.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +public partial class CSharpSyntaxVisitor { - using System.Diagnostics.CodeAnalysis; - using Microsoft.CodeAnalysis.CSharp.Syntax; + /// Called when the visitor visits a IdentifierNameSyntax node. + public virtual TResult? VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); - public partial class CSharpSyntaxVisitor - { - /// Called when the visitor visits a IdentifierNameSyntax node. - public virtual TResult? VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a QualifiedNameSyntax node. + public virtual TResult? VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a QualifiedNameSyntax node. - public virtual TResult? VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a GenericNameSyntax node. + public virtual TResult? VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a GenericNameSyntax node. - public virtual TResult? VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeArgumentListSyntax node. + public virtual TResult? VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeArgumentListSyntax node. - public virtual TResult? VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AliasQualifiedNameSyntax node. + public virtual TResult? VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AliasQualifiedNameSyntax node. - public virtual TResult? VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PredefinedTypeSyntax node. + public virtual TResult? VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PredefinedTypeSyntax node. - public virtual TResult? VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArrayTypeSyntax node. + public virtual TResult? VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArrayTypeSyntax node. - public virtual TResult? VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArrayRankSpecifierSyntax node. + public virtual TResult? VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArrayRankSpecifierSyntax node. - public virtual TResult? VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PointerTypeSyntax node. + public virtual TResult? VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PointerTypeSyntax node. - public virtual TResult? VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerTypeSyntax node. + public virtual TResult? VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerTypeSyntax node. - public virtual TResult? VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerParameterListSyntax node. + public virtual TResult? VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerParameterListSyntax node. - public virtual TResult? VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerCallingConventionSyntax node. + public virtual TResult? VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerCallingConventionSyntax node. - public virtual TResult? VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerUnmanagedCallingConventionListSyntax node. + public virtual TResult? VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerUnmanagedCallingConventionListSyntax node. - public virtual TResult? VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerUnmanagedCallingConventionSyntax node. + public virtual TResult? VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerUnmanagedCallingConventionSyntax node. - public virtual TResult? VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NullableTypeSyntax node. + public virtual TResult? VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a NullableTypeSyntax node. - public virtual TResult? VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TupleTypeSyntax node. + public virtual TResult? VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TupleTypeSyntax node. - public virtual TResult? VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TupleElementSyntax node. + public virtual TResult? VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TupleElementSyntax node. - public virtual TResult? VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OmittedTypeArgumentSyntax node. + public virtual TResult? VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OmittedTypeArgumentSyntax node. - public virtual TResult? VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RefTypeSyntax node. + public virtual TResult? VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RefTypeSyntax node. - public virtual TResult? VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ScopedTypeSyntax node. + public virtual TResult? VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ScopedTypeSyntax node. - public virtual TResult? VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParenthesizedExpressionSyntax node. + public virtual TResult? VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParenthesizedExpressionSyntax node. - public virtual TResult? VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TupleExpressionSyntax node. + public virtual TResult? VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TupleExpressionSyntax node. - public virtual TResult? VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PrefixUnaryExpressionSyntax node. + public virtual TResult? VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PrefixUnaryExpressionSyntax node. - public virtual TResult? VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AwaitExpressionSyntax node. + public virtual TResult? VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AwaitExpressionSyntax node. - public virtual TResult? VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PostfixUnaryExpressionSyntax node. + public virtual TResult? VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PostfixUnaryExpressionSyntax node. - public virtual TResult? VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a MemberAccessExpressionSyntax node. + public virtual TResult? VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a MemberAccessExpressionSyntax node. - public virtual TResult? VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConditionalAccessExpressionSyntax node. + public virtual TResult? VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConditionalAccessExpressionSyntax node. - public virtual TResult? VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a MemberBindingExpressionSyntax node. + public virtual TResult? VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a MemberBindingExpressionSyntax node. - public virtual TResult? VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ElementBindingExpressionSyntax node. + public virtual TResult? VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ElementBindingExpressionSyntax node. - public virtual TResult? VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RangeExpressionSyntax node. + public virtual TResult? VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RangeExpressionSyntax node. - public virtual TResult? VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ImplicitElementAccessSyntax node. + public virtual TResult? VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ImplicitElementAccessSyntax node. - public virtual TResult? VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BinaryExpressionSyntax node. + public virtual TResult? VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BinaryExpressionSyntax node. - public virtual TResult? VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AssignmentExpressionSyntax node. + public virtual TResult? VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AssignmentExpressionSyntax node. - public virtual TResult? VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConditionalExpressionSyntax node. + public virtual TResult? VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConditionalExpressionSyntax node. - public virtual TResult? VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ThisExpressionSyntax node. + public virtual TResult? VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ThisExpressionSyntax node. - public virtual TResult? VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BaseExpressionSyntax node. + public virtual TResult? VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BaseExpressionSyntax node. - public virtual TResult? VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LiteralExpressionSyntax node. + public virtual TResult? VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LiteralExpressionSyntax node. - public virtual TResult? VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a MakeRefExpressionSyntax node. + public virtual TResult? VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a MakeRefExpressionSyntax node. - public virtual TResult? VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RefTypeExpressionSyntax node. + public virtual TResult? VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RefTypeExpressionSyntax node. - public virtual TResult? VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RefValueExpressionSyntax node. + public virtual TResult? VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RefValueExpressionSyntax node. - public virtual TResult? VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CheckedExpressionSyntax node. + public virtual TResult? VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CheckedExpressionSyntax node. - public virtual TResult? VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DefaultExpressionSyntax node. + public virtual TResult? VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DefaultExpressionSyntax node. - public virtual TResult? VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeOfExpressionSyntax node. + public virtual TResult? VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeOfExpressionSyntax node. - public virtual TResult? VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SizeOfExpressionSyntax node. + public virtual TResult? VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SizeOfExpressionSyntax node. - public virtual TResult? VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InvocationExpressionSyntax node. + public virtual TResult? VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InvocationExpressionSyntax node. - public virtual TResult? VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ElementAccessExpressionSyntax node. + public virtual TResult? VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ElementAccessExpressionSyntax node. - public virtual TResult? VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArgumentListSyntax node. + public virtual TResult? VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArgumentListSyntax node. - public virtual TResult? VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BracketedArgumentListSyntax node. + public virtual TResult? VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BracketedArgumentListSyntax node. - public virtual TResult? VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArgumentSyntax node. + public virtual TResult? VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArgumentSyntax node. - public virtual TResult? VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ExpressionColonSyntax node. + public virtual TResult? VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ExpressionColonSyntax node. - public virtual TResult? VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NameColonSyntax node. + public virtual TResult? VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a NameColonSyntax node. - public virtual TResult? VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DeclarationExpressionSyntax node. + public virtual TResult? VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DeclarationExpressionSyntax node. - public virtual TResult? VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CastExpressionSyntax node. + public virtual TResult? VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CastExpressionSyntax node. - public virtual TResult? VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AnonymousMethodExpressionSyntax node. + public virtual TResult? VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AnonymousMethodExpressionSyntax node. - public virtual TResult? VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SimpleLambdaExpressionSyntax node. + public virtual TResult? VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SimpleLambdaExpressionSyntax node. - public virtual TResult? VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RefExpressionSyntax node. + public virtual TResult? VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RefExpressionSyntax node. - public virtual TResult? VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParenthesizedLambdaExpressionSyntax node. + public virtual TResult? VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParenthesizedLambdaExpressionSyntax node. - public virtual TResult? VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InitializerExpressionSyntax node. + public virtual TResult? VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InitializerExpressionSyntax node. - public virtual TResult? VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ImplicitObjectCreationExpressionSyntax node. + public virtual TResult? VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ImplicitObjectCreationExpressionSyntax node. - public virtual TResult? VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ObjectCreationExpressionSyntax node. + public virtual TResult? VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ObjectCreationExpressionSyntax node. - public virtual TResult? VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a WithExpressionSyntax node. + public virtual TResult? VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a WithExpressionSyntax node. - public virtual TResult? VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AnonymousObjectMemberDeclaratorSyntax node. + public virtual TResult? VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AnonymousObjectMemberDeclaratorSyntax node. - public virtual TResult? VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AnonymousObjectCreationExpressionSyntax node. + public virtual TResult? VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AnonymousObjectCreationExpressionSyntax node. - public virtual TResult? VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArrayCreationExpressionSyntax node. + public virtual TResult? VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArrayCreationExpressionSyntax node. - public virtual TResult? VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ImplicitArrayCreationExpressionSyntax node. + public virtual TResult? VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ImplicitArrayCreationExpressionSyntax node. - public virtual TResult? VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a StackAllocArrayCreationExpressionSyntax node. + public virtual TResult? VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a StackAllocArrayCreationExpressionSyntax node. - public virtual TResult? VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ImplicitStackAllocArrayCreationExpressionSyntax node. + public virtual TResult? VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ImplicitStackAllocArrayCreationExpressionSyntax node. - public virtual TResult? VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CollectionExpressionSyntax node. + public virtual TResult? VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CollectionExpressionSyntax node. - public virtual TResult? VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ExpressionElementSyntax node. + public virtual TResult? VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ExpressionElementSyntax node. - public virtual TResult? VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SpreadElementSyntax node. + public virtual TResult? VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SpreadElementSyntax node. - public virtual TResult? VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a QueryExpressionSyntax node. + public virtual TResult? VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a QueryExpressionSyntax node. - public virtual TResult? VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a QueryBodySyntax node. + public virtual TResult? VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a QueryBodySyntax node. - public virtual TResult? VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FromClauseSyntax node. + public virtual TResult? VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FromClauseSyntax node. - public virtual TResult? VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LetClauseSyntax node. + public virtual TResult? VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LetClauseSyntax node. - public virtual TResult? VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a JoinClauseSyntax node. + public virtual TResult? VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a JoinClauseSyntax node. - public virtual TResult? VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a JoinIntoClauseSyntax node. + public virtual TResult? VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a JoinIntoClauseSyntax node. - public virtual TResult? VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a WhereClauseSyntax node. + public virtual TResult? VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a WhereClauseSyntax node. - public virtual TResult? VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OrderByClauseSyntax node. + public virtual TResult? VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OrderByClauseSyntax node. - public virtual TResult? VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OrderingSyntax node. + public virtual TResult? VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OrderingSyntax node. - public virtual TResult? VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SelectClauseSyntax node. + public virtual TResult? VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SelectClauseSyntax node. - public virtual TResult? VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a GroupClauseSyntax node. + public virtual TResult? VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a GroupClauseSyntax node. - public virtual TResult? VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a QueryContinuationSyntax node. + public virtual TResult? VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a QueryContinuationSyntax node. - public virtual TResult? VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OmittedArraySizeExpressionSyntax node. + public virtual TResult? VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OmittedArraySizeExpressionSyntax node. - public virtual TResult? VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterpolatedStringExpressionSyntax node. + public virtual TResult? VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterpolatedStringExpressionSyntax node. - public virtual TResult? VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IsPatternExpressionSyntax node. + public virtual TResult? VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IsPatternExpressionSyntax node. - public virtual TResult? VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ThrowExpressionSyntax node. + public virtual TResult? VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ThrowExpressionSyntax node. - public virtual TResult? VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a WhenClauseSyntax node. + public virtual TResult? VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a WhenClauseSyntax node. - public virtual TResult? VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DiscardPatternSyntax node. + public virtual TResult? VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DiscardPatternSyntax node. - public virtual TResult? VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DeclarationPatternSyntax node. + public virtual TResult? VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DeclarationPatternSyntax node. - public virtual TResult? VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a VarPatternSyntax node. + public virtual TResult? VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a VarPatternSyntax node. - public virtual TResult? VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RecursivePatternSyntax node. + public virtual TResult? VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RecursivePatternSyntax node. - public virtual TResult? VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PositionalPatternClauseSyntax node. + public virtual TResult? VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PositionalPatternClauseSyntax node. - public virtual TResult? VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PropertyPatternClauseSyntax node. + public virtual TResult? VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PropertyPatternClauseSyntax node. - public virtual TResult? VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SubpatternSyntax node. + public virtual TResult? VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SubpatternSyntax node. - public virtual TResult? VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConstantPatternSyntax node. + public virtual TResult? VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConstantPatternSyntax node. - public virtual TResult? VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParenthesizedPatternSyntax node. + public virtual TResult? VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParenthesizedPatternSyntax node. - public virtual TResult? VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RelationalPatternSyntax node. + public virtual TResult? VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RelationalPatternSyntax node. - public virtual TResult? VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypePatternSyntax node. + public virtual TResult? VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypePatternSyntax node. - public virtual TResult? VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BinaryPatternSyntax node. + public virtual TResult? VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BinaryPatternSyntax node. - public virtual TResult? VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a UnaryPatternSyntax node. + public virtual TResult? VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a UnaryPatternSyntax node. - public virtual TResult? VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ListPatternSyntax node. + public virtual TResult? VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ListPatternSyntax node. - public virtual TResult? VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SlicePatternSyntax node. + public virtual TResult? VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SlicePatternSyntax node. - public virtual TResult? VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterpolatedStringTextSyntax node. + public virtual TResult? VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterpolatedStringTextSyntax node. - public virtual TResult? VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterpolationSyntax node. + public virtual TResult? VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterpolationSyntax node. - public virtual TResult? VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterpolationAlignmentClauseSyntax node. + public virtual TResult? VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterpolationAlignmentClauseSyntax node. - public virtual TResult? VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterpolationFormatClauseSyntax node. + public virtual TResult? VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterpolationFormatClauseSyntax node. - public virtual TResult? VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a GlobalStatementSyntax node. + public virtual TResult? VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a GlobalStatementSyntax node. - public virtual TResult? VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BlockSyntax node. + public virtual TResult? VisitBlock(BlockSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BlockSyntax node. - public virtual TResult? VisitBlock(BlockSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LocalFunctionStatementSyntax node. + public virtual TResult? VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LocalFunctionStatementSyntax node. - public virtual TResult? VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LocalDeclarationStatementSyntax node. + public virtual TResult? VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LocalDeclarationStatementSyntax node. - public virtual TResult? VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a VariableDeclarationSyntax node. + public virtual TResult? VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a VariableDeclarationSyntax node. - public virtual TResult? VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a VariableDeclaratorSyntax node. + public virtual TResult? VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a VariableDeclaratorSyntax node. - public virtual TResult? VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EqualsValueClauseSyntax node. + public virtual TResult? VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EqualsValueClauseSyntax node. - public virtual TResult? VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SingleVariableDesignationSyntax node. + public virtual TResult? VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SingleVariableDesignationSyntax node. - public virtual TResult? VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DiscardDesignationSyntax node. + public virtual TResult? VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DiscardDesignationSyntax node. - public virtual TResult? VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParenthesizedVariableDesignationSyntax node. + public virtual TResult? VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParenthesizedVariableDesignationSyntax node. - public virtual TResult? VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ExpressionStatementSyntax node. + public virtual TResult? VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ExpressionStatementSyntax node. - public virtual TResult? VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EmptyStatementSyntax node. + public virtual TResult? VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EmptyStatementSyntax node. - public virtual TResult? VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LabeledStatementSyntax node. + public virtual TResult? VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LabeledStatementSyntax node. - public virtual TResult? VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a GotoStatementSyntax node. + public virtual TResult? VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a GotoStatementSyntax node. - public virtual TResult? VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BreakStatementSyntax node. + public virtual TResult? VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BreakStatementSyntax node. - public virtual TResult? VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ContinueStatementSyntax node. + public virtual TResult? VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ContinueStatementSyntax node. - public virtual TResult? VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ReturnStatementSyntax node. + public virtual TResult? VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ReturnStatementSyntax node. - public virtual TResult? VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ThrowStatementSyntax node. + public virtual TResult? VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ThrowStatementSyntax node. - public virtual TResult? VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a YieldStatementSyntax node. + public virtual TResult? VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a YieldStatementSyntax node. - public virtual TResult? VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a WhileStatementSyntax node. + public virtual TResult? VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a WhileStatementSyntax node. - public virtual TResult? VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DoStatementSyntax node. + public virtual TResult? VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DoStatementSyntax node. - public virtual TResult? VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ForStatementSyntax node. + public virtual TResult? VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ForStatementSyntax node. - public virtual TResult? VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ForEachStatementSyntax node. + public virtual TResult? VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ForEachStatementSyntax node. - public virtual TResult? VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ForEachVariableStatementSyntax node. + public virtual TResult? VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ForEachVariableStatementSyntax node. - public virtual TResult? VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a UsingStatementSyntax node. + public virtual TResult? VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a UsingStatementSyntax node. - public virtual TResult? VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FixedStatementSyntax node. + public virtual TResult? VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FixedStatementSyntax node. - public virtual TResult? VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CheckedStatementSyntax node. + public virtual TResult? VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CheckedStatementSyntax node. - public virtual TResult? VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a UnsafeStatementSyntax node. + public virtual TResult? VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a UnsafeStatementSyntax node. - public virtual TResult? VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LockStatementSyntax node. + public virtual TResult? VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LockStatementSyntax node. - public virtual TResult? VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IfStatementSyntax node. + public virtual TResult? VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IfStatementSyntax node. - public virtual TResult? VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ElseClauseSyntax node. + public virtual TResult? VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ElseClauseSyntax node. - public virtual TResult? VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SwitchStatementSyntax node. + public virtual TResult? VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SwitchStatementSyntax node. - public virtual TResult? VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SwitchSectionSyntax node. + public virtual TResult? VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SwitchSectionSyntax node. - public virtual TResult? VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CasePatternSwitchLabelSyntax node. + public virtual TResult? VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CasePatternSwitchLabelSyntax node. - public virtual TResult? VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CaseSwitchLabelSyntax node. + public virtual TResult? VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CaseSwitchLabelSyntax node. - public virtual TResult? VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DefaultSwitchLabelSyntax node. + public virtual TResult? VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DefaultSwitchLabelSyntax node. - public virtual TResult? VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SwitchExpressionSyntax node. + public virtual TResult? VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SwitchExpressionSyntax node. - public virtual TResult? VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SwitchExpressionArmSyntax node. + public virtual TResult? VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SwitchExpressionArmSyntax node. - public virtual TResult? VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TryStatementSyntax node. + public virtual TResult? VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TryStatementSyntax node. - public virtual TResult? VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CatchClauseSyntax node. + public virtual TResult? VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CatchClauseSyntax node. - public virtual TResult? VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CatchDeclarationSyntax node. + public virtual TResult? VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CatchDeclarationSyntax node. - public virtual TResult? VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CatchFilterClauseSyntax node. + public virtual TResult? VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CatchFilterClauseSyntax node. - public virtual TResult? VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FinallyClauseSyntax node. + public virtual TResult? VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FinallyClauseSyntax node. - public virtual TResult? VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CompilationUnitSyntax node. + public virtual TResult? VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CompilationUnitSyntax node. - public virtual TResult? VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ExternAliasDirectiveSyntax node. + public virtual TResult? VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ExternAliasDirectiveSyntax node. - public virtual TResult? VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a UsingDirectiveSyntax node. + public virtual TResult? VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a UsingDirectiveSyntax node. - public virtual TResult? VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NamespaceDeclarationSyntax node. + public virtual TResult? VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a NamespaceDeclarationSyntax node. - public virtual TResult? VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FileScopedNamespaceDeclarationSyntax node. + public virtual TResult? VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FileScopedNamespaceDeclarationSyntax node. - public virtual TResult? VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AttributeListSyntax node. + public virtual TResult? VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AttributeListSyntax node. - public virtual TResult? VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AttributeTargetSpecifierSyntax node. + public virtual TResult? VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AttributeTargetSpecifierSyntax node. - public virtual TResult? VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AttributeSyntax node. + public virtual TResult? VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AttributeSyntax node. - public virtual TResult? VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AttributeArgumentListSyntax node. + public virtual TResult? VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AttributeArgumentListSyntax node. - public virtual TResult? VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AttributeArgumentSyntax node. + public virtual TResult? VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AttributeArgumentSyntax node. - public virtual TResult? VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NameEqualsSyntax node. + public virtual TResult? VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a NameEqualsSyntax node. - public virtual TResult? VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeParameterListSyntax node. + public virtual TResult? VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeParameterListSyntax node. - public virtual TResult? VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeParameterSyntax node. + public virtual TResult? VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeParameterSyntax node. - public virtual TResult? VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ClassDeclarationSyntax node. + public virtual TResult? VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ClassDeclarationSyntax node. - public virtual TResult? VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a StructDeclarationSyntax node. + public virtual TResult? VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a StructDeclarationSyntax node. - public virtual TResult? VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterfaceDeclarationSyntax node. + public virtual TResult? VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterfaceDeclarationSyntax node. - public virtual TResult? VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RecordDeclarationSyntax node. + public virtual TResult? VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RecordDeclarationSyntax node. - public virtual TResult? VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EnumDeclarationSyntax node. + public virtual TResult? VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EnumDeclarationSyntax node. - public virtual TResult? VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DelegateDeclarationSyntax node. + public virtual TResult? VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DelegateDeclarationSyntax node. - public virtual TResult? VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EnumMemberDeclarationSyntax node. + public virtual TResult? VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EnumMemberDeclarationSyntax node. - public virtual TResult? VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BaseListSyntax node. + public virtual TResult? VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BaseListSyntax node. - public virtual TResult? VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SimpleBaseTypeSyntax node. + public virtual TResult? VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SimpleBaseTypeSyntax node. - public virtual TResult? VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PrimaryConstructorBaseTypeSyntax node. + public virtual TResult? VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PrimaryConstructorBaseTypeSyntax node. - public virtual TResult? VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeParameterConstraintClauseSyntax node. + public virtual TResult? VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeParameterConstraintClauseSyntax node. - public virtual TResult? VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConstructorConstraintSyntax node. + public virtual TResult? VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConstructorConstraintSyntax node. - public virtual TResult? VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ClassOrStructConstraintSyntax node. + public virtual TResult? VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ClassOrStructConstraintSyntax node. - public virtual TResult? VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeConstraintSyntax node. + public virtual TResult? VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeConstraintSyntax node. - public virtual TResult? VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DefaultConstraintSyntax node. + public virtual TResult? VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DefaultConstraintSyntax node. - public virtual TResult? VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FieldDeclarationSyntax node. + public virtual TResult? VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FieldDeclarationSyntax node. - public virtual TResult? VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EventFieldDeclarationSyntax node. + public virtual TResult? VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EventFieldDeclarationSyntax node. - public virtual TResult? VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ExplicitInterfaceSpecifierSyntax node. + public virtual TResult? VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ExplicitInterfaceSpecifierSyntax node. - public virtual TResult? VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a MethodDeclarationSyntax node. + public virtual TResult? VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a MethodDeclarationSyntax node. - public virtual TResult? VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OperatorDeclarationSyntax node. + public virtual TResult? VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OperatorDeclarationSyntax node. - public virtual TResult? VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConversionOperatorDeclarationSyntax node. + public virtual TResult? VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConversionOperatorDeclarationSyntax node. - public virtual TResult? VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConstructorDeclarationSyntax node. + public virtual TResult? VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConstructorDeclarationSyntax node. - public virtual TResult? VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConstructorInitializerSyntax node. + public virtual TResult? VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConstructorInitializerSyntax node. - public virtual TResult? VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DestructorDeclarationSyntax node. + public virtual TResult? VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DestructorDeclarationSyntax node. - public virtual TResult? VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PropertyDeclarationSyntax node. + public virtual TResult? VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PropertyDeclarationSyntax node. - public virtual TResult? VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArrowExpressionClauseSyntax node. + public virtual TResult? VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArrowExpressionClauseSyntax node. - public virtual TResult? VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EventDeclarationSyntax node. + public virtual TResult? VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EventDeclarationSyntax node. - public virtual TResult? VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IndexerDeclarationSyntax node. + public virtual TResult? VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IndexerDeclarationSyntax node. - public virtual TResult? VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AccessorListSyntax node. + public virtual TResult? VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AccessorListSyntax node. - public virtual TResult? VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AccessorDeclarationSyntax node. + public virtual TResult? VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AccessorDeclarationSyntax node. - public virtual TResult? VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParameterListSyntax node. + public virtual TResult? VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParameterListSyntax node. - public virtual TResult? VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BracketedParameterListSyntax node. + public virtual TResult? VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BracketedParameterListSyntax node. - public virtual TResult? VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParameterSyntax node. + public virtual TResult? VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParameterSyntax node. - public virtual TResult? VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerParameterSyntax node. + public virtual TResult? VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerParameterSyntax node. - public virtual TResult? VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IncompleteMemberSyntax node. + public virtual TResult? VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IncompleteMemberSyntax node. - public virtual TResult? VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SkippedTokensTriviaSyntax node. + public virtual TResult? VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SkippedTokensTriviaSyntax node. - public virtual TResult? VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DocumentationCommentTriviaSyntax node. + public virtual TResult? VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DocumentationCommentTriviaSyntax node. - public virtual TResult? VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeCrefSyntax node. + public virtual TResult? VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeCrefSyntax node. - public virtual TResult? VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a QualifiedCrefSyntax node. + public virtual TResult? VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a QualifiedCrefSyntax node. - public virtual TResult? VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NameMemberCrefSyntax node. + public virtual TResult? VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a NameMemberCrefSyntax node. - public virtual TResult? VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IndexerMemberCrefSyntax node. + public virtual TResult? VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IndexerMemberCrefSyntax node. - public virtual TResult? VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OperatorMemberCrefSyntax node. + public virtual TResult? VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OperatorMemberCrefSyntax node. - public virtual TResult? VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConversionOperatorMemberCrefSyntax node. + public virtual TResult? VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConversionOperatorMemberCrefSyntax node. - public virtual TResult? VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CrefParameterListSyntax node. + public virtual TResult? VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CrefParameterListSyntax node. - public virtual TResult? VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CrefBracketedParameterListSyntax node. + public virtual TResult? VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CrefBracketedParameterListSyntax node. - public virtual TResult? VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CrefParameterSyntax node. + public virtual TResult? VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CrefParameterSyntax node. - public virtual TResult? VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlElementSyntax node. + public virtual TResult? VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlElementSyntax node. - public virtual TResult? VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlElementStartTagSyntax node. + public virtual TResult? VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlElementStartTagSyntax node. - public virtual TResult? VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlElementEndTagSyntax node. + public virtual TResult? VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlElementEndTagSyntax node. - public virtual TResult? VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlEmptyElementSyntax node. + public virtual TResult? VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlEmptyElementSyntax node. - public virtual TResult? VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlNameSyntax node. + public virtual TResult? VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlNameSyntax node. - public virtual TResult? VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlPrefixSyntax node. + public virtual TResult? VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlPrefixSyntax node. - public virtual TResult? VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlTextAttributeSyntax node. + public virtual TResult? VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlTextAttributeSyntax node. - public virtual TResult? VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlCrefAttributeSyntax node. + public virtual TResult? VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlCrefAttributeSyntax node. - public virtual TResult? VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlNameAttributeSyntax node. + public virtual TResult? VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlNameAttributeSyntax node. - public virtual TResult? VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlTextSyntax node. + public virtual TResult? VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlTextSyntax node. - public virtual TResult? VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlCDataSectionSyntax node. + public virtual TResult? VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlCDataSectionSyntax node. - public virtual TResult? VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlProcessingInstructionSyntax node. + public virtual TResult? VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlProcessingInstructionSyntax node. - public virtual TResult? VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlCommentSyntax node. + public virtual TResult? VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlCommentSyntax node. - public virtual TResult? VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IfDirectiveTriviaSyntax node. + public virtual TResult? VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IfDirectiveTriviaSyntax node. - public virtual TResult? VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ElifDirectiveTriviaSyntax node. + public virtual TResult? VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ElifDirectiveTriviaSyntax node. - public virtual TResult? VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ElseDirectiveTriviaSyntax node. + public virtual TResult? VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ElseDirectiveTriviaSyntax node. - public virtual TResult? VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EndIfDirectiveTriviaSyntax node. + public virtual TResult? VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EndIfDirectiveTriviaSyntax node. - public virtual TResult? VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RegionDirectiveTriviaSyntax node. + public virtual TResult? VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RegionDirectiveTriviaSyntax node. - public virtual TResult? VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EndRegionDirectiveTriviaSyntax node. + public virtual TResult? VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EndRegionDirectiveTriviaSyntax node. - public virtual TResult? VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ErrorDirectiveTriviaSyntax node. + public virtual TResult? VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ErrorDirectiveTriviaSyntax node. - public virtual TResult? VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a WarningDirectiveTriviaSyntax node. + public virtual TResult? VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a WarningDirectiveTriviaSyntax node. - public virtual TResult? VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BadDirectiveTriviaSyntax node. + public virtual TResult? VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BadDirectiveTriviaSyntax node. - public virtual TResult? VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DefineDirectiveTriviaSyntax node. + public virtual TResult? VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DefineDirectiveTriviaSyntax node. - public virtual TResult? VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a UndefDirectiveTriviaSyntax node. + public virtual TResult? VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a UndefDirectiveTriviaSyntax node. - public virtual TResult? VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LineDirectiveTriviaSyntax node. + public virtual TResult? VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LineDirectiveTriviaSyntax node. - public virtual TResult? VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LineDirectivePositionSyntax node. + public virtual TResult? VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LineDirectivePositionSyntax node. - public virtual TResult? VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LineSpanDirectiveTriviaSyntax node. + public virtual TResult? VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LineSpanDirectiveTriviaSyntax node. - public virtual TResult? VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PragmaWarningDirectiveTriviaSyntax node. + public virtual TResult? VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PragmaWarningDirectiveTriviaSyntax node. - public virtual TResult? VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PragmaChecksumDirectiveTriviaSyntax node. + public virtual TResult? VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PragmaChecksumDirectiveTriviaSyntax node. - public virtual TResult? VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ReferenceDirectiveTriviaSyntax node. + public virtual TResult? VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ReferenceDirectiveTriviaSyntax node. - public virtual TResult? VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LoadDirectiveTriviaSyntax node. + public virtual TResult? VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LoadDirectiveTriviaSyntax node. - public virtual TResult? VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ShebangDirectiveTriviaSyntax node. + public virtual TResult? VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ShebangDirectiveTriviaSyntax node. - public virtual TResult? VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NullableDirectiveTriviaSyntax node. + public virtual TResult? VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); +} - /// Called when the visitor visits a NullableDirectiveTriviaSyntax node. - public virtual TResult? VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); - } +public partial class CSharpSyntaxVisitor +{ + /// Called when the visitor visits a IdentifierNameSyntax node. + public virtual void VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); - public partial class CSharpSyntaxVisitor - { - /// Called when the visitor visits a IdentifierNameSyntax node. - public virtual void VisitIdentifierName(IdentifierNameSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a QualifiedNameSyntax node. + public virtual void VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a QualifiedNameSyntax node. - public virtual void VisitQualifiedName(QualifiedNameSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a GenericNameSyntax node. + public virtual void VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a GenericNameSyntax node. - public virtual void VisitGenericName(GenericNameSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeArgumentListSyntax node. + public virtual void VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeArgumentListSyntax node. - public virtual void VisitTypeArgumentList(TypeArgumentListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AliasQualifiedNameSyntax node. + public virtual void VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AliasQualifiedNameSyntax node. - public virtual void VisitAliasQualifiedName(AliasQualifiedNameSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PredefinedTypeSyntax node. + public virtual void VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PredefinedTypeSyntax node. - public virtual void VisitPredefinedType(PredefinedTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArrayTypeSyntax node. + public virtual void VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArrayTypeSyntax node. - public virtual void VisitArrayType(ArrayTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArrayRankSpecifierSyntax node. + public virtual void VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArrayRankSpecifierSyntax node. - public virtual void VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PointerTypeSyntax node. + public virtual void VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PointerTypeSyntax node. - public virtual void VisitPointerType(PointerTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerTypeSyntax node. + public virtual void VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerTypeSyntax node. - public virtual void VisitFunctionPointerType(FunctionPointerTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerParameterListSyntax node. + public virtual void VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerParameterListSyntax node. - public virtual void VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerCallingConventionSyntax node. + public virtual void VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerCallingConventionSyntax node. - public virtual void VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerUnmanagedCallingConventionListSyntax node. + public virtual void VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerUnmanagedCallingConventionListSyntax node. - public virtual void VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerUnmanagedCallingConventionSyntax node. + public virtual void VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerUnmanagedCallingConventionSyntax node. - public virtual void VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NullableTypeSyntax node. + public virtual void VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a NullableTypeSyntax node. - public virtual void VisitNullableType(NullableTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TupleTypeSyntax node. + public virtual void VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TupleTypeSyntax node. - public virtual void VisitTupleType(TupleTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TupleElementSyntax node. + public virtual void VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TupleElementSyntax node. - public virtual void VisitTupleElement(TupleElementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OmittedTypeArgumentSyntax node. + public virtual void VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OmittedTypeArgumentSyntax node. - public virtual void VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RefTypeSyntax node. + public virtual void VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RefTypeSyntax node. - public virtual void VisitRefType(RefTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ScopedTypeSyntax node. + public virtual void VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ScopedTypeSyntax node. - public virtual void VisitScopedType(ScopedTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParenthesizedExpressionSyntax node. + public virtual void VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParenthesizedExpressionSyntax node. - public virtual void VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TupleExpressionSyntax node. + public virtual void VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TupleExpressionSyntax node. - public virtual void VisitTupleExpression(TupleExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PrefixUnaryExpressionSyntax node. + public virtual void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PrefixUnaryExpressionSyntax node. - public virtual void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AwaitExpressionSyntax node. + public virtual void VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AwaitExpressionSyntax node. - public virtual void VisitAwaitExpression(AwaitExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PostfixUnaryExpressionSyntax node. + public virtual void VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PostfixUnaryExpressionSyntax node. - public virtual void VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a MemberAccessExpressionSyntax node. + public virtual void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a MemberAccessExpressionSyntax node. - public virtual void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConditionalAccessExpressionSyntax node. + public virtual void VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConditionalAccessExpressionSyntax node. - public virtual void VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a MemberBindingExpressionSyntax node. + public virtual void VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a MemberBindingExpressionSyntax node. - public virtual void VisitMemberBindingExpression(MemberBindingExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ElementBindingExpressionSyntax node. + public virtual void VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ElementBindingExpressionSyntax node. - public virtual void VisitElementBindingExpression(ElementBindingExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RangeExpressionSyntax node. + public virtual void VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RangeExpressionSyntax node. - public virtual void VisitRangeExpression(RangeExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ImplicitElementAccessSyntax node. + public virtual void VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ImplicitElementAccessSyntax node. - public virtual void VisitImplicitElementAccess(ImplicitElementAccessSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BinaryExpressionSyntax node. + public virtual void VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BinaryExpressionSyntax node. - public virtual void VisitBinaryExpression(BinaryExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AssignmentExpressionSyntax node. + public virtual void VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AssignmentExpressionSyntax node. - public virtual void VisitAssignmentExpression(AssignmentExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConditionalExpressionSyntax node. + public virtual void VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConditionalExpressionSyntax node. - public virtual void VisitConditionalExpression(ConditionalExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ThisExpressionSyntax node. + public virtual void VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ThisExpressionSyntax node. - public virtual void VisitThisExpression(ThisExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BaseExpressionSyntax node. + public virtual void VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BaseExpressionSyntax node. - public virtual void VisitBaseExpression(BaseExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LiteralExpressionSyntax node. + public virtual void VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LiteralExpressionSyntax node. - public virtual void VisitLiteralExpression(LiteralExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a MakeRefExpressionSyntax node. + public virtual void VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a MakeRefExpressionSyntax node. - public virtual void VisitMakeRefExpression(MakeRefExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RefTypeExpressionSyntax node. + public virtual void VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RefTypeExpressionSyntax node. - public virtual void VisitRefTypeExpression(RefTypeExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RefValueExpressionSyntax node. + public virtual void VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RefValueExpressionSyntax node. - public virtual void VisitRefValueExpression(RefValueExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CheckedExpressionSyntax node. + public virtual void VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CheckedExpressionSyntax node. - public virtual void VisitCheckedExpression(CheckedExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DefaultExpressionSyntax node. + public virtual void VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DefaultExpressionSyntax node. - public virtual void VisitDefaultExpression(DefaultExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeOfExpressionSyntax node. + public virtual void VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeOfExpressionSyntax node. - public virtual void VisitTypeOfExpression(TypeOfExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SizeOfExpressionSyntax node. + public virtual void VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SizeOfExpressionSyntax node. - public virtual void VisitSizeOfExpression(SizeOfExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InvocationExpressionSyntax node. + public virtual void VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InvocationExpressionSyntax node. - public virtual void VisitInvocationExpression(InvocationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ElementAccessExpressionSyntax node. + public virtual void VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ElementAccessExpressionSyntax node. - public virtual void VisitElementAccessExpression(ElementAccessExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArgumentListSyntax node. + public virtual void VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArgumentListSyntax node. - public virtual void VisitArgumentList(ArgumentListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BracketedArgumentListSyntax node. + public virtual void VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BracketedArgumentListSyntax node. - public virtual void VisitBracketedArgumentList(BracketedArgumentListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArgumentSyntax node. + public virtual void VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArgumentSyntax node. - public virtual void VisitArgument(ArgumentSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ExpressionColonSyntax node. + public virtual void VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ExpressionColonSyntax node. - public virtual void VisitExpressionColon(ExpressionColonSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NameColonSyntax node. + public virtual void VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a NameColonSyntax node. - public virtual void VisitNameColon(NameColonSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DeclarationExpressionSyntax node. + public virtual void VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DeclarationExpressionSyntax node. - public virtual void VisitDeclarationExpression(DeclarationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CastExpressionSyntax node. + public virtual void VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CastExpressionSyntax node. - public virtual void VisitCastExpression(CastExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AnonymousMethodExpressionSyntax node. + public virtual void VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AnonymousMethodExpressionSyntax node. - public virtual void VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SimpleLambdaExpressionSyntax node. + public virtual void VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SimpleLambdaExpressionSyntax node. - public virtual void VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RefExpressionSyntax node. + public virtual void VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RefExpressionSyntax node. - public virtual void VisitRefExpression(RefExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParenthesizedLambdaExpressionSyntax node. + public virtual void VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParenthesizedLambdaExpressionSyntax node. - public virtual void VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InitializerExpressionSyntax node. + public virtual void VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InitializerExpressionSyntax node. - public virtual void VisitInitializerExpression(InitializerExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ImplicitObjectCreationExpressionSyntax node. + public virtual void VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ImplicitObjectCreationExpressionSyntax node. - public virtual void VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ObjectCreationExpressionSyntax node. + public virtual void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ObjectCreationExpressionSyntax node. - public virtual void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a WithExpressionSyntax node. + public virtual void VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a WithExpressionSyntax node. - public virtual void VisitWithExpression(WithExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AnonymousObjectMemberDeclaratorSyntax node. + public virtual void VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AnonymousObjectMemberDeclaratorSyntax node. - public virtual void VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AnonymousObjectCreationExpressionSyntax node. + public virtual void VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AnonymousObjectCreationExpressionSyntax node. - public virtual void VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArrayCreationExpressionSyntax node. + public virtual void VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArrayCreationExpressionSyntax node. - public virtual void VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ImplicitArrayCreationExpressionSyntax node. + public virtual void VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ImplicitArrayCreationExpressionSyntax node. - public virtual void VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a StackAllocArrayCreationExpressionSyntax node. + public virtual void VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a StackAllocArrayCreationExpressionSyntax node. - public virtual void VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ImplicitStackAllocArrayCreationExpressionSyntax node. + public virtual void VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ImplicitStackAllocArrayCreationExpressionSyntax node. - public virtual void VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CollectionExpressionSyntax node. + public virtual void VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CollectionExpressionSyntax node. - public virtual void VisitCollectionExpression(CollectionExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ExpressionElementSyntax node. + public virtual void VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ExpressionElementSyntax node. - public virtual void VisitExpressionElement(ExpressionElementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SpreadElementSyntax node. + public virtual void VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SpreadElementSyntax node. - public virtual void VisitSpreadElement(SpreadElementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a QueryExpressionSyntax node. + public virtual void VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a QueryExpressionSyntax node. - public virtual void VisitQueryExpression(QueryExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a QueryBodySyntax node. + public virtual void VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a QueryBodySyntax node. - public virtual void VisitQueryBody(QueryBodySyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FromClauseSyntax node. + public virtual void VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FromClauseSyntax node. - public virtual void VisitFromClause(FromClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LetClauseSyntax node. + public virtual void VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LetClauseSyntax node. - public virtual void VisitLetClause(LetClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a JoinClauseSyntax node. + public virtual void VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a JoinClauseSyntax node. - public virtual void VisitJoinClause(JoinClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a JoinIntoClauseSyntax node. + public virtual void VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a JoinIntoClauseSyntax node. - public virtual void VisitJoinIntoClause(JoinIntoClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a WhereClauseSyntax node. + public virtual void VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a WhereClauseSyntax node. - public virtual void VisitWhereClause(WhereClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OrderByClauseSyntax node. + public virtual void VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OrderByClauseSyntax node. - public virtual void VisitOrderByClause(OrderByClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OrderingSyntax node. + public virtual void VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OrderingSyntax node. - public virtual void VisitOrdering(OrderingSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SelectClauseSyntax node. + public virtual void VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SelectClauseSyntax node. - public virtual void VisitSelectClause(SelectClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a GroupClauseSyntax node. + public virtual void VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a GroupClauseSyntax node. - public virtual void VisitGroupClause(GroupClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a QueryContinuationSyntax node. + public virtual void VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a QueryContinuationSyntax node. - public virtual void VisitQueryContinuation(QueryContinuationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OmittedArraySizeExpressionSyntax node. + public virtual void VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OmittedArraySizeExpressionSyntax node. - public virtual void VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterpolatedStringExpressionSyntax node. + public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterpolatedStringExpressionSyntax node. - public virtual void VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IsPatternExpressionSyntax node. + public virtual void VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IsPatternExpressionSyntax node. - public virtual void VisitIsPatternExpression(IsPatternExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ThrowExpressionSyntax node. + public virtual void VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ThrowExpressionSyntax node. - public virtual void VisitThrowExpression(ThrowExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a WhenClauseSyntax node. + public virtual void VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a WhenClauseSyntax node. - public virtual void VisitWhenClause(WhenClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DiscardPatternSyntax node. + public virtual void VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DiscardPatternSyntax node. - public virtual void VisitDiscardPattern(DiscardPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DeclarationPatternSyntax node. + public virtual void VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DeclarationPatternSyntax node. - public virtual void VisitDeclarationPattern(DeclarationPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a VarPatternSyntax node. + public virtual void VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a VarPatternSyntax node. - public virtual void VisitVarPattern(VarPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RecursivePatternSyntax node. + public virtual void VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RecursivePatternSyntax node. - public virtual void VisitRecursivePattern(RecursivePatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PositionalPatternClauseSyntax node. + public virtual void VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PositionalPatternClauseSyntax node. - public virtual void VisitPositionalPatternClause(PositionalPatternClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PropertyPatternClauseSyntax node. + public virtual void VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PropertyPatternClauseSyntax node. - public virtual void VisitPropertyPatternClause(PropertyPatternClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SubpatternSyntax node. + public virtual void VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SubpatternSyntax node. - public virtual void VisitSubpattern(SubpatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConstantPatternSyntax node. + public virtual void VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConstantPatternSyntax node. - public virtual void VisitConstantPattern(ConstantPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParenthesizedPatternSyntax node. + public virtual void VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParenthesizedPatternSyntax node. - public virtual void VisitParenthesizedPattern(ParenthesizedPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RelationalPatternSyntax node. + public virtual void VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RelationalPatternSyntax node. - public virtual void VisitRelationalPattern(RelationalPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypePatternSyntax node. + public virtual void VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypePatternSyntax node. - public virtual void VisitTypePattern(TypePatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BinaryPatternSyntax node. + public virtual void VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BinaryPatternSyntax node. - public virtual void VisitBinaryPattern(BinaryPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a UnaryPatternSyntax node. + public virtual void VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a UnaryPatternSyntax node. - public virtual void VisitUnaryPattern(UnaryPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ListPatternSyntax node. + public virtual void VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ListPatternSyntax node. - public virtual void VisitListPattern(ListPatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SlicePatternSyntax node. + public virtual void VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SlicePatternSyntax node. - public virtual void VisitSlicePattern(SlicePatternSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterpolatedStringTextSyntax node. + public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterpolatedStringTextSyntax node. - public virtual void VisitInterpolatedStringText(InterpolatedStringTextSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterpolationSyntax node. + public virtual void VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterpolationSyntax node. - public virtual void VisitInterpolation(InterpolationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterpolationAlignmentClauseSyntax node. + public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterpolationAlignmentClauseSyntax node. - public virtual void VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterpolationFormatClauseSyntax node. + public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterpolationFormatClauseSyntax node. - public virtual void VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a GlobalStatementSyntax node. + public virtual void VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a GlobalStatementSyntax node. - public virtual void VisitGlobalStatement(GlobalStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BlockSyntax node. + public virtual void VisitBlock(BlockSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BlockSyntax node. - public virtual void VisitBlock(BlockSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LocalFunctionStatementSyntax node. + public virtual void VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LocalFunctionStatementSyntax node. - public virtual void VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LocalDeclarationStatementSyntax node. + public virtual void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LocalDeclarationStatementSyntax node. - public virtual void VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a VariableDeclarationSyntax node. + public virtual void VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a VariableDeclarationSyntax node. - public virtual void VisitVariableDeclaration(VariableDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a VariableDeclaratorSyntax node. + public virtual void VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a VariableDeclaratorSyntax node. - public virtual void VisitVariableDeclarator(VariableDeclaratorSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EqualsValueClauseSyntax node. + public virtual void VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EqualsValueClauseSyntax node. - public virtual void VisitEqualsValueClause(EqualsValueClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SingleVariableDesignationSyntax node. + public virtual void VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SingleVariableDesignationSyntax node. - public virtual void VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DiscardDesignationSyntax node. + public virtual void VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DiscardDesignationSyntax node. - public virtual void VisitDiscardDesignation(DiscardDesignationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParenthesizedVariableDesignationSyntax node. + public virtual void VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParenthesizedVariableDesignationSyntax node. - public virtual void VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ExpressionStatementSyntax node. + public virtual void VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ExpressionStatementSyntax node. - public virtual void VisitExpressionStatement(ExpressionStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EmptyStatementSyntax node. + public virtual void VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EmptyStatementSyntax node. - public virtual void VisitEmptyStatement(EmptyStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LabeledStatementSyntax node. + public virtual void VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LabeledStatementSyntax node. - public virtual void VisitLabeledStatement(LabeledStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a GotoStatementSyntax node. + public virtual void VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a GotoStatementSyntax node. - public virtual void VisitGotoStatement(GotoStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BreakStatementSyntax node. + public virtual void VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BreakStatementSyntax node. - public virtual void VisitBreakStatement(BreakStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ContinueStatementSyntax node. + public virtual void VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ContinueStatementSyntax node. - public virtual void VisitContinueStatement(ContinueStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ReturnStatementSyntax node. + public virtual void VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ReturnStatementSyntax node. - public virtual void VisitReturnStatement(ReturnStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ThrowStatementSyntax node. + public virtual void VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ThrowStatementSyntax node. - public virtual void VisitThrowStatement(ThrowStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a YieldStatementSyntax node. + public virtual void VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a YieldStatementSyntax node. - public virtual void VisitYieldStatement(YieldStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a WhileStatementSyntax node. + public virtual void VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a WhileStatementSyntax node. - public virtual void VisitWhileStatement(WhileStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DoStatementSyntax node. + public virtual void VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DoStatementSyntax node. - public virtual void VisitDoStatement(DoStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ForStatementSyntax node. + public virtual void VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ForStatementSyntax node. - public virtual void VisitForStatement(ForStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ForEachStatementSyntax node. + public virtual void VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ForEachStatementSyntax node. - public virtual void VisitForEachStatement(ForEachStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ForEachVariableStatementSyntax node. + public virtual void VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ForEachVariableStatementSyntax node. - public virtual void VisitForEachVariableStatement(ForEachVariableStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a UsingStatementSyntax node. + public virtual void VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a UsingStatementSyntax node. - public virtual void VisitUsingStatement(UsingStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FixedStatementSyntax node. + public virtual void VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FixedStatementSyntax node. - public virtual void VisitFixedStatement(FixedStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CheckedStatementSyntax node. + public virtual void VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CheckedStatementSyntax node. - public virtual void VisitCheckedStatement(CheckedStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a UnsafeStatementSyntax node. + public virtual void VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a UnsafeStatementSyntax node. - public virtual void VisitUnsafeStatement(UnsafeStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LockStatementSyntax node. + public virtual void VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LockStatementSyntax node. - public virtual void VisitLockStatement(LockStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IfStatementSyntax node. + public virtual void VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IfStatementSyntax node. - public virtual void VisitIfStatement(IfStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ElseClauseSyntax node. + public virtual void VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ElseClauseSyntax node. - public virtual void VisitElseClause(ElseClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SwitchStatementSyntax node. + public virtual void VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SwitchStatementSyntax node. - public virtual void VisitSwitchStatement(SwitchStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SwitchSectionSyntax node. + public virtual void VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SwitchSectionSyntax node. - public virtual void VisitSwitchSection(SwitchSectionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CasePatternSwitchLabelSyntax node. + public virtual void VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CasePatternSwitchLabelSyntax node. - public virtual void VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CaseSwitchLabelSyntax node. + public virtual void VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CaseSwitchLabelSyntax node. - public virtual void VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DefaultSwitchLabelSyntax node. + public virtual void VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DefaultSwitchLabelSyntax node. - public virtual void VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SwitchExpressionSyntax node. + public virtual void VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SwitchExpressionSyntax node. - public virtual void VisitSwitchExpression(SwitchExpressionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SwitchExpressionArmSyntax node. + public virtual void VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SwitchExpressionArmSyntax node. - public virtual void VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TryStatementSyntax node. + public virtual void VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TryStatementSyntax node. - public virtual void VisitTryStatement(TryStatementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CatchClauseSyntax node. + public virtual void VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CatchClauseSyntax node. - public virtual void VisitCatchClause(CatchClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CatchDeclarationSyntax node. + public virtual void VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CatchDeclarationSyntax node. - public virtual void VisitCatchDeclaration(CatchDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CatchFilterClauseSyntax node. + public virtual void VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CatchFilterClauseSyntax node. - public virtual void VisitCatchFilterClause(CatchFilterClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FinallyClauseSyntax node. + public virtual void VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FinallyClauseSyntax node. - public virtual void VisitFinallyClause(FinallyClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CompilationUnitSyntax node. + public virtual void VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CompilationUnitSyntax node. - public virtual void VisitCompilationUnit(CompilationUnitSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ExternAliasDirectiveSyntax node. + public virtual void VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ExternAliasDirectiveSyntax node. - public virtual void VisitExternAliasDirective(ExternAliasDirectiveSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a UsingDirectiveSyntax node. + public virtual void VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a UsingDirectiveSyntax node. - public virtual void VisitUsingDirective(UsingDirectiveSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NamespaceDeclarationSyntax node. + public virtual void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a NamespaceDeclarationSyntax node. - public virtual void VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FileScopedNamespaceDeclarationSyntax node. + public virtual void VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FileScopedNamespaceDeclarationSyntax node. - public virtual void VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AttributeListSyntax node. + public virtual void VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AttributeListSyntax node. - public virtual void VisitAttributeList(AttributeListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AttributeTargetSpecifierSyntax node. + public virtual void VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AttributeTargetSpecifierSyntax node. - public virtual void VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AttributeSyntax node. + public virtual void VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AttributeSyntax node. - public virtual void VisitAttribute(AttributeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AttributeArgumentListSyntax node. + public virtual void VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AttributeArgumentListSyntax node. - public virtual void VisitAttributeArgumentList(AttributeArgumentListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AttributeArgumentSyntax node. + public virtual void VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AttributeArgumentSyntax node. - public virtual void VisitAttributeArgument(AttributeArgumentSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NameEqualsSyntax node. + public virtual void VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a NameEqualsSyntax node. - public virtual void VisitNameEquals(NameEqualsSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeParameterListSyntax node. + public virtual void VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeParameterListSyntax node. - public virtual void VisitTypeParameterList(TypeParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeParameterSyntax node. + public virtual void VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeParameterSyntax node. - public virtual void VisitTypeParameter(TypeParameterSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ClassDeclarationSyntax node. + public virtual void VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ClassDeclarationSyntax node. - public virtual void VisitClassDeclaration(ClassDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a StructDeclarationSyntax node. + public virtual void VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a StructDeclarationSyntax node. - public virtual void VisitStructDeclaration(StructDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a InterfaceDeclarationSyntax node. + public virtual void VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a InterfaceDeclarationSyntax node. - public virtual void VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RecordDeclarationSyntax node. + public virtual void VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RecordDeclarationSyntax node. - public virtual void VisitRecordDeclaration(RecordDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EnumDeclarationSyntax node. + public virtual void VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EnumDeclarationSyntax node. - public virtual void VisitEnumDeclaration(EnumDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DelegateDeclarationSyntax node. + public virtual void VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DelegateDeclarationSyntax node. - public virtual void VisitDelegateDeclaration(DelegateDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EnumMemberDeclarationSyntax node. + public virtual void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EnumMemberDeclarationSyntax node. - public virtual void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BaseListSyntax node. + public virtual void VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BaseListSyntax node. - public virtual void VisitBaseList(BaseListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SimpleBaseTypeSyntax node. + public virtual void VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SimpleBaseTypeSyntax node. - public virtual void VisitSimpleBaseType(SimpleBaseTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PrimaryConstructorBaseTypeSyntax node. + public virtual void VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PrimaryConstructorBaseTypeSyntax node. - public virtual void VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeParameterConstraintClauseSyntax node. + public virtual void VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeParameterConstraintClauseSyntax node. - public virtual void VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConstructorConstraintSyntax node. + public virtual void VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConstructorConstraintSyntax node. - public virtual void VisitConstructorConstraint(ConstructorConstraintSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ClassOrStructConstraintSyntax node. + public virtual void VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ClassOrStructConstraintSyntax node. - public virtual void VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeConstraintSyntax node. + public virtual void VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeConstraintSyntax node. - public virtual void VisitTypeConstraint(TypeConstraintSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DefaultConstraintSyntax node. + public virtual void VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DefaultConstraintSyntax node. - public virtual void VisitDefaultConstraint(DefaultConstraintSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FieldDeclarationSyntax node. + public virtual void VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FieldDeclarationSyntax node. - public virtual void VisitFieldDeclaration(FieldDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EventFieldDeclarationSyntax node. + public virtual void VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EventFieldDeclarationSyntax node. - public virtual void VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ExplicitInterfaceSpecifierSyntax node. + public virtual void VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ExplicitInterfaceSpecifierSyntax node. - public virtual void VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a MethodDeclarationSyntax node. + public virtual void VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a MethodDeclarationSyntax node. - public virtual void VisitMethodDeclaration(MethodDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OperatorDeclarationSyntax node. + public virtual void VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OperatorDeclarationSyntax node. - public virtual void VisitOperatorDeclaration(OperatorDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConversionOperatorDeclarationSyntax node. + public virtual void VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConversionOperatorDeclarationSyntax node. - public virtual void VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConstructorDeclarationSyntax node. + public virtual void VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConstructorDeclarationSyntax node. - public virtual void VisitConstructorDeclaration(ConstructorDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConstructorInitializerSyntax node. + public virtual void VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConstructorInitializerSyntax node. - public virtual void VisitConstructorInitializer(ConstructorInitializerSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DestructorDeclarationSyntax node. + public virtual void VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DestructorDeclarationSyntax node. - public virtual void VisitDestructorDeclaration(DestructorDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PropertyDeclarationSyntax node. + public virtual void VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PropertyDeclarationSyntax node. - public virtual void VisitPropertyDeclaration(PropertyDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ArrowExpressionClauseSyntax node. + public virtual void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ArrowExpressionClauseSyntax node. - public virtual void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EventDeclarationSyntax node. + public virtual void VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EventDeclarationSyntax node. - public virtual void VisitEventDeclaration(EventDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IndexerDeclarationSyntax node. + public virtual void VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IndexerDeclarationSyntax node. - public virtual void VisitIndexerDeclaration(IndexerDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AccessorListSyntax node. + public virtual void VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AccessorListSyntax node. - public virtual void VisitAccessorList(AccessorListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a AccessorDeclarationSyntax node. + public virtual void VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a AccessorDeclarationSyntax node. - public virtual void VisitAccessorDeclaration(AccessorDeclarationSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParameterListSyntax node. + public virtual void VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParameterListSyntax node. - public virtual void VisitParameterList(ParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BracketedParameterListSyntax node. + public virtual void VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BracketedParameterListSyntax node. - public virtual void VisitBracketedParameterList(BracketedParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ParameterSyntax node. + public virtual void VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ParameterSyntax node. - public virtual void VisitParameter(ParameterSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a FunctionPointerParameterSyntax node. + public virtual void VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a FunctionPointerParameterSyntax node. - public virtual void VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IncompleteMemberSyntax node. + public virtual void VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IncompleteMemberSyntax node. - public virtual void VisitIncompleteMember(IncompleteMemberSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a SkippedTokensTriviaSyntax node. + public virtual void VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a SkippedTokensTriviaSyntax node. - public virtual void VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DocumentationCommentTriviaSyntax node. + public virtual void VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DocumentationCommentTriviaSyntax node. - public virtual void VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a TypeCrefSyntax node. + public virtual void VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a TypeCrefSyntax node. - public virtual void VisitTypeCref(TypeCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a QualifiedCrefSyntax node. + public virtual void VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a QualifiedCrefSyntax node. - public virtual void VisitQualifiedCref(QualifiedCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NameMemberCrefSyntax node. + public virtual void VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a NameMemberCrefSyntax node. - public virtual void VisitNameMemberCref(NameMemberCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IndexerMemberCrefSyntax node. + public virtual void VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IndexerMemberCrefSyntax node. - public virtual void VisitIndexerMemberCref(IndexerMemberCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a OperatorMemberCrefSyntax node. + public virtual void VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a OperatorMemberCrefSyntax node. - public virtual void VisitOperatorMemberCref(OperatorMemberCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ConversionOperatorMemberCrefSyntax node. + public virtual void VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ConversionOperatorMemberCrefSyntax node. - public virtual void VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CrefParameterListSyntax node. + public virtual void VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CrefParameterListSyntax node. - public virtual void VisitCrefParameterList(CrefParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CrefBracketedParameterListSyntax node. + public virtual void VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CrefBracketedParameterListSyntax node. - public virtual void VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a CrefParameterSyntax node. + public virtual void VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a CrefParameterSyntax node. - public virtual void VisitCrefParameter(CrefParameterSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlElementSyntax node. + public virtual void VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlElementSyntax node. - public virtual void VisitXmlElement(XmlElementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlElementStartTagSyntax node. + public virtual void VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlElementStartTagSyntax node. - public virtual void VisitXmlElementStartTag(XmlElementStartTagSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlElementEndTagSyntax node. + public virtual void VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlElementEndTagSyntax node. - public virtual void VisitXmlElementEndTag(XmlElementEndTagSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlEmptyElementSyntax node. + public virtual void VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlEmptyElementSyntax node. - public virtual void VisitXmlEmptyElement(XmlEmptyElementSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlNameSyntax node. + public virtual void VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlNameSyntax node. - public virtual void VisitXmlName(XmlNameSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlPrefixSyntax node. + public virtual void VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlPrefixSyntax node. - public virtual void VisitXmlPrefix(XmlPrefixSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlTextAttributeSyntax node. + public virtual void VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlTextAttributeSyntax node. - public virtual void VisitXmlTextAttribute(XmlTextAttributeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlCrefAttributeSyntax node. + public virtual void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlCrefAttributeSyntax node. - public virtual void VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlNameAttributeSyntax node. + public virtual void VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlNameAttributeSyntax node. - public virtual void VisitXmlNameAttribute(XmlNameAttributeSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlTextSyntax node. + public virtual void VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlTextSyntax node. - public virtual void VisitXmlText(XmlTextSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlCDataSectionSyntax node. + public virtual void VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlCDataSectionSyntax node. - public virtual void VisitXmlCDataSection(XmlCDataSectionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlProcessingInstructionSyntax node. + public virtual void VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlProcessingInstructionSyntax node. - public virtual void VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a XmlCommentSyntax node. + public virtual void VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a XmlCommentSyntax node. - public virtual void VisitXmlComment(XmlCommentSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a IfDirectiveTriviaSyntax node. + public virtual void VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a IfDirectiveTriviaSyntax node. - public virtual void VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ElifDirectiveTriviaSyntax node. + public virtual void VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ElifDirectiveTriviaSyntax node. - public virtual void VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ElseDirectiveTriviaSyntax node. + public virtual void VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ElseDirectiveTriviaSyntax node. - public virtual void VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EndIfDirectiveTriviaSyntax node. + public virtual void VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EndIfDirectiveTriviaSyntax node. - public virtual void VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a RegionDirectiveTriviaSyntax node. + public virtual void VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a RegionDirectiveTriviaSyntax node. - public virtual void VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a EndRegionDirectiveTriviaSyntax node. + public virtual void VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a EndRegionDirectiveTriviaSyntax node. - public virtual void VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ErrorDirectiveTriviaSyntax node. + public virtual void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ErrorDirectiveTriviaSyntax node. - public virtual void VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a WarningDirectiveTriviaSyntax node. + public virtual void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a WarningDirectiveTriviaSyntax node. - public virtual void VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a BadDirectiveTriviaSyntax node. + public virtual void VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a BadDirectiveTriviaSyntax node. - public virtual void VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a DefineDirectiveTriviaSyntax node. + public virtual void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a DefineDirectiveTriviaSyntax node. - public virtual void VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a UndefDirectiveTriviaSyntax node. + public virtual void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a UndefDirectiveTriviaSyntax node. - public virtual void VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LineDirectiveTriviaSyntax node. + public virtual void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LineDirectiveTriviaSyntax node. - public virtual void VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LineDirectivePositionSyntax node. + public virtual void VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LineDirectivePositionSyntax node. - public virtual void VisitLineDirectivePosition(LineDirectivePositionSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LineSpanDirectiveTriviaSyntax node. + public virtual void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LineSpanDirectiveTriviaSyntax node. - public virtual void VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PragmaWarningDirectiveTriviaSyntax node. + public virtual void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PragmaWarningDirectiveTriviaSyntax node. - public virtual void VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a PragmaChecksumDirectiveTriviaSyntax node. + public virtual void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a PragmaChecksumDirectiveTriviaSyntax node. - public virtual void VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ReferenceDirectiveTriviaSyntax node. + public virtual void VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ReferenceDirectiveTriviaSyntax node. - public virtual void VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a LoadDirectiveTriviaSyntax node. + public virtual void VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a LoadDirectiveTriviaSyntax node. - public virtual void VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a ShebangDirectiveTriviaSyntax node. + public virtual void VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); - /// Called when the visitor visits a ShebangDirectiveTriviaSyntax node. - public virtual void VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) => this.DefaultVisit(node); + /// Called when the visitor visits a NullableDirectiveTriviaSyntax node. + public virtual void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); +} - /// Called when the visitor visits a NullableDirectiveTriviaSyntax node. - public virtual void VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) => this.DefaultVisit(node); - } +public partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor +{ + public override SyntaxNode? VisitIdentifierName(IdentifierNameSyntax node) + => node.Update(VisitToken(node.Identifier)); - public partial class CSharpSyntaxRewriter : CSharpSyntaxVisitor - { - public override SyntaxNode? VisitIdentifierName(IdentifierNameSyntax node) - => node.Update(VisitToken(node.Identifier)); + public override SyntaxNode? VisitQualifiedName(QualifiedNameSyntax node) + => node.Update((NameSyntax?)Visit(node.Left) ?? throw new ArgumentNullException("left"), VisitToken(node.DotToken), (SimpleNameSyntax?)Visit(node.Right) ?? throw new ArgumentNullException("right")); - public override SyntaxNode? VisitQualifiedName(QualifiedNameSyntax node) - => node.Update((NameSyntax?)Visit(node.Left) ?? throw new ArgumentNullException("left"), VisitToken(node.DotToken), (SimpleNameSyntax?)Visit(node.Right) ?? throw new ArgumentNullException("right")); + public override SyntaxNode? VisitGenericName(GenericNameSyntax node) + => node.Update(VisitToken(node.Identifier), (TypeArgumentListSyntax?)Visit(node.TypeArgumentList) ?? throw new ArgumentNullException("typeArgumentList")); - public override SyntaxNode? VisitGenericName(GenericNameSyntax node) - => node.Update(VisitToken(node.Identifier), (TypeArgumentListSyntax?)Visit(node.TypeArgumentList) ?? throw new ArgumentNullException("typeArgumentList")); + public override SyntaxNode? VisitTypeArgumentList(TypeArgumentListSyntax node) + => node.Update(VisitToken(node.LessThanToken), VisitList(node.Arguments), VisitToken(node.GreaterThanToken)); - public override SyntaxNode? VisitTypeArgumentList(TypeArgumentListSyntax node) - => node.Update(VisitToken(node.LessThanToken), VisitList(node.Arguments), VisitToken(node.GreaterThanToken)); + public override SyntaxNode? VisitAliasQualifiedName(AliasQualifiedNameSyntax node) + => node.Update((IdentifierNameSyntax?)Visit(node.Alias) ?? throw new ArgumentNullException("alias"), VisitToken(node.ColonColonToken), (SimpleNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name")); - public override SyntaxNode? VisitAliasQualifiedName(AliasQualifiedNameSyntax node) - => node.Update((IdentifierNameSyntax?)Visit(node.Alias) ?? throw new ArgumentNullException("alias"), VisitToken(node.ColonColonToken), (SimpleNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name")); + public override SyntaxNode? VisitPredefinedType(PredefinedTypeSyntax node) + => node.Update(VisitToken(node.Keyword)); - public override SyntaxNode? VisitPredefinedType(PredefinedTypeSyntax node) - => node.Update(VisitToken(node.Keyword)); + public override SyntaxNode? VisitArrayType(ArrayTypeSyntax node) + => node.Update((TypeSyntax?)Visit(node.ElementType) ?? throw new ArgumentNullException("elementType"), VisitList(node.RankSpecifiers)); - public override SyntaxNode? VisitArrayType(ArrayTypeSyntax node) - => node.Update((TypeSyntax?)Visit(node.ElementType) ?? throw new ArgumentNullException("elementType"), VisitList(node.RankSpecifiers)); + public override SyntaxNode? VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) + => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Sizes), VisitToken(node.CloseBracketToken)); - public override SyntaxNode? VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node) - => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Sizes), VisitToken(node.CloseBracketToken)); + public override SyntaxNode? VisitPointerType(PointerTypeSyntax node) + => node.Update((TypeSyntax?)Visit(node.ElementType) ?? throw new ArgumentNullException("elementType"), VisitToken(node.AsteriskToken)); - public override SyntaxNode? VisitPointerType(PointerTypeSyntax node) - => node.Update((TypeSyntax?)Visit(node.ElementType) ?? throw new ArgumentNullException("elementType"), VisitToken(node.AsteriskToken)); + public override SyntaxNode? VisitFunctionPointerType(FunctionPointerTypeSyntax node) + => node.Update(VisitToken(node.DelegateKeyword), VisitToken(node.AsteriskToken), (FunctionPointerCallingConventionSyntax?)Visit(node.CallingConvention), (FunctionPointerParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList")); - public override SyntaxNode? VisitFunctionPointerType(FunctionPointerTypeSyntax node) - => node.Update(VisitToken(node.DelegateKeyword), VisitToken(node.AsteriskToken), (FunctionPointerCallingConventionSyntax?)Visit(node.CallingConvention), (FunctionPointerParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList")); + public override SyntaxNode? VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) + => node.Update(VisitToken(node.LessThanToken), VisitList(node.Parameters), VisitToken(node.GreaterThanToken)); - public override SyntaxNode? VisitFunctionPointerParameterList(FunctionPointerParameterListSyntax node) - => node.Update(VisitToken(node.LessThanToken), VisitList(node.Parameters), VisitToken(node.GreaterThanToken)); + public override SyntaxNode? VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) + => node.Update(VisitToken(node.ManagedOrUnmanagedKeyword), (FunctionPointerUnmanagedCallingConventionListSyntax?)Visit(node.UnmanagedCallingConventionList)); - public override SyntaxNode? VisitFunctionPointerCallingConvention(FunctionPointerCallingConventionSyntax node) - => node.Update(VisitToken(node.ManagedOrUnmanagedKeyword), (FunctionPointerUnmanagedCallingConventionListSyntax?)Visit(node.UnmanagedCallingConventionList)); + public override SyntaxNode? VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) + => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.CallingConventions), VisitToken(node.CloseBracketToken)); - public override SyntaxNode? VisitFunctionPointerUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax node) - => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.CallingConventions), VisitToken(node.CloseBracketToken)); + public override SyntaxNode? VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) + => node.Update(VisitToken(node.Name)); - public override SyntaxNode? VisitFunctionPointerUnmanagedCallingConvention(FunctionPointerUnmanagedCallingConventionSyntax node) - => node.Update(VisitToken(node.Name)); + public override SyntaxNode? VisitNullableType(NullableTypeSyntax node) + => node.Update((TypeSyntax?)Visit(node.ElementType) ?? throw new ArgumentNullException("elementType"), VisitToken(node.QuestionToken)); - public override SyntaxNode? VisitNullableType(NullableTypeSyntax node) - => node.Update((TypeSyntax?)Visit(node.ElementType) ?? throw new ArgumentNullException("elementType"), VisitToken(node.QuestionToken)); + public override SyntaxNode? VisitTupleType(TupleTypeSyntax node) + => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Elements), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitTupleType(TupleTypeSyntax node) - => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Elements), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitTupleElement(TupleElementSyntax node) + => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.Identifier)); - public override SyntaxNode? VisitTupleElement(TupleElementSyntax node) - => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.Identifier)); + public override SyntaxNode? VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) + => node.Update(VisitToken(node.OmittedTypeArgumentToken)); - public override SyntaxNode? VisitOmittedTypeArgument(OmittedTypeArgumentSyntax node) - => node.Update(VisitToken(node.OmittedTypeArgumentToken)); + public override SyntaxNode? VisitRefType(RefTypeSyntax node) + => node.Update(VisitToken(node.RefKeyword), VisitToken(node.ReadOnlyKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); - public override SyntaxNode? VisitRefType(RefTypeSyntax node) - => node.Update(VisitToken(node.RefKeyword), VisitToken(node.ReadOnlyKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); + public override SyntaxNode? VisitScopedType(ScopedTypeSyntax node) + => node.Update(VisitToken(node.ScopedKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); - public override SyntaxNode? VisitScopedType(ScopedTypeSyntax node) - => node.Update(VisitToken(node.ScopedKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); + public override SyntaxNode? VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) + => node.Update(VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitParenthesizedExpression(ParenthesizedExpressionSyntax node) - => node.Update(VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitTupleExpression(TupleExpressionSyntax node) + => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Arguments), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitTupleExpression(TupleExpressionSyntax node) - => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Arguments), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) + => node.Update(VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.Operand) ?? throw new ArgumentNullException("operand")); - public override SyntaxNode? VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) - => node.Update(VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.Operand) ?? throw new ArgumentNullException("operand")); + public override SyntaxNode? VisitAwaitExpression(AwaitExpressionSyntax node) + => node.Update(VisitToken(node.AwaitKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitAwaitExpression(AwaitExpressionSyntax node) - => node.Update(VisitToken(node.AwaitKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Operand) ?? throw new ArgumentNullException("operand"), VisitToken(node.OperatorToken)); - public override SyntaxNode? VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Operand) ?? throw new ArgumentNullException("operand"), VisitToken(node.OperatorToken)); + public override SyntaxNode? VisitMemberAccessExpression(MemberAccessExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.OperatorToken), (SimpleNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name")); - public override SyntaxNode? VisitMemberAccessExpression(MemberAccessExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.OperatorToken), (SimpleNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name")); + public override SyntaxNode? VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.WhenNotNull) ?? throw new ArgumentNullException("whenNotNull")); - public override SyntaxNode? VisitConditionalAccessExpression(ConditionalAccessExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.WhenNotNull) ?? throw new ArgumentNullException("whenNotNull")); + public override SyntaxNode? VisitMemberBindingExpression(MemberBindingExpressionSyntax node) + => node.Update(VisitToken(node.OperatorToken), (SimpleNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name")); - public override SyntaxNode? VisitMemberBindingExpression(MemberBindingExpressionSyntax node) - => node.Update(VisitToken(node.OperatorToken), (SimpleNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name")); + public override SyntaxNode? VisitElementBindingExpression(ElementBindingExpressionSyntax node) + => node.Update((BracketedArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); - public override SyntaxNode? VisitElementBindingExpression(ElementBindingExpressionSyntax node) - => node.Update((BracketedArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); + public override SyntaxNode? VisitRangeExpression(RangeExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.LeftOperand), VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.RightOperand)); - public override SyntaxNode? VisitRangeExpression(RangeExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.LeftOperand), VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.RightOperand)); + public override SyntaxNode? VisitImplicitElementAccess(ImplicitElementAccessSyntax node) + => node.Update((BracketedArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); - public override SyntaxNode? VisitImplicitElementAccess(ImplicitElementAccessSyntax node) - => node.Update((BracketedArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); + public override SyntaxNode? VisitBinaryExpression(BinaryExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Left) ?? throw new ArgumentNullException("left"), VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.Right) ?? throw new ArgumentNullException("right")); - public override SyntaxNode? VisitBinaryExpression(BinaryExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Left) ?? throw new ArgumentNullException("left"), VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.Right) ?? throw new ArgumentNullException("right")); + public override SyntaxNode? VisitAssignmentExpression(AssignmentExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Left) ?? throw new ArgumentNullException("left"), VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.Right) ?? throw new ArgumentNullException("right")); - public override SyntaxNode? VisitAssignmentExpression(AssignmentExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Left) ?? throw new ArgumentNullException("left"), VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.Right) ?? throw new ArgumentNullException("right")); + public override SyntaxNode? VisitConditionalExpression(ConditionalExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.QuestionToken), (ExpressionSyntax?)Visit(node.WhenTrue) ?? throw new ArgumentNullException("whenTrue"), VisitToken(node.ColonToken), (ExpressionSyntax?)Visit(node.WhenFalse) ?? throw new ArgumentNullException("whenFalse")); - public override SyntaxNode? VisitConditionalExpression(ConditionalExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.QuestionToken), (ExpressionSyntax?)Visit(node.WhenTrue) ?? throw new ArgumentNullException("whenTrue"), VisitToken(node.ColonToken), (ExpressionSyntax?)Visit(node.WhenFalse) ?? throw new ArgumentNullException("whenFalse")); + public override SyntaxNode? VisitThisExpression(ThisExpressionSyntax node) + => node.Update(VisitToken(node.Token)); - public override SyntaxNode? VisitThisExpression(ThisExpressionSyntax node) - => node.Update(VisitToken(node.Token)); + public override SyntaxNode? VisitBaseExpression(BaseExpressionSyntax node) + => node.Update(VisitToken(node.Token)); - public override SyntaxNode? VisitBaseExpression(BaseExpressionSyntax node) - => node.Update(VisitToken(node.Token)); + public override SyntaxNode? VisitLiteralExpression(LiteralExpressionSyntax node) + => node.Update(VisitToken(node.Token)); - public override SyntaxNode? VisitLiteralExpression(LiteralExpressionSyntax node) - => node.Update(VisitToken(node.Token)); + public override SyntaxNode? VisitMakeRefExpression(MakeRefExpressionSyntax node) + => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitMakeRefExpression(MakeRefExpressionSyntax node) - => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitRefTypeExpression(RefTypeExpressionSyntax node) + => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitRefTypeExpression(RefTypeExpressionSyntax node) - => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitRefValueExpression(RefValueExpressionSyntax node) + => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.Comma), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitRefValueExpression(RefValueExpressionSyntax node) - => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.Comma), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitCheckedExpression(CheckedExpressionSyntax node) + => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitCheckedExpression(CheckedExpressionSyntax node) - => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitDefaultExpression(DefaultExpressionSyntax node) + => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitDefaultExpression(DefaultExpressionSyntax node) - => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitTypeOfExpression(TypeOfExpressionSyntax node) + => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitTypeOfExpression(TypeOfExpressionSyntax node) - => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitSizeOfExpression(SizeOfExpressionSyntax node) + => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitSizeOfExpression(SizeOfExpressionSyntax node) - => node.Update(VisitToken(node.Keyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitInvocationExpression(InvocationExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), (ArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); - public override SyntaxNode? VisitInvocationExpression(InvocationExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), (ArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); + public override SyntaxNode? VisitElementAccessExpression(ElementAccessExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), (BracketedArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); - public override SyntaxNode? VisitElementAccessExpression(ElementAccessExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), (BracketedArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); + public override SyntaxNode? VisitArgumentList(ArgumentListSyntax node) + => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Arguments), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitArgumentList(ArgumentListSyntax node) - => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Arguments), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitBracketedArgumentList(BracketedArgumentListSyntax node) + => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Arguments), VisitToken(node.CloseBracketToken)); - public override SyntaxNode? VisitBracketedArgumentList(BracketedArgumentListSyntax node) - => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Arguments), VisitToken(node.CloseBracketToken)); + public override SyntaxNode? VisitArgument(ArgumentSyntax node) + => node.Update((NameColonSyntax?)Visit(node.NameColon), VisitToken(node.RefKindKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitArgument(ArgumentSyntax node) - => node.Update((NameColonSyntax?)Visit(node.NameColon), VisitToken(node.RefKindKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitExpressionColon(ExpressionColonSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.ColonToken)); - public override SyntaxNode? VisitExpressionColon(ExpressionColonSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.ColonToken)); + public override SyntaxNode? VisitNameColon(NameColonSyntax node) + => node.Update((IdentifierNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.ColonToken)); - public override SyntaxNode? VisitNameColon(NameColonSyntax node) - => node.Update((IdentifierNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.ColonToken)); + public override SyntaxNode? VisitDeclarationExpression(DeclarationExpressionSyntax node) + => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (VariableDesignationSyntax?)Visit(node.Designation) ?? throw new ArgumentNullException("designation")); - public override SyntaxNode? VisitDeclarationExpression(DeclarationExpressionSyntax node) - => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (VariableDesignationSyntax?)Visit(node.Designation) ?? throw new ArgumentNullException("designation")); + public override SyntaxNode? VisitCastExpression(CastExpressionSyntax node) + => node.Update(VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitCastExpression(CastExpressionSyntax node) - => node.Update(VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.CloseParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) + => node.Update(VisitList(node.Modifiers), VisitToken(node.DelegateKeyword), (ParameterListSyntax?)Visit(node.ParameterList), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block"), (ExpressionSyntax?)Visit(node.ExpressionBody)); - public override SyntaxNode? VisitAnonymousMethodExpression(AnonymousMethodExpressionSyntax node) - => node.Update(VisitList(node.Modifiers), VisitToken(node.DelegateKeyword), (ParameterListSyntax?)Visit(node.ParameterList), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block"), (ExpressionSyntax?)Visit(node.ExpressionBody)); + public override SyntaxNode? VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (ParameterSyntax?)Visit(node.Parameter) ?? throw new ArgumentNullException("parameter"), VisitToken(node.ArrowToken), (BlockSyntax?)Visit(node.Block), (ExpressionSyntax?)Visit(node.ExpressionBody)); - public override SyntaxNode? VisitSimpleLambdaExpression(SimpleLambdaExpressionSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (ParameterSyntax?)Visit(node.Parameter) ?? throw new ArgumentNullException("parameter"), VisitToken(node.ArrowToken), (BlockSyntax?)Visit(node.Block), (ExpressionSyntax?)Visit(node.ExpressionBody)); + public override SyntaxNode? VisitRefExpression(RefExpressionSyntax node) + => node.Update(VisitToken(node.RefKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitRefExpression(RefExpressionSyntax node) - => node.Update(VisitToken(node.RefKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitToken(node.ArrowToken), (BlockSyntax?)Visit(node.Block), (ExpressionSyntax?)Visit(node.ExpressionBody)); - public override SyntaxNode? VisitParenthesizedLambdaExpression(ParenthesizedLambdaExpressionSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitToken(node.ArrowToken), (BlockSyntax?)Visit(node.Block), (ExpressionSyntax?)Visit(node.ExpressionBody)); + public override SyntaxNode? VisitInitializerExpression(InitializerExpressionSyntax node) + => node.Update(VisitToken(node.OpenBraceToken), VisitList(node.Expressions), VisitToken(node.CloseBraceToken)); - public override SyntaxNode? VisitInitializerExpression(InitializerExpressionSyntax node) - => node.Update(VisitToken(node.OpenBraceToken), VisitList(node.Expressions), VisitToken(node.CloseBraceToken)); + public override SyntaxNode? VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) + => node.Update(VisitToken(node.NewKeyword), (ArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList"), (InitializerExpressionSyntax?)Visit(node.Initializer)); - public override SyntaxNode? VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node) - => node.Update(VisitToken(node.NewKeyword), (ArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList"), (InitializerExpressionSyntax?)Visit(node.Initializer)); + public override SyntaxNode? VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) + => node.Update(VisitToken(node.NewKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ArgumentListSyntax?)Visit(node.ArgumentList), (InitializerExpressionSyntax?)Visit(node.Initializer)); - public override SyntaxNode? VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) - => node.Update(VisitToken(node.NewKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ArgumentListSyntax?)Visit(node.ArgumentList), (InitializerExpressionSyntax?)Visit(node.Initializer)); + public override SyntaxNode? VisitWithExpression(WithExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.WithKeyword), (InitializerExpressionSyntax?)Visit(node.Initializer) ?? throw new ArgumentNullException("initializer")); - public override SyntaxNode? VisitWithExpression(WithExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.WithKeyword), (InitializerExpressionSyntax?)Visit(node.Initializer) ?? throw new ArgumentNullException("initializer")); + public override SyntaxNode? VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) + => node.Update((NameEqualsSyntax?)Visit(node.NameEquals), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitAnonymousObjectMemberDeclarator(AnonymousObjectMemberDeclaratorSyntax node) - => node.Update((NameEqualsSyntax?)Visit(node.NameEquals), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) + => node.Update(VisitToken(node.NewKeyword), VisitToken(node.OpenBraceToken), VisitList(node.Initializers), VisitToken(node.CloseBraceToken)); - public override SyntaxNode? VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node) - => node.Update(VisitToken(node.NewKeyword), VisitToken(node.OpenBraceToken), VisitList(node.Initializers), VisitToken(node.CloseBraceToken)); + public override SyntaxNode? VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) + => node.Update(VisitToken(node.NewKeyword), (ArrayTypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (InitializerExpressionSyntax?)Visit(node.Initializer)); - public override SyntaxNode? VisitArrayCreationExpression(ArrayCreationExpressionSyntax node) - => node.Update(VisitToken(node.NewKeyword), (ArrayTypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (InitializerExpressionSyntax?)Visit(node.Initializer)); + public override SyntaxNode? VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) + => node.Update(VisitToken(node.NewKeyword), VisitToken(node.OpenBracketToken), VisitList(node.Commas), VisitToken(node.CloseBracketToken), (InitializerExpressionSyntax?)Visit(node.Initializer) ?? throw new ArgumentNullException("initializer")); - public override SyntaxNode? VisitImplicitArrayCreationExpression(ImplicitArrayCreationExpressionSyntax node) - => node.Update(VisitToken(node.NewKeyword), VisitToken(node.OpenBracketToken), VisitList(node.Commas), VisitToken(node.CloseBracketToken), (InitializerExpressionSyntax?)Visit(node.Initializer) ?? throw new ArgumentNullException("initializer")); + public override SyntaxNode? VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) + => node.Update(VisitToken(node.StackAllocKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (InitializerExpressionSyntax?)Visit(node.Initializer)); - public override SyntaxNode? VisitStackAllocArrayCreationExpression(StackAllocArrayCreationExpressionSyntax node) - => node.Update(VisitToken(node.StackAllocKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (InitializerExpressionSyntax?)Visit(node.Initializer)); + public override SyntaxNode? VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) + => node.Update(VisitToken(node.StackAllocKeyword), VisitToken(node.OpenBracketToken), VisitToken(node.CloseBracketToken), (InitializerExpressionSyntax?)Visit(node.Initializer) ?? throw new ArgumentNullException("initializer")); - public override SyntaxNode? VisitImplicitStackAllocArrayCreationExpression(ImplicitStackAllocArrayCreationExpressionSyntax node) - => node.Update(VisitToken(node.StackAllocKeyword), VisitToken(node.OpenBracketToken), VisitToken(node.CloseBracketToken), (InitializerExpressionSyntax?)Visit(node.Initializer) ?? throw new ArgumentNullException("initializer")); + public override SyntaxNode? VisitCollectionExpression(CollectionExpressionSyntax node) + => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Elements), VisitToken(node.CloseBracketToken)); - public override SyntaxNode? VisitCollectionExpression(CollectionExpressionSyntax node) - => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Elements), VisitToken(node.CloseBracketToken)); + public override SyntaxNode? VisitExpressionElement(ExpressionElementSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitExpressionElement(ExpressionElementSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitSpreadElement(SpreadElementSyntax node) + => node.Update(VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitSpreadElement(SpreadElementSyntax node) - => node.Update(VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitQueryExpression(QueryExpressionSyntax node) + => node.Update((FromClauseSyntax?)Visit(node.FromClause) ?? throw new ArgumentNullException("fromClause"), (QueryBodySyntax?)Visit(node.Body) ?? throw new ArgumentNullException("body")); - public override SyntaxNode? VisitQueryExpression(QueryExpressionSyntax node) - => node.Update((FromClauseSyntax?)Visit(node.FromClause) ?? throw new ArgumentNullException("fromClause"), (QueryBodySyntax?)Visit(node.Body) ?? throw new ArgumentNullException("body")); + public override SyntaxNode? VisitQueryBody(QueryBodySyntax node) + => node.Update(VisitList(node.Clauses), (SelectOrGroupClauseSyntax?)Visit(node.SelectOrGroup) ?? throw new ArgumentNullException("selectOrGroup"), (QueryContinuationSyntax?)Visit(node.Continuation)); - public override SyntaxNode? VisitQueryBody(QueryBodySyntax node) - => node.Update(VisitList(node.Clauses), (SelectOrGroupClauseSyntax?)Visit(node.SelectOrGroup) ?? throw new ArgumentNullException("selectOrGroup"), (QueryContinuationSyntax?)Visit(node.Continuation)); + public override SyntaxNode? VisitFromClause(FromClauseSyntax node) + => node.Update(VisitToken(node.FromKeyword), (TypeSyntax?)Visit(node.Type), VisitToken(node.Identifier), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitFromClause(FromClauseSyntax node) - => node.Update(VisitToken(node.FromKeyword), (TypeSyntax?)Visit(node.Type), VisitToken(node.Identifier), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitLetClause(LetClauseSyntax node) + => node.Update(VisitToken(node.LetKeyword), VisitToken(node.Identifier), VisitToken(node.EqualsToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitLetClause(LetClauseSyntax node) - => node.Update(VisitToken(node.LetKeyword), VisitToken(node.Identifier), VisitToken(node.EqualsToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitJoinClause(JoinClauseSyntax node) + => node.Update(VisitToken(node.JoinKeyword), (TypeSyntax?)Visit(node.Type), VisitToken(node.Identifier), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.InExpression) ?? throw new ArgumentNullException("inExpression"), VisitToken(node.OnKeyword), (ExpressionSyntax?)Visit(node.LeftExpression) ?? throw new ArgumentNullException("leftExpression"), VisitToken(node.EqualsKeyword), (ExpressionSyntax?)Visit(node.RightExpression) ?? throw new ArgumentNullException("rightExpression"), (JoinIntoClauseSyntax?)Visit(node.Into)); - public override SyntaxNode? VisitJoinClause(JoinClauseSyntax node) - => node.Update(VisitToken(node.JoinKeyword), (TypeSyntax?)Visit(node.Type), VisitToken(node.Identifier), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.InExpression) ?? throw new ArgumentNullException("inExpression"), VisitToken(node.OnKeyword), (ExpressionSyntax?)Visit(node.LeftExpression) ?? throw new ArgumentNullException("leftExpression"), VisitToken(node.EqualsKeyword), (ExpressionSyntax?)Visit(node.RightExpression) ?? throw new ArgumentNullException("rightExpression"), (JoinIntoClauseSyntax?)Visit(node.Into)); + public override SyntaxNode? VisitJoinIntoClause(JoinIntoClauseSyntax node) + => node.Update(VisitToken(node.IntoKeyword), VisitToken(node.Identifier)); - public override SyntaxNode? VisitJoinIntoClause(JoinIntoClauseSyntax node) - => node.Update(VisitToken(node.IntoKeyword), VisitToken(node.Identifier)); + public override SyntaxNode? VisitWhereClause(WhereClauseSyntax node) + => node.Update(VisitToken(node.WhereKeyword), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition")); - public override SyntaxNode? VisitWhereClause(WhereClauseSyntax node) - => node.Update(VisitToken(node.WhereKeyword), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition")); + public override SyntaxNode? VisitOrderByClause(OrderByClauseSyntax node) + => node.Update(VisitToken(node.OrderByKeyword), VisitList(node.Orderings)); - public override SyntaxNode? VisitOrderByClause(OrderByClauseSyntax node) - => node.Update(VisitToken(node.OrderByKeyword), VisitList(node.Orderings)); + public override SyntaxNode? VisitOrdering(OrderingSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.AscendingOrDescendingKeyword)); - public override SyntaxNode? VisitOrdering(OrderingSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.AscendingOrDescendingKeyword)); + public override SyntaxNode? VisitSelectClause(SelectClauseSyntax node) + => node.Update(VisitToken(node.SelectKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitSelectClause(SelectClauseSyntax node) - => node.Update(VisitToken(node.SelectKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitGroupClause(GroupClauseSyntax node) + => node.Update(VisitToken(node.GroupKeyword), (ExpressionSyntax?)Visit(node.GroupExpression) ?? throw new ArgumentNullException("groupExpression"), VisitToken(node.ByKeyword), (ExpressionSyntax?)Visit(node.ByExpression) ?? throw new ArgumentNullException("byExpression")); - public override SyntaxNode? VisitGroupClause(GroupClauseSyntax node) - => node.Update(VisitToken(node.GroupKeyword), (ExpressionSyntax?)Visit(node.GroupExpression) ?? throw new ArgumentNullException("groupExpression"), VisitToken(node.ByKeyword), (ExpressionSyntax?)Visit(node.ByExpression) ?? throw new ArgumentNullException("byExpression")); + public override SyntaxNode? VisitQueryContinuation(QueryContinuationSyntax node) + => node.Update(VisitToken(node.IntoKeyword), VisitToken(node.Identifier), (QueryBodySyntax?)Visit(node.Body) ?? throw new ArgumentNullException("body")); - public override SyntaxNode? VisitQueryContinuation(QueryContinuationSyntax node) - => node.Update(VisitToken(node.IntoKeyword), VisitToken(node.Identifier), (QueryBodySyntax?)Visit(node.Body) ?? throw new ArgumentNullException("body")); + public override SyntaxNode? VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) + => node.Update(VisitToken(node.OmittedArraySizeExpressionToken)); - public override SyntaxNode? VisitOmittedArraySizeExpression(OmittedArraySizeExpressionSyntax node) - => node.Update(VisitToken(node.OmittedArraySizeExpressionToken)); + public override SyntaxNode? VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) + => node.Update(VisitToken(node.StringStartToken), VisitList(node.Contents), VisitToken(node.StringEndToken)); - public override SyntaxNode? VisitInterpolatedStringExpression(InterpolatedStringExpressionSyntax node) - => node.Update(VisitToken(node.StringStartToken), VisitList(node.Contents), VisitToken(node.StringEndToken)); + public override SyntaxNode? VisitIsPatternExpression(IsPatternExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.IsKeyword), (PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern")); - public override SyntaxNode? VisitIsPatternExpression(IsPatternExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.IsKeyword), (PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern")); + public override SyntaxNode? VisitThrowExpression(ThrowExpressionSyntax node) + => node.Update(VisitToken(node.ThrowKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitThrowExpression(ThrowExpressionSyntax node) - => node.Update(VisitToken(node.ThrowKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitWhenClause(WhenClauseSyntax node) + => node.Update(VisitToken(node.WhenKeyword), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition")); - public override SyntaxNode? VisitWhenClause(WhenClauseSyntax node) - => node.Update(VisitToken(node.WhenKeyword), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition")); + public override SyntaxNode? VisitDiscardPattern(DiscardPatternSyntax node) + => node.Update(VisitToken(node.UnderscoreToken)); - public override SyntaxNode? VisitDiscardPattern(DiscardPatternSyntax node) - => node.Update(VisitToken(node.UnderscoreToken)); + public override SyntaxNode? VisitDeclarationPattern(DeclarationPatternSyntax node) + => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (VariableDesignationSyntax?)Visit(node.Designation) ?? throw new ArgumentNullException("designation")); - public override SyntaxNode? VisitDeclarationPattern(DeclarationPatternSyntax node) - => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (VariableDesignationSyntax?)Visit(node.Designation) ?? throw new ArgumentNullException("designation")); + public override SyntaxNode? VisitVarPattern(VarPatternSyntax node) + => node.Update(VisitToken(node.VarKeyword), (VariableDesignationSyntax?)Visit(node.Designation) ?? throw new ArgumentNullException("designation")); - public override SyntaxNode? VisitVarPattern(VarPatternSyntax node) - => node.Update(VisitToken(node.VarKeyword), (VariableDesignationSyntax?)Visit(node.Designation) ?? throw new ArgumentNullException("designation")); + public override SyntaxNode? VisitRecursivePattern(RecursivePatternSyntax node) + => node.Update((TypeSyntax?)Visit(node.Type), (PositionalPatternClauseSyntax?)Visit(node.PositionalPatternClause), (PropertyPatternClauseSyntax?)Visit(node.PropertyPatternClause), (VariableDesignationSyntax?)Visit(node.Designation)); - public override SyntaxNode? VisitRecursivePattern(RecursivePatternSyntax node) - => node.Update((TypeSyntax?)Visit(node.Type), (PositionalPatternClauseSyntax?)Visit(node.PositionalPatternClause), (PropertyPatternClauseSyntax?)Visit(node.PropertyPatternClause), (VariableDesignationSyntax?)Visit(node.Designation)); + public override SyntaxNode? VisitPositionalPatternClause(PositionalPatternClauseSyntax node) + => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Subpatterns), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitPositionalPatternClause(PositionalPatternClauseSyntax node) - => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Subpatterns), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitPropertyPatternClause(PropertyPatternClauseSyntax node) + => node.Update(VisitToken(node.OpenBraceToken), VisitList(node.Subpatterns), VisitToken(node.CloseBraceToken)); - public override SyntaxNode? VisitPropertyPatternClause(PropertyPatternClauseSyntax node) - => node.Update(VisitToken(node.OpenBraceToken), VisitList(node.Subpatterns), VisitToken(node.CloseBraceToken)); + public override SyntaxNode? VisitSubpattern(SubpatternSyntax node) + => node.Update((BaseExpressionColonSyntax?)Visit(node.ExpressionColon), (PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern")); - public override SyntaxNode? VisitSubpattern(SubpatternSyntax node) - => node.Update((BaseExpressionColonSyntax?)Visit(node.ExpressionColon), (PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern")); + public override SyntaxNode? VisitConstantPattern(ConstantPatternSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitConstantPattern(ConstantPatternSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitParenthesizedPattern(ParenthesizedPatternSyntax node) + => node.Update(VisitToken(node.OpenParenToken), (PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern"), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitParenthesizedPattern(ParenthesizedPatternSyntax node) - => node.Update(VisitToken(node.OpenParenToken), (PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern"), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitRelationalPattern(RelationalPatternSyntax node) + => node.Update(VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitRelationalPattern(RelationalPatternSyntax node) - => node.Update(VisitToken(node.OperatorToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitTypePattern(TypePatternSyntax node) + => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); - public override SyntaxNode? VisitTypePattern(TypePatternSyntax node) - => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); + public override SyntaxNode? VisitBinaryPattern(BinaryPatternSyntax node) + => node.Update((PatternSyntax?)Visit(node.Left) ?? throw new ArgumentNullException("left"), VisitToken(node.OperatorToken), (PatternSyntax?)Visit(node.Right) ?? throw new ArgumentNullException("right")); - public override SyntaxNode? VisitBinaryPattern(BinaryPatternSyntax node) - => node.Update((PatternSyntax?)Visit(node.Left) ?? throw new ArgumentNullException("left"), VisitToken(node.OperatorToken), (PatternSyntax?)Visit(node.Right) ?? throw new ArgumentNullException("right")); + public override SyntaxNode? VisitUnaryPattern(UnaryPatternSyntax node) + => node.Update(VisitToken(node.OperatorToken), (PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern")); - public override SyntaxNode? VisitUnaryPattern(UnaryPatternSyntax node) - => node.Update(VisitToken(node.OperatorToken), (PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern")); + public override SyntaxNode? VisitListPattern(ListPatternSyntax node) + => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Patterns), VisitToken(node.CloseBracketToken), (VariableDesignationSyntax?)Visit(node.Designation)); - public override SyntaxNode? VisitListPattern(ListPatternSyntax node) - => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Patterns), VisitToken(node.CloseBracketToken), (VariableDesignationSyntax?)Visit(node.Designation)); + public override SyntaxNode? VisitSlicePattern(SlicePatternSyntax node) + => node.Update(VisitToken(node.DotDotToken), (PatternSyntax?)Visit(node.Pattern)); - public override SyntaxNode? VisitSlicePattern(SlicePatternSyntax node) - => node.Update(VisitToken(node.DotDotToken), (PatternSyntax?)Visit(node.Pattern)); + public override SyntaxNode? VisitInterpolatedStringText(InterpolatedStringTextSyntax node) + => node.Update(VisitToken(node.TextToken)); - public override SyntaxNode? VisitInterpolatedStringText(InterpolatedStringTextSyntax node) - => node.Update(VisitToken(node.TextToken)); + public override SyntaxNode? VisitInterpolation(InterpolationSyntax node) + => node.Update(VisitToken(node.OpenBraceToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), (InterpolationAlignmentClauseSyntax?)Visit(node.AlignmentClause), (InterpolationFormatClauseSyntax?)Visit(node.FormatClause), VisitToken(node.CloseBraceToken)); - public override SyntaxNode? VisitInterpolation(InterpolationSyntax node) - => node.Update(VisitToken(node.OpenBraceToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), (InterpolationAlignmentClauseSyntax?)Visit(node.AlignmentClause), (InterpolationFormatClauseSyntax?)Visit(node.FormatClause), VisitToken(node.CloseBraceToken)); + public override SyntaxNode? VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) + => node.Update(VisitToken(node.CommaToken), (ExpressionSyntax?)Visit(node.Value) ?? throw new ArgumentNullException("value")); - public override SyntaxNode? VisitInterpolationAlignmentClause(InterpolationAlignmentClauseSyntax node) - => node.Update(VisitToken(node.CommaToken), (ExpressionSyntax?)Visit(node.Value) ?? throw new ArgumentNullException("value")); + public override SyntaxNode? VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) + => node.Update(VisitToken(node.ColonToken), VisitToken(node.FormatStringToken)); - public override SyntaxNode? VisitInterpolationFormatClause(InterpolationFormatClauseSyntax node) - => node.Update(VisitToken(node.ColonToken), VisitToken(node.FormatStringToken)); + public override SyntaxNode? VisitGlobalStatement(GlobalStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); - public override SyntaxNode? VisitGlobalStatement(GlobalStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); + public override SyntaxNode? VisitBlock(BlockSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.OpenBraceToken), VisitList(node.Statements), VisitToken(node.CloseBraceToken)); - public override SyntaxNode? VisitBlock(BlockSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.OpenBraceToken), VisitList(node.Statements), VisitToken(node.CloseBraceToken)); + public override SyntaxNode? VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitLocalFunctionStatement(LocalFunctionStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.AwaitKeyword), VisitToken(node.UsingKeyword), VisitList(node.Modifiers), (VariableDeclarationSyntax?)Visit(node.Declaration) ?? throw new ArgumentNullException("declaration"), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.AwaitKeyword), VisitToken(node.UsingKeyword), VisitList(node.Modifiers), (VariableDeclarationSyntax?)Visit(node.Declaration) ?? throw new ArgumentNullException("declaration"), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitVariableDeclaration(VariableDeclarationSyntax node) + => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitList(node.Variables)); - public override SyntaxNode? VisitVariableDeclaration(VariableDeclarationSyntax node) - => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitList(node.Variables)); + public override SyntaxNode? VisitVariableDeclarator(VariableDeclaratorSyntax node) + => node.Update(VisitToken(node.Identifier), (BracketedArgumentListSyntax?)Visit(node.ArgumentList), (EqualsValueClauseSyntax?)Visit(node.Initializer)); - public override SyntaxNode? VisitVariableDeclarator(VariableDeclaratorSyntax node) - => node.Update(VisitToken(node.Identifier), (BracketedArgumentListSyntax?)Visit(node.ArgumentList), (EqualsValueClauseSyntax?)Visit(node.Initializer)); + public override SyntaxNode? VisitEqualsValueClause(EqualsValueClauseSyntax node) + => node.Update(VisitToken(node.EqualsToken), (ExpressionSyntax?)Visit(node.Value) ?? throw new ArgumentNullException("value")); - public override SyntaxNode? VisitEqualsValueClause(EqualsValueClauseSyntax node) - => node.Update(VisitToken(node.EqualsToken), (ExpressionSyntax?)Visit(node.Value) ?? throw new ArgumentNullException("value")); + public override SyntaxNode? VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) + => node.Update(VisitToken(node.Identifier)); - public override SyntaxNode? VisitSingleVariableDesignation(SingleVariableDesignationSyntax node) - => node.Update(VisitToken(node.Identifier)); + public override SyntaxNode? VisitDiscardDesignation(DiscardDesignationSyntax node) + => node.Update(VisitToken(node.UnderscoreToken)); - public override SyntaxNode? VisitDiscardDesignation(DiscardDesignationSyntax node) - => node.Update(VisitToken(node.UnderscoreToken)); + public override SyntaxNode? VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) + => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Variables), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignationSyntax node) - => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Variables), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitExpressionStatement(ExpressionStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitExpressionStatement(ExpressionStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitEmptyStatement(EmptyStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitEmptyStatement(EmptyStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitLabeledStatement(LabeledStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.Identifier), VisitToken(node.ColonToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); - public override SyntaxNode? VisitLabeledStatement(LabeledStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.Identifier), VisitToken(node.ColonToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); + public override SyntaxNode? VisitGotoStatement(GotoStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.GotoKeyword), VisitToken(node.CaseOrDefaultKeyword), (ExpressionSyntax?)Visit(node.Expression), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitGotoStatement(GotoStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.GotoKeyword), VisitToken(node.CaseOrDefaultKeyword), (ExpressionSyntax?)Visit(node.Expression), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitBreakStatement(BreakStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.BreakKeyword), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitBreakStatement(BreakStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.BreakKeyword), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitContinueStatement(ContinueStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.ContinueKeyword), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitContinueStatement(ContinueStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.ContinueKeyword), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitReturnStatement(ReturnStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.ReturnKeyword), (ExpressionSyntax?)Visit(node.Expression), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitReturnStatement(ReturnStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.ReturnKeyword), (ExpressionSyntax?)Visit(node.Expression), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitThrowStatement(ThrowStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.ThrowKeyword), (ExpressionSyntax?)Visit(node.Expression), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitThrowStatement(ThrowStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.ThrowKeyword), (ExpressionSyntax?)Visit(node.Expression), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitYieldStatement(YieldStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.YieldKeyword), VisitToken(node.ReturnOrBreakKeyword), (ExpressionSyntax?)Visit(node.Expression), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitYieldStatement(YieldStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.YieldKeyword), VisitToken(node.ReturnOrBreakKeyword), (ExpressionSyntax?)Visit(node.Expression), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitWhileStatement(WhileStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.WhileKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); - public override SyntaxNode? VisitWhileStatement(WhileStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.WhileKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); + public override SyntaxNode? VisitDoStatement(DoStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.DoKeyword), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement"), VisitToken(node.WhileKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.CloseParenToken), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitDoStatement(DoStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.DoKeyword), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement"), VisitToken(node.WhileKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.CloseParenToken), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitForStatement(ForStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.ForKeyword), VisitToken(node.OpenParenToken), (VariableDeclarationSyntax?)Visit(node.Declaration), VisitList(node.Initializers), VisitToken(node.FirstSemicolonToken), (ExpressionSyntax?)Visit(node.Condition), VisitToken(node.SecondSemicolonToken), VisitList(node.Incrementors), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); - public override SyntaxNode? VisitForStatement(ForStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.ForKeyword), VisitToken(node.OpenParenToken), (VariableDeclarationSyntax?)Visit(node.Declaration), VisitList(node.Initializers), VisitToken(node.FirstSemicolonToken), (ExpressionSyntax?)Visit(node.Condition), VisitToken(node.SecondSemicolonToken), VisitList(node.Incrementors), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); + public override SyntaxNode? VisitForEachStatement(ForEachStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.AwaitKeyword), VisitToken(node.ForEachKeyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.Identifier), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); - public override SyntaxNode? VisitForEachStatement(ForEachStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.AwaitKeyword), VisitToken(node.ForEachKeyword), VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.Identifier), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); + public override SyntaxNode? VisitForEachVariableStatement(ForEachVariableStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.AwaitKeyword), VisitToken(node.ForEachKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Variable) ?? throw new ArgumentNullException("variable"), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); - public override SyntaxNode? VisitForEachVariableStatement(ForEachVariableStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.AwaitKeyword), VisitToken(node.ForEachKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Variable) ?? throw new ArgumentNullException("variable"), VisitToken(node.InKeyword), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); + public override SyntaxNode? VisitUsingStatement(UsingStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.AwaitKeyword), VisitToken(node.UsingKeyword), VisitToken(node.OpenParenToken), (VariableDeclarationSyntax?)Visit(node.Declaration), (ExpressionSyntax?)Visit(node.Expression), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); - public override SyntaxNode? VisitUsingStatement(UsingStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.AwaitKeyword), VisitToken(node.UsingKeyword), VisitToken(node.OpenParenToken), (VariableDeclarationSyntax?)Visit(node.Declaration), (ExpressionSyntax?)Visit(node.Expression), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); + public override SyntaxNode? VisitFixedStatement(FixedStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.FixedKeyword), VisitToken(node.OpenParenToken), (VariableDeclarationSyntax?)Visit(node.Declaration) ?? throw new ArgumentNullException("declaration"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); - public override SyntaxNode? VisitFixedStatement(FixedStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.FixedKeyword), VisitToken(node.OpenParenToken), (VariableDeclarationSyntax?)Visit(node.Declaration) ?? throw new ArgumentNullException("declaration"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); + public override SyntaxNode? VisitCheckedStatement(CheckedStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.Keyword), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block")); - public override SyntaxNode? VisitCheckedStatement(CheckedStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.Keyword), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block")); + public override SyntaxNode? VisitUnsafeStatement(UnsafeStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.UnsafeKeyword), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block")); - public override SyntaxNode? VisitUnsafeStatement(UnsafeStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.UnsafeKeyword), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block")); + public override SyntaxNode? VisitLockStatement(LockStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.LockKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); - public override SyntaxNode? VisitLockStatement(LockStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.LockKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); + public override SyntaxNode? VisitIfStatement(IfStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.IfKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement"), (ElseClauseSyntax?)Visit(node.Else)); - public override SyntaxNode? VisitIfStatement(IfStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.IfKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.CloseParenToken), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement"), (ElseClauseSyntax?)Visit(node.Else)); + public override SyntaxNode? VisitElseClause(ElseClauseSyntax node) + => node.Update(VisitToken(node.ElseKeyword), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); - public override SyntaxNode? VisitElseClause(ElseClauseSyntax node) - => node.Update(VisitToken(node.ElseKeyword), (StatementSyntax?)Visit(node.Statement) ?? throw new ArgumentNullException("statement")); + public override SyntaxNode? VisitSwitchStatement(SwitchStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.SwitchKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), VisitToken(node.OpenBraceToken), VisitList(node.Sections), VisitToken(node.CloseBraceToken)); - public override SyntaxNode? VisitSwitchStatement(SwitchStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.SwitchKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression"), VisitToken(node.CloseParenToken), VisitToken(node.OpenBraceToken), VisitList(node.Sections), VisitToken(node.CloseBraceToken)); + public override SyntaxNode? VisitSwitchSection(SwitchSectionSyntax node) + => node.Update(VisitList(node.Labels), VisitList(node.Statements)); - public override SyntaxNode? VisitSwitchSection(SwitchSectionSyntax node) - => node.Update(VisitList(node.Labels), VisitList(node.Statements)); + public override SyntaxNode? VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) + => node.Update(VisitToken(node.Keyword), (PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern"), (WhenClauseSyntax?)Visit(node.WhenClause), VisitToken(node.ColonToken)); - public override SyntaxNode? VisitCasePatternSwitchLabel(CasePatternSwitchLabelSyntax node) - => node.Update(VisitToken(node.Keyword), (PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern"), (WhenClauseSyntax?)Visit(node.WhenClause), VisitToken(node.ColonToken)); + public override SyntaxNode? VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) + => node.Update(VisitToken(node.Keyword), (ExpressionSyntax?)Visit(node.Value) ?? throw new ArgumentNullException("value"), VisitToken(node.ColonToken)); - public override SyntaxNode? VisitCaseSwitchLabel(CaseSwitchLabelSyntax node) - => node.Update(VisitToken(node.Keyword), (ExpressionSyntax?)Visit(node.Value) ?? throw new ArgumentNullException("value"), VisitToken(node.ColonToken)); + public override SyntaxNode? VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) + => node.Update(VisitToken(node.Keyword), VisitToken(node.ColonToken)); - public override SyntaxNode? VisitDefaultSwitchLabel(DefaultSwitchLabelSyntax node) - => node.Update(VisitToken(node.Keyword), VisitToken(node.ColonToken)); + public override SyntaxNode? VisitSwitchExpression(SwitchExpressionSyntax node) + => node.Update((ExpressionSyntax?)Visit(node.GoverningExpression) ?? throw new ArgumentNullException("governingExpression"), VisitToken(node.SwitchKeyword), VisitToken(node.OpenBraceToken), VisitList(node.Arms), VisitToken(node.CloseBraceToken)); - public override SyntaxNode? VisitSwitchExpression(SwitchExpressionSyntax node) - => node.Update((ExpressionSyntax?)Visit(node.GoverningExpression) ?? throw new ArgumentNullException("governingExpression"), VisitToken(node.SwitchKeyword), VisitToken(node.OpenBraceToken), VisitList(node.Arms), VisitToken(node.CloseBraceToken)); + public override SyntaxNode? VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) + => node.Update((PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern"), (WhenClauseSyntax?)Visit(node.WhenClause), VisitToken(node.EqualsGreaterThanToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitSwitchExpressionArm(SwitchExpressionArmSyntax node) - => node.Update((PatternSyntax?)Visit(node.Pattern) ?? throw new ArgumentNullException("pattern"), (WhenClauseSyntax?)Visit(node.WhenClause), VisitToken(node.EqualsGreaterThanToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitTryStatement(TryStatementSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.TryKeyword), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block"), VisitList(node.Catches), (FinallyClauseSyntax?)Visit(node.Finally)); - public override SyntaxNode? VisitTryStatement(TryStatementSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.TryKeyword), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block"), VisitList(node.Catches), (FinallyClauseSyntax?)Visit(node.Finally)); + public override SyntaxNode? VisitCatchClause(CatchClauseSyntax node) + => node.Update(VisitToken(node.CatchKeyword), (CatchDeclarationSyntax?)Visit(node.Declaration), (CatchFilterClauseSyntax?)Visit(node.Filter), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block")); - public override SyntaxNode? VisitCatchClause(CatchClauseSyntax node) - => node.Update(VisitToken(node.CatchKeyword), (CatchDeclarationSyntax?)Visit(node.Declaration), (CatchFilterClauseSyntax?)Visit(node.Filter), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block")); + public override SyntaxNode? VisitCatchDeclaration(CatchDeclarationSyntax node) + => node.Update(VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.Identifier), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitCatchDeclaration(CatchDeclarationSyntax node) - => node.Update(VisitToken(node.OpenParenToken), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), VisitToken(node.Identifier), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitCatchFilterClause(CatchFilterClauseSyntax node) + => node.Update(VisitToken(node.WhenKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.FilterExpression) ?? throw new ArgumentNullException("filterExpression"), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitCatchFilterClause(CatchFilterClauseSyntax node) - => node.Update(VisitToken(node.WhenKeyword), VisitToken(node.OpenParenToken), (ExpressionSyntax?)Visit(node.FilterExpression) ?? throw new ArgumentNullException("filterExpression"), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitFinallyClause(FinallyClauseSyntax node) + => node.Update(VisitToken(node.FinallyKeyword), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block")); - public override SyntaxNode? VisitFinallyClause(FinallyClauseSyntax node) - => node.Update(VisitToken(node.FinallyKeyword), (BlockSyntax?)Visit(node.Block) ?? throw new ArgumentNullException("block")); + public override SyntaxNode? VisitCompilationUnit(CompilationUnitSyntax node) + => node.Update(VisitList(node.Externs), VisitList(node.Usings), VisitList(node.AttributeLists), VisitList(node.Members), VisitToken(node.EndOfFileToken)); - public override SyntaxNode? VisitCompilationUnit(CompilationUnitSyntax node) - => node.Update(VisitList(node.Externs), VisitList(node.Usings), VisitList(node.AttributeLists), VisitList(node.Members), VisitToken(node.EndOfFileToken)); + public override SyntaxNode? VisitExternAliasDirective(ExternAliasDirectiveSyntax node) + => node.Update(VisitToken(node.ExternKeyword), VisitToken(node.AliasKeyword), VisitToken(node.Identifier), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitExternAliasDirective(ExternAliasDirectiveSyntax node) - => node.Update(VisitToken(node.ExternKeyword), VisitToken(node.AliasKeyword), VisitToken(node.Identifier), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitUsingDirective(UsingDirectiveSyntax node) + => node.Update(VisitToken(node.GlobalKeyword), VisitToken(node.UsingKeyword), VisitToken(node.StaticKeyword), VisitToken(node.UnsafeKeyword), (NameEqualsSyntax?)Visit(node.Alias), (TypeSyntax?)Visit(node.NamespaceOrType) ?? throw new ArgumentNullException("namespaceOrType"), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitUsingDirective(UsingDirectiveSyntax node) - => node.Update(VisitToken(node.GlobalKeyword), VisitToken(node.UsingKeyword), VisitToken(node.StaticKeyword), VisitToken(node.UnsafeKeyword), (NameEqualsSyntax?)Visit(node.Alias), (TypeSyntax?)Visit(node.NamespaceOrType) ?? throw new ArgumentNullException("namespaceOrType"), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.NamespaceKeyword), (NameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.OpenBraceToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.NamespaceKeyword), (NameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.OpenBraceToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.NamespaceKeyword), (NameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.SemicolonToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members)); - public override SyntaxNode? VisitFileScopedNamespaceDeclaration(FileScopedNamespaceDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.NamespaceKeyword), (NameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.SemicolonToken), VisitList(node.Externs), VisitList(node.Usings), VisitList(node.Members)); + public override SyntaxNode? VisitAttributeList(AttributeListSyntax node) + => node.Update(VisitToken(node.OpenBracketToken), (AttributeTargetSpecifierSyntax?)Visit(node.Target), VisitList(node.Attributes), VisitToken(node.CloseBracketToken)); - public override SyntaxNode? VisitAttributeList(AttributeListSyntax node) - => node.Update(VisitToken(node.OpenBracketToken), (AttributeTargetSpecifierSyntax?)Visit(node.Target), VisitList(node.Attributes), VisitToken(node.CloseBracketToken)); + public override SyntaxNode? VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) + => node.Update(VisitToken(node.Identifier), VisitToken(node.ColonToken)); - public override SyntaxNode? VisitAttributeTargetSpecifier(AttributeTargetSpecifierSyntax node) - => node.Update(VisitToken(node.Identifier), VisitToken(node.ColonToken)); + public override SyntaxNode? VisitAttribute(AttributeSyntax node) + => node.Update((NameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), (AttributeArgumentListSyntax?)Visit(node.ArgumentList)); - public override SyntaxNode? VisitAttribute(AttributeSyntax node) - => node.Update((NameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), (AttributeArgumentListSyntax?)Visit(node.ArgumentList)); + public override SyntaxNode? VisitAttributeArgumentList(AttributeArgumentListSyntax node) + => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Arguments), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitAttributeArgumentList(AttributeArgumentListSyntax node) - => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Arguments), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitAttributeArgument(AttributeArgumentSyntax node) + => node.Update((NameEqualsSyntax?)Visit(node.NameEquals), (NameColonSyntax?)Visit(node.NameColon), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitAttributeArgument(AttributeArgumentSyntax node) - => node.Update((NameEqualsSyntax?)Visit(node.NameEquals), (NameColonSyntax?)Visit(node.NameColon), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitNameEquals(NameEqualsSyntax node) + => node.Update((IdentifierNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.EqualsToken)); - public override SyntaxNode? VisitNameEquals(NameEqualsSyntax node) - => node.Update((IdentifierNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.EqualsToken)); + public override SyntaxNode? VisitTypeParameterList(TypeParameterListSyntax node) + => node.Update(VisitToken(node.LessThanToken), VisitList(node.Parameters), VisitToken(node.GreaterThanToken)); - public override SyntaxNode? VisitTypeParameterList(TypeParameterListSyntax node) - => node.Update(VisitToken(node.LessThanToken), VisitList(node.Parameters), VisitToken(node.GreaterThanToken)); + public override SyntaxNode? VisitTypeParameter(TypeParameterSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitToken(node.VarianceKeyword), VisitToken(node.Identifier)); - public override SyntaxNode? VisitTypeParameter(TypeParameterSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitToken(node.VarianceKeyword), VisitToken(node.Identifier)); + public override SyntaxNode? VisitClassDeclaration(ClassDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitClassDeclaration(ClassDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitStructDeclaration(StructDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitStructDeclaration(StructDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitRecordDeclaration(RecordDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.ClassOrStructKeyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitRecordDeclaration(RecordDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), VisitToken(node.ClassOrStructKeyword), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList), (BaseListSyntax?)Visit(node.BaseList), VisitList(node.ConstraintClauses), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitEnumDeclaration(EnumDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.EnumKeyword), VisitToken(node.Identifier), (BaseListSyntax?)Visit(node.BaseList), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitEnumDeclaration(EnumDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.EnumKeyword), VisitToken(node.Identifier), (BaseListSyntax?)Visit(node.BaseList), VisitToken(node.OpenBraceToken), VisitList(node.Members), VisitToken(node.CloseBraceToken), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitDelegateDeclaration(DelegateDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.DelegateKeyword), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitDelegateDeclaration(DelegateDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.DelegateKeyword), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Identifier), (EqualsValueClauseSyntax?)Visit(node.EqualsValue)); - public override SyntaxNode? VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Identifier), (EqualsValueClauseSyntax?)Visit(node.EqualsValue)); + public override SyntaxNode? VisitBaseList(BaseListSyntax node) + => node.Update(VisitToken(node.ColonToken), VisitList(node.Types)); - public override SyntaxNode? VisitBaseList(BaseListSyntax node) - => node.Update(VisitToken(node.ColonToken), VisitList(node.Types)); + public override SyntaxNode? VisitSimpleBaseType(SimpleBaseTypeSyntax node) + => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); - public override SyntaxNode? VisitSimpleBaseType(SimpleBaseTypeSyntax node) - => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); + public override SyntaxNode? VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) + => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); - public override SyntaxNode? VisitPrimaryConstructorBaseType(PrimaryConstructorBaseTypeSyntax node) - => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); + public override SyntaxNode? VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) + => node.Update(VisitToken(node.WhereKeyword), (IdentifierNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.ColonToken), VisitList(node.Constraints)); - public override SyntaxNode? VisitTypeParameterConstraintClause(TypeParameterConstraintClauseSyntax node) - => node.Update(VisitToken(node.WhereKeyword), (IdentifierNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.ColonToken), VisitList(node.Constraints)); + public override SyntaxNode? VisitConstructorConstraint(ConstructorConstraintSyntax node) + => node.Update(VisitToken(node.NewKeyword), VisitToken(node.OpenParenToken), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitConstructorConstraint(ConstructorConstraintSyntax node) - => node.Update(VisitToken(node.NewKeyword), VisitToken(node.OpenParenToken), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) + => node.Update(VisitToken(node.ClassOrStructKeyword), VisitToken(node.QuestionToken)); - public override SyntaxNode? VisitClassOrStructConstraint(ClassOrStructConstraintSyntax node) - => node.Update(VisitToken(node.ClassOrStructKeyword), VisitToken(node.QuestionToken)); + public override SyntaxNode? VisitTypeConstraint(TypeConstraintSyntax node) + => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); - public override SyntaxNode? VisitTypeConstraint(TypeConstraintSyntax node) - => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); + public override SyntaxNode? VisitDefaultConstraint(DefaultConstraintSyntax node) + => node.Update(VisitToken(node.DefaultKeyword)); - public override SyntaxNode? VisitDefaultConstraint(DefaultConstraintSyntax node) - => node.Update(VisitToken(node.DefaultKeyword)); + public override SyntaxNode? VisitFieldDeclaration(FieldDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (VariableDeclarationSyntax?)Visit(node.Declaration) ?? throw new ArgumentNullException("declaration"), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitFieldDeclaration(FieldDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (VariableDeclarationSyntax?)Visit(node.Declaration) ?? throw new ArgumentNullException("declaration"), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.EventKeyword), (VariableDeclarationSyntax?)Visit(node.Declaration) ?? throw new ArgumentNullException("declaration"), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitEventFieldDeclaration(EventFieldDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.EventKeyword), (VariableDeclarationSyntax?)Visit(node.Declaration) ?? throw new ArgumentNullException("declaration"), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) + => node.Update((NameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.DotToken)); - public override SyntaxNode? VisitExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax node) - => node.Update((NameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.DotToken)); + public override SyntaxNode? VisitMethodDeclaration(MethodDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitMethodDeclaration(MethodDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (TypeParameterListSyntax?)Visit(node.TypeParameterList), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), VisitList(node.ConstraintClauses), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitOperatorDeclaration(OperatorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), VisitToken(node.OperatorToken), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitOperatorDeclaration(OperatorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.ReturnType) ?? throw new ArgumentNullException("returnType"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), VisitToken(node.OperatorToken), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.ImplicitOrExplicitKeyword), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitConversionOperatorDeclaration(ConversionOperatorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.ImplicitOrExplicitKeyword), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitConstructorDeclaration(ConstructorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Identifier), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (ConstructorInitializerSyntax?)Visit(node.Initializer), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitConstructorDeclaration(ConstructorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Identifier), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (ConstructorInitializerSyntax?)Visit(node.Initializer), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitConstructorInitializer(ConstructorInitializerSyntax node) + => node.Update(VisitToken(node.ColonToken), VisitToken(node.ThisOrBaseKeyword), (ArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); - public override SyntaxNode? VisitConstructorInitializer(ConstructorInitializerSyntax node) - => node.Update(VisitToken(node.ColonToken), VisitToken(node.ThisOrBaseKeyword), (ArgumentListSyntax?)Visit(node.ArgumentList) ?? throw new ArgumentNullException("argumentList")); + public override SyntaxNode? VisitDestructorDeclaration(DestructorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.TildeToken), VisitToken(node.Identifier), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitDestructorDeclaration(DestructorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.TildeToken), VisitToken(node.Identifier), (ParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitPropertyDeclaration(PropertyDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (AccessorListSyntax?)Visit(node.AccessorList), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), (EqualsValueClauseSyntax?)Visit(node.Initializer), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitPropertyDeclaration(PropertyDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (AccessorListSyntax?)Visit(node.AccessorList), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), (EqualsValueClauseSyntax?)Visit(node.Initializer), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) + => node.Update(VisitToken(node.ArrowToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); - public override SyntaxNode? VisitArrowExpressionClause(ArrowExpressionClauseSyntax node) - => node.Update(VisitToken(node.ArrowToken), (ExpressionSyntax?)Visit(node.Expression) ?? throw new ArgumentNullException("expression")); + public override SyntaxNode? VisitEventDeclaration(EventDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.EventKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (AccessorListSyntax?)Visit(node.AccessorList), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitEventDeclaration(EventDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.EventKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.Identifier), (AccessorListSyntax?)Visit(node.AccessorList), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitIndexerDeclaration(IndexerDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.ThisKeyword), (BracketedParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (AccessorListSyntax?)Visit(node.AccessorList), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitIndexerDeclaration(IndexerDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (ExplicitInterfaceSpecifierSyntax?)Visit(node.ExplicitInterfaceSpecifier), VisitToken(node.ThisKeyword), (BracketedParameterListSyntax?)Visit(node.ParameterList) ?? throw new ArgumentNullException("parameterList"), (AccessorListSyntax?)Visit(node.AccessorList), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitAccessorList(AccessorListSyntax node) + => node.Update(VisitToken(node.OpenBraceToken), VisitList(node.Accessors), VisitToken(node.CloseBraceToken)); - public override SyntaxNode? VisitAccessorList(AccessorListSyntax node) - => node.Update(VisitToken(node.OpenBraceToken), VisitList(node.Accessors), VisitToken(node.CloseBraceToken)); + public override SyntaxNode? VisitAccessorDeclaration(AccessorDeclarationSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); - public override SyntaxNode? VisitAccessorDeclaration(AccessorDeclarationSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), VisitToken(node.Keyword), (BlockSyntax?)Visit(node.Body), (ArrowExpressionClauseSyntax?)Visit(node.ExpressionBody), VisitToken(node.SemicolonToken)); + public override SyntaxNode? VisitParameterList(ParameterListSyntax node) + => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Parameters), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitParameterList(ParameterListSyntax node) - => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Parameters), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitBracketedParameterList(BracketedParameterListSyntax node) + => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Parameters), VisitToken(node.CloseBracketToken)); - public override SyntaxNode? VisitBracketedParameterList(BracketedParameterListSyntax node) - => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Parameters), VisitToken(node.CloseBracketToken)); + public override SyntaxNode? VisitParameter(ParameterSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type), VisitToken(node.Identifier), (EqualsValueClauseSyntax?)Visit(node.Default)); - public override SyntaxNode? VisitParameter(ParameterSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type), VisitToken(node.Identifier), (EqualsValueClauseSyntax?)Visit(node.Default)); + public override SyntaxNode? VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); - public override SyntaxNode? VisitFunctionPointerParameter(FunctionPointerParameterSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); + public override SyntaxNode? VisitIncompleteMember(IncompleteMemberSyntax node) + => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type)); - public override SyntaxNode? VisitIncompleteMember(IncompleteMemberSyntax node) - => node.Update(VisitList(node.AttributeLists), VisitList(node.Modifiers), (TypeSyntax?)Visit(node.Type)); + public override SyntaxNode? VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) + => node.Update(VisitList(node.Tokens)); - public override SyntaxNode? VisitSkippedTokensTrivia(SkippedTokensTriviaSyntax node) - => node.Update(VisitList(node.Tokens)); + public override SyntaxNode? VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) + => node.Update(VisitList(node.Content), VisitToken(node.EndOfComment)); - public override SyntaxNode? VisitDocumentationCommentTrivia(DocumentationCommentTriviaSyntax node) - => node.Update(VisitList(node.Content), VisitToken(node.EndOfComment)); + public override SyntaxNode? VisitTypeCref(TypeCrefSyntax node) + => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); - public override SyntaxNode? VisitTypeCref(TypeCrefSyntax node) - => node.Update((TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); + public override SyntaxNode? VisitQualifiedCref(QualifiedCrefSyntax node) + => node.Update((TypeSyntax?)Visit(node.Container) ?? throw new ArgumentNullException("container"), VisitToken(node.DotToken), (MemberCrefSyntax?)Visit(node.Member) ?? throw new ArgumentNullException("member")); - public override SyntaxNode? VisitQualifiedCref(QualifiedCrefSyntax node) - => node.Update((TypeSyntax?)Visit(node.Container) ?? throw new ArgumentNullException("container"), VisitToken(node.DotToken), (MemberCrefSyntax?)Visit(node.Member) ?? throw new ArgumentNullException("member")); + public override SyntaxNode? VisitNameMemberCref(NameMemberCrefSyntax node) + => node.Update((TypeSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), (CrefParameterListSyntax?)Visit(node.Parameters)); - public override SyntaxNode? VisitNameMemberCref(NameMemberCrefSyntax node) - => node.Update((TypeSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), (CrefParameterListSyntax?)Visit(node.Parameters)); + public override SyntaxNode? VisitIndexerMemberCref(IndexerMemberCrefSyntax node) + => node.Update(VisitToken(node.ThisKeyword), (CrefBracketedParameterListSyntax?)Visit(node.Parameters)); - public override SyntaxNode? VisitIndexerMemberCref(IndexerMemberCrefSyntax node) - => node.Update(VisitToken(node.ThisKeyword), (CrefBracketedParameterListSyntax?)Visit(node.Parameters)); + public override SyntaxNode? VisitOperatorMemberCref(OperatorMemberCrefSyntax node) + => node.Update(VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), VisitToken(node.OperatorToken), (CrefParameterListSyntax?)Visit(node.Parameters)); - public override SyntaxNode? VisitOperatorMemberCref(OperatorMemberCrefSyntax node) - => node.Update(VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), VisitToken(node.OperatorToken), (CrefParameterListSyntax?)Visit(node.Parameters)); + public override SyntaxNode? VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) + => node.Update(VisitToken(node.ImplicitOrExplicitKeyword), VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (CrefParameterListSyntax?)Visit(node.Parameters)); - public override SyntaxNode? VisitConversionOperatorMemberCref(ConversionOperatorMemberCrefSyntax node) - => node.Update(VisitToken(node.ImplicitOrExplicitKeyword), VisitToken(node.OperatorKeyword), VisitToken(node.CheckedKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type"), (CrefParameterListSyntax?)Visit(node.Parameters)); + public override SyntaxNode? VisitCrefParameterList(CrefParameterListSyntax node) + => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Parameters), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitCrefParameterList(CrefParameterListSyntax node) - => node.Update(VisitToken(node.OpenParenToken), VisitList(node.Parameters), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) + => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Parameters), VisitToken(node.CloseBracketToken)); - public override SyntaxNode? VisitCrefBracketedParameterList(CrefBracketedParameterListSyntax node) - => node.Update(VisitToken(node.OpenBracketToken), VisitList(node.Parameters), VisitToken(node.CloseBracketToken)); + public override SyntaxNode? VisitCrefParameter(CrefParameterSyntax node) + => node.Update(VisitToken(node.RefKindKeyword), VisitToken(node.ReadOnlyKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); - public override SyntaxNode? VisitCrefParameter(CrefParameterSyntax node) - => node.Update(VisitToken(node.RefKindKeyword), VisitToken(node.ReadOnlyKeyword), (TypeSyntax?)Visit(node.Type) ?? throw new ArgumentNullException("type")); + public override SyntaxNode? VisitXmlElement(XmlElementSyntax node) + => node.Update((XmlElementStartTagSyntax?)Visit(node.StartTag) ?? throw new ArgumentNullException("startTag"), VisitList(node.Content), (XmlElementEndTagSyntax?)Visit(node.EndTag) ?? throw new ArgumentNullException("endTag")); - public override SyntaxNode? VisitXmlElement(XmlElementSyntax node) - => node.Update((XmlElementStartTagSyntax?)Visit(node.StartTag) ?? throw new ArgumentNullException("startTag"), VisitList(node.Content), (XmlElementEndTagSyntax?)Visit(node.EndTag) ?? throw new ArgumentNullException("endTag")); + public override SyntaxNode? VisitXmlElementStartTag(XmlElementStartTagSyntax node) + => node.Update(VisitToken(node.LessThanToken), (XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitList(node.Attributes), VisitToken(node.GreaterThanToken)); - public override SyntaxNode? VisitXmlElementStartTag(XmlElementStartTagSyntax node) - => node.Update(VisitToken(node.LessThanToken), (XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitList(node.Attributes), VisitToken(node.GreaterThanToken)); + public override SyntaxNode? VisitXmlElementEndTag(XmlElementEndTagSyntax node) + => node.Update(VisitToken(node.LessThanSlashToken), (XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.GreaterThanToken)); - public override SyntaxNode? VisitXmlElementEndTag(XmlElementEndTagSyntax node) - => node.Update(VisitToken(node.LessThanSlashToken), (XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.GreaterThanToken)); + public override SyntaxNode? VisitXmlEmptyElement(XmlEmptyElementSyntax node) + => node.Update(VisitToken(node.LessThanToken), (XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitList(node.Attributes), VisitToken(node.SlashGreaterThanToken)); - public override SyntaxNode? VisitXmlEmptyElement(XmlEmptyElementSyntax node) - => node.Update(VisitToken(node.LessThanToken), (XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitList(node.Attributes), VisitToken(node.SlashGreaterThanToken)); + public override SyntaxNode? VisitXmlName(XmlNameSyntax node) + => node.Update((XmlPrefixSyntax?)Visit(node.Prefix), VisitToken(node.LocalName)); - public override SyntaxNode? VisitXmlName(XmlNameSyntax node) - => node.Update((XmlPrefixSyntax?)Visit(node.Prefix), VisitToken(node.LocalName)); + public override SyntaxNode? VisitXmlPrefix(XmlPrefixSyntax node) + => node.Update(VisitToken(node.Prefix), VisitToken(node.ColonToken)); - public override SyntaxNode? VisitXmlPrefix(XmlPrefixSyntax node) - => node.Update(VisitToken(node.Prefix), VisitToken(node.ColonToken)); + public override SyntaxNode? VisitXmlTextAttribute(XmlTextAttributeSyntax node) + => node.Update((XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.EqualsToken), VisitToken(node.StartQuoteToken), VisitList(node.TextTokens), VisitToken(node.EndQuoteToken)); - public override SyntaxNode? VisitXmlTextAttribute(XmlTextAttributeSyntax node) - => node.Update((XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.EqualsToken), VisitToken(node.StartQuoteToken), VisitList(node.TextTokens), VisitToken(node.EndQuoteToken)); + public override SyntaxNode? VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) + => node.Update((XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.EqualsToken), VisitToken(node.StartQuoteToken), (CrefSyntax?)Visit(node.Cref) ?? throw new ArgumentNullException("cref"), VisitToken(node.EndQuoteToken)); - public override SyntaxNode? VisitXmlCrefAttribute(XmlCrefAttributeSyntax node) - => node.Update((XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.EqualsToken), VisitToken(node.StartQuoteToken), (CrefSyntax?)Visit(node.Cref) ?? throw new ArgumentNullException("cref"), VisitToken(node.EndQuoteToken)); + public override SyntaxNode? VisitXmlNameAttribute(XmlNameAttributeSyntax node) + => node.Update((XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.EqualsToken), VisitToken(node.StartQuoteToken), (IdentifierNameSyntax?)Visit(node.Identifier) ?? throw new ArgumentNullException("identifier"), VisitToken(node.EndQuoteToken)); - public override SyntaxNode? VisitXmlNameAttribute(XmlNameAttributeSyntax node) - => node.Update((XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitToken(node.EqualsToken), VisitToken(node.StartQuoteToken), (IdentifierNameSyntax?)Visit(node.Identifier) ?? throw new ArgumentNullException("identifier"), VisitToken(node.EndQuoteToken)); + public override SyntaxNode? VisitXmlText(XmlTextSyntax node) + => node.Update(VisitList(node.TextTokens)); - public override SyntaxNode? VisitXmlText(XmlTextSyntax node) - => node.Update(VisitList(node.TextTokens)); + public override SyntaxNode? VisitXmlCDataSection(XmlCDataSectionSyntax node) + => node.Update(VisitToken(node.StartCDataToken), VisitList(node.TextTokens), VisitToken(node.EndCDataToken)); - public override SyntaxNode? VisitXmlCDataSection(XmlCDataSectionSyntax node) - => node.Update(VisitToken(node.StartCDataToken), VisitList(node.TextTokens), VisitToken(node.EndCDataToken)); + public override SyntaxNode? VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) + => node.Update(VisitToken(node.StartProcessingInstructionToken), (XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitList(node.TextTokens), VisitToken(node.EndProcessingInstructionToken)); - public override SyntaxNode? VisitXmlProcessingInstruction(XmlProcessingInstructionSyntax node) - => node.Update(VisitToken(node.StartProcessingInstructionToken), (XmlNameSyntax?)Visit(node.Name) ?? throw new ArgumentNullException("name"), VisitList(node.TextTokens), VisitToken(node.EndProcessingInstructionToken)); + public override SyntaxNode? VisitXmlComment(XmlCommentSyntax node) + => node.Update(VisitToken(node.LessThanExclamationMinusMinusToken), VisitList(node.TextTokens), VisitToken(node.MinusMinusGreaterThanToken)); - public override SyntaxNode? VisitXmlComment(XmlCommentSyntax node) - => node.Update(VisitToken(node.LessThanExclamationMinusMinusToken), VisitList(node.TextTokens), VisitToken(node.MinusMinusGreaterThanToken)); + public override SyntaxNode? VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.IfKeyword), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); - public override SyntaxNode? VisitIfDirectiveTrivia(IfDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.IfKeyword), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); + public override SyntaxNode? VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.ElifKeyword), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); - public override SyntaxNode? VisitElifDirectiveTrivia(ElifDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.ElifKeyword), (ExpressionSyntax?)Visit(node.Condition) ?? throw new ArgumentNullException("condition"), VisitToken(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken, node.ConditionValue); + public override SyntaxNode? VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.ElseKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken); - public override SyntaxNode? VisitElseDirectiveTrivia(ElseDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.ElseKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive, node.BranchTaken); + public override SyntaxNode? VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.EndIfKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitEndIfDirectiveTrivia(EndIfDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.EndIfKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.RegionKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.RegionKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.EndRegionKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitEndRegionDirectiveTrivia(EndRegionDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.EndRegionKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.ErrorKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitErrorDirectiveTrivia(ErrorDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.ErrorKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.WarningKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitWarningDirectiveTrivia(WarningDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.WarningKeyword), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.Identifier), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitBadDirectiveTrivia(BadDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.Identifier), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.DefineKeyword), VisitToken(node.Name), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitDefineDirectiveTrivia(DefineDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.DefineKeyword), VisitToken(node.Name), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.UndefKeyword), VisitToken(node.Name), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitUndefDirectiveTrivia(UndefDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.UndefKeyword), VisitToken(node.Name), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.LineKeyword), VisitToken(node.Line), VisitToken(node.File), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitLineDirectiveTrivia(LineDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.LineKeyword), VisitToken(node.Line), VisitToken(node.File), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitLineDirectivePosition(LineDirectivePositionSyntax node) + => node.Update(VisitToken(node.OpenParenToken), VisitToken(node.Line), VisitToken(node.CommaToken), VisitToken(node.Character), VisitToken(node.CloseParenToken)); - public override SyntaxNode? VisitLineDirectivePosition(LineDirectivePositionSyntax node) - => node.Update(VisitToken(node.OpenParenToken), VisitToken(node.Line), VisitToken(node.CommaToken), VisitToken(node.Character), VisitToken(node.CloseParenToken)); + public override SyntaxNode? VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.LineKeyword), (LineDirectivePositionSyntax?)Visit(node.Start) ?? throw new ArgumentNullException("start"), VisitToken(node.MinusToken), (LineDirectivePositionSyntax?)Visit(node.End) ?? throw new ArgumentNullException("end"), VisitToken(node.CharacterOffset), VisitToken(node.File), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitLineSpanDirectiveTrivia(LineSpanDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.LineKeyword), (LineDirectivePositionSyntax?)Visit(node.Start) ?? throw new ArgumentNullException("start"), VisitToken(node.MinusToken), (LineDirectivePositionSyntax?)Visit(node.End) ?? throw new ArgumentNullException("end"), VisitToken(node.CharacterOffset), VisitToken(node.File), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.PragmaKeyword), VisitToken(node.WarningKeyword), VisitToken(node.DisableOrRestoreKeyword), VisitList(node.ErrorCodes), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitPragmaWarningDirectiveTrivia(PragmaWarningDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.PragmaKeyword), VisitToken(node.WarningKeyword), VisitToken(node.DisableOrRestoreKeyword), VisitList(node.ErrorCodes), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.PragmaKeyword), VisitToken(node.ChecksumKeyword), VisitToken(node.File), VisitToken(node.Guid), VisitToken(node.Bytes), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitPragmaChecksumDirectiveTrivia(PragmaChecksumDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.PragmaKeyword), VisitToken(node.ChecksumKeyword), VisitToken(node.File), VisitToken(node.Guid), VisitToken(node.Bytes), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.ReferenceKeyword), VisitToken(node.File), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitReferenceDirectiveTrivia(ReferenceDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.ReferenceKeyword), VisitToken(node.File), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.LoadKeyword), VisitToken(node.File), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitLoadDirectiveTrivia(LoadDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.LoadKeyword), VisitToken(node.File), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.ExclamationToken), VisitToken(node.EndOfDirectiveToken), node.IsActive); - public override SyntaxNode? VisitShebangDirectiveTrivia(ShebangDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.ExclamationToken), VisitToken(node.EndOfDirectiveToken), node.IsActive); + public override SyntaxNode? VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) + => node.Update(VisitToken(node.HashToken), VisitToken(node.NullableKeyword), VisitToken(node.SettingToken), VisitToken(node.TargetToken), VisitToken(node.EndOfDirectiveToken), node.IsActive); +} - public override SyntaxNode? VisitNullableDirectiveTrivia(NullableDirectiveTriviaSyntax node) - => node.Update(VisitToken(node.HashToken), VisitToken(node.NullableKeyword), VisitToken(node.SettingToken), VisitToken(node.TargetToken), VisitToken(node.EndOfDirectiveToken), node.IsActive); - } +public static partial class SyntaxFactory +{ - public static partial class SyntaxFactory + /// Creates a new IdentifierNameSyntax instance. + public static IdentifierNameSyntax IdentifierName(SyntaxToken identifier) { - - /// Creates a new IdentifierNameSyntax instance. - public static IdentifierNameSyntax IdentifierName(SyntaxToken identifier) + switch (identifier.Kind()) { - switch (identifier.Kind()) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.GlobalKeyword: break; - default: throw new ArgumentException(nameof(identifier)); - } - return (IdentifierNameSyntax)Syntax.InternalSyntax.SyntaxFactory.IdentifierName((Syntax.InternalSyntax.SyntaxToken)identifier.Node!).CreateRed(); + case SyntaxKind.IdentifierToken: + case SyntaxKind.GlobalKeyword: break; + default: throw new ArgumentException(nameof(identifier)); } + return (IdentifierNameSyntax)Syntax.InternalSyntax.SyntaxFactory.IdentifierName((Syntax.InternalSyntax.SyntaxToken)identifier.Node!).CreateRed(); + } - /// Creates a new QualifiedNameSyntax instance. - public static QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) - { - if (left == null) throw new ArgumentNullException(nameof(left)); - if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - if (right == null) throw new ArgumentNullException(nameof(right)); - return (QualifiedNameSyntax)Syntax.InternalSyntax.SyntaxFactory.QualifiedName((Syntax.InternalSyntax.NameSyntax)left.Green, (Syntax.InternalSyntax.SyntaxToken)dotToken.Node!, (Syntax.InternalSyntax.SimpleNameSyntax)right.Green).CreateRed(); - } + /// Creates a new QualifiedNameSyntax instance. + public static QualifiedNameSyntax QualifiedName(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + { + if (left == null) throw new ArgumentNullException(nameof(left)); + if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (right == null) throw new ArgumentNullException(nameof(right)); + return (QualifiedNameSyntax)Syntax.InternalSyntax.SyntaxFactory.QualifiedName((Syntax.InternalSyntax.NameSyntax)left.Green, (Syntax.InternalSyntax.SyntaxToken)dotToken.Node!, (Syntax.InternalSyntax.SimpleNameSyntax)right.Green).CreateRed(); + } - /// Creates a new QualifiedNameSyntax instance. - public static QualifiedNameSyntax QualifiedName(NameSyntax left, SimpleNameSyntax right) - => SyntaxFactory.QualifiedName(left, SyntaxFactory.Token(SyntaxKind.DotToken), right); + /// Creates a new QualifiedNameSyntax instance. + public static QualifiedNameSyntax QualifiedName(NameSyntax left, SimpleNameSyntax right) + => SyntaxFactory.QualifiedName(left, SyntaxFactory.Token(SyntaxKind.DotToken), right); - /// Creates a new GenericNameSyntax instance. - public static GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) - { - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList)); - return (GenericNameSyntax)Syntax.InternalSyntax.SyntaxFactory.GenericName((Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.TypeArgumentListSyntax)typeArgumentList.Green).CreateRed(); - } + /// Creates a new GenericNameSyntax instance. + public static GenericNameSyntax GenericName(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) + { + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (typeArgumentList == null) throw new ArgumentNullException(nameof(typeArgumentList)); + return (GenericNameSyntax)Syntax.InternalSyntax.SyntaxFactory.GenericName((Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.TypeArgumentListSyntax)typeArgumentList.Green).CreateRed(); + } - /// Creates a new GenericNameSyntax instance. - public static GenericNameSyntax GenericName(SyntaxToken identifier) - => SyntaxFactory.GenericName(identifier, SyntaxFactory.TypeArgumentList()); + /// Creates a new GenericNameSyntax instance. + public static GenericNameSyntax GenericName(SyntaxToken identifier) + => SyntaxFactory.GenericName(identifier, SyntaxFactory.TypeArgumentList()); - /// Creates a new GenericNameSyntax instance. - public static GenericNameSyntax GenericName(string identifier) - => SyntaxFactory.GenericName(SyntaxFactory.Identifier(identifier), SyntaxFactory.TypeArgumentList()); + /// Creates a new GenericNameSyntax instance. + public static GenericNameSyntax GenericName(string identifier) + => SyntaxFactory.GenericName(SyntaxFactory.Identifier(identifier), SyntaxFactory.TypeArgumentList()); - /// Creates a new TypeArgumentListSyntax instance. - public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) - { - if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); - return (TypeArgumentListSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeArgumentList((Syntax.InternalSyntax.SyntaxToken)lessThanToken.Node!, arguments.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)greaterThanToken.Node!).CreateRed(); - } + /// Creates a new TypeArgumentListSyntax instance. + public static TypeArgumentListSyntax TypeArgumentList(SyntaxToken lessThanToken, SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + { + if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + return (TypeArgumentListSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeArgumentList((Syntax.InternalSyntax.SyntaxToken)lessThanToken.Node!, arguments.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)greaterThanToken.Node!).CreateRed(); + } - /// Creates a new TypeArgumentListSyntax instance. - public static TypeArgumentListSyntax TypeArgumentList(SeparatedSyntaxList arguments = default) - => SyntaxFactory.TypeArgumentList(SyntaxFactory.Token(SyntaxKind.LessThanToken), arguments, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); + /// Creates a new TypeArgumentListSyntax instance. + public static TypeArgumentListSyntax TypeArgumentList(SeparatedSyntaxList arguments = default) + => SyntaxFactory.TypeArgumentList(SyntaxFactory.Token(SyntaxKind.LessThanToken), arguments, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); - /// Creates a new AliasQualifiedNameSyntax instance. - public static AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) - { - if (alias == null) throw new ArgumentNullException(nameof(alias)); - if (colonColonToken.Kind() != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - return (AliasQualifiedNameSyntax)Syntax.InternalSyntax.SyntaxFactory.AliasQualifiedName((Syntax.InternalSyntax.IdentifierNameSyntax)alias.Green, (Syntax.InternalSyntax.SyntaxToken)colonColonToken.Node!, (Syntax.InternalSyntax.SimpleNameSyntax)name.Green).CreateRed(); - } + /// Creates a new AliasQualifiedNameSyntax instance. + public static AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + { + if (alias == null) throw new ArgumentNullException(nameof(alias)); + if (colonColonToken.Kind() != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + return (AliasQualifiedNameSyntax)Syntax.InternalSyntax.SyntaxFactory.AliasQualifiedName((Syntax.InternalSyntax.IdentifierNameSyntax)alias.Green, (Syntax.InternalSyntax.SyntaxToken)colonColonToken.Node!, (Syntax.InternalSyntax.SimpleNameSyntax)name.Green).CreateRed(); + } - /// Creates a new AliasQualifiedNameSyntax instance. - public static AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SimpleNameSyntax name) - => SyntaxFactory.AliasQualifiedName(alias, SyntaxFactory.Token(SyntaxKind.ColonColonToken), name); + /// Creates a new AliasQualifiedNameSyntax instance. + public static AliasQualifiedNameSyntax AliasQualifiedName(IdentifierNameSyntax alias, SimpleNameSyntax name) + => SyntaxFactory.AliasQualifiedName(alias, SyntaxFactory.Token(SyntaxKind.ColonColonToken), name); - /// Creates a new AliasQualifiedNameSyntax instance. - public static AliasQualifiedNameSyntax AliasQualifiedName(string alias, SimpleNameSyntax name) - => SyntaxFactory.AliasQualifiedName(SyntaxFactory.IdentifierName(alias), SyntaxFactory.Token(SyntaxKind.ColonColonToken), name); + /// Creates a new AliasQualifiedNameSyntax instance. + public static AliasQualifiedNameSyntax AliasQualifiedName(string alias, SimpleNameSyntax name) + => SyntaxFactory.AliasQualifiedName(SyntaxFactory.IdentifierName(alias), SyntaxFactory.Token(SyntaxKind.ColonColonToken), name); - /// Creates a new PredefinedTypeSyntax instance. - public static PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) - { - switch (keyword.Kind()) - { - case SyntaxKind.BoolKeyword: - case SyntaxKind.ByteKeyword: - case SyntaxKind.SByteKeyword: - case SyntaxKind.IntKeyword: - case SyntaxKind.UIntKeyword: - case SyntaxKind.ShortKeyword: - case SyntaxKind.UShortKeyword: - case SyntaxKind.LongKeyword: - case SyntaxKind.ULongKeyword: - case SyntaxKind.FloatKeyword: - case SyntaxKind.DoubleKeyword: - case SyntaxKind.DecimalKeyword: - case SyntaxKind.StringKeyword: - case SyntaxKind.CharKeyword: - case SyntaxKind.ObjectKeyword: - case SyntaxKind.VoidKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - return (PredefinedTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.PredefinedType((Syntax.InternalSyntax.SyntaxToken)keyword.Node!).CreateRed(); - } + /// Creates a new PredefinedTypeSyntax instance. + public static PredefinedTypeSyntax PredefinedType(SyntaxToken keyword) + { + switch (keyword.Kind()) + { + case SyntaxKind.BoolKeyword: + case SyntaxKind.ByteKeyword: + case SyntaxKind.SByteKeyword: + case SyntaxKind.IntKeyword: + case SyntaxKind.UIntKeyword: + case SyntaxKind.ShortKeyword: + case SyntaxKind.UShortKeyword: + case SyntaxKind.LongKeyword: + case SyntaxKind.ULongKeyword: + case SyntaxKind.FloatKeyword: + case SyntaxKind.DoubleKeyword: + case SyntaxKind.DecimalKeyword: + case SyntaxKind.StringKeyword: + case SyntaxKind.CharKeyword: + case SyntaxKind.ObjectKeyword: + case SyntaxKind.VoidKeyword: break; + default: throw new ArgumentException(nameof(keyword)); + } + return (PredefinedTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.PredefinedType((Syntax.InternalSyntax.SyntaxToken)keyword.Node!).CreateRed(); + } - /// Creates a new ArrayTypeSyntax instance. - public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, SyntaxList rankSpecifiers) - { - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - return (ArrayTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.ArrayType((Syntax.InternalSyntax.TypeSyntax)elementType.Green, rankSpecifiers.Node.ToGreenList()).CreateRed(); - } + /// Creates a new ArrayTypeSyntax instance. + public static ArrayTypeSyntax ArrayType(TypeSyntax elementType, SyntaxList rankSpecifiers) + { + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + return (ArrayTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.ArrayType((Syntax.InternalSyntax.TypeSyntax)elementType.Green, rankSpecifiers.Node.ToGreenList()).CreateRed(); + } - /// Creates a new ArrayTypeSyntax instance. - public static ArrayTypeSyntax ArrayType(TypeSyntax elementType) - => SyntaxFactory.ArrayType(elementType, default); + /// Creates a new ArrayTypeSyntax instance. + public static ArrayTypeSyntax ArrayType(TypeSyntax elementType) + => SyntaxFactory.ArrayType(elementType, default); - /// Creates a new ArrayRankSpecifierSyntax instance. - public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) - { - if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - return (ArrayRankSpecifierSyntax)Syntax.InternalSyntax.SyntaxFactory.ArrayRankSpecifier((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, sizes.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); - } + /// Creates a new ArrayRankSpecifierSyntax instance. + public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SyntaxToken openBracketToken, SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + { + if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + return (ArrayRankSpecifierSyntax)Syntax.InternalSyntax.SyntaxFactory.ArrayRankSpecifier((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, sizes.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); + } - /// Creates a new ArrayRankSpecifierSyntax instance. - public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SeparatedSyntaxList sizes = default) - => SyntaxFactory.ArrayRankSpecifier(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), sizes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); + /// Creates a new ArrayRankSpecifierSyntax instance. + public static ArrayRankSpecifierSyntax ArrayRankSpecifier(SeparatedSyntaxList sizes = default) + => SyntaxFactory.ArrayRankSpecifier(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), sizes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); - /// Creates a new PointerTypeSyntax instance. - public static PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) - { - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (asteriskToken.Kind() != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); - return (PointerTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.PointerType((Syntax.InternalSyntax.TypeSyntax)elementType.Green, (Syntax.InternalSyntax.SyntaxToken)asteriskToken.Node!).CreateRed(); - } + /// Creates a new PointerTypeSyntax instance. + public static PointerTypeSyntax PointerType(TypeSyntax elementType, SyntaxToken asteriskToken) + { + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (asteriskToken.Kind() != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); + return (PointerTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.PointerType((Syntax.InternalSyntax.TypeSyntax)elementType.Green, (Syntax.InternalSyntax.SyntaxToken)asteriskToken.Node!).CreateRed(); + } - /// Creates a new PointerTypeSyntax instance. - public static PointerTypeSyntax PointerType(TypeSyntax elementType) - => SyntaxFactory.PointerType(elementType, SyntaxFactory.Token(SyntaxKind.AsteriskToken)); + /// Creates a new PointerTypeSyntax instance. + public static PointerTypeSyntax PointerType(TypeSyntax elementType) + => SyntaxFactory.PointerType(elementType, SyntaxFactory.Token(SyntaxKind.AsteriskToken)); - /// Creates a new FunctionPointerTypeSyntax instance. - public static FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) - { - if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (asteriskToken.Kind() != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - return (FunctionPointerTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerType((Syntax.InternalSyntax.SyntaxToken)delegateKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)asteriskToken.Node!, callingConvention == null ? null : (Syntax.InternalSyntax.FunctionPointerCallingConventionSyntax)callingConvention.Green, (Syntax.InternalSyntax.FunctionPointerParameterListSyntax)parameterList.Green).CreateRed(); - } + /// Creates a new FunctionPointerTypeSyntax instance. + public static FunctionPointerTypeSyntax FunctionPointerType(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + { + if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (asteriskToken.Kind() != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + return (FunctionPointerTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerType((Syntax.InternalSyntax.SyntaxToken)delegateKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)asteriskToken.Node!, callingConvention == null ? null : (Syntax.InternalSyntax.FunctionPointerCallingConventionSyntax)callingConvention.Green, (Syntax.InternalSyntax.FunctionPointerParameterListSyntax)parameterList.Green).CreateRed(); + } - /// Creates a new FunctionPointerTypeSyntax instance. - public static FunctionPointerTypeSyntax FunctionPointerType(FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) - => SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), callingConvention, parameterList); + /// Creates a new FunctionPointerTypeSyntax instance. + public static FunctionPointerTypeSyntax FunctionPointerType(FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + => SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), callingConvention, parameterList); - /// Creates a new FunctionPointerTypeSyntax instance. - public static FunctionPointerTypeSyntax FunctionPointerType() - => SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), default, SyntaxFactory.FunctionPointerParameterList()); + /// Creates a new FunctionPointerTypeSyntax instance. + public static FunctionPointerTypeSyntax FunctionPointerType() + => SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), default, SyntaxFactory.FunctionPointerParameterList()); - /// Creates a new FunctionPointerParameterListSyntax instance. - public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { - if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); - return (FunctionPointerParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerParameterList((Syntax.InternalSyntax.SyntaxToken)lessThanToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)greaterThanToken.Node!).CreateRed(); - } + /// Creates a new FunctionPointerParameterListSyntax instance. + public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + return (FunctionPointerParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerParameterList((Syntax.InternalSyntax.SyntaxToken)lessThanToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)greaterThanToken.Node!).CreateRed(); + } - /// Creates a new FunctionPointerParameterListSyntax instance. - public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SeparatedSyntaxList parameters = default) - => SyntaxFactory.FunctionPointerParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), parameters, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); + /// Creates a new FunctionPointerParameterListSyntax instance. + public static FunctionPointerParameterListSyntax FunctionPointerParameterList(SeparatedSyntaxList parameters = default) + => SyntaxFactory.FunctionPointerParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), parameters, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); - /// Creates a new FunctionPointerCallingConventionSyntax instance. - public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + /// Creates a new FunctionPointerCallingConventionSyntax instance. + public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + { + switch (managedOrUnmanagedKeyword.Kind()) { - switch (managedOrUnmanagedKeyword.Kind()) - { - case SyntaxKind.ManagedKeyword: - case SyntaxKind.UnmanagedKeyword: break; - default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword)); - } - return (FunctionPointerCallingConventionSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerCallingConvention((Syntax.InternalSyntax.SyntaxToken)managedOrUnmanagedKeyword.Node!, unmanagedCallingConventionList == null ? null : (Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)unmanagedCallingConventionList.Green).CreateRed(); + case SyntaxKind.ManagedKeyword: + case SyntaxKind.UnmanagedKeyword: break; + default: throw new ArgumentException(nameof(managedOrUnmanagedKeyword)); } + return (FunctionPointerCallingConventionSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerCallingConvention((Syntax.InternalSyntax.SyntaxToken)managedOrUnmanagedKeyword.Node!, unmanagedCallingConventionList == null ? null : (Syntax.InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)unmanagedCallingConventionList.Green).CreateRed(); + } - /// Creates a new FunctionPointerCallingConventionSyntax instance. - public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword) - => SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, default); + /// Creates a new FunctionPointerCallingConventionSyntax instance. + public static FunctionPointerCallingConventionSyntax FunctionPointerCallingConvention(SyntaxToken managedOrUnmanagedKeyword) + => SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, default); - /// Creates a new FunctionPointerUnmanagedCallingConventionListSyntax instance. - public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) - { - if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - return (FunctionPointerUnmanagedCallingConventionListSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerUnmanagedCallingConventionList((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, callingConventions.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); - } + /// Creates a new FunctionPointerUnmanagedCallingConventionListSyntax instance. + public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SyntaxToken openBracketToken, SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + { + if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + return (FunctionPointerUnmanagedCallingConventionListSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerUnmanagedCallingConventionList((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, callingConventions.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); + } - /// Creates a new FunctionPointerUnmanagedCallingConventionListSyntax instance. - public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SeparatedSyntaxList callingConventions = default) - => SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), callingConventions, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); + /// Creates a new FunctionPointerUnmanagedCallingConventionListSyntax instance. + public static FunctionPointerUnmanagedCallingConventionListSyntax FunctionPointerUnmanagedCallingConventionList(SeparatedSyntaxList callingConventions = default) + => SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), callingConventions, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); - /// Creates a new FunctionPointerUnmanagedCallingConventionSyntax instance. - public static FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name) - { - if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - return (FunctionPointerUnmanagedCallingConventionSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerUnmanagedCallingConvention((Syntax.InternalSyntax.SyntaxToken)name.Node!).CreateRed(); - } + /// Creates a new FunctionPointerUnmanagedCallingConventionSyntax instance. + public static FunctionPointerUnmanagedCallingConventionSyntax FunctionPointerUnmanagedCallingConvention(SyntaxToken name) + { + if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + return (FunctionPointerUnmanagedCallingConventionSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerUnmanagedCallingConvention((Syntax.InternalSyntax.SyntaxToken)name.Node!).CreateRed(); + } - /// Creates a new NullableTypeSyntax instance. - public static NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) - { - if (elementType == null) throw new ArgumentNullException(nameof(elementType)); - if (questionToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); - return (NullableTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.NullableType((Syntax.InternalSyntax.TypeSyntax)elementType.Green, (Syntax.InternalSyntax.SyntaxToken)questionToken.Node!).CreateRed(); - } + /// Creates a new NullableTypeSyntax instance. + public static NullableTypeSyntax NullableType(TypeSyntax elementType, SyntaxToken questionToken) + { + if (elementType == null) throw new ArgumentNullException(nameof(elementType)); + if (questionToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); + return (NullableTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.NullableType((Syntax.InternalSyntax.TypeSyntax)elementType.Green, (Syntax.InternalSyntax.SyntaxToken)questionToken.Node!).CreateRed(); + } - /// Creates a new NullableTypeSyntax instance. - public static NullableTypeSyntax NullableType(TypeSyntax elementType) - => SyntaxFactory.NullableType(elementType, SyntaxFactory.Token(SyntaxKind.QuestionToken)); + /// Creates a new NullableTypeSyntax instance. + public static NullableTypeSyntax NullableType(TypeSyntax elementType) + => SyntaxFactory.NullableType(elementType, SyntaxFactory.Token(SyntaxKind.QuestionToken)); - /// Creates a new TupleTypeSyntax instance. - public static TupleTypeSyntax TupleType(SyntaxToken openParenToken, SeparatedSyntaxList elements, SyntaxToken closeParenToken) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (TupleTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.TupleType((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, elements.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new TupleTypeSyntax instance. + public static TupleTypeSyntax TupleType(SyntaxToken openParenToken, SeparatedSyntaxList elements, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (TupleTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.TupleType((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, elements.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new TupleTypeSyntax instance. - public static TupleTypeSyntax TupleType(SeparatedSyntaxList elements = default) - => SyntaxFactory.TupleType(SyntaxFactory.Token(SyntaxKind.OpenParenToken), elements, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new TupleTypeSyntax instance. + public static TupleTypeSyntax TupleType(SeparatedSyntaxList elements = default) + => SyntaxFactory.TupleType(SyntaxFactory.Token(SyntaxKind.OpenParenToken), elements, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new TupleElementSyntax instance. - public static TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken identifier) + /// Creates a new TupleElementSyntax instance. + public static TupleElementSyntax TupleElement(TypeSyntax type, SyntaxToken identifier) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + switch (identifier.Kind()) { - if (type == null) throw new ArgumentNullException(nameof(type)); - switch (identifier.Kind()) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(identifier)); - } - return (TupleElementSyntax)Syntax.InternalSyntax.SyntaxFactory.TupleElement((Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken?)identifier.Node).CreateRed(); + case SyntaxKind.IdentifierToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(identifier)); } + return (TupleElementSyntax)Syntax.InternalSyntax.SyntaxFactory.TupleElement((Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken?)identifier.Node).CreateRed(); + } - /// Creates a new TupleElementSyntax instance. - public static TupleElementSyntax TupleElement(TypeSyntax type) - => SyntaxFactory.TupleElement(type, default); + /// Creates a new TupleElementSyntax instance. + public static TupleElementSyntax TupleElement(TypeSyntax type) + => SyntaxFactory.TupleElement(type, default); - /// Creates a new OmittedTypeArgumentSyntax instance. - public static OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken) - { - if (omittedTypeArgumentToken.Kind() != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); - return (OmittedTypeArgumentSyntax)Syntax.InternalSyntax.SyntaxFactory.OmittedTypeArgument((Syntax.InternalSyntax.SyntaxToken)omittedTypeArgumentToken.Node!).CreateRed(); - } + /// Creates a new OmittedTypeArgumentSyntax instance. + public static OmittedTypeArgumentSyntax OmittedTypeArgument(SyntaxToken omittedTypeArgumentToken) + { + if (omittedTypeArgumentToken.Kind() != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); + return (OmittedTypeArgumentSyntax)Syntax.InternalSyntax.SyntaxFactory.OmittedTypeArgument((Syntax.InternalSyntax.SyntaxToken)omittedTypeArgumentToken.Node!).CreateRed(); + } - /// Creates a new OmittedTypeArgumentSyntax instance. - public static OmittedTypeArgumentSyntax OmittedTypeArgument() - => SyntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); + /// Creates a new OmittedTypeArgumentSyntax instance. + public static OmittedTypeArgumentSyntax OmittedTypeArgument() + => SyntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); - /// Creates a new RefTypeSyntax instance. - public static RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + /// Creates a new RefTypeSyntax instance. + public static RefTypeSyntax RefType(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + { + if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); + switch (readOnlyKeyword.Kind()) { - if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); - switch (readOnlyKeyword.Kind()) - { - case SyntaxKind.ReadOnlyKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(readOnlyKeyword)); - } - if (type == null) throw new ArgumentNullException(nameof(type)); - return (RefTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.RefType((Syntax.InternalSyntax.SyntaxToken)refKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)readOnlyKeyword.Node, (Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + case SyntaxKind.ReadOnlyKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(readOnlyKeyword)); } + if (type == null) throw new ArgumentNullException(nameof(type)); + return (RefTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.RefType((Syntax.InternalSyntax.SyntaxToken)refKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)readOnlyKeyword.Node, (Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + } - /// Creates a new RefTypeSyntax instance. - public static RefTypeSyntax RefType(TypeSyntax type) - => SyntaxFactory.RefType(SyntaxFactory.Token(SyntaxKind.RefKeyword), default, type); + /// Creates a new RefTypeSyntax instance. + public static RefTypeSyntax RefType(TypeSyntax type) + => SyntaxFactory.RefType(SyntaxFactory.Token(SyntaxKind.RefKeyword), default, type); - /// Creates a new ScopedTypeSyntax instance. - public static ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) - { - if (scopedKeyword.Kind() != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); - return (ScopedTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.ScopedType((Syntax.InternalSyntax.SyntaxToken)scopedKeyword.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); - } + /// Creates a new ScopedTypeSyntax instance. + public static ScopedTypeSyntax ScopedType(SyntaxToken scopedKeyword, TypeSyntax type) + { + if (scopedKeyword.Kind() != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); + return (ScopedTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.ScopedType((Syntax.InternalSyntax.SyntaxToken)scopedKeyword.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + } - /// Creates a new ScopedTypeSyntax instance. - public static ScopedTypeSyntax ScopedType(TypeSyntax type) - => SyntaxFactory.ScopedType(SyntaxFactory.Token(SyntaxKind.ScopedKeyword), type); + /// Creates a new ScopedTypeSyntax instance. + public static ScopedTypeSyntax ScopedType(TypeSyntax type) + => SyntaxFactory.ScopedType(SyntaxFactory.Token(SyntaxKind.ScopedKeyword), type); - /// Creates a new ParenthesizedExpressionSyntax instance. - public static ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (ParenthesizedExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ParenthesizedExpression((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new ParenthesizedExpressionSyntax instance. + public static ParenthesizedExpressionSyntax ParenthesizedExpression(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (ParenthesizedExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ParenthesizedExpression((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new ParenthesizedExpressionSyntax instance. - public static ParenthesizedExpressionSyntax ParenthesizedExpression(ExpressionSyntax expression) - => SyntaxFactory.ParenthesizedExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new ParenthesizedExpressionSyntax instance. + public static ParenthesizedExpressionSyntax ParenthesizedExpression(ExpressionSyntax expression) + => SyntaxFactory.ParenthesizedExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new TupleExpressionSyntax instance. - public static TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (TupleExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.TupleExpression((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, arguments.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new TupleExpressionSyntax instance. + public static TupleExpressionSyntax TupleExpression(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (TupleExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.TupleExpression((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, arguments.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new TupleExpressionSyntax instance. - public static TupleExpressionSyntax TupleExpression(SeparatedSyntaxList arguments = default) - => SyntaxFactory.TupleExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new TupleExpressionSyntax instance. + public static TupleExpressionSyntax TupleExpression(SeparatedSyntaxList arguments = default) + => SyntaxFactory.TupleExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new PrefixUnaryExpressionSyntax instance. - public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) - { - switch (kind) - { - case SyntaxKind.UnaryPlusExpression: - case SyntaxKind.UnaryMinusExpression: - case SyntaxKind.BitwiseNotExpression: - case SyntaxKind.LogicalNotExpression: - case SyntaxKind.PreIncrementExpression: - case SyntaxKind.PreDecrementExpression: - case SyntaxKind.AddressOfExpression: - case SyntaxKind.PointerIndirectionExpression: - case SyntaxKind.IndexExpression: break; - default: throw new ArgumentException(nameof(kind)); - } - switch (operatorToken.Kind()) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.TildeToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.CaretToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (operand == null) throw new ArgumentNullException(nameof(operand)); - return (PrefixUnaryExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.PrefixUnaryExpression(kind, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)operand.Green).CreateRed(); - } + /// Creates a new PrefixUnaryExpressionSyntax instance. + public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) + { + switch (kind) + { + case SyntaxKind.UnaryPlusExpression: + case SyntaxKind.UnaryMinusExpression: + case SyntaxKind.BitwiseNotExpression: + case SyntaxKind.LogicalNotExpression: + case SyntaxKind.PreIncrementExpression: + case SyntaxKind.PreDecrementExpression: + case SyntaxKind.AddressOfExpression: + case SyntaxKind.PointerIndirectionExpression: + case SyntaxKind.IndexExpression: break; + default: throw new ArgumentException(nameof(kind)); + } + switch (operatorToken.Kind()) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.TildeToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.CaretToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (operand == null) throw new ArgumentNullException(nameof(operand)); + return (PrefixUnaryExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.PrefixUnaryExpression(kind, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)operand.Green).CreateRed(); + } - /// Creates a new PrefixUnaryExpressionSyntax instance. - public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand) - => SyntaxFactory.PrefixUnaryExpression(kind, SyntaxFactory.Token(GetPrefixUnaryExpressionOperatorTokenKind(kind)), operand); - - private static SyntaxKind GetPrefixUnaryExpressionOperatorTokenKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.UnaryPlusExpression => SyntaxKind.PlusToken, - SyntaxKind.UnaryMinusExpression => SyntaxKind.MinusToken, - SyntaxKind.BitwiseNotExpression => SyntaxKind.TildeToken, - SyntaxKind.LogicalNotExpression => SyntaxKind.ExclamationToken, - SyntaxKind.PreIncrementExpression => SyntaxKind.PlusPlusToken, - SyntaxKind.PreDecrementExpression => SyntaxKind.MinusMinusToken, - SyntaxKind.AddressOfExpression => SyntaxKind.AmpersandToken, - SyntaxKind.PointerIndirectionExpression => SyntaxKind.AsteriskToken, - SyntaxKind.IndexExpression => SyntaxKind.CaretToken, - _ => throw new ArgumentOutOfRangeException(), - }; - - /// Creates a new AwaitExpressionSyntax instance. - public static AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression) - { - if (awaitKeyword.Kind() != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (AwaitExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.AwaitExpression((Syntax.InternalSyntax.SyntaxToken)awaitKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new PrefixUnaryExpressionSyntax instance. + public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand) + => SyntaxFactory.PrefixUnaryExpression(kind, SyntaxFactory.Token(GetPrefixUnaryExpressionOperatorTokenKind(kind)), operand); + + private static SyntaxKind GetPrefixUnaryExpressionOperatorTokenKind(SyntaxKind kind) + => kind switch + { + SyntaxKind.UnaryPlusExpression => SyntaxKind.PlusToken, + SyntaxKind.UnaryMinusExpression => SyntaxKind.MinusToken, + SyntaxKind.BitwiseNotExpression => SyntaxKind.TildeToken, + SyntaxKind.LogicalNotExpression => SyntaxKind.ExclamationToken, + SyntaxKind.PreIncrementExpression => SyntaxKind.PlusPlusToken, + SyntaxKind.PreDecrementExpression => SyntaxKind.MinusMinusToken, + SyntaxKind.AddressOfExpression => SyntaxKind.AmpersandToken, + SyntaxKind.PointerIndirectionExpression => SyntaxKind.AsteriskToken, + SyntaxKind.IndexExpression => SyntaxKind.CaretToken, + _ => throw new ArgumentOutOfRangeException(), + }; + + /// Creates a new AwaitExpressionSyntax instance. + public static AwaitExpressionSyntax AwaitExpression(SyntaxToken awaitKeyword, ExpressionSyntax expression) + { + if (awaitKeyword.Kind() != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (AwaitExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.AwaitExpression((Syntax.InternalSyntax.SyntaxToken)awaitKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new AwaitExpressionSyntax instance. - public static AwaitExpressionSyntax AwaitExpression(ExpressionSyntax expression) - => SyntaxFactory.AwaitExpression(SyntaxFactory.Token(SyntaxKind.AwaitKeyword), expression); + /// Creates a new AwaitExpressionSyntax instance. + public static AwaitExpressionSyntax AwaitExpression(ExpressionSyntax expression) + => SyntaxFactory.AwaitExpression(SyntaxFactory.Token(SyntaxKind.AwaitKeyword), expression); - /// Creates a new PostfixUnaryExpressionSyntax instance. - public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + /// Creates a new PostfixUnaryExpressionSyntax instance. + public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) + { + switch (kind) { - switch (kind) - { - case SyntaxKind.PostIncrementExpression: - case SyntaxKind.PostDecrementExpression: - case SyntaxKind.SuppressNullableWarningExpression: break; - default: throw new ArgumentException(nameof(kind)); - } - if (operand == null) throw new ArgumentNullException(nameof(operand)); - switch (operatorToken.Kind()) - { - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.ExclamationToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - return (PostfixUnaryExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.PostfixUnaryExpression(kind, (Syntax.InternalSyntax.ExpressionSyntax)operand.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!).CreateRed(); + case SyntaxKind.PostIncrementExpression: + case SyntaxKind.PostDecrementExpression: + case SyntaxKind.SuppressNullableWarningExpression: break; + default: throw new ArgumentException(nameof(kind)); } - - /// Creates a new PostfixUnaryExpressionSyntax instance. - public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand) - => SyntaxFactory.PostfixUnaryExpression(kind, operand, SyntaxFactory.Token(GetPostfixUnaryExpressionOperatorTokenKind(kind))); - - private static SyntaxKind GetPostfixUnaryExpressionOperatorTokenKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.PostIncrementExpression => SyntaxKind.PlusPlusToken, - SyntaxKind.PostDecrementExpression => SyntaxKind.MinusMinusToken, - SyntaxKind.SuppressNullableWarningExpression => SyntaxKind.ExclamationToken, - _ => throw new ArgumentOutOfRangeException(), - }; - - /// Creates a new MemberAccessExpressionSyntax instance. - public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + if (operand == null) throw new ArgumentNullException(nameof(operand)); + switch (operatorToken.Kind()) { - switch (kind) - { - case SyntaxKind.SimpleMemberAccessExpression: - case SyntaxKind.PointerMemberAccessExpression: break; - default: throw new ArgumentException(nameof(kind)); - } - if (expression == null) throw new ArgumentNullException(nameof(expression)); - switch (operatorToken.Kind()) - { - case SyntaxKind.DotToken: - case SyntaxKind.MinusGreaterThanToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (name == null) throw new ArgumentNullException(nameof(name)); - return (MemberAccessExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.MemberAccessExpression(kind, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.SimpleNameSyntax)name.Green).CreateRed(); + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.ExclamationToken: break; + default: throw new ArgumentException(nameof(operatorToken)); } + return (PostfixUnaryExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.PostfixUnaryExpression(kind, (Syntax.InternalSyntax.ExpressionSyntax)operand.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!).CreateRed(); + } - /// Creates a new MemberAccessExpressionSyntax instance. - public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SimpleNameSyntax name) - => SyntaxFactory.MemberAccessExpression(kind, expression, SyntaxFactory.Token(GetMemberAccessExpressionOperatorTokenKind(kind)), name); + /// Creates a new PostfixUnaryExpressionSyntax instance. + public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand) + => SyntaxFactory.PostfixUnaryExpression(kind, operand, SyntaxFactory.Token(GetPostfixUnaryExpressionOperatorTokenKind(kind))); - private static SyntaxKind GetMemberAccessExpressionOperatorTokenKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.SimpleMemberAccessExpression => SyntaxKind.DotToken, - SyntaxKind.PointerMemberAccessExpression => SyntaxKind.MinusGreaterThanToken, - _ => throw new ArgumentOutOfRangeException(), - }; + private static SyntaxKind GetPostfixUnaryExpressionOperatorTokenKind(SyntaxKind kind) + => kind switch + { + SyntaxKind.PostIncrementExpression => SyntaxKind.PlusPlusToken, + SyntaxKind.PostDecrementExpression => SyntaxKind.MinusMinusToken, + SyntaxKind.SuppressNullableWarningExpression => SyntaxKind.ExclamationToken, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new ConditionalAccessExpressionSyntax instance. - public static ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + /// Creates a new MemberAccessExpressionSyntax instance. + public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + { + switch (kind) { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (operatorToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); - if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull)); - return (ConditionalAccessExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ConditionalAccessExpression((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)whenNotNull.Green).CreateRed(); + case SyntaxKind.SimpleMemberAccessExpression: + case SyntaxKind.PointerMemberAccessExpression: break; + default: throw new ArgumentException(nameof(kind)); } - - /// Creates a new ConditionalAccessExpressionSyntax instance. - public static ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, ExpressionSyntax whenNotNull) - => SyntaxFactory.ConditionalAccessExpression(expression, SyntaxFactory.Token(SyntaxKind.QuestionToken), whenNotNull); - - /// Creates a new MemberBindingExpressionSyntax instance. - public static MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name) + if (expression == null) throw new ArgumentNullException(nameof(expression)); + switch (operatorToken.Kind()) { - if (operatorToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - return (MemberBindingExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.MemberBindingExpression((Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.SimpleNameSyntax)name.Green).CreateRed(); + case SyntaxKind.DotToken: + case SyntaxKind.MinusGreaterThanToken: break; + default: throw new ArgumentException(nameof(operatorToken)); } + if (name == null) throw new ArgumentNullException(nameof(name)); + return (MemberAccessExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.MemberAccessExpression(kind, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.SimpleNameSyntax)name.Green).CreateRed(); + } - /// Creates a new MemberBindingExpressionSyntax instance. - public static MemberBindingExpressionSyntax MemberBindingExpression(SimpleNameSyntax name) - => SyntaxFactory.MemberBindingExpression(SyntaxFactory.Token(SyntaxKind.DotToken), name); + /// Creates a new MemberAccessExpressionSyntax instance. + public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SimpleNameSyntax name) + => SyntaxFactory.MemberAccessExpression(kind, expression, SyntaxFactory.Token(GetMemberAccessExpressionOperatorTokenKind(kind)), name); - /// Creates a new ElementBindingExpressionSyntax instance. - public static ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList) + private static SyntaxKind GetMemberAccessExpressionOperatorTokenKind(SyntaxKind kind) + => kind switch { - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); - return (ElementBindingExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ElementBindingExpression((Syntax.InternalSyntax.BracketedArgumentListSyntax)argumentList.Green).CreateRed(); - } + SyntaxKind.SimpleMemberAccessExpression => SyntaxKind.DotToken, + SyntaxKind.PointerMemberAccessExpression => SyntaxKind.MinusGreaterThanToken, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new ElementBindingExpressionSyntax instance. - public static ElementBindingExpressionSyntax ElementBindingExpression() - => SyntaxFactory.ElementBindingExpression(SyntaxFactory.BracketedArgumentList()); + /// Creates a new ConditionalAccessExpressionSyntax instance. + public static ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (operatorToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); + if (whenNotNull == null) throw new ArgumentNullException(nameof(whenNotNull)); + return (ConditionalAccessExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ConditionalAccessExpression((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)whenNotNull.Green).CreateRed(); + } - /// Creates a new RangeExpressionSyntax instance. - public static RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) - { - if (operatorToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); - return (RangeExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.RangeExpression(leftOperand == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)leftOperand.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, rightOperand == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)rightOperand.Green).CreateRed(); - } + /// Creates a new ConditionalAccessExpressionSyntax instance. + public static ConditionalAccessExpressionSyntax ConditionalAccessExpression(ExpressionSyntax expression, ExpressionSyntax whenNotNull) + => SyntaxFactory.ConditionalAccessExpression(expression, SyntaxFactory.Token(SyntaxKind.QuestionToken), whenNotNull); - /// Creates a new RangeExpressionSyntax instance. - public static RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, ExpressionSyntax? rightOperand) - => SyntaxFactory.RangeExpression(leftOperand, SyntaxFactory.Token(SyntaxKind.DotDotToken), rightOperand); + /// Creates a new MemberBindingExpressionSyntax instance. + public static MemberBindingExpressionSyntax MemberBindingExpression(SyntaxToken operatorToken, SimpleNameSyntax name) + { + if (operatorToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + return (MemberBindingExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.MemberBindingExpression((Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.SimpleNameSyntax)name.Green).CreateRed(); + } - /// Creates a new RangeExpressionSyntax instance. - public static RangeExpressionSyntax RangeExpression() - => SyntaxFactory.RangeExpression(default, SyntaxFactory.Token(SyntaxKind.DotDotToken), default); + /// Creates a new MemberBindingExpressionSyntax instance. + public static MemberBindingExpressionSyntax MemberBindingExpression(SimpleNameSyntax name) + => SyntaxFactory.MemberBindingExpression(SyntaxFactory.Token(SyntaxKind.DotToken), name); - /// Creates a new ImplicitElementAccessSyntax instance. - public static ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList) - { - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); - return (ImplicitElementAccessSyntax)Syntax.InternalSyntax.SyntaxFactory.ImplicitElementAccess((Syntax.InternalSyntax.BracketedArgumentListSyntax)argumentList.Green).CreateRed(); - } + /// Creates a new ElementBindingExpressionSyntax instance. + public static ElementBindingExpressionSyntax ElementBindingExpression(BracketedArgumentListSyntax argumentList) + { + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + return (ElementBindingExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ElementBindingExpression((Syntax.InternalSyntax.BracketedArgumentListSyntax)argumentList.Green).CreateRed(); + } - /// Creates a new ImplicitElementAccessSyntax instance. - public static ImplicitElementAccessSyntax ImplicitElementAccess() - => SyntaxFactory.ImplicitElementAccess(SyntaxFactory.BracketedArgumentList()); + /// Creates a new ElementBindingExpressionSyntax instance. + public static ElementBindingExpressionSyntax ElementBindingExpression() + => SyntaxFactory.ElementBindingExpression(SyntaxFactory.BracketedArgumentList()); - /// Creates a new BinaryExpressionSyntax instance. - public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) - { - switch (kind) - { - case SyntaxKind.AddExpression: - case SyntaxKind.SubtractExpression: - case SyntaxKind.MultiplyExpression: - case SyntaxKind.DivideExpression: - case SyntaxKind.ModuloExpression: - case SyntaxKind.LeftShiftExpression: - case SyntaxKind.RightShiftExpression: - case SyntaxKind.UnsignedRightShiftExpression: - case SyntaxKind.LogicalOrExpression: - case SyntaxKind.LogicalAndExpression: - case SyntaxKind.BitwiseOrExpression: - case SyntaxKind.BitwiseAndExpression: - case SyntaxKind.ExclusiveOrExpression: - case SyntaxKind.EqualsExpression: - case SyntaxKind.NotEqualsExpression: - case SyntaxKind.LessThanExpression: - case SyntaxKind.LessThanOrEqualExpression: - case SyntaxKind.GreaterThanExpression: - case SyntaxKind.GreaterThanOrEqualExpression: - case SyntaxKind.IsExpression: - case SyntaxKind.AsExpression: - case SyntaxKind.CoalesceExpression: break; - default: throw new ArgumentException(nameof(kind)); - } - if (left == null) throw new ArgumentNullException(nameof(left)); - switch (operatorToken.Kind()) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarBarToken: - case SyntaxKind.AmpersandAmpersandToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.IsKeyword: - case SyntaxKind.AsKeyword: - case SyntaxKind.QuestionQuestionToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); - return (BinaryExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.BinaryExpression(kind, (Syntax.InternalSyntax.ExpressionSyntax)left.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)right.Green).CreateRed(); - } + /// Creates a new RangeExpressionSyntax instance. + public static RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) + { + if (operatorToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); + return (RangeExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.RangeExpression(leftOperand == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)leftOperand.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, rightOperand == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)rightOperand.Green).CreateRed(); + } - /// Creates a new BinaryExpressionSyntax instance. - public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, ExpressionSyntax right) - => SyntaxFactory.BinaryExpression(kind, left, SyntaxFactory.Token(GetBinaryExpressionOperatorTokenKind(kind)), right); - - private static SyntaxKind GetBinaryExpressionOperatorTokenKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.AddExpression => SyntaxKind.PlusToken, - SyntaxKind.SubtractExpression => SyntaxKind.MinusToken, - SyntaxKind.MultiplyExpression => SyntaxKind.AsteriskToken, - SyntaxKind.DivideExpression => SyntaxKind.SlashToken, - SyntaxKind.ModuloExpression => SyntaxKind.PercentToken, - SyntaxKind.LeftShiftExpression => SyntaxKind.LessThanLessThanToken, - SyntaxKind.RightShiftExpression => SyntaxKind.GreaterThanGreaterThanToken, - SyntaxKind.UnsignedRightShiftExpression => SyntaxKind.GreaterThanGreaterThanGreaterThanToken, - SyntaxKind.LogicalOrExpression => SyntaxKind.BarBarToken, - SyntaxKind.LogicalAndExpression => SyntaxKind.AmpersandAmpersandToken, - SyntaxKind.BitwiseOrExpression => SyntaxKind.BarToken, - SyntaxKind.BitwiseAndExpression => SyntaxKind.AmpersandToken, - SyntaxKind.ExclusiveOrExpression => SyntaxKind.CaretToken, - SyntaxKind.EqualsExpression => SyntaxKind.EqualsEqualsToken, - SyntaxKind.NotEqualsExpression => SyntaxKind.ExclamationEqualsToken, - SyntaxKind.LessThanExpression => SyntaxKind.LessThanToken, - SyntaxKind.LessThanOrEqualExpression => SyntaxKind.LessThanEqualsToken, - SyntaxKind.GreaterThanExpression => SyntaxKind.GreaterThanToken, - SyntaxKind.GreaterThanOrEqualExpression => SyntaxKind.GreaterThanEqualsToken, - SyntaxKind.IsExpression => SyntaxKind.IsKeyword, - SyntaxKind.AsExpression => SyntaxKind.AsKeyword, - SyntaxKind.CoalesceExpression => SyntaxKind.QuestionQuestionToken, - _ => throw new ArgumentOutOfRangeException(), - }; - - /// Creates a new AssignmentExpressionSyntax instance. - public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) - { - switch (kind) - { - case SyntaxKind.SimpleAssignmentExpression: - case SyntaxKind.AddAssignmentExpression: - case SyntaxKind.SubtractAssignmentExpression: - case SyntaxKind.MultiplyAssignmentExpression: - case SyntaxKind.DivideAssignmentExpression: - case SyntaxKind.ModuloAssignmentExpression: - case SyntaxKind.AndAssignmentExpression: - case SyntaxKind.ExclusiveOrAssignmentExpression: - case SyntaxKind.OrAssignmentExpression: - case SyntaxKind.LeftShiftAssignmentExpression: - case SyntaxKind.RightShiftAssignmentExpression: - case SyntaxKind.UnsignedRightShiftAssignmentExpression: - case SyntaxKind.CoalesceAssignmentExpression: break; - default: throw new ArgumentException(nameof(kind)); - } - if (left == null) throw new ArgumentNullException(nameof(left)); - switch (operatorToken.Kind()) - { - case SyntaxKind.EqualsToken: - case SyntaxKind.PlusEqualsToken: - case SyntaxKind.MinusEqualsToken: - case SyntaxKind.AsteriskEqualsToken: - case SyntaxKind.SlashEqualsToken: - case SyntaxKind.PercentEqualsToken: - case SyntaxKind.AmpersandEqualsToken: - case SyntaxKind.CaretEqualsToken: - case SyntaxKind.BarEqualsToken: - case SyntaxKind.LessThanLessThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: - case SyntaxKind.QuestionQuestionEqualsToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); - return (AssignmentExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.AssignmentExpression(kind, (Syntax.InternalSyntax.ExpressionSyntax)left.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)right.Green).CreateRed(); - } + /// Creates a new RangeExpressionSyntax instance. + public static RangeExpressionSyntax RangeExpression(ExpressionSyntax? leftOperand, ExpressionSyntax? rightOperand) + => SyntaxFactory.RangeExpression(leftOperand, SyntaxFactory.Token(SyntaxKind.DotDotToken), rightOperand); - /// Creates a new AssignmentExpressionSyntax instance. - public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, ExpressionSyntax right) - => SyntaxFactory.AssignmentExpression(kind, left, SyntaxFactory.Token(GetAssignmentExpressionOperatorTokenKind(kind)), right); - - private static SyntaxKind GetAssignmentExpressionOperatorTokenKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.SimpleAssignmentExpression => SyntaxKind.EqualsToken, - SyntaxKind.AddAssignmentExpression => SyntaxKind.PlusEqualsToken, - SyntaxKind.SubtractAssignmentExpression => SyntaxKind.MinusEqualsToken, - SyntaxKind.MultiplyAssignmentExpression => SyntaxKind.AsteriskEqualsToken, - SyntaxKind.DivideAssignmentExpression => SyntaxKind.SlashEqualsToken, - SyntaxKind.ModuloAssignmentExpression => SyntaxKind.PercentEqualsToken, - SyntaxKind.AndAssignmentExpression => SyntaxKind.AmpersandEqualsToken, - SyntaxKind.ExclusiveOrAssignmentExpression => SyntaxKind.CaretEqualsToken, - SyntaxKind.OrAssignmentExpression => SyntaxKind.BarEqualsToken, - SyntaxKind.LeftShiftAssignmentExpression => SyntaxKind.LessThanLessThanEqualsToken, - SyntaxKind.RightShiftAssignmentExpression => SyntaxKind.GreaterThanGreaterThanEqualsToken, - SyntaxKind.UnsignedRightShiftAssignmentExpression => SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, - SyntaxKind.CoalesceAssignmentExpression => SyntaxKind.QuestionQuestionEqualsToken, - _ => throw new ArgumentOutOfRangeException(), - }; - - /// Creates a new ConditionalExpressionSyntax instance. - public static ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) - { - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (questionToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); - if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue)); - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse)); - return (ConditionalExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ConditionalExpression((Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)questionToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)whenTrue.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)whenFalse.Green).CreateRed(); - } + /// Creates a new RangeExpressionSyntax instance. + public static RangeExpressionSyntax RangeExpression() + => SyntaxFactory.RangeExpression(default, SyntaxFactory.Token(SyntaxKind.DotDotToken), default); - /// Creates a new ConditionalExpressionSyntax instance. - public static ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, ExpressionSyntax whenTrue, ExpressionSyntax whenFalse) - => SyntaxFactory.ConditionalExpression(condition, SyntaxFactory.Token(SyntaxKind.QuestionToken), whenTrue, SyntaxFactory.Token(SyntaxKind.ColonToken), whenFalse); + /// Creates a new ImplicitElementAccessSyntax instance. + public static ImplicitElementAccessSyntax ImplicitElementAccess(BracketedArgumentListSyntax argumentList) + { + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + return (ImplicitElementAccessSyntax)Syntax.InternalSyntax.SyntaxFactory.ImplicitElementAccess((Syntax.InternalSyntax.BracketedArgumentListSyntax)argumentList.Green).CreateRed(); + } - /// Creates a new ThisExpressionSyntax instance. - public static ThisExpressionSyntax ThisExpression(SyntaxToken token) - { - if (token.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); - return (ThisExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ThisExpression((Syntax.InternalSyntax.SyntaxToken)token.Node!).CreateRed(); - } + /// Creates a new ImplicitElementAccessSyntax instance. + public static ImplicitElementAccessSyntax ImplicitElementAccess() + => SyntaxFactory.ImplicitElementAccess(SyntaxFactory.BracketedArgumentList()); - /// Creates a new ThisExpressionSyntax instance. - public static ThisExpressionSyntax ThisExpression() - => SyntaxFactory.ThisExpression(SyntaxFactory.Token(SyntaxKind.ThisKeyword)); + /// Creates a new BinaryExpressionSyntax instance. + public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + switch (kind) + { + case SyntaxKind.AddExpression: + case SyntaxKind.SubtractExpression: + case SyntaxKind.MultiplyExpression: + case SyntaxKind.DivideExpression: + case SyntaxKind.ModuloExpression: + case SyntaxKind.LeftShiftExpression: + case SyntaxKind.RightShiftExpression: + case SyntaxKind.UnsignedRightShiftExpression: + case SyntaxKind.LogicalOrExpression: + case SyntaxKind.LogicalAndExpression: + case SyntaxKind.BitwiseOrExpression: + case SyntaxKind.BitwiseAndExpression: + case SyntaxKind.ExclusiveOrExpression: + case SyntaxKind.EqualsExpression: + case SyntaxKind.NotEqualsExpression: + case SyntaxKind.LessThanExpression: + case SyntaxKind.LessThanOrEqualExpression: + case SyntaxKind.GreaterThanExpression: + case SyntaxKind.GreaterThanOrEqualExpression: + case SyntaxKind.IsExpression: + case SyntaxKind.AsExpression: + case SyntaxKind.CoalesceExpression: break; + default: throw new ArgumentException(nameof(kind)); + } + if (left == null) throw new ArgumentNullException(nameof(left)); + switch (operatorToken.Kind()) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarBarToken: + case SyntaxKind.AmpersandAmpersandToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.IsKeyword: + case SyntaxKind.AsKeyword: + case SyntaxKind.QuestionQuestionToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); + return (BinaryExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.BinaryExpression(kind, (Syntax.InternalSyntax.ExpressionSyntax)left.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)right.Green).CreateRed(); + } - /// Creates a new BaseExpressionSyntax instance. - public static BaseExpressionSyntax BaseExpression(SyntaxToken token) - { - if (token.Kind() != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); - return (BaseExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.BaseExpression((Syntax.InternalSyntax.SyntaxToken)token.Node!).CreateRed(); - } + /// Creates a new BinaryExpressionSyntax instance. + public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, ExpressionSyntax right) + => SyntaxFactory.BinaryExpression(kind, left, SyntaxFactory.Token(GetBinaryExpressionOperatorTokenKind(kind)), right); + + private static SyntaxKind GetBinaryExpressionOperatorTokenKind(SyntaxKind kind) + => kind switch + { + SyntaxKind.AddExpression => SyntaxKind.PlusToken, + SyntaxKind.SubtractExpression => SyntaxKind.MinusToken, + SyntaxKind.MultiplyExpression => SyntaxKind.AsteriskToken, + SyntaxKind.DivideExpression => SyntaxKind.SlashToken, + SyntaxKind.ModuloExpression => SyntaxKind.PercentToken, + SyntaxKind.LeftShiftExpression => SyntaxKind.LessThanLessThanToken, + SyntaxKind.RightShiftExpression => SyntaxKind.GreaterThanGreaterThanToken, + SyntaxKind.UnsignedRightShiftExpression => SyntaxKind.GreaterThanGreaterThanGreaterThanToken, + SyntaxKind.LogicalOrExpression => SyntaxKind.BarBarToken, + SyntaxKind.LogicalAndExpression => SyntaxKind.AmpersandAmpersandToken, + SyntaxKind.BitwiseOrExpression => SyntaxKind.BarToken, + SyntaxKind.BitwiseAndExpression => SyntaxKind.AmpersandToken, + SyntaxKind.ExclusiveOrExpression => SyntaxKind.CaretToken, + SyntaxKind.EqualsExpression => SyntaxKind.EqualsEqualsToken, + SyntaxKind.NotEqualsExpression => SyntaxKind.ExclamationEqualsToken, + SyntaxKind.LessThanExpression => SyntaxKind.LessThanToken, + SyntaxKind.LessThanOrEqualExpression => SyntaxKind.LessThanEqualsToken, + SyntaxKind.GreaterThanExpression => SyntaxKind.GreaterThanToken, + SyntaxKind.GreaterThanOrEqualExpression => SyntaxKind.GreaterThanEqualsToken, + SyntaxKind.IsExpression => SyntaxKind.IsKeyword, + SyntaxKind.AsExpression => SyntaxKind.AsKeyword, + SyntaxKind.CoalesceExpression => SyntaxKind.QuestionQuestionToken, + _ => throw new ArgumentOutOfRangeException(), + }; + + /// Creates a new AssignmentExpressionSyntax instance. + public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + switch (kind) + { + case SyntaxKind.SimpleAssignmentExpression: + case SyntaxKind.AddAssignmentExpression: + case SyntaxKind.SubtractAssignmentExpression: + case SyntaxKind.MultiplyAssignmentExpression: + case SyntaxKind.DivideAssignmentExpression: + case SyntaxKind.ModuloAssignmentExpression: + case SyntaxKind.AndAssignmentExpression: + case SyntaxKind.ExclusiveOrAssignmentExpression: + case SyntaxKind.OrAssignmentExpression: + case SyntaxKind.LeftShiftAssignmentExpression: + case SyntaxKind.RightShiftAssignmentExpression: + case SyntaxKind.UnsignedRightShiftAssignmentExpression: + case SyntaxKind.CoalesceAssignmentExpression: break; + default: throw new ArgumentException(nameof(kind)); + } + if (left == null) throw new ArgumentNullException(nameof(left)); + switch (operatorToken.Kind()) + { + case SyntaxKind.EqualsToken: + case SyntaxKind.PlusEqualsToken: + case SyntaxKind.MinusEqualsToken: + case SyntaxKind.AsteriskEqualsToken: + case SyntaxKind.SlashEqualsToken: + case SyntaxKind.PercentEqualsToken: + case SyntaxKind.AmpersandEqualsToken: + case SyntaxKind.CaretEqualsToken: + case SyntaxKind.BarEqualsToken: + case SyntaxKind.LessThanLessThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + case SyntaxKind.QuestionQuestionEqualsToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (right == null) throw new ArgumentNullException(nameof(right)); + return (AssignmentExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.AssignmentExpression(kind, (Syntax.InternalSyntax.ExpressionSyntax)left.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)right.Green).CreateRed(); + } - /// Creates a new BaseExpressionSyntax instance. - public static BaseExpressionSyntax BaseExpression() - => SyntaxFactory.BaseExpression(SyntaxFactory.Token(SyntaxKind.BaseKeyword)); + /// Creates a new AssignmentExpressionSyntax instance. + public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, ExpressionSyntax right) + => SyntaxFactory.AssignmentExpression(kind, left, SyntaxFactory.Token(GetAssignmentExpressionOperatorTokenKind(kind)), right); + + private static SyntaxKind GetAssignmentExpressionOperatorTokenKind(SyntaxKind kind) + => kind switch + { + SyntaxKind.SimpleAssignmentExpression => SyntaxKind.EqualsToken, + SyntaxKind.AddAssignmentExpression => SyntaxKind.PlusEqualsToken, + SyntaxKind.SubtractAssignmentExpression => SyntaxKind.MinusEqualsToken, + SyntaxKind.MultiplyAssignmentExpression => SyntaxKind.AsteriskEqualsToken, + SyntaxKind.DivideAssignmentExpression => SyntaxKind.SlashEqualsToken, + SyntaxKind.ModuloAssignmentExpression => SyntaxKind.PercentEqualsToken, + SyntaxKind.AndAssignmentExpression => SyntaxKind.AmpersandEqualsToken, + SyntaxKind.ExclusiveOrAssignmentExpression => SyntaxKind.CaretEqualsToken, + SyntaxKind.OrAssignmentExpression => SyntaxKind.BarEqualsToken, + SyntaxKind.LeftShiftAssignmentExpression => SyntaxKind.LessThanLessThanEqualsToken, + SyntaxKind.RightShiftAssignmentExpression => SyntaxKind.GreaterThanGreaterThanEqualsToken, + SyntaxKind.UnsignedRightShiftAssignmentExpression => SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, + SyntaxKind.CoalesceAssignmentExpression => SyntaxKind.QuestionQuestionEqualsToken, + _ => throw new ArgumentOutOfRangeException(), + }; + + /// Creates a new ConditionalExpressionSyntax instance. + public static ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + { + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (questionToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); + if (whenTrue == null) throw new ArgumentNullException(nameof(whenTrue)); + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (whenFalse == null) throw new ArgumentNullException(nameof(whenFalse)); + return (ConditionalExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ConditionalExpression((Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)questionToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)whenTrue.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)whenFalse.Green).CreateRed(); + } - /// Creates a new LiteralExpressionSyntax instance. - public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) - { - switch (kind) - { - case SyntaxKind.ArgListExpression: - case SyntaxKind.NumericLiteralExpression: - case SyntaxKind.StringLiteralExpression: - case SyntaxKind.Utf8StringLiteralExpression: - case SyntaxKind.CharacterLiteralExpression: - case SyntaxKind.TrueLiteralExpression: - case SyntaxKind.FalseLiteralExpression: - case SyntaxKind.NullLiteralExpression: - case SyntaxKind.DefaultLiteralExpression: break; - default: throw new ArgumentException(nameof(kind)); - } - switch (token.Kind()) - { - case SyntaxKind.ArgListKeyword: - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.StringLiteralToken: - case SyntaxKind.Utf8StringLiteralToken: - case SyntaxKind.MultiLineRawStringLiteralToken: - case SyntaxKind.Utf8MultiLineRawStringLiteralToken: - case SyntaxKind.SingleLineRawStringLiteralToken: - case SyntaxKind.Utf8SingleLineRawStringLiteralToken: - case SyntaxKind.CharacterLiteralToken: - case SyntaxKind.TrueKeyword: - case SyntaxKind.FalseKeyword: - case SyntaxKind.NullKeyword: - case SyntaxKind.DefaultKeyword: break; - default: throw new ArgumentException(nameof(token)); - } - return (LiteralExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.LiteralExpression(kind, (Syntax.InternalSyntax.SyntaxToken)token.Node!).CreateRed(); - } + /// Creates a new ConditionalExpressionSyntax instance. + public static ConditionalExpressionSyntax ConditionalExpression(ExpressionSyntax condition, ExpressionSyntax whenTrue, ExpressionSyntax whenFalse) + => SyntaxFactory.ConditionalExpression(condition, SyntaxFactory.Token(SyntaxKind.QuestionToken), whenTrue, SyntaxFactory.Token(SyntaxKind.ColonToken), whenFalse); - /// Creates a new MakeRefExpressionSyntax instance. - public static MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword.Kind() != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (MakeRefExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.MakeRefExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new ThisExpressionSyntax instance. + public static ThisExpressionSyntax ThisExpression(SyntaxToken token) + { + if (token.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); + return (ThisExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ThisExpression((Syntax.InternalSyntax.SyntaxToken)token.Node!).CreateRed(); + } - /// Creates a new MakeRefExpressionSyntax instance. - public static MakeRefExpressionSyntax MakeRefExpression(ExpressionSyntax expression) - => SyntaxFactory.MakeRefExpression(SyntaxFactory.Token(SyntaxKind.MakeRefKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new ThisExpressionSyntax instance. + public static ThisExpressionSyntax ThisExpression() + => SyntaxFactory.ThisExpression(SyntaxFactory.Token(SyntaxKind.ThisKeyword)); - /// Creates a new RefTypeExpressionSyntax instance. - public static RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword.Kind() != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (RefTypeExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.RefTypeExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new BaseExpressionSyntax instance. + public static BaseExpressionSyntax BaseExpression(SyntaxToken token) + { + if (token.Kind() != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); + return (BaseExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.BaseExpression((Syntax.InternalSyntax.SyntaxToken)token.Node!).CreateRed(); + } - /// Creates a new RefTypeExpressionSyntax instance. - public static RefTypeExpressionSyntax RefTypeExpression(ExpressionSyntax expression) - => SyntaxFactory.RefTypeExpression(SyntaxFactory.Token(SyntaxKind.RefTypeKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new BaseExpressionSyntax instance. + public static BaseExpressionSyntax BaseExpression() + => SyntaxFactory.BaseExpression(SyntaxFactory.Token(SyntaxKind.BaseKeyword)); - /// Creates a new RefValueExpressionSyntax instance. - public static RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) - { - if (keyword.Kind() != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (comma.Kind() != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (RefValueExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.RefValueExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)comma.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new LiteralExpressionSyntax instance. + public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) + { + switch (kind) + { + case SyntaxKind.ArgListExpression: + case SyntaxKind.NumericLiteralExpression: + case SyntaxKind.StringLiteralExpression: + case SyntaxKind.Utf8StringLiteralExpression: + case SyntaxKind.CharacterLiteralExpression: + case SyntaxKind.TrueLiteralExpression: + case SyntaxKind.FalseLiteralExpression: + case SyntaxKind.NullLiteralExpression: + case SyntaxKind.DefaultLiteralExpression: break; + default: throw new ArgumentException(nameof(kind)); + } + switch (token.Kind()) + { + case SyntaxKind.ArgListKeyword: + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.StringLiteralToken: + case SyntaxKind.Utf8StringLiteralToken: + case SyntaxKind.MultiLineRawStringLiteralToken: + case SyntaxKind.Utf8MultiLineRawStringLiteralToken: + case SyntaxKind.SingleLineRawStringLiteralToken: + case SyntaxKind.Utf8SingleLineRawStringLiteralToken: + case SyntaxKind.CharacterLiteralToken: + case SyntaxKind.TrueKeyword: + case SyntaxKind.FalseKeyword: + case SyntaxKind.NullKeyword: + case SyntaxKind.DefaultKeyword: break; + default: throw new ArgumentException(nameof(token)); + } + return (LiteralExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.LiteralExpression(kind, (Syntax.InternalSyntax.SyntaxToken)token.Node!).CreateRed(); + } - /// Creates a new RefValueExpressionSyntax instance. - public static RefValueExpressionSyntax RefValueExpression(ExpressionSyntax expression, TypeSyntax type) - => SyntaxFactory.RefValueExpression(SyntaxFactory.Token(SyntaxKind.RefValueKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CommaToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new MakeRefExpressionSyntax instance. + public static MakeRefExpressionSyntax MakeRefExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword.Kind() != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (MakeRefExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.MakeRefExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new CheckedExpressionSyntax instance. - public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - switch (kind) - { - case SyntaxKind.CheckedExpression: - case SyntaxKind.UncheckedExpression: break; - default: throw new ArgumentException(nameof(kind)); - } - switch (keyword.Kind()) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.UncheckedKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (CheckedExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.CheckedExpression(kind, (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new MakeRefExpressionSyntax instance. + public static MakeRefExpressionSyntax MakeRefExpression(ExpressionSyntax expression) + => SyntaxFactory.MakeRefExpression(SyntaxFactory.Token(SyntaxKind.MakeRefKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new CheckedExpressionSyntax instance. - public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, ExpressionSyntax expression) - => SyntaxFactory.CheckedExpression(kind, SyntaxFactory.Token(GetCheckedExpressionKeywordKind(kind)), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new RefTypeExpressionSyntax instance. + public static RefTypeExpressionSyntax RefTypeExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword.Kind() != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (RefTypeExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.RefTypeExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - private static SyntaxKind GetCheckedExpressionKeywordKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.CheckedExpression => SyntaxKind.CheckedKeyword, - SyntaxKind.UncheckedExpression => SyntaxKind.UncheckedKeyword, - _ => throw new ArgumentOutOfRangeException(), - }; + /// Creates a new RefTypeExpressionSyntax instance. + public static RefTypeExpressionSyntax RefTypeExpression(ExpressionSyntax expression) + => SyntaxFactory.RefTypeExpression(SyntaxFactory.Token(SyntaxKind.RefTypeKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new DefaultExpressionSyntax instance. - public static DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { - if (keyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (DefaultExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.DefaultExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new RefValueExpressionSyntax instance. + public static RefValueExpressionSyntax RefValueExpression(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword.Kind() != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (comma.Kind() != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (RefValueExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.RefValueExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)comma.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new DefaultExpressionSyntax instance. - public static DefaultExpressionSyntax DefaultExpression(TypeSyntax type) - => SyntaxFactory.DefaultExpression(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new RefValueExpressionSyntax instance. + public static RefValueExpressionSyntax RefValueExpression(ExpressionSyntax expression, TypeSyntax type) + => SyntaxFactory.RefValueExpression(SyntaxFactory.Token(SyntaxKind.RefValueKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CommaToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new TypeOfExpressionSyntax instance. - public static TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + /// Creates a new CheckedExpressionSyntax instance. + public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + switch (kind) { - if (keyword.Kind() != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (TypeOfExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeOfExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + case SyntaxKind.CheckedExpression: + case SyntaxKind.UncheckedExpression: break; + default: throw new ArgumentException(nameof(kind)); } - - /// Creates a new TypeOfExpressionSyntax instance. - public static TypeOfExpressionSyntax TypeOfExpression(TypeSyntax type) - => SyntaxFactory.TypeOfExpression(SyntaxFactory.Token(SyntaxKind.TypeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - - /// Creates a new SizeOfExpressionSyntax instance. - public static SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + switch (keyword.Kind()) { - if (keyword.Kind() != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (SizeOfExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.SizeOfExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.UncheckedKeyword: break; + default: throw new ArgumentException(nameof(keyword)); } + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (CheckedExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.CheckedExpression(kind, (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new SizeOfExpressionSyntax instance. - public static SizeOfExpressionSyntax SizeOfExpression(TypeSyntax type) - => SyntaxFactory.SizeOfExpression(SyntaxFactory.Token(SyntaxKind.SizeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new CheckedExpressionSyntax instance. + public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, ExpressionSyntax expression) + => SyntaxFactory.CheckedExpression(kind, SyntaxFactory.Token(GetCheckedExpressionKeywordKind(kind)), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new InvocationExpressionSyntax instance. - public static InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList) + private static SyntaxKind GetCheckedExpressionKeywordKind(SyntaxKind kind) + => kind switch { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); - return (InvocationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.InvocationExpression((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.ArgumentListSyntax)argumentList.Green).CreateRed(); - } + SyntaxKind.CheckedExpression => SyntaxKind.CheckedKeyword, + SyntaxKind.UncheckedExpression => SyntaxKind.UncheckedKeyword, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new InvocationExpressionSyntax instance. - public static InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression) - => SyntaxFactory.InvocationExpression(expression, SyntaxFactory.ArgumentList()); + /// Creates a new DefaultExpressionSyntax instance. + public static DefaultExpressionSyntax DefaultExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (DefaultExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.DefaultExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new ElementAccessExpressionSyntax instance. - public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); - return (ElementAccessExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ElementAccessExpression((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.BracketedArgumentListSyntax)argumentList.Green).CreateRed(); - } + /// Creates a new DefaultExpressionSyntax instance. + public static DefaultExpressionSyntax DefaultExpression(TypeSyntax type) + => SyntaxFactory.DefaultExpression(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new ElementAccessExpressionSyntax instance. - public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression) - => SyntaxFactory.ElementAccessExpression(expression, SyntaxFactory.BracketedArgumentList()); + /// Creates a new TypeOfExpressionSyntax instance. + public static TypeOfExpressionSyntax TypeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword.Kind() != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (TypeOfExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeOfExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new ArgumentListSyntax instance. - public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (ArgumentListSyntax)Syntax.InternalSyntax.SyntaxFactory.ArgumentList((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, arguments.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new TypeOfExpressionSyntax instance. + public static TypeOfExpressionSyntax TypeOfExpression(TypeSyntax type) + => SyntaxFactory.TypeOfExpression(SyntaxFactory.Token(SyntaxKind.TypeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new ArgumentListSyntax instance. - public static ArgumentListSyntax ArgumentList(SeparatedSyntaxList arguments = default) - => SyntaxFactory.ArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new SizeOfExpressionSyntax instance. + public static SizeOfExpressionSyntax SizeOfExpression(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword.Kind() != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (SizeOfExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.SizeOfExpression((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new BracketedArgumentListSyntax instance. - public static BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) - { - if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - return (BracketedArgumentListSyntax)Syntax.InternalSyntax.SyntaxFactory.BracketedArgumentList((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, arguments.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); - } + /// Creates a new SizeOfExpressionSyntax instance. + public static SizeOfExpressionSyntax SizeOfExpression(TypeSyntax type) + => SyntaxFactory.SizeOfExpression(SyntaxFactory.Token(SyntaxKind.SizeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new BracketedArgumentListSyntax instance. - public static BracketedArgumentListSyntax BracketedArgumentList(SeparatedSyntaxList arguments = default) - => SyntaxFactory.BracketedArgumentList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); + /// Creates a new InvocationExpressionSyntax instance. + public static InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression, ArgumentListSyntax argumentList) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + return (InvocationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.InvocationExpression((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.ArgumentListSyntax)argumentList.Green).CreateRed(); + } - /// Creates a new ArgumentSyntax instance. - public static ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) - { - switch (refKindKeyword.Kind()) - { - case SyntaxKind.RefKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.InKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(refKindKeyword)); - } - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (ArgumentSyntax)Syntax.InternalSyntax.SyntaxFactory.Argument(nameColon == null ? null : (Syntax.InternalSyntax.NameColonSyntax)nameColon.Green, (Syntax.InternalSyntax.SyntaxToken?)refKindKeyword.Node, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new InvocationExpressionSyntax instance. + public static InvocationExpressionSyntax InvocationExpression(ExpressionSyntax expression) + => SyntaxFactory.InvocationExpression(expression, SyntaxFactory.ArgumentList()); - /// Creates a new ArgumentSyntax instance. - public static ArgumentSyntax Argument(ExpressionSyntax expression) - => SyntaxFactory.Argument(default, default, expression); + /// Creates a new ElementAccessExpressionSyntax instance. + public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + return (ElementAccessExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ElementAccessExpression((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.BracketedArgumentListSyntax)argumentList.Green).CreateRed(); + } - /// Creates a new ExpressionColonSyntax instance. - public static ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken) - { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - return (ExpressionColonSyntax)Syntax.InternalSyntax.SyntaxFactory.ExpressionColon((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); - } + /// Creates a new ElementAccessExpressionSyntax instance. + public static ElementAccessExpressionSyntax ElementAccessExpression(ExpressionSyntax expression) + => SyntaxFactory.ElementAccessExpression(expression, SyntaxFactory.BracketedArgumentList()); - /// Creates a new NameColonSyntax instance. - public static NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken) - { - if (name == null) throw new ArgumentNullException(nameof(name)); - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - return (NameColonSyntax)Syntax.InternalSyntax.SyntaxFactory.NameColon((Syntax.InternalSyntax.IdentifierNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); - } + /// Creates a new ArgumentListSyntax instance. + public static ArgumentListSyntax ArgumentList(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (ArgumentListSyntax)Syntax.InternalSyntax.SyntaxFactory.ArgumentList((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, arguments.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new DeclarationExpressionSyntax instance. - public static DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) - { - if (type == null) throw new ArgumentNullException(nameof(type)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); - return (DeclarationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.DeclarationExpression((Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.VariableDesignationSyntax)designation.Green).CreateRed(); - } + /// Creates a new ArgumentListSyntax instance. + public static ArgumentListSyntax ArgumentList(SeparatedSyntaxList arguments = default) + => SyntaxFactory.ArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new CastExpressionSyntax instance. - public static CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (CastExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.CastExpression((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new BracketedArgumentListSyntax instance. + public static BracketedArgumentListSyntax BracketedArgumentList(SyntaxToken openBracketToken, SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + { + if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + return (BracketedArgumentListSyntax)Syntax.InternalSyntax.SyntaxFactory.BracketedArgumentList((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, arguments.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); + } - /// Creates a new CastExpressionSyntax instance. - public static CastExpressionSyntax CastExpression(TypeSyntax type, ExpressionSyntax expression) - => SyntaxFactory.CastExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken), expression); + /// Creates a new BracketedArgumentListSyntax instance. + public static BracketedArgumentListSyntax BracketedArgumentList(SeparatedSyntaxList arguments = default) + => SyntaxFactory.BracketedArgumentList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); - /// Creates a new AnonymousMethodExpressionSyntax instance. - public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(SyntaxTokenList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + /// Creates a new ArgumentSyntax instance. + public static ArgumentSyntax Argument(NameColonSyntax? nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) + { + switch (refKindKeyword.Kind()) { - if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); - return (AnonymousMethodExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.AnonymousMethodExpression(modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)delegateKeyword.Node!, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, (Syntax.InternalSyntax.BlockSyntax)block.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expressionBody.Green).CreateRed(); + case SyntaxKind.RefKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.InKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(refKindKeyword)); } + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (ArgumentSyntax)Syntax.InternalSyntax.SyntaxFactory.Argument(nameColon == null ? null : (Syntax.InternalSyntax.NameColonSyntax)nameColon.Green, (Syntax.InternalSyntax.SyntaxToken?)refKindKeyword.Node, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new SimpleLambdaExpressionSyntax instance. - public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(SyntaxList attributeLists, SyntaxTokenList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { - if (parameter == null) throw new ArgumentNullException(nameof(parameter)); - if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); - return (SimpleLambdaExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.SimpleLambdaExpression(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.ParameterSyntax)parameter.Green, (Syntax.InternalSyntax.SyntaxToken)arrowToken.Node!, block == null ? null : (Syntax.InternalSyntax.BlockSyntax)block.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expressionBody.Green).CreateRed(); - } + /// Creates a new ArgumentSyntax instance. + public static ArgumentSyntax Argument(ExpressionSyntax expression) + => SyntaxFactory.Argument(default, default, expression); - /// Creates a new SimpleLambdaExpressionSyntax instance. - public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(SyntaxList attributeLists, SyntaxTokenList modifiers, ParameterSyntax parameter, BlockSyntax? block, ExpressionSyntax? expressionBody) - => SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), block, expressionBody); + /// Creates a new ExpressionColonSyntax instance. + public static ExpressionColonSyntax ExpressionColon(ExpressionSyntax expression, SyntaxToken colonToken) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + return (ExpressionColonSyntax)Syntax.InternalSyntax.SyntaxFactory.ExpressionColon((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); + } - /// Creates a new SimpleLambdaExpressionSyntax instance. - public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(ParameterSyntax parameter) - => SyntaxFactory.SimpleLambdaExpression(default, default(SyntaxTokenList), parameter, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default, default); + /// Creates a new NameColonSyntax instance. + public static NameColonSyntax NameColon(IdentifierNameSyntax name, SyntaxToken colonToken) + { + if (name == null) throw new ArgumentNullException(nameof(name)); + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + return (NameColonSyntax)Syntax.InternalSyntax.SyntaxFactory.NameColon((Syntax.InternalSyntax.IdentifierNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); + } - /// Creates a new RefExpressionSyntax instance. - public static RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression) - { - if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (RefExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.RefExpression((Syntax.InternalSyntax.SyntaxToken)refKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new DeclarationExpressionSyntax instance. + public static DeclarationExpressionSyntax DeclarationExpression(TypeSyntax type, VariableDesignationSyntax designation) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); + return (DeclarationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.DeclarationExpression((Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.VariableDesignationSyntax)designation.Green).CreateRed(); + } - /// Creates a new RefExpressionSyntax instance. - public static RefExpressionSyntax RefExpression(ExpressionSyntax expression) - => SyntaxFactory.RefExpression(SyntaxFactory.Token(SyntaxKind.RefKeyword), expression); + /// Creates a new CastExpressionSyntax instance. + public static CastExpressionSyntax CastExpression(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (CastExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.CastExpression((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new ParenthesizedLambdaExpressionSyntax instance. - public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); - return (ParenthesizedLambdaExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ParenthesizedLambdaExpression(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), returnType == null ? null : (Syntax.InternalSyntax.TypeSyntax)returnType.Green, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, (Syntax.InternalSyntax.SyntaxToken)arrowToken.Node!, block == null ? null : (Syntax.InternalSyntax.BlockSyntax)block.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expressionBody.Green).CreateRed(); - } + /// Creates a new CastExpressionSyntax instance. + public static CastExpressionSyntax CastExpression(TypeSyntax type, ExpressionSyntax expression) + => SyntaxFactory.CastExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken), expression); - /// Creates a new ParenthesizedLambdaExpressionSyntax instance. - public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, BlockSyntax? block, ExpressionSyntax? expressionBody) - => SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), block, expressionBody); + /// Creates a new AnonymousMethodExpressionSyntax instance. + public static AnonymousMethodExpressionSyntax AnonymousMethodExpression(SyntaxTokenList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + { + if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); + return (AnonymousMethodExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.AnonymousMethodExpression(modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)delegateKeyword.Node!, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, (Syntax.InternalSyntax.BlockSyntax)block.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expressionBody.Green).CreateRed(); + } - /// Creates a new ParenthesizedLambdaExpressionSyntax instance. - public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression() - => SyntaxFactory.ParenthesizedLambdaExpression(default, default(SyntaxTokenList), default, SyntaxFactory.ParameterList(), SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default, default); + /// Creates a new SimpleLambdaExpressionSyntax instance. + public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(SyntaxList attributeLists, SyntaxTokenList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { + if (parameter == null) throw new ArgumentNullException(nameof(parameter)); + if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + return (SimpleLambdaExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.SimpleLambdaExpression(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.ParameterSyntax)parameter.Green, (Syntax.InternalSyntax.SyntaxToken)arrowToken.Node!, block == null ? null : (Syntax.InternalSyntax.BlockSyntax)block.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expressionBody.Green).CreateRed(); + } - /// Creates a new InitializerExpressionSyntax instance. - public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) - { - switch (kind) - { - case SyntaxKind.ObjectInitializerExpression: - case SyntaxKind.CollectionInitializerExpression: - case SyntaxKind.ArrayInitializerExpression: - case SyntaxKind.ComplexElementInitializerExpression: - case SyntaxKind.WithInitializerExpression: break; - default: throw new ArgumentException(nameof(kind)); - } - if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - return (InitializerExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.InitializerExpression(kind, (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, expressions.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); - } + /// Creates a new SimpleLambdaExpressionSyntax instance. + public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(SyntaxList attributeLists, SyntaxTokenList modifiers, ParameterSyntax parameter, BlockSyntax? block, ExpressionSyntax? expressionBody) + => SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), block, expressionBody); - /// Creates a new InitializerExpressionSyntax instance. - public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SeparatedSyntaxList expressions = default) - => SyntaxFactory.InitializerExpression(kind, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expressions, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + /// Creates a new SimpleLambdaExpressionSyntax instance. + public static SimpleLambdaExpressionSyntax SimpleLambdaExpression(ParameterSyntax parameter) + => SyntaxFactory.SimpleLambdaExpression(default, default(SyntaxTokenList), parameter, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default, default); - /// Creates a new ImplicitObjectCreationExpressionSyntax instance. - public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) - { - if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); - return (ImplicitObjectCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ImplicitObjectCreationExpression((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.ArgumentListSyntax)argumentList.Green, initializer == null ? null : (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); - } + /// Creates a new RefExpressionSyntax instance. + public static RefExpressionSyntax RefExpression(SyntaxToken refKeyword, ExpressionSyntax expression) + { + if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (RefExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.RefExpression((Syntax.InternalSyntax.SyntaxToken)refKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new ImplicitObjectCreationExpressionSyntax instance. - public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) - => SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), argumentList, initializer); + /// Creates a new RefExpressionSyntax instance. + public static RefExpressionSyntax RefExpression(ExpressionSyntax expression) + => SyntaxFactory.RefExpression(SyntaxFactory.Token(SyntaxKind.RefKeyword), expression); - /// Creates a new ImplicitObjectCreationExpressionSyntax instance. - public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression() - => SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.ArgumentList(), default); + /// Creates a new ParenthesizedLambdaExpressionSyntax instance. + public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + return (ParenthesizedLambdaExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ParenthesizedLambdaExpression(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), returnType == null ? null : (Syntax.InternalSyntax.TypeSyntax)returnType.Green, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, (Syntax.InternalSyntax.SyntaxToken)arrowToken.Node!, block == null ? null : (Syntax.InternalSyntax.BlockSyntax)block.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expressionBody.Green).CreateRed(); + } - /// Creates a new ObjectCreationExpressionSyntax instance. - public static ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) - { - if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); - return (ObjectCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ObjectCreationExpression((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, argumentList == null ? null : (Syntax.InternalSyntax.ArgumentListSyntax)argumentList.Green, initializer == null ? null : (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); - } + /// Creates a new ParenthesizedLambdaExpressionSyntax instance. + public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, BlockSyntax? block, ExpressionSyntax? expressionBody) + => SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), block, expressionBody); - /// Creates a new ObjectCreationExpressionSyntax instance. - public static ObjectCreationExpressionSyntax ObjectCreationExpression(TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) - => SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, argumentList, initializer); + /// Creates a new ParenthesizedLambdaExpressionSyntax instance. + public static ParenthesizedLambdaExpressionSyntax ParenthesizedLambdaExpression() + => SyntaxFactory.ParenthesizedLambdaExpression(default, default(SyntaxTokenList), default, SyntaxFactory.ParameterList(), SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default, default); - /// Creates a new ObjectCreationExpressionSyntax instance. - public static ObjectCreationExpressionSyntax ObjectCreationExpression(TypeSyntax type) - => SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, default, default); + /// Creates a new InitializerExpressionSyntax instance. + public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + { + switch (kind) + { + case SyntaxKind.ObjectInitializerExpression: + case SyntaxKind.CollectionInitializerExpression: + case SyntaxKind.ArrayInitializerExpression: + case SyntaxKind.ComplexElementInitializerExpression: + case SyntaxKind.WithInitializerExpression: break; + default: throw new ArgumentException(nameof(kind)); + } + if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + return (InitializerExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.InitializerExpression(kind, (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, expressions.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); + } - /// Creates a new WithExpressionSyntax instance. - public static WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) - { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (withKeyword.Kind() != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); - return (WithExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.WithExpression((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)withKeyword.Node!, (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); - } + /// Creates a new InitializerExpressionSyntax instance. + public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SeparatedSyntaxList expressions = default) + => SyntaxFactory.InitializerExpression(kind, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expressions, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); - /// Creates a new WithExpressionSyntax instance. - public static WithExpressionSyntax WithExpression(ExpressionSyntax expression, InitializerExpressionSyntax initializer) - => SyntaxFactory.WithExpression(expression, SyntaxFactory.Token(SyntaxKind.WithKeyword), initializer); + /// Creates a new ImplicitObjectCreationExpressionSyntax instance. + public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + { + if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + return (ImplicitObjectCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ImplicitObjectCreationExpression((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.ArgumentListSyntax)argumentList.Green, initializer == null ? null : (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); + } - /// Creates a new AnonymousObjectMemberDeclaratorSyntax instance. - public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) - { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (AnonymousObjectMemberDeclaratorSyntax)Syntax.InternalSyntax.SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals == null ? null : (Syntax.InternalSyntax.NameEqualsSyntax)nameEquals.Green, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new ImplicitObjectCreationExpressionSyntax instance. + public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression(ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + => SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), argumentList, initializer); - /// Creates a new AnonymousObjectMemberDeclaratorSyntax instance. - public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(ExpressionSyntax expression) - => SyntaxFactory.AnonymousObjectMemberDeclarator(default, expression); + /// Creates a new ImplicitObjectCreationExpressionSyntax instance. + public static ImplicitObjectCreationExpressionSyntax ImplicitObjectCreationExpression() + => SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.ArgumentList(), default); - /// Creates a new AnonymousObjectCreationExpressionSyntax instance. - public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) - { - if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - return (AnonymousObjectCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.AnonymousObjectCreationExpression((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, initializers.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); - } + /// Creates a new ObjectCreationExpressionSyntax instance. + public static ObjectCreationExpressionSyntax ObjectCreationExpression(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) + { + if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); + return (ObjectCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ObjectCreationExpression((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, argumentList == null ? null : (Syntax.InternalSyntax.ArgumentListSyntax)argumentList.Green, initializer == null ? null : (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); + } - /// Creates a new AnonymousObjectCreationExpressionSyntax instance. - public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SeparatedSyntaxList initializers = default) - => SyntaxFactory.AnonymousObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), initializers, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + /// Creates a new ObjectCreationExpressionSyntax instance. + public static ObjectCreationExpressionSyntax ObjectCreationExpression(TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) + => SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, argumentList, initializer); - /// Creates a new ArrayCreationExpressionSyntax instance. - public static ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) - { - if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); - return (ArrayCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ArrayCreationExpression((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.ArrayTypeSyntax)type.Green, initializer == null ? null : (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); - } + /// Creates a new ObjectCreationExpressionSyntax instance. + public static ObjectCreationExpressionSyntax ObjectCreationExpression(TypeSyntax type) + => SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, default, default); - /// Creates a new ArrayCreationExpressionSyntax instance. - public static ArrayCreationExpressionSyntax ArrayCreationExpression(ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) - => SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, initializer); + /// Creates a new WithExpressionSyntax instance. + public static WithExpressionSyntax WithExpression(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (withKeyword.Kind() != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + return (WithExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.WithExpression((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)withKeyword.Node!, (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); + } - /// Creates a new ArrayCreationExpressionSyntax instance. - public static ArrayCreationExpressionSyntax ArrayCreationExpression(ArrayTypeSyntax type) - => SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, default); + /// Creates a new WithExpressionSyntax instance. + public static WithExpressionSyntax WithExpression(ExpressionSyntax expression, InitializerExpressionSyntax initializer) + => SyntaxFactory.WithExpression(expression, SyntaxFactory.Token(SyntaxKind.WithKeyword), initializer); - /// Creates a new ImplicitArrayCreationExpressionSyntax instance. - public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, SyntaxTokenList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { - if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); - return (ImplicitArrayCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ImplicitArrayCreationExpression((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, commas.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!, (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); - } + /// Creates a new AnonymousObjectMemberDeclaratorSyntax instance. + public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (AnonymousObjectMemberDeclaratorSyntax)Syntax.InternalSyntax.SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals == null ? null : (Syntax.InternalSyntax.NameEqualsSyntax)nameEquals.Green, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new ImplicitArrayCreationExpressionSyntax instance. - public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxTokenList commas, InitializerExpressionSyntax initializer) - => SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), commas, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); + /// Creates a new AnonymousObjectMemberDeclaratorSyntax instance. + public static AnonymousObjectMemberDeclaratorSyntax AnonymousObjectMemberDeclarator(ExpressionSyntax expression) + => SyntaxFactory.AnonymousObjectMemberDeclarator(default, expression); - /// Creates a new ImplicitArrayCreationExpressionSyntax instance. - public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(InitializerExpressionSyntax initializer) - => SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); + /// Creates a new AnonymousObjectCreationExpressionSyntax instance. + public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SyntaxToken newKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + { + if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + return (AnonymousObjectCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.AnonymousObjectCreationExpression((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, initializers.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); + } - /// Creates a new StackAllocArrayCreationExpressionSyntax instance. - public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) - { - if (stackAllocKeyword.Kind() != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); - return (StackAllocArrayCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.StackAllocArrayCreationExpression((Syntax.InternalSyntax.SyntaxToken)stackAllocKeyword.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, initializer == null ? null : (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); - } + /// Creates a new AnonymousObjectCreationExpressionSyntax instance. + public static AnonymousObjectCreationExpressionSyntax AnonymousObjectCreationExpression(SeparatedSyntaxList initializers = default) + => SyntaxFactory.AnonymousObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), initializers, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); - /// Creates a new StackAllocArrayCreationExpressionSyntax instance. - public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(TypeSyntax type, InitializerExpressionSyntax? initializer) - => SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), type, initializer); + /// Creates a new ArrayCreationExpressionSyntax instance. + public static ArrayCreationExpressionSyntax ArrayCreationExpression(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + { + if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); + return (ArrayCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ArrayCreationExpression((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.ArrayTypeSyntax)type.Green, initializer == null ? null : (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); + } - /// Creates a new StackAllocArrayCreationExpressionSyntax instance. - public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(TypeSyntax type) - => SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), type, default); + /// Creates a new ArrayCreationExpressionSyntax instance. + public static ArrayCreationExpressionSyntax ArrayCreationExpression(ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + => SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, initializer); - /// Creates a new ImplicitStackAllocArrayCreationExpressionSyntax instance. - public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { - if (stackAllocKeyword.Kind() != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); - if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - if (initializer == null) throw new ArgumentNullException(nameof(initializer)); - return (ImplicitStackAllocArrayCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ImplicitStackAllocArrayCreationExpression((Syntax.InternalSyntax.SyntaxToken)stackAllocKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!, (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); - } + /// Creates a new ArrayCreationExpressionSyntax instance. + public static ArrayCreationExpressionSyntax ArrayCreationExpression(ArrayTypeSyntax type) + => SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, default); - /// Creates a new ImplicitStackAllocArrayCreationExpressionSyntax instance. - public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(InitializerExpressionSyntax initializer) - => SyntaxFactory.ImplicitStackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); + /// Creates a new ImplicitArrayCreationExpressionSyntax instance. + public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxToken newKeyword, SyntaxToken openBracketToken, SyntaxTokenList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { + if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + return (ImplicitArrayCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ImplicitArrayCreationExpression((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, commas.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!, (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); + } - /// Creates a new CollectionExpressionSyntax instance. - public static CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, SeparatedSyntaxList elements, SyntaxToken closeBracketToken) - { - if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - return (CollectionExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.CollectionExpression((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, elements.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); - } + /// Creates a new ImplicitArrayCreationExpressionSyntax instance. + public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(SyntaxTokenList commas, InitializerExpressionSyntax initializer) + => SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), commas, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); - /// Creates a new CollectionExpressionSyntax instance. - public static CollectionExpressionSyntax CollectionExpression(SeparatedSyntaxList elements = default) - => SyntaxFactory.CollectionExpression(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), elements, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); + /// Creates a new ImplicitArrayCreationExpressionSyntax instance. + public static ImplicitArrayCreationExpressionSyntax ImplicitArrayCreationExpression(InitializerExpressionSyntax initializer) + => SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); - /// Creates a new ExpressionElementSyntax instance. - public static ExpressionElementSyntax ExpressionElement(ExpressionSyntax expression) - { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (ExpressionElementSyntax)Syntax.InternalSyntax.SyntaxFactory.ExpressionElement((Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new StackAllocArrayCreationExpressionSyntax instance. + public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) + { + if (stackAllocKeyword.Kind() != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); + return (StackAllocArrayCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.StackAllocArrayCreationExpression((Syntax.InternalSyntax.SyntaxToken)stackAllocKeyword.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, initializer == null ? null : (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); + } - /// Creates a new SpreadElementSyntax instance. - public static SpreadElementSyntax SpreadElement(SyntaxToken operatorToken, ExpressionSyntax expression) - { - if (operatorToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (SpreadElementSyntax)Syntax.InternalSyntax.SyntaxFactory.SpreadElement((Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new StackAllocArrayCreationExpressionSyntax instance. + public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(TypeSyntax type, InitializerExpressionSyntax? initializer) + => SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), type, initializer); - /// Creates a new SpreadElementSyntax instance. - public static SpreadElementSyntax SpreadElement(ExpressionSyntax expression) - => SyntaxFactory.SpreadElement(SyntaxFactory.Token(SyntaxKind.DotDotToken), expression); + /// Creates a new StackAllocArrayCreationExpressionSyntax instance. + public static StackAllocArrayCreationExpressionSyntax StackAllocArrayCreationExpression(TypeSyntax type) + => SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), type, default); - /// Creates a new QueryExpressionSyntax instance. - public static QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body) - { - if (fromClause == null) throw new ArgumentNullException(nameof(fromClause)); - if (body == null) throw new ArgumentNullException(nameof(body)); - return (QueryExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.QueryExpression((Syntax.InternalSyntax.FromClauseSyntax)fromClause.Green, (Syntax.InternalSyntax.QueryBodySyntax)body.Green).CreateRed(); - } + /// Creates a new ImplicitStackAllocArrayCreationExpressionSyntax instance. + public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { + if (stackAllocKeyword.Kind() != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); + if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + if (initializer == null) throw new ArgumentNullException(nameof(initializer)); + return (ImplicitStackAllocArrayCreationExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ImplicitStackAllocArrayCreationExpression((Syntax.InternalSyntax.SyntaxToken)stackAllocKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!, (Syntax.InternalSyntax.InitializerExpressionSyntax)initializer.Green).CreateRed(); + } - /// Creates a new QueryBodySyntax instance. - public static QueryBodySyntax QueryBody(SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) - { - if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); - return (QueryBodySyntax)Syntax.InternalSyntax.SyntaxFactory.QueryBody(clauses.Node.ToGreenList(), (Syntax.InternalSyntax.SelectOrGroupClauseSyntax)selectOrGroup.Green, continuation == null ? null : (Syntax.InternalSyntax.QueryContinuationSyntax)continuation.Green).CreateRed(); - } + /// Creates a new ImplicitStackAllocArrayCreationExpressionSyntax instance. + public static ImplicitStackAllocArrayCreationExpressionSyntax ImplicitStackAllocArrayCreationExpression(InitializerExpressionSyntax initializer) + => SyntaxFactory.ImplicitStackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); - /// Creates a new QueryBodySyntax instance. - public static QueryBodySyntax QueryBody(SelectOrGroupClauseSyntax selectOrGroup) - => SyntaxFactory.QueryBody(default, selectOrGroup, default); + /// Creates a new CollectionExpressionSyntax instance. + public static CollectionExpressionSyntax CollectionExpression(SyntaxToken openBracketToken, SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + { + if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + return (CollectionExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.CollectionExpression((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, elements.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); + } - /// Creates a new FromClauseSyntax instance. - public static FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) - { - if (fromKeyword.Kind() != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (FromClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.FromClause((Syntax.InternalSyntax.SyntaxToken)fromKeyword.Node!, type == null ? null : (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)inKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new CollectionExpressionSyntax instance. + public static CollectionExpressionSyntax CollectionExpression(SeparatedSyntaxList elements = default) + => SyntaxFactory.CollectionExpression(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), elements, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); - /// Creates a new FromClauseSyntax instance. - public static FromClauseSyntax FromClause(TypeSyntax? type, SyntaxToken identifier, ExpressionSyntax expression) - => SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression); + /// Creates a new ExpressionElementSyntax instance. + public static ExpressionElementSyntax ExpressionElement(ExpressionSyntax expression) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (ExpressionElementSyntax)Syntax.InternalSyntax.SyntaxFactory.ExpressionElement((Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new FromClauseSyntax instance. - public static FromClauseSyntax FromClause(SyntaxToken identifier, ExpressionSyntax expression) - => SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression); + /// Creates a new SpreadElementSyntax instance. + public static SpreadElementSyntax SpreadElement(SyntaxToken operatorToken, ExpressionSyntax expression) + { + if (operatorToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (SpreadElementSyntax)Syntax.InternalSyntax.SyntaxFactory.SpreadElement((Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new FromClauseSyntax instance. - public static FromClauseSyntax FromClause(string identifier, ExpressionSyntax expression) - => SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.InKeyword), expression); + /// Creates a new SpreadElementSyntax instance. + public static SpreadElementSyntax SpreadElement(ExpressionSyntax expression) + => SyntaxFactory.SpreadElement(SyntaxFactory.Token(SyntaxKind.DotDotToken), expression); - /// Creates a new LetClauseSyntax instance. - public static LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) - { - if (letKeyword.Kind() != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (LetClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.LetClause((Syntax.InternalSyntax.SyntaxToken)letKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new QueryExpressionSyntax instance. + public static QueryExpressionSyntax QueryExpression(FromClauseSyntax fromClause, QueryBodySyntax body) + { + if (fromClause == null) throw new ArgumentNullException(nameof(fromClause)); + if (body == null) throw new ArgumentNullException(nameof(body)); + return (QueryExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.QueryExpression((Syntax.InternalSyntax.FromClauseSyntax)fromClause.Green, (Syntax.InternalSyntax.QueryBodySyntax)body.Green).CreateRed(); + } - /// Creates a new LetClauseSyntax instance. - public static LetClauseSyntax LetClause(SyntaxToken identifier, ExpressionSyntax expression) - => SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), identifier, SyntaxFactory.Token(SyntaxKind.EqualsToken), expression); + /// Creates a new QueryBodySyntax instance. + public static QueryBodySyntax QueryBody(SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + { + if (selectOrGroup == null) throw new ArgumentNullException(nameof(selectOrGroup)); + return (QueryBodySyntax)Syntax.InternalSyntax.SyntaxFactory.QueryBody(clauses.Node.ToGreenList(), (Syntax.InternalSyntax.SelectOrGroupClauseSyntax)selectOrGroup.Green, continuation == null ? null : (Syntax.InternalSyntax.QueryContinuationSyntax)continuation.Green).CreateRed(); + } - /// Creates a new LetClauseSyntax instance. - public static LetClauseSyntax LetClause(string identifier, ExpressionSyntax expression) - => SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.EqualsToken), expression); + /// Creates a new QueryBodySyntax instance. + public static QueryBodySyntax QueryBody(SelectOrGroupClauseSyntax selectOrGroup) + => SyntaxFactory.QueryBody(default, selectOrGroup, default); - /// Creates a new JoinClauseSyntax instance. - public static JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) - { - if (joinKeyword.Kind() != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (inExpression == null) throw new ArgumentNullException(nameof(inExpression)); - if (onKeyword.Kind() != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); - if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression)); - if (equalsKeyword.Kind() != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); - if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression)); - return (JoinClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.JoinClause((Syntax.InternalSyntax.SyntaxToken)joinKeyword.Node!, type == null ? null : (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)inKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)inExpression.Green, (Syntax.InternalSyntax.SyntaxToken)onKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)leftExpression.Green, (Syntax.InternalSyntax.SyntaxToken)equalsKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)rightExpression.Green, into == null ? null : (Syntax.InternalSyntax.JoinIntoClauseSyntax)into.Green).CreateRed(); - } + /// Creates a new FromClauseSyntax instance. + public static FromClauseSyntax FromClause(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + { + if (fromKeyword.Kind() != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (FromClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.FromClause((Syntax.InternalSyntax.SyntaxToken)fromKeyword.Node!, type == null ? null : (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)inKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new JoinClauseSyntax instance. - public static JoinClauseSyntax JoinClause(TypeSyntax? type, SyntaxToken identifier, ExpressionSyntax inExpression, ExpressionSyntax leftExpression, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) - => SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, into); + /// Creates a new FromClauseSyntax instance. + public static FromClauseSyntax FromClause(TypeSyntax? type, SyntaxToken identifier, ExpressionSyntax expression) + => SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression); - /// Creates a new JoinClauseSyntax instance. - public static JoinClauseSyntax JoinClause(SyntaxToken identifier, ExpressionSyntax inExpression, ExpressionSyntax leftExpression, ExpressionSyntax rightExpression) - => SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), default, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, default); + /// Creates a new FromClauseSyntax instance. + public static FromClauseSyntax FromClause(SyntaxToken identifier, ExpressionSyntax expression) + => SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression); - /// Creates a new JoinClauseSyntax instance. - public static JoinClauseSyntax JoinClause(string identifier, ExpressionSyntax inExpression, ExpressionSyntax leftExpression, ExpressionSyntax rightExpression) - => 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); + /// Creates a new FromClauseSyntax instance. + public static FromClauseSyntax FromClause(string identifier, ExpressionSyntax expression) + => SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.InKeyword), expression); - /// Creates a new JoinIntoClauseSyntax instance. - public static JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier) - { - if (intoKeyword.Kind() != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - return (JoinIntoClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.JoinIntoClause((Syntax.InternalSyntax.SyntaxToken)intoKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!).CreateRed(); - } + /// Creates a new LetClauseSyntax instance. + public static LetClauseSyntax LetClause(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) + { + if (letKeyword.Kind() != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (LetClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.LetClause((Syntax.InternalSyntax.SyntaxToken)letKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new JoinIntoClauseSyntax instance. - public static JoinIntoClauseSyntax JoinIntoClause(SyntaxToken identifier) - => SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), identifier); + /// Creates a new LetClauseSyntax instance. + public static LetClauseSyntax LetClause(SyntaxToken identifier, ExpressionSyntax expression) + => SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), identifier, SyntaxFactory.Token(SyntaxKind.EqualsToken), expression); - /// Creates a new JoinIntoClauseSyntax instance. - public static JoinIntoClauseSyntax JoinIntoClause(string identifier) - => SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier(identifier)); + /// Creates a new LetClauseSyntax instance. + public static LetClauseSyntax LetClause(string identifier, ExpressionSyntax expression) + => SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.EqualsToken), expression); - /// Creates a new WhereClauseSyntax instance. - public static WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition) - { - if (whereKeyword.Kind() != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - return (WhereClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.WhereClause((Syntax.InternalSyntax.SyntaxToken)whereKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green).CreateRed(); - } + /// Creates a new JoinClauseSyntax instance. + public static JoinClauseSyntax JoinClause(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + { + if (joinKeyword.Kind() != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (inExpression == null) throw new ArgumentNullException(nameof(inExpression)); + if (onKeyword.Kind() != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); + if (leftExpression == null) throw new ArgumentNullException(nameof(leftExpression)); + if (equalsKeyword.Kind() != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); + if (rightExpression == null) throw new ArgumentNullException(nameof(rightExpression)); + return (JoinClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.JoinClause((Syntax.InternalSyntax.SyntaxToken)joinKeyword.Node!, type == null ? null : (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)inKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)inExpression.Green, (Syntax.InternalSyntax.SyntaxToken)onKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)leftExpression.Green, (Syntax.InternalSyntax.SyntaxToken)equalsKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)rightExpression.Green, into == null ? null : (Syntax.InternalSyntax.JoinIntoClauseSyntax)into.Green).CreateRed(); + } - /// Creates a new WhereClauseSyntax instance. - public static WhereClauseSyntax WhereClause(ExpressionSyntax condition) - => SyntaxFactory.WhereClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), condition); + /// Creates a new JoinClauseSyntax instance. + public static JoinClauseSyntax JoinClause(TypeSyntax? type, SyntaxToken identifier, ExpressionSyntax inExpression, ExpressionSyntax leftExpression, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + => SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, into); - /// Creates a new OrderByClauseSyntax instance. - public static OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, SeparatedSyntaxList orderings) - { - if (orderByKeyword.Kind() != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); - return (OrderByClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.OrderByClause((Syntax.InternalSyntax.SyntaxToken)orderByKeyword.Node!, orderings.Node.ToGreenSeparatedList()).CreateRed(); - } + /// Creates a new JoinClauseSyntax instance. + public static JoinClauseSyntax JoinClause(SyntaxToken identifier, ExpressionSyntax inExpression, ExpressionSyntax leftExpression, ExpressionSyntax rightExpression) + => SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), default, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, default); - /// Creates a new OrderByClauseSyntax instance. - public static OrderByClauseSyntax OrderByClause(SeparatedSyntaxList orderings = default) - => SyntaxFactory.OrderByClause(SyntaxFactory.Token(SyntaxKind.OrderByKeyword), orderings); + /// Creates a new JoinClauseSyntax instance. + public static JoinClauseSyntax JoinClause(string identifier, ExpressionSyntax inExpression, ExpressionSyntax leftExpression, ExpressionSyntax rightExpression) + => 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); - /// Creates a new OrderingSyntax instance. - public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) - { - switch (kind) - { - case SyntaxKind.AscendingOrdering: - case SyntaxKind.DescendingOrdering: break; - default: throw new ArgumentException(nameof(kind)); - } - if (expression == null) throw new ArgumentNullException(nameof(expression)); - switch (ascendingOrDescendingKeyword.Kind()) - { - case SyntaxKind.AscendingKeyword: - case SyntaxKind.DescendingKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword)); - } - return (OrderingSyntax)Syntax.InternalSyntax.SyntaxFactory.Ordering(kind, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken?)ascendingOrDescendingKeyword.Node).CreateRed(); - } + /// Creates a new JoinIntoClauseSyntax instance. + public static JoinIntoClauseSyntax JoinIntoClause(SyntaxToken intoKeyword, SyntaxToken identifier) + { + if (intoKeyword.Kind() != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + return (JoinIntoClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.JoinIntoClause((Syntax.InternalSyntax.SyntaxToken)intoKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!).CreateRed(); + } - /// Creates a new OrderingSyntax instance. - public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression) - => SyntaxFactory.Ordering(kind, expression, default); + /// Creates a new JoinIntoClauseSyntax instance. + public static JoinIntoClauseSyntax JoinIntoClause(SyntaxToken identifier) + => SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), identifier); - private static SyntaxKind GetOrderingAscendingOrDescendingKeywordKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.AscendingOrdering => SyntaxKind.AscendingKeyword, - SyntaxKind.DescendingOrdering => SyntaxKind.DescendingKeyword, - _ => throw new ArgumentOutOfRangeException(), - }; + /// Creates a new JoinIntoClauseSyntax instance. + public static JoinIntoClauseSyntax JoinIntoClause(string identifier) + => SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier(identifier)); - /// Creates a new SelectClauseSyntax instance. - public static SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression) - { - if (selectKeyword.Kind() != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (SelectClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.SelectClause((Syntax.InternalSyntax.SyntaxToken)selectKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new WhereClauseSyntax instance. + public static WhereClauseSyntax WhereClause(SyntaxToken whereKeyword, ExpressionSyntax condition) + { + if (whereKeyword.Kind() != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + return (WhereClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.WhereClause((Syntax.InternalSyntax.SyntaxToken)whereKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green).CreateRed(); + } - /// Creates a new SelectClauseSyntax instance. - public static SelectClauseSyntax SelectClause(ExpressionSyntax expression) - => SyntaxFactory.SelectClause(SyntaxFactory.Token(SyntaxKind.SelectKeyword), expression); + /// Creates a new WhereClauseSyntax instance. + public static WhereClauseSyntax WhereClause(ExpressionSyntax condition) + => SyntaxFactory.WhereClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), condition); - /// Creates a new GroupClauseSyntax instance. - public static GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) - { - if (groupKeyword.Kind() != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); - if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression)); - if (byKeyword.Kind() != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); - if (byExpression == null) throw new ArgumentNullException(nameof(byExpression)); - return (GroupClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.GroupClause((Syntax.InternalSyntax.SyntaxToken)groupKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)groupExpression.Green, (Syntax.InternalSyntax.SyntaxToken)byKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)byExpression.Green).CreateRed(); - } + /// Creates a new OrderByClauseSyntax instance. + public static OrderByClauseSyntax OrderByClause(SyntaxToken orderByKeyword, SeparatedSyntaxList orderings) + { + if (orderByKeyword.Kind() != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); + return (OrderByClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.OrderByClause((Syntax.InternalSyntax.SyntaxToken)orderByKeyword.Node!, orderings.Node.ToGreenSeparatedList()).CreateRed(); + } - /// Creates a new GroupClauseSyntax instance. - public static GroupClauseSyntax GroupClause(ExpressionSyntax groupExpression, ExpressionSyntax byExpression) - => SyntaxFactory.GroupClause(SyntaxFactory.Token(SyntaxKind.GroupKeyword), groupExpression, SyntaxFactory.Token(SyntaxKind.ByKeyword), byExpression); + /// Creates a new OrderByClauseSyntax instance. + public static OrderByClauseSyntax OrderByClause(SeparatedSyntaxList orderings = default) + => SyntaxFactory.OrderByClause(SyntaxFactory.Token(SyntaxKind.OrderByKeyword), orderings); - /// Creates a new QueryContinuationSyntax instance. - public static QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + /// Creates a new OrderingSyntax instance. + public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) + { + switch (kind) { - if (intoKeyword.Kind() != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (body == null) throw new ArgumentNullException(nameof(body)); - return (QueryContinuationSyntax)Syntax.InternalSyntax.SyntaxFactory.QueryContinuation((Syntax.InternalSyntax.SyntaxToken)intoKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.QueryBodySyntax)body.Green).CreateRed(); + case SyntaxKind.AscendingOrdering: + case SyntaxKind.DescendingOrdering: break; + default: throw new ArgumentException(nameof(kind)); } - - /// Creates a new QueryContinuationSyntax instance. - public static QueryContinuationSyntax QueryContinuation(SyntaxToken identifier, QueryBodySyntax body) - => SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), identifier, body); - - /// Creates a new QueryContinuationSyntax instance. - public static QueryContinuationSyntax QueryContinuation(string identifier, QueryBodySyntax body) - => SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier(identifier), body); - - /// Creates a new OmittedArraySizeExpressionSyntax instance. - public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken) + if (expression == null) throw new ArgumentNullException(nameof(expression)); + switch (ascendingOrDescendingKeyword.Kind()) { - if (omittedArraySizeExpressionToken.Kind() != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); - return (OmittedArraySizeExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.OmittedArraySizeExpression((Syntax.InternalSyntax.SyntaxToken)omittedArraySizeExpressionToken.Node!).CreateRed(); + case SyntaxKind.AscendingKeyword: + case SyntaxKind.DescendingKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(ascendingOrDescendingKeyword)); } + return (OrderingSyntax)Syntax.InternalSyntax.SyntaxFactory.Ordering(kind, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken?)ascendingOrDescendingKeyword.Node).CreateRed(); + } - /// Creates a new OmittedArraySizeExpressionSyntax instance. - public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression() - => SyntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); + /// Creates a new OrderingSyntax instance. + public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression) + => SyntaxFactory.Ordering(kind, expression, default); - /// Creates a new InterpolatedStringExpressionSyntax instance. - public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, SyntaxList contents, SyntaxToken stringEndToken) + private static SyntaxKind GetOrderingAscendingOrDescendingKeywordKind(SyntaxKind kind) + => kind switch { - switch (stringStartToken.Kind()) - { - case SyntaxKind.InterpolatedStringStartToken: - case SyntaxKind.InterpolatedVerbatimStringStartToken: - case SyntaxKind.InterpolatedSingleLineRawStringStartToken: - case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; - default: throw new ArgumentException(nameof(stringStartToken)); - } - switch (stringEndToken.Kind()) - { - case SyntaxKind.InterpolatedStringEndToken: - case SyntaxKind.InterpolatedRawStringEndToken: break; - default: throw new ArgumentException(nameof(stringEndToken)); - } - return (InterpolatedStringExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.InterpolatedStringExpression((Syntax.InternalSyntax.SyntaxToken)stringStartToken.Node!, contents.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)stringEndToken.Node!).CreateRed(); - } + SyntaxKind.AscendingOrdering => SyntaxKind.AscendingKeyword, + SyntaxKind.DescendingOrdering => SyntaxKind.DescendingKeyword, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new InterpolatedStringExpressionSyntax instance. - public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, SyntaxToken stringEndToken) - => SyntaxFactory.InterpolatedStringExpression(stringStartToken, default, stringEndToken); + /// Creates a new SelectClauseSyntax instance. + public static SelectClauseSyntax SelectClause(SyntaxToken selectKeyword, ExpressionSyntax expression) + { + if (selectKeyword.Kind() != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (SelectClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.SelectClause((Syntax.InternalSyntax.SyntaxToken)selectKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new IsPatternExpressionSyntax instance. - public static IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) - { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (isKeyword.Kind() != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - return (IsPatternExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.IsPatternExpression((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)isKeyword.Node!, (Syntax.InternalSyntax.PatternSyntax)pattern.Green).CreateRed(); - } + /// Creates a new SelectClauseSyntax instance. + public static SelectClauseSyntax SelectClause(ExpressionSyntax expression) + => SyntaxFactory.SelectClause(SyntaxFactory.Token(SyntaxKind.SelectKeyword), expression); - /// Creates a new IsPatternExpressionSyntax instance. - public static IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, PatternSyntax pattern) - => SyntaxFactory.IsPatternExpression(expression, SyntaxFactory.Token(SyntaxKind.IsKeyword), pattern); + /// Creates a new GroupClauseSyntax instance. + public static GroupClauseSyntax GroupClause(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + { + if (groupKeyword.Kind() != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); + if (groupExpression == null) throw new ArgumentNullException(nameof(groupExpression)); + if (byKeyword.Kind() != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); + if (byExpression == null) throw new ArgumentNullException(nameof(byExpression)); + return (GroupClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.GroupClause((Syntax.InternalSyntax.SyntaxToken)groupKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)groupExpression.Green, (Syntax.InternalSyntax.SyntaxToken)byKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)byExpression.Green).CreateRed(); + } - /// Creates a new ThrowExpressionSyntax instance. - public static ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression) - { - if (throwKeyword.Kind() != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (ThrowExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ThrowExpression((Syntax.InternalSyntax.SyntaxToken)throwKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new GroupClauseSyntax instance. + public static GroupClauseSyntax GroupClause(ExpressionSyntax groupExpression, ExpressionSyntax byExpression) + => SyntaxFactory.GroupClause(SyntaxFactory.Token(SyntaxKind.GroupKeyword), groupExpression, SyntaxFactory.Token(SyntaxKind.ByKeyword), byExpression); - /// Creates a new ThrowExpressionSyntax instance. - public static ThrowExpressionSyntax ThrowExpression(ExpressionSyntax expression) - => SyntaxFactory.ThrowExpression(SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression); + /// Creates a new QueryContinuationSyntax instance. + public static QueryContinuationSyntax QueryContinuation(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + { + if (intoKeyword.Kind() != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (body == null) throw new ArgumentNullException(nameof(body)); + return (QueryContinuationSyntax)Syntax.InternalSyntax.SyntaxFactory.QueryContinuation((Syntax.InternalSyntax.SyntaxToken)intoKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.QueryBodySyntax)body.Green).CreateRed(); + } - /// Creates a new WhenClauseSyntax instance. - public static WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition) - { - if (whenKeyword.Kind() != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - return (WhenClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.WhenClause((Syntax.InternalSyntax.SyntaxToken)whenKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green).CreateRed(); - } + /// Creates a new QueryContinuationSyntax instance. + public static QueryContinuationSyntax QueryContinuation(SyntaxToken identifier, QueryBodySyntax body) + => SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), identifier, body); - /// Creates a new WhenClauseSyntax instance. - public static WhenClauseSyntax WhenClause(ExpressionSyntax condition) - => SyntaxFactory.WhenClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), condition); + /// Creates a new QueryContinuationSyntax instance. + public static QueryContinuationSyntax QueryContinuation(string identifier, QueryBodySyntax body) + => SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier(identifier), body); - /// Creates a new DiscardPatternSyntax instance. - public static DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken) - { - if (underscoreToken.Kind() != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); - return (DiscardPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.DiscardPattern((Syntax.InternalSyntax.SyntaxToken)underscoreToken.Node!).CreateRed(); - } + /// Creates a new OmittedArraySizeExpressionSyntax instance. + public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression(SyntaxToken omittedArraySizeExpressionToken) + { + if (omittedArraySizeExpressionToken.Kind() != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); + return (OmittedArraySizeExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.OmittedArraySizeExpression((Syntax.InternalSyntax.SyntaxToken)omittedArraySizeExpressionToken.Node!).CreateRed(); + } - /// Creates a new DiscardPatternSyntax instance. - public static DiscardPatternSyntax DiscardPattern() - => SyntaxFactory.DiscardPattern(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); + /// Creates a new OmittedArraySizeExpressionSyntax instance. + public static OmittedArraySizeExpressionSyntax OmittedArraySizeExpression() + => SyntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); - /// Creates a new DeclarationPatternSyntax instance. - public static DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) + /// Creates a new InterpolatedStringExpressionSyntax instance. + public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, SyntaxList contents, SyntaxToken stringEndToken) + { + switch (stringStartToken.Kind()) { - if (type == null) throw new ArgumentNullException(nameof(type)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); - return (DeclarationPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.DeclarationPattern((Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.VariableDesignationSyntax)designation.Green).CreateRed(); + case SyntaxKind.InterpolatedStringStartToken: + case SyntaxKind.InterpolatedVerbatimStringStartToken: + case SyntaxKind.InterpolatedSingleLineRawStringStartToken: + case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; + default: throw new ArgumentException(nameof(stringStartToken)); } - - /// Creates a new VarPatternSyntax instance. - public static VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation) + switch (stringEndToken.Kind()) { - if (varKeyword.Kind() != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); - if (designation == null) throw new ArgumentNullException(nameof(designation)); - return (VarPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.VarPattern((Syntax.InternalSyntax.SyntaxToken)varKeyword.Node!, (Syntax.InternalSyntax.VariableDesignationSyntax)designation.Green).CreateRed(); + case SyntaxKind.InterpolatedStringEndToken: + case SyntaxKind.InterpolatedRawStringEndToken: break; + default: throw new ArgumentException(nameof(stringEndToken)); } + return (InterpolatedStringExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.InterpolatedStringExpression((Syntax.InternalSyntax.SyntaxToken)stringStartToken.Node!, contents.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)stringEndToken.Node!).CreateRed(); + } - /// Creates a new VarPatternSyntax instance. - public static VarPatternSyntax VarPattern(VariableDesignationSyntax designation) - => SyntaxFactory.VarPattern(SyntaxFactory.Token(SyntaxKind.VarKeyword), designation); + /// Creates a new InterpolatedStringExpressionSyntax instance. + public static InterpolatedStringExpressionSyntax InterpolatedStringExpression(SyntaxToken stringStartToken, SyntaxToken stringEndToken) + => SyntaxFactory.InterpolatedStringExpression(stringStartToken, default, stringEndToken); - /// Creates a new RecursivePatternSyntax instance. - public static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) - { - return (RecursivePatternSyntax)Syntax.InternalSyntax.SyntaxFactory.RecursivePattern(type == null ? null : (Syntax.InternalSyntax.TypeSyntax)type.Green, positionalPatternClause == null ? null : (Syntax.InternalSyntax.PositionalPatternClauseSyntax)positionalPatternClause.Green, propertyPatternClause == null ? null : (Syntax.InternalSyntax.PropertyPatternClauseSyntax)propertyPatternClause.Green, designation == null ? null : (Syntax.InternalSyntax.VariableDesignationSyntax)designation.Green).CreateRed(); - } + /// Creates a new IsPatternExpressionSyntax instance. + public static IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (isKeyword.Kind() != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + return (IsPatternExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.IsPatternExpression((Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)isKeyword.Node!, (Syntax.InternalSyntax.PatternSyntax)pattern.Green).CreateRed(); + } - /// Creates a new RecursivePatternSyntax instance. - public static RecursivePatternSyntax RecursivePattern() - => SyntaxFactory.RecursivePattern(default, default, default, default); + /// Creates a new IsPatternExpressionSyntax instance. + public static IsPatternExpressionSyntax IsPatternExpression(ExpressionSyntax expression, PatternSyntax pattern) + => SyntaxFactory.IsPatternExpression(expression, SyntaxFactory.Token(SyntaxKind.IsKeyword), pattern); - /// Creates a new PositionalPatternClauseSyntax instance. - public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (PositionalPatternClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.PositionalPatternClause((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, subpatterns.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new ThrowExpressionSyntax instance. + public static ThrowExpressionSyntax ThrowExpression(SyntaxToken throwKeyword, ExpressionSyntax expression) + { + if (throwKeyword.Kind() != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (ThrowExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.ThrowExpression((Syntax.InternalSyntax.SyntaxToken)throwKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new PositionalPatternClauseSyntax instance. - public static PositionalPatternClauseSyntax PositionalPatternClause(SeparatedSyntaxList subpatterns = default) - => SyntaxFactory.PositionalPatternClause(SyntaxFactory.Token(SyntaxKind.OpenParenToken), subpatterns, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new ThrowExpressionSyntax instance. + public static ThrowExpressionSyntax ThrowExpression(ExpressionSyntax expression) + => SyntaxFactory.ThrowExpression(SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression); - /// Creates a new PropertyPatternClauseSyntax instance. - public static PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) - { - if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - return (PropertyPatternClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.PropertyPatternClause((Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, subpatterns.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); - } + /// Creates a new WhenClauseSyntax instance. + public static WhenClauseSyntax WhenClause(SyntaxToken whenKeyword, ExpressionSyntax condition) + { + if (whenKeyword.Kind() != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + return (WhenClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.WhenClause((Syntax.InternalSyntax.SyntaxToken)whenKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green).CreateRed(); + } - /// Creates a new PropertyPatternClauseSyntax instance. - public static PropertyPatternClauseSyntax PropertyPatternClause(SeparatedSyntaxList subpatterns = default) - => SyntaxFactory.PropertyPatternClause(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), subpatterns, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + /// Creates a new WhenClauseSyntax instance. + public static WhenClauseSyntax WhenClause(ExpressionSyntax condition) + => SyntaxFactory.WhenClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), condition); - /// Creates a new SubpatternSyntax instance. - public static SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) - { - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - return (SubpatternSyntax)Syntax.InternalSyntax.SyntaxFactory.Subpattern(expressionColon == null ? null : (Syntax.InternalSyntax.BaseExpressionColonSyntax)expressionColon.Green, (Syntax.InternalSyntax.PatternSyntax)pattern.Green).CreateRed(); - } + /// Creates a new DiscardPatternSyntax instance. + public static DiscardPatternSyntax DiscardPattern(SyntaxToken underscoreToken) + { + if (underscoreToken.Kind() != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); + return (DiscardPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.DiscardPattern((Syntax.InternalSyntax.SyntaxToken)underscoreToken.Node!).CreateRed(); + } - /// Creates a new SubpatternSyntax instance. - public static SubpatternSyntax Subpattern(PatternSyntax pattern) - => SyntaxFactory.Subpattern(default, pattern); + /// Creates a new DiscardPatternSyntax instance. + public static DiscardPatternSyntax DiscardPattern() + => SyntaxFactory.DiscardPattern(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); - /// Creates a new ConstantPatternSyntax instance. - public static ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression) - { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (ConstantPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.ConstantPattern((Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new DeclarationPatternSyntax instance. + public static DeclarationPatternSyntax DeclarationPattern(TypeSyntax type, VariableDesignationSyntax designation) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); + return (DeclarationPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.DeclarationPattern((Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.VariableDesignationSyntax)designation.Green).CreateRed(); + } - /// Creates a new ParenthesizedPatternSyntax instance. - public static ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (ParenthesizedPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.ParenthesizedPattern((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.PatternSyntax)pattern.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new VarPatternSyntax instance. + public static VarPatternSyntax VarPattern(SyntaxToken varKeyword, VariableDesignationSyntax designation) + { + if (varKeyword.Kind() != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); + if (designation == null) throw new ArgumentNullException(nameof(designation)); + return (VarPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.VarPattern((Syntax.InternalSyntax.SyntaxToken)varKeyword.Node!, (Syntax.InternalSyntax.VariableDesignationSyntax)designation.Green).CreateRed(); + } - /// Creates a new ParenthesizedPatternSyntax instance. - public static ParenthesizedPatternSyntax ParenthesizedPattern(PatternSyntax pattern) - => SyntaxFactory.ParenthesizedPattern(SyntaxFactory.Token(SyntaxKind.OpenParenToken), pattern, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new VarPatternSyntax instance. + public static VarPatternSyntax VarPattern(VariableDesignationSyntax designation) + => SyntaxFactory.VarPattern(SyntaxFactory.Token(SyntaxKind.VarKeyword), designation); - /// Creates a new RelationalPatternSyntax instance. - public static RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression) - { - switch (operatorToken.Kind()) - { - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (RelationalPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.RelationalPattern((Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new RecursivePatternSyntax instance. + public static RecursivePatternSyntax RecursivePattern(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) + { + return (RecursivePatternSyntax)Syntax.InternalSyntax.SyntaxFactory.RecursivePattern(type == null ? null : (Syntax.InternalSyntax.TypeSyntax)type.Green, positionalPatternClause == null ? null : (Syntax.InternalSyntax.PositionalPatternClauseSyntax)positionalPatternClause.Green, propertyPatternClause == null ? null : (Syntax.InternalSyntax.PropertyPatternClauseSyntax)propertyPatternClause.Green, designation == null ? null : (Syntax.InternalSyntax.VariableDesignationSyntax)designation.Green).CreateRed(); + } - /// Creates a new TypePatternSyntax instance. - public static TypePatternSyntax TypePattern(TypeSyntax type) - { - if (type == null) throw new ArgumentNullException(nameof(type)); - return (TypePatternSyntax)Syntax.InternalSyntax.SyntaxFactory.TypePattern((Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); - } + /// Creates a new RecursivePatternSyntax instance. + public static RecursivePatternSyntax RecursivePattern() + => SyntaxFactory.RecursivePattern(default, default, default, default); - /// Creates a new BinaryPatternSyntax instance. - public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) - { - switch (kind) - { - case SyntaxKind.OrPattern: - case SyntaxKind.AndPattern: break; - default: throw new ArgumentException(nameof(kind)); - } - if (left == null) throw new ArgumentNullException(nameof(left)); - switch (operatorToken.Kind()) - { - case SyntaxKind.OrKeyword: - case SyntaxKind.AndKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (right == null) throw new ArgumentNullException(nameof(right)); - return (BinaryPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.BinaryPattern(kind, (Syntax.InternalSyntax.PatternSyntax)left.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.PatternSyntax)right.Green).CreateRed(); - } + /// Creates a new PositionalPatternClauseSyntax instance. + public static PositionalPatternClauseSyntax PositionalPatternClause(SyntaxToken openParenToken, SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (PositionalPatternClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.PositionalPatternClause((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, subpatterns.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new BinaryPatternSyntax instance. - public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, PatternSyntax right) - => SyntaxFactory.BinaryPattern(kind, left, SyntaxFactory.Token(GetBinaryPatternOperatorTokenKind(kind)), right); + /// Creates a new PositionalPatternClauseSyntax instance. + public static PositionalPatternClauseSyntax PositionalPatternClause(SeparatedSyntaxList subpatterns = default) + => SyntaxFactory.PositionalPatternClause(SyntaxFactory.Token(SyntaxKind.OpenParenToken), subpatterns, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - private static SyntaxKind GetBinaryPatternOperatorTokenKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.OrPattern => SyntaxKind.OrKeyword, - SyntaxKind.AndPattern => SyntaxKind.AndKeyword, - _ => throw new ArgumentOutOfRangeException(), - }; + /// Creates a new PropertyPatternClauseSyntax instance. + public static PropertyPatternClauseSyntax PropertyPatternClause(SyntaxToken openBraceToken, SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + { + if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + return (PropertyPatternClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.PropertyPatternClause((Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, subpatterns.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); + } - /// Creates a new UnaryPatternSyntax instance. - public static UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern) - { - if (operatorToken.Kind() != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - return (UnaryPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.UnaryPattern((Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.PatternSyntax)pattern.Green).CreateRed(); - } + /// Creates a new PropertyPatternClauseSyntax instance. + public static PropertyPatternClauseSyntax PropertyPatternClause(SeparatedSyntaxList subpatterns = default) + => SyntaxFactory.PropertyPatternClause(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), subpatterns, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); - /// Creates a new UnaryPatternSyntax instance. - public static UnaryPatternSyntax UnaryPattern(PatternSyntax pattern) - => SyntaxFactory.UnaryPattern(SyntaxFactory.Token(SyntaxKind.NotKeyword), pattern); + /// Creates a new SubpatternSyntax instance. + public static SubpatternSyntax Subpattern(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) + { + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + return (SubpatternSyntax)Syntax.InternalSyntax.SyntaxFactory.Subpattern(expressionColon == null ? null : (Syntax.InternalSyntax.BaseExpressionColonSyntax)expressionColon.Green, (Syntax.InternalSyntax.PatternSyntax)pattern.Green).CreateRed(); + } - /// Creates a new ListPatternSyntax instance. - public static ListPatternSyntax ListPattern(SyntaxToken openBracketToken, SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) - { - if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - return (ListPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.ListPattern((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, patterns.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!, designation == null ? null : (Syntax.InternalSyntax.VariableDesignationSyntax)designation.Green).CreateRed(); - } + /// Creates a new SubpatternSyntax instance. + public static SubpatternSyntax Subpattern(PatternSyntax pattern) + => SyntaxFactory.Subpattern(default, pattern); - /// Creates a new ListPatternSyntax instance. - public static ListPatternSyntax ListPattern(SeparatedSyntaxList patterns, VariableDesignationSyntax? designation) - => SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), patterns, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), designation); + /// Creates a new ConstantPatternSyntax instance. + public static ConstantPatternSyntax ConstantPattern(ExpressionSyntax expression) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (ConstantPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.ConstantPattern((Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new ListPatternSyntax instance. - public static ListPatternSyntax ListPattern(SeparatedSyntaxList patterns = default) - => SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), patterns, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), default); + /// Creates a new ParenthesizedPatternSyntax instance. + public static ParenthesizedPatternSyntax ParenthesizedPattern(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (ParenthesizedPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.ParenthesizedPattern((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.PatternSyntax)pattern.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new SlicePatternSyntax instance. - public static SlicePatternSyntax SlicePattern(SyntaxToken dotDotToken, PatternSyntax? pattern) - { - if (dotDotToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); - return (SlicePatternSyntax)Syntax.InternalSyntax.SyntaxFactory.SlicePattern((Syntax.InternalSyntax.SyntaxToken)dotDotToken.Node!, pattern == null ? null : (Syntax.InternalSyntax.PatternSyntax)pattern.Green).CreateRed(); - } + /// Creates a new ParenthesizedPatternSyntax instance. + public static ParenthesizedPatternSyntax ParenthesizedPattern(PatternSyntax pattern) + => SyntaxFactory.ParenthesizedPattern(SyntaxFactory.Token(SyntaxKind.OpenParenToken), pattern, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new SlicePatternSyntax instance. - public static SlicePatternSyntax SlicePattern(PatternSyntax? pattern = default) - => SyntaxFactory.SlicePattern(SyntaxFactory.Token(SyntaxKind.DotDotToken), pattern); + /// Creates a new RelationalPatternSyntax instance. + public static RelationalPatternSyntax RelationalPattern(SyntaxToken operatorToken, ExpressionSyntax expression) + { + switch (operatorToken.Kind()) + { + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (RelationalPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.RelationalPattern((Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } + + /// Creates a new TypePatternSyntax instance. + public static TypePatternSyntax TypePattern(TypeSyntax type) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + return (TypePatternSyntax)Syntax.InternalSyntax.SyntaxFactory.TypePattern((Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + } - /// Creates a new InterpolatedStringTextSyntax instance. - public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken) + /// Creates a new BinaryPatternSyntax instance. + public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + { + switch (kind) + { + case SyntaxKind.OrPattern: + case SyntaxKind.AndPattern: break; + default: throw new ArgumentException(nameof(kind)); + } + if (left == null) throw new ArgumentNullException(nameof(left)); + switch (operatorToken.Kind()) { - if (textToken.Kind() != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); - return (InterpolatedStringTextSyntax)Syntax.InternalSyntax.SyntaxFactory.InterpolatedStringText((Syntax.InternalSyntax.SyntaxToken)textToken.Node!).CreateRed(); + case SyntaxKind.OrKeyword: + case SyntaxKind.AndKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); } + if (right == null) throw new ArgumentNullException(nameof(right)); + return (BinaryPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.BinaryPattern(kind, (Syntax.InternalSyntax.PatternSyntax)left.Green, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.PatternSyntax)right.Green).CreateRed(); + } - /// Creates a new InterpolatedStringTextSyntax instance. - public static InterpolatedStringTextSyntax InterpolatedStringText() - => SyntaxFactory.InterpolatedStringText(SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); + /// Creates a new BinaryPatternSyntax instance. + public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, PatternSyntax right) + => SyntaxFactory.BinaryPattern(kind, left, SyntaxFactory.Token(GetBinaryPatternOperatorTokenKind(kind)), right); - /// Creates a new InterpolationSyntax instance. - public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + private static SyntaxKind GetBinaryPatternOperatorTokenKind(SyntaxKind kind) + => kind switch { - if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - return (InterpolationSyntax)Syntax.InternalSyntax.SyntaxFactory.Interpolation((Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, alignmentClause == null ? null : (Syntax.InternalSyntax.InterpolationAlignmentClauseSyntax)alignmentClause.Green, formatClause == null ? null : (Syntax.InternalSyntax.InterpolationFormatClauseSyntax)formatClause.Green, (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); - } + SyntaxKind.OrPattern => SyntaxKind.OrKeyword, + SyntaxKind.AndPattern => SyntaxKind.AndKeyword, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new InterpolationSyntax instance. - public static InterpolationSyntax Interpolation(ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause) - => SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expression, alignmentClause, formatClause, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + /// Creates a new UnaryPatternSyntax instance. + public static UnaryPatternSyntax UnaryPattern(SyntaxToken operatorToken, PatternSyntax pattern) + { + if (operatorToken.Kind() != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + return (UnaryPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.UnaryPattern((Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.PatternSyntax)pattern.Green).CreateRed(); + } - /// Creates a new InterpolationSyntax instance. - public static InterpolationSyntax Interpolation(ExpressionSyntax expression) - => SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expression, default, default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + /// Creates a new UnaryPatternSyntax instance. + public static UnaryPatternSyntax UnaryPattern(PatternSyntax pattern) + => SyntaxFactory.UnaryPattern(SyntaxFactory.Token(SyntaxKind.NotKeyword), pattern); - /// Creates a new InterpolationAlignmentClauseSyntax instance. - public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value) - { - if (value == null) throw new ArgumentNullException(nameof(value)); - return (InterpolationAlignmentClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.InterpolationAlignmentClause((Syntax.InternalSyntax.SyntaxToken)commaToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)value.Green).CreateRed(); - } + /// Creates a new ListPatternSyntax instance. + public static ListPatternSyntax ListPattern(SyntaxToken openBracketToken, SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + { + if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + return (ListPatternSyntax)Syntax.InternalSyntax.SyntaxFactory.ListPattern((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, patterns.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!, designation == null ? null : (Syntax.InternalSyntax.VariableDesignationSyntax)designation.Green).CreateRed(); + } - /// Creates a new InterpolationFormatClauseSyntax instance. - public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken) - { - if (formatStringToken.Kind() != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); - return (InterpolationFormatClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.InterpolationFormatClause((Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.SyntaxToken)formatStringToken.Node!).CreateRed(); - } + /// Creates a new ListPatternSyntax instance. + public static ListPatternSyntax ListPattern(SeparatedSyntaxList patterns, VariableDesignationSyntax? designation) + => SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), patterns, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), designation); - /// Creates a new InterpolationFormatClauseSyntax instance. - public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken) - => SyntaxFactory.InterpolationFormatClause(colonToken, SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); + /// Creates a new ListPatternSyntax instance. + public static ListPatternSyntax ListPattern(SeparatedSyntaxList patterns = default) + => SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), patterns, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), default); - /// Creates a new GlobalStatementSyntax instance. - public static GlobalStatementSyntax GlobalStatement(SyntaxList attributeLists, SyntaxTokenList modifiers, StatementSyntax statement) - { - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (GlobalStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.GlobalStatement(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); - } + /// Creates a new SlicePatternSyntax instance. + public static SlicePatternSyntax SlicePattern(SyntaxToken dotDotToken, PatternSyntax? pattern) + { + if (dotDotToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); + return (SlicePatternSyntax)Syntax.InternalSyntax.SyntaxFactory.SlicePattern((Syntax.InternalSyntax.SyntaxToken)dotDotToken.Node!, pattern == null ? null : (Syntax.InternalSyntax.PatternSyntax)pattern.Green).CreateRed(); + } - /// Creates a new GlobalStatementSyntax instance. - public static GlobalStatementSyntax GlobalStatement(StatementSyntax statement) - => SyntaxFactory.GlobalStatement(default, default(SyntaxTokenList), statement); + /// Creates a new SlicePatternSyntax instance. + public static SlicePatternSyntax SlicePattern(PatternSyntax? pattern = default) + => SyntaxFactory.SlicePattern(SyntaxFactory.Token(SyntaxKind.DotDotToken), pattern); - /// Creates a new BlockSyntax instance. - public static BlockSyntax Block(SyntaxList attributeLists, SyntaxToken openBraceToken, SyntaxList statements, SyntaxToken closeBraceToken) - { - if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - return (BlockSyntax)Syntax.InternalSyntax.SyntaxFactory.Block(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, statements.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); - } + /// Creates a new InterpolatedStringTextSyntax instance. + public static InterpolatedStringTextSyntax InterpolatedStringText(SyntaxToken textToken) + { + if (textToken.Kind() != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); + return (InterpolatedStringTextSyntax)Syntax.InternalSyntax.SyntaxFactory.InterpolatedStringText((Syntax.InternalSyntax.SyntaxToken)textToken.Node!).CreateRed(); + } + + /// Creates a new InterpolatedStringTextSyntax instance. + public static InterpolatedStringTextSyntax InterpolatedStringText() + => SyntaxFactory.InterpolatedStringText(SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); + + /// Creates a new InterpolationSyntax instance. + public static InterpolationSyntax Interpolation(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + { + if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + return (InterpolationSyntax)Syntax.InternalSyntax.SyntaxFactory.Interpolation((Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, alignmentClause == null ? null : (Syntax.InternalSyntax.InterpolationAlignmentClauseSyntax)alignmentClause.Green, formatClause == null ? null : (Syntax.InternalSyntax.InterpolationFormatClauseSyntax)formatClause.Green, (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); + } + + /// Creates a new InterpolationSyntax instance. + public static InterpolationSyntax Interpolation(ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause) + => SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expression, alignmentClause, formatClause, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + + /// Creates a new InterpolationSyntax instance. + public static InterpolationSyntax Interpolation(ExpressionSyntax expression) + => SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expression, default, default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + + /// Creates a new InterpolationAlignmentClauseSyntax instance. + public static InterpolationAlignmentClauseSyntax InterpolationAlignmentClause(SyntaxToken commaToken, ExpressionSyntax value) + { + if (value == null) throw new ArgumentNullException(nameof(value)); + return (InterpolationAlignmentClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.InterpolationAlignmentClause((Syntax.InternalSyntax.SyntaxToken)commaToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)value.Green).CreateRed(); + } + + /// Creates a new InterpolationFormatClauseSyntax instance. + public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken, SyntaxToken formatStringToken) + { + if (formatStringToken.Kind() != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); + return (InterpolationFormatClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.InterpolationFormatClause((Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.SyntaxToken)formatStringToken.Node!).CreateRed(); + } + + /// Creates a new InterpolationFormatClauseSyntax instance. + public static InterpolationFormatClauseSyntax InterpolationFormatClause(SyntaxToken colonToken) + => SyntaxFactory.InterpolationFormatClause(colonToken, SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); + + /// Creates a new GlobalStatementSyntax instance. + public static GlobalStatementSyntax GlobalStatement(SyntaxList attributeLists, SyntaxTokenList modifiers, StatementSyntax statement) + { + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (GlobalStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.GlobalStatement(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + } - /// Creates a new BlockSyntax instance. - public static BlockSyntax Block(SyntaxList attributeLists, SyntaxList statements) - => SyntaxFactory.Block(attributeLists, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), statements, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + /// Creates a new GlobalStatementSyntax instance. + public static GlobalStatementSyntax GlobalStatement(StatementSyntax statement) + => SyntaxFactory.GlobalStatement(default, default(SyntaxTokenList), statement); + + /// Creates a new BlockSyntax instance. + public static BlockSyntax Block(SyntaxList attributeLists, SyntaxToken openBraceToken, SyntaxList statements, SyntaxToken closeBraceToken) + { + if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + return (BlockSyntax)Syntax.InternalSyntax.SyntaxFactory.Block(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, statements.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); + } + + /// Creates a new BlockSyntax instance. + public static BlockSyntax Block(SyntaxList attributeLists, SyntaxList statements) + => SyntaxFactory.Block(attributeLists, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), statements, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); #pragma warning disable RS0027 - /// Creates a new BlockSyntax instance. - public static BlockSyntax Block(SyntaxList statements = default) - => SyntaxFactory.Block(default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), statements, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + /// Creates a new BlockSyntax instance. + public static BlockSyntax Block(SyntaxList statements = default) + => SyntaxFactory.Block(default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), statements, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); #pragma warning restore RS0027 - /// Creates a new LocalFunctionStatementSyntax instance. - public static LocalFunctionStatementSyntax LocalFunctionStatement(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + /// Creates a new LocalFunctionStatementSyntax instance. + public static LocalFunctionStatementSyntax LocalFunctionStatement(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + switch (semicolonToken.Kind()) { - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (LocalFunctionStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.LocalFunctionStatement(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)returnType.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, constraintClauses.Node.ToGreenList(), body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (LocalFunctionStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.LocalFunctionStatement(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)returnType.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, constraintClauses.Node.ToGreenList(), body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new LocalFunctionStatementSyntax instance. - public static LocalFunctionStatementSyntax LocalFunctionStatement(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) - => SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, default); + /// Creates a new LocalFunctionStatementSyntax instance. + public static LocalFunctionStatementSyntax LocalFunctionStatement(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) + => SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, default); - /// Creates a new LocalFunctionStatementSyntax instance. - public static LocalFunctionStatementSyntax LocalFunctionStatement(TypeSyntax returnType, SyntaxToken identifier) - => SyntaxFactory.LocalFunctionStatement(default, default(SyntaxTokenList), returnType, identifier, default, SyntaxFactory.ParameterList(), default, default, default, default); + /// Creates a new LocalFunctionStatementSyntax instance. + public static LocalFunctionStatementSyntax LocalFunctionStatement(TypeSyntax returnType, SyntaxToken identifier) + => SyntaxFactory.LocalFunctionStatement(default, default(SyntaxTokenList), returnType, identifier, default, SyntaxFactory.ParameterList(), default, default, default, default); - /// Creates a new LocalFunctionStatementSyntax instance. - public static LocalFunctionStatementSyntax LocalFunctionStatement(TypeSyntax returnType, string identifier) - => SyntaxFactory.LocalFunctionStatement(default, default(SyntaxTokenList), returnType, SyntaxFactory.Identifier(identifier), default, SyntaxFactory.ParameterList(), default, default, default, default); + /// Creates a new LocalFunctionStatementSyntax instance. + public static LocalFunctionStatementSyntax LocalFunctionStatement(TypeSyntax returnType, string identifier) + => SyntaxFactory.LocalFunctionStatement(default, default(SyntaxTokenList), returnType, SyntaxFactory.Identifier(identifier), default, SyntaxFactory.ParameterList(), default, default, default, default); - /// Creates a new LocalDeclarationStatementSyntax instance. - public static LocalDeclarationStatementSyntax LocalDeclarationStatement(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + /// Creates a new LocalDeclarationStatementSyntax instance. + public static LocalDeclarationStatementSyntax LocalDeclarationStatement(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + switch (awaitKeyword.Kind()) { - switch (awaitKeyword.Kind()) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } - switch (usingKeyword.Kind()) - { - case SyntaxKind.UsingKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(usingKeyword)); - } - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (LocalDeclarationStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.LocalDeclarationStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)awaitKeyword.Node, (Syntax.InternalSyntax.SyntaxToken?)usingKeyword.Node, modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } + switch (usingKeyword.Kind()) + { + case SyntaxKind.UsingKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(usingKeyword)); + } + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (LocalDeclarationStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.LocalDeclarationStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)awaitKeyword.Node, (Syntax.InternalSyntax.SyntaxToken?)usingKeyword.Node, modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new LocalDeclarationStatementSyntax instance. - public static LocalDeclarationStatementSyntax LocalDeclarationStatement(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration) - => SyntaxFactory.LocalDeclarationStatement(attributeLists, default, default, modifiers, declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new LocalDeclarationStatementSyntax instance. + public static LocalDeclarationStatementSyntax LocalDeclarationStatement(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration) + => SyntaxFactory.LocalDeclarationStatement(attributeLists, default, default, modifiers, declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new LocalDeclarationStatementSyntax instance. - public static LocalDeclarationStatementSyntax LocalDeclarationStatement(VariableDeclarationSyntax declaration) - => SyntaxFactory.LocalDeclarationStatement(default, default, default, default(SyntaxTokenList), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new LocalDeclarationStatementSyntax instance. + public static LocalDeclarationStatementSyntax LocalDeclarationStatement(VariableDeclarationSyntax declaration) + => SyntaxFactory.LocalDeclarationStatement(default, default, default, default(SyntaxTokenList), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new VariableDeclarationSyntax instance. - public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, SeparatedSyntaxList variables) - { - if (type == null) throw new ArgumentNullException(nameof(type)); - return (VariableDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.VariableDeclaration((Syntax.InternalSyntax.TypeSyntax)type.Green, variables.Node.ToGreenSeparatedList()).CreateRed(); - } + /// Creates a new VariableDeclarationSyntax instance. + public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type, SeparatedSyntaxList variables) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + return (VariableDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.VariableDeclaration((Syntax.InternalSyntax.TypeSyntax)type.Green, variables.Node.ToGreenSeparatedList()).CreateRed(); + } - /// Creates a new VariableDeclarationSyntax instance. - public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type) - => SyntaxFactory.VariableDeclaration(type, default); + /// Creates a new VariableDeclarationSyntax instance. + public static VariableDeclarationSyntax VariableDeclaration(TypeSyntax type) + => SyntaxFactory.VariableDeclaration(type, default); - /// Creates a new VariableDeclaratorSyntax instance. - public static VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) - { - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - return (VariableDeclaratorSyntax)Syntax.InternalSyntax.SyntaxFactory.VariableDeclarator((Syntax.InternalSyntax.SyntaxToken)identifier.Node!, argumentList == null ? null : (Syntax.InternalSyntax.BracketedArgumentListSyntax)argumentList.Green, initializer == null ? null : (Syntax.InternalSyntax.EqualsValueClauseSyntax)initializer.Green).CreateRed(); - } + /// Creates a new VariableDeclaratorSyntax instance. + public static VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) + { + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + return (VariableDeclaratorSyntax)Syntax.InternalSyntax.SyntaxFactory.VariableDeclarator((Syntax.InternalSyntax.SyntaxToken)identifier.Node!, argumentList == null ? null : (Syntax.InternalSyntax.BracketedArgumentListSyntax)argumentList.Green, initializer == null ? null : (Syntax.InternalSyntax.EqualsValueClauseSyntax)initializer.Green).CreateRed(); + } - /// Creates a new VariableDeclaratorSyntax instance. - public static VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier) - => SyntaxFactory.VariableDeclarator(identifier, default, default); + /// Creates a new VariableDeclaratorSyntax instance. + public static VariableDeclaratorSyntax VariableDeclarator(SyntaxToken identifier) + => SyntaxFactory.VariableDeclarator(identifier, default, default); - /// Creates a new VariableDeclaratorSyntax instance. - public static VariableDeclaratorSyntax VariableDeclarator(string identifier) - => SyntaxFactory.VariableDeclarator(SyntaxFactory.Identifier(identifier), default, default); + /// Creates a new VariableDeclaratorSyntax instance. + public static VariableDeclaratorSyntax VariableDeclarator(string identifier) + => SyntaxFactory.VariableDeclarator(SyntaxFactory.Identifier(identifier), default, default); - /// Creates a new EqualsValueClauseSyntax instance. - public static EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value) - { - if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - if (value == null) throw new ArgumentNullException(nameof(value)); - return (EqualsValueClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.EqualsValueClause((Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)value.Green).CreateRed(); - } + /// Creates a new EqualsValueClauseSyntax instance. + public static EqualsValueClauseSyntax EqualsValueClause(SyntaxToken equalsToken, ExpressionSyntax value) + { + if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + if (value == null) throw new ArgumentNullException(nameof(value)); + return (EqualsValueClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.EqualsValueClause((Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)value.Green).CreateRed(); + } - /// Creates a new EqualsValueClauseSyntax instance. - public static EqualsValueClauseSyntax EqualsValueClause(ExpressionSyntax value) - => SyntaxFactory.EqualsValueClause(SyntaxFactory.Token(SyntaxKind.EqualsToken), value); + /// Creates a new EqualsValueClauseSyntax instance. + public static EqualsValueClauseSyntax EqualsValueClause(ExpressionSyntax value) + => SyntaxFactory.EqualsValueClause(SyntaxFactory.Token(SyntaxKind.EqualsToken), value); - /// Creates a new SingleVariableDesignationSyntax instance. - public static SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier) - { - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - return (SingleVariableDesignationSyntax)Syntax.InternalSyntax.SyntaxFactory.SingleVariableDesignation((Syntax.InternalSyntax.SyntaxToken)identifier.Node!).CreateRed(); - } + /// Creates a new SingleVariableDesignationSyntax instance. + public static SingleVariableDesignationSyntax SingleVariableDesignation(SyntaxToken identifier) + { + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + return (SingleVariableDesignationSyntax)Syntax.InternalSyntax.SyntaxFactory.SingleVariableDesignation((Syntax.InternalSyntax.SyntaxToken)identifier.Node!).CreateRed(); + } - /// Creates a new DiscardDesignationSyntax instance. - public static DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) - { - if (underscoreToken.Kind() != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); - return (DiscardDesignationSyntax)Syntax.InternalSyntax.SyntaxFactory.DiscardDesignation((Syntax.InternalSyntax.SyntaxToken)underscoreToken.Node!).CreateRed(); - } + /// Creates a new DiscardDesignationSyntax instance. + public static DiscardDesignationSyntax DiscardDesignation(SyntaxToken underscoreToken) + { + if (underscoreToken.Kind() != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); + return (DiscardDesignationSyntax)Syntax.InternalSyntax.SyntaxFactory.DiscardDesignation((Syntax.InternalSyntax.SyntaxToken)underscoreToken.Node!).CreateRed(); + } - /// Creates a new DiscardDesignationSyntax instance. - public static DiscardDesignationSyntax DiscardDesignation() - => SyntaxFactory.DiscardDesignation(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); + /// Creates a new DiscardDesignationSyntax instance. + public static DiscardDesignationSyntax DiscardDesignation() + => SyntaxFactory.DiscardDesignation(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); - /// Creates a new ParenthesizedVariableDesignationSyntax instance. - public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, SeparatedSyntaxList variables, SyntaxToken closeParenToken) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (ParenthesizedVariableDesignationSyntax)Syntax.InternalSyntax.SyntaxFactory.ParenthesizedVariableDesignation((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, variables.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new ParenthesizedVariableDesignationSyntax instance. + public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SyntaxToken openParenToken, SeparatedSyntaxList variables, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (ParenthesizedVariableDesignationSyntax)Syntax.InternalSyntax.SyntaxFactory.ParenthesizedVariableDesignation((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, variables.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new ParenthesizedVariableDesignationSyntax instance. - public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SeparatedSyntaxList variables = default) - => SyntaxFactory.ParenthesizedVariableDesignation(SyntaxFactory.Token(SyntaxKind.OpenParenToken), variables, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new ParenthesizedVariableDesignationSyntax instance. + public static ParenthesizedVariableDesignationSyntax ParenthesizedVariableDesignation(SeparatedSyntaxList variables = default) + => SyntaxFactory.ParenthesizedVariableDesignation(SyntaxFactory.Token(SyntaxKind.OpenParenToken), variables, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new ExpressionStatementSyntax instance. - public static ExpressionStatementSyntax ExpressionStatement(SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) - { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (ExpressionStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ExpressionStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); - } + /// Creates a new ExpressionStatementSyntax instance. + public static ExpressionStatementSyntax ExpressionStatement(SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (ExpressionStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ExpressionStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new ExpressionStatementSyntax instance. - public static ExpressionStatementSyntax ExpressionStatement(SyntaxList attributeLists, ExpressionSyntax expression) - => SyntaxFactory.ExpressionStatement(attributeLists, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new ExpressionStatementSyntax instance. + public static ExpressionStatementSyntax ExpressionStatement(SyntaxList attributeLists, ExpressionSyntax expression) + => SyntaxFactory.ExpressionStatement(attributeLists, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new ExpressionStatementSyntax instance. - public static ExpressionStatementSyntax ExpressionStatement(ExpressionSyntax expression) - => SyntaxFactory.ExpressionStatement(default, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new ExpressionStatementSyntax instance. + public static ExpressionStatementSyntax ExpressionStatement(ExpressionSyntax expression) + => SyntaxFactory.ExpressionStatement(default, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new EmptyStatementSyntax instance. - public static EmptyStatementSyntax EmptyStatement(SyntaxList attributeLists, SyntaxToken semicolonToken) - { - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (EmptyStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.EmptyStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); - } + /// Creates a new EmptyStatementSyntax instance. + public static EmptyStatementSyntax EmptyStatement(SyntaxList attributeLists, SyntaxToken semicolonToken) + { + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (EmptyStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.EmptyStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new EmptyStatementSyntax instance. - public static EmptyStatementSyntax EmptyStatement(SyntaxList attributeLists) - => SyntaxFactory.EmptyStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new EmptyStatementSyntax instance. + public static EmptyStatementSyntax EmptyStatement(SyntaxList attributeLists) + => SyntaxFactory.EmptyStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new EmptyStatementSyntax instance. - public static EmptyStatementSyntax EmptyStatement() - => SyntaxFactory.EmptyStatement(default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new EmptyStatementSyntax instance. + public static EmptyStatementSyntax EmptyStatement() + => SyntaxFactory.EmptyStatement(default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new LabeledStatementSyntax instance. - public static LabeledStatementSyntax LabeledStatement(SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) - { - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (LabeledStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.LabeledStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); - } + /// Creates a new LabeledStatementSyntax instance. + public static LabeledStatementSyntax LabeledStatement(SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + { + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (LabeledStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.LabeledStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + } - /// Creates a new LabeledStatementSyntax instance. - public static LabeledStatementSyntax LabeledStatement(SyntaxList attributeLists, SyntaxToken identifier, StatementSyntax statement) - => SyntaxFactory.LabeledStatement(attributeLists, identifier, SyntaxFactory.Token(SyntaxKind.ColonToken), statement); + /// Creates a new LabeledStatementSyntax instance. + public static LabeledStatementSyntax LabeledStatement(SyntaxList attributeLists, SyntaxToken identifier, StatementSyntax statement) + => SyntaxFactory.LabeledStatement(attributeLists, identifier, SyntaxFactory.Token(SyntaxKind.ColonToken), statement); - /// Creates a new LabeledStatementSyntax instance. - public static LabeledStatementSyntax LabeledStatement(SyntaxToken identifier, StatementSyntax statement) - => SyntaxFactory.LabeledStatement(default, identifier, SyntaxFactory.Token(SyntaxKind.ColonToken), statement); + /// Creates a new LabeledStatementSyntax instance. + public static LabeledStatementSyntax LabeledStatement(SyntaxToken identifier, StatementSyntax statement) + => SyntaxFactory.LabeledStatement(default, identifier, SyntaxFactory.Token(SyntaxKind.ColonToken), statement); - /// Creates a new LabeledStatementSyntax instance. - public static LabeledStatementSyntax LabeledStatement(string identifier, StatementSyntax statement) - => SyntaxFactory.LabeledStatement(default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.ColonToken), statement); + /// Creates a new LabeledStatementSyntax instance. + public static LabeledStatementSyntax LabeledStatement(string identifier, StatementSyntax statement) + => SyntaxFactory.LabeledStatement(default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.ColonToken), statement); - /// Creates a new GotoStatementSyntax instance. - public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + /// Creates a new GotoStatementSyntax instance. + public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + switch (kind) + { + case SyntaxKind.GotoStatement: + case SyntaxKind.GotoCaseStatement: + case SyntaxKind.GotoDefaultStatement: break; + default: throw new ArgumentException(nameof(kind)); + } + if (gotoKeyword.Kind() != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); + switch (caseOrDefaultKeyword.Kind()) { - switch (kind) - { - case SyntaxKind.GotoStatement: - case SyntaxKind.GotoCaseStatement: - case SyntaxKind.GotoDefaultStatement: break; - default: throw new ArgumentException(nameof(kind)); - } - if (gotoKeyword.Kind() != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); - switch (caseOrDefaultKeyword.Kind()) - { - case SyntaxKind.CaseKeyword: - case SyntaxKind.DefaultKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(caseOrDefaultKeyword)); - } - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (GotoStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.GotoStatement(kind, attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)gotoKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)caseOrDefaultKeyword.Node, expression == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + case SyntaxKind.CaseKeyword: + case SyntaxKind.DefaultKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(caseOrDefaultKeyword)); } + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (GotoStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.GotoStatement(kind, attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)gotoKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)caseOrDefaultKeyword.Node, expression == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new GotoStatementSyntax instance. - public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxList attributeLists, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression) - => SyntaxFactory.GotoStatement(kind, attributeLists, SyntaxFactory.Token(SyntaxKind.GotoKeyword), caseOrDefaultKeyword, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new GotoStatementSyntax instance. + public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxList attributeLists, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression) + => SyntaxFactory.GotoStatement(kind, attributeLists, SyntaxFactory.Token(SyntaxKind.GotoKeyword), caseOrDefaultKeyword, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); #pragma warning disable RS0027 - /// Creates a new GotoStatementSyntax instance. - public static GotoStatementSyntax GotoStatement(SyntaxKind kind, ExpressionSyntax? expression = default) - => SyntaxFactory.GotoStatement(kind, default, SyntaxFactory.Token(SyntaxKind.GotoKeyword), default, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new GotoStatementSyntax instance. + public static GotoStatementSyntax GotoStatement(SyntaxKind kind, ExpressionSyntax? expression = default) + => SyntaxFactory.GotoStatement(kind, default, SyntaxFactory.Token(SyntaxKind.GotoKeyword), default, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); #pragma warning restore RS0027 - /// Creates a new BreakStatementSyntax instance. - public static BreakStatementSyntax BreakStatement(SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) - { - if (breakKeyword.Kind() != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (BreakStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.BreakStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)breakKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); - } + /// Creates a new BreakStatementSyntax instance. + public static BreakStatementSyntax BreakStatement(SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + { + if (breakKeyword.Kind() != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (BreakStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.BreakStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)breakKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new BreakStatementSyntax instance. - public static BreakStatementSyntax BreakStatement(SyntaxList attributeLists) - => SyntaxFactory.BreakStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.BreakKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new BreakStatementSyntax instance. + public static BreakStatementSyntax BreakStatement(SyntaxList attributeLists) + => SyntaxFactory.BreakStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.BreakKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new BreakStatementSyntax instance. - public static BreakStatementSyntax BreakStatement() - => SyntaxFactory.BreakStatement(default, SyntaxFactory.Token(SyntaxKind.BreakKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new BreakStatementSyntax instance. + public static BreakStatementSyntax BreakStatement() + => SyntaxFactory.BreakStatement(default, SyntaxFactory.Token(SyntaxKind.BreakKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new ContinueStatementSyntax instance. - public static ContinueStatementSyntax ContinueStatement(SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) - { - if (continueKeyword.Kind() != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (ContinueStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ContinueStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)continueKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); - } + /// Creates a new ContinueStatementSyntax instance. + public static ContinueStatementSyntax ContinueStatement(SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + { + if (continueKeyword.Kind() != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (ContinueStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ContinueStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)continueKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new ContinueStatementSyntax instance. - public static ContinueStatementSyntax ContinueStatement(SyntaxList attributeLists) - => SyntaxFactory.ContinueStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ContinueKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new ContinueStatementSyntax instance. + public static ContinueStatementSyntax ContinueStatement(SyntaxList attributeLists) + => SyntaxFactory.ContinueStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ContinueKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new ContinueStatementSyntax instance. - public static ContinueStatementSyntax ContinueStatement() - => SyntaxFactory.ContinueStatement(default, SyntaxFactory.Token(SyntaxKind.ContinueKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new ContinueStatementSyntax instance. + public static ContinueStatementSyntax ContinueStatement() + => SyntaxFactory.ContinueStatement(default, SyntaxFactory.Token(SyntaxKind.ContinueKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new ReturnStatementSyntax instance. - public static ReturnStatementSyntax ReturnStatement(SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { - if (returnKeyword.Kind() != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (ReturnStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ReturnStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)returnKeyword.Node!, expression == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); - } + /// Creates a new ReturnStatementSyntax instance. + public static ReturnStatementSyntax ReturnStatement(SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + if (returnKeyword.Kind() != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (ReturnStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ReturnStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)returnKeyword.Node!, expression == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new ReturnStatementSyntax instance. - public static ReturnStatementSyntax ReturnStatement(SyntaxList attributeLists, ExpressionSyntax? expression) - => SyntaxFactory.ReturnStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ReturnKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new ReturnStatementSyntax instance. + public static ReturnStatementSyntax ReturnStatement(SyntaxList attributeLists, ExpressionSyntax? expression) + => SyntaxFactory.ReturnStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ReturnKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); #pragma warning disable RS0027 - /// Creates a new ReturnStatementSyntax instance. - public static ReturnStatementSyntax ReturnStatement(ExpressionSyntax? expression = default) - => SyntaxFactory.ReturnStatement(default, SyntaxFactory.Token(SyntaxKind.ReturnKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new ReturnStatementSyntax instance. + public static ReturnStatementSyntax ReturnStatement(ExpressionSyntax? expression = default) + => SyntaxFactory.ReturnStatement(default, SyntaxFactory.Token(SyntaxKind.ReturnKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); #pragma warning restore RS0027 - /// Creates a new ThrowStatementSyntax instance. - public static ThrowStatementSyntax ThrowStatement(SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { - if (throwKeyword.Kind() != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (ThrowStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ThrowStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)throwKeyword.Node!, expression == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); - } + /// Creates a new ThrowStatementSyntax instance. + public static ThrowStatementSyntax ThrowStatement(SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + if (throwKeyword.Kind() != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (ThrowStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ThrowStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)throwKeyword.Node!, expression == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new ThrowStatementSyntax instance. - public static ThrowStatementSyntax ThrowStatement(SyntaxList attributeLists, ExpressionSyntax? expression) - => SyntaxFactory.ThrowStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new ThrowStatementSyntax instance. + public static ThrowStatementSyntax ThrowStatement(SyntaxList attributeLists, ExpressionSyntax? expression) + => SyntaxFactory.ThrowStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); #pragma warning disable RS0027 - /// Creates a new ThrowStatementSyntax instance. - public static ThrowStatementSyntax ThrowStatement(ExpressionSyntax? expression = default) - => SyntaxFactory.ThrowStatement(default, SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new ThrowStatementSyntax instance. + public static ThrowStatementSyntax ThrowStatement(ExpressionSyntax? expression = default) + => SyntaxFactory.ThrowStatement(default, SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); #pragma warning restore RS0027 - /// Creates a new YieldStatementSyntax instance. - public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + /// Creates a new YieldStatementSyntax instance. + public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + switch (kind) + { + case SyntaxKind.YieldReturnStatement: + case SyntaxKind.YieldBreakStatement: break; + default: throw new ArgumentException(nameof(kind)); + } + if (yieldKeyword.Kind() != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); + switch (returnOrBreakKeyword.Kind()) { - switch (kind) - { - case SyntaxKind.YieldReturnStatement: - case SyntaxKind.YieldBreakStatement: break; - default: throw new ArgumentException(nameof(kind)); - } - if (yieldKeyword.Kind() != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); - switch (returnOrBreakKeyword.Kind()) - { - case SyntaxKind.ReturnKeyword: - case SyntaxKind.BreakKeyword: break; - default: throw new ArgumentException(nameof(returnOrBreakKeyword)); - } - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (YieldStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.YieldStatement(kind, attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)yieldKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)returnOrBreakKeyword.Node!, expression == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + case SyntaxKind.ReturnKeyword: + case SyntaxKind.BreakKeyword: break; + default: throw new ArgumentException(nameof(returnOrBreakKeyword)); } + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (YieldStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.YieldStatement(kind, attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)yieldKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)returnOrBreakKeyword.Node!, expression == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new YieldStatementSyntax instance. - public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxList attributeLists, ExpressionSyntax? expression) - => SyntaxFactory.YieldStatement(kind, attributeLists, SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(GetYieldStatementReturnOrBreakKeywordKind(kind)), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new YieldStatementSyntax instance. + public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxList attributeLists, ExpressionSyntax? expression) + => SyntaxFactory.YieldStatement(kind, attributeLists, SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(GetYieldStatementReturnOrBreakKeywordKind(kind)), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); #pragma warning disable RS0027 - /// Creates a new YieldStatementSyntax instance. - public static YieldStatementSyntax YieldStatement(SyntaxKind kind, ExpressionSyntax? expression = default) - => SyntaxFactory.YieldStatement(kind, default, SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(GetYieldStatementReturnOrBreakKeywordKind(kind)), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new YieldStatementSyntax instance. + public static YieldStatementSyntax YieldStatement(SyntaxKind kind, ExpressionSyntax? expression = default) + => SyntaxFactory.YieldStatement(kind, default, SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(GetYieldStatementReturnOrBreakKeywordKind(kind)), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); #pragma warning restore RS0027 - private static SyntaxKind GetYieldStatementReturnOrBreakKeywordKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.YieldReturnStatement => SyntaxKind.ReturnKeyword, - SyntaxKind.YieldBreakStatement => SyntaxKind.BreakKeyword, - _ => throw new ArgumentOutOfRangeException(), - }; - - /// Creates a new WhileStatementSyntax instance. - public static WhileStatementSyntax WhileStatement(SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + private static SyntaxKind GetYieldStatementReturnOrBreakKeywordKind(SyntaxKind kind) + => kind switch { - if (whileKeyword.Kind() != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (WhileStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.WhileStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)whileKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); - } + SyntaxKind.YieldReturnStatement => SyntaxKind.ReturnKeyword, + SyntaxKind.YieldBreakStatement => SyntaxKind.BreakKeyword, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new WhileStatementSyntax instance. - public static WhileStatementSyntax WhileStatement(SyntaxList attributeLists, ExpressionSyntax condition, StatementSyntax statement) - => SyntaxFactory.WhileStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new WhileStatementSyntax instance. + public static WhileStatementSyntax WhileStatement(SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (whileKeyword.Kind() != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (WhileStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.WhileStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)whileKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + } - /// Creates a new WhileStatementSyntax instance. - public static WhileStatementSyntax WhileStatement(ExpressionSyntax condition, StatementSyntax statement) - => SyntaxFactory.WhileStatement(default, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new WhileStatementSyntax instance. + public static WhileStatementSyntax WhileStatement(SyntaxList attributeLists, ExpressionSyntax condition, StatementSyntax statement) + => SyntaxFactory.WhileStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new DoStatementSyntax instance. - public static DoStatementSyntax DoStatement(SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) - { - if (doKeyword.Kind() != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - if (whileKeyword.Kind() != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (DoStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.DoStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)doKeyword.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green, (Syntax.InternalSyntax.SyntaxToken)whileKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); - } + /// Creates a new WhileStatementSyntax instance. + public static WhileStatementSyntax WhileStatement(ExpressionSyntax condition, StatementSyntax statement) + => SyntaxFactory.WhileStatement(default, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new DoStatementSyntax instance. - public static DoStatementSyntax DoStatement(SyntaxList attributeLists, StatementSyntax statement, ExpressionSyntax condition) - => 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)); + /// Creates a new DoStatementSyntax instance. + public static DoStatementSyntax DoStatement(SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + { + if (doKeyword.Kind() != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + if (whileKeyword.Kind() != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (DoStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.DoStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)doKeyword.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green, (Syntax.InternalSyntax.SyntaxToken)whileKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new DoStatementSyntax instance. - public static DoStatementSyntax DoStatement(StatementSyntax statement, ExpressionSyntax condition) - => 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)); + /// Creates a new DoStatementSyntax instance. + public static DoStatementSyntax DoStatement(SyntaxList attributeLists, StatementSyntax statement, ExpressionSyntax condition) + => 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)); - /// Creates a new ForStatementSyntax instance. - public static ForStatementSyntax ForStatement(SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (forKeyword.Kind() != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (firstSemicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); - if (secondSemicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (ForStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ForStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)forKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, declaration == null ? null : (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, initializers.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)firstSemicolonToken.Node!, condition == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)secondSemicolonToken.Node!, incrementors.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); - } + /// Creates a new DoStatementSyntax instance. + public static DoStatementSyntax DoStatement(StatementSyntax statement, ExpressionSyntax condition) + => 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)); + + /// Creates a new ForStatementSyntax instance. + public static ForStatementSyntax ForStatement(SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (forKeyword.Kind() != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (firstSemicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); + if (secondSemicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (ForStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ForStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)forKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, declaration == null ? null : (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, initializers.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)firstSemicolonToken.Node!, condition == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)secondSemicolonToken.Node!, incrementors.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + } - /// Creates a new ForStatementSyntax instance. - public static ForStatementSyntax ForStatement(SyntaxList attributeLists, VariableDeclarationSyntax? declaration, SeparatedSyntaxList initializers, ExpressionSyntax? condition, SeparatedSyntaxList incrementors, StatementSyntax statement) - => 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); + /// Creates a new ForStatementSyntax instance. + public static ForStatementSyntax ForStatement(SyntaxList attributeLists, VariableDeclarationSyntax? declaration, SeparatedSyntaxList initializers, ExpressionSyntax? condition, SeparatedSyntaxList incrementors, StatementSyntax statement) + => 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); - /// Creates a new ForStatementSyntax instance. - public static ForStatementSyntax ForStatement(StatementSyntax statement) - => 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); + /// Creates a new ForStatementSyntax instance. + public static ForStatementSyntax ForStatement(StatementSyntax statement) + => 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); - /// Creates a new ForEachStatementSyntax instance. - public static ForEachStatementSyntax ForEachStatement(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - switch (awaitKeyword.Kind()) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } - if (forEachKeyword.Kind() != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (ForEachStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ForEachStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)awaitKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)forEachKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)inKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); - } + /// Creates a new ForEachStatementSyntax instance. + public static ForEachStatementSyntax ForEachStatement(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + switch (awaitKeyword.Kind()) + { + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); + } + if (forEachKeyword.Kind() != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (ForEachStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ForEachStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)awaitKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)forEachKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)inKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + } - /// Creates a new ForEachStatementSyntax instance. - public static ForEachStatementSyntax ForEachStatement(SyntaxList attributeLists, TypeSyntax type, SyntaxToken identifier, ExpressionSyntax expression, StatementSyntax statement) - => SyntaxFactory.ForEachStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new ForEachStatementSyntax instance. + public static ForEachStatementSyntax ForEachStatement(SyntaxList attributeLists, TypeSyntax type, SyntaxToken identifier, ExpressionSyntax expression, StatementSyntax statement) + => SyntaxFactory.ForEachStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new ForEachStatementSyntax instance. - public static ForEachStatementSyntax ForEachStatement(TypeSyntax type, SyntaxToken identifier, ExpressionSyntax expression, StatementSyntax statement) - => SyntaxFactory.ForEachStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new ForEachStatementSyntax instance. + public static ForEachStatementSyntax ForEachStatement(TypeSyntax type, SyntaxToken identifier, ExpressionSyntax expression, StatementSyntax statement) + => SyntaxFactory.ForEachStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new ForEachStatementSyntax instance. - public static ForEachStatementSyntax ForEachStatement(TypeSyntax type, string identifier, ExpressionSyntax expression, StatementSyntax statement) - => 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); + /// Creates a new ForEachStatementSyntax instance. + public static ForEachStatementSyntax ForEachStatement(TypeSyntax type, string identifier, ExpressionSyntax expression, StatementSyntax statement) + => 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); - /// Creates a new ForEachVariableStatementSyntax instance. - public static ForEachVariableStatementSyntax ForEachVariableStatement(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - switch (awaitKeyword.Kind()) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } - if (forEachKeyword.Kind() != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (variable == null) throw new ArgumentNullException(nameof(variable)); - if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (ForEachVariableStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ForEachVariableStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)awaitKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)forEachKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)variable.Green, (Syntax.InternalSyntax.SyntaxToken)inKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); - } + /// Creates a new ForEachVariableStatementSyntax instance. + public static ForEachVariableStatementSyntax ForEachVariableStatement(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + switch (awaitKeyword.Kind()) + { + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); + } + if (forEachKeyword.Kind() != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (variable == null) throw new ArgumentNullException(nameof(variable)); + if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (ForEachVariableStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.ForEachVariableStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)awaitKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)forEachKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)variable.Green, (Syntax.InternalSyntax.SyntaxToken)inKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + } - /// Creates a new ForEachVariableStatementSyntax instance. - public static ForEachVariableStatementSyntax ForEachVariableStatement(SyntaxList attributeLists, ExpressionSyntax variable, ExpressionSyntax expression, StatementSyntax statement) - => SyntaxFactory.ForEachVariableStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), variable, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new ForEachVariableStatementSyntax instance. + public static ForEachVariableStatementSyntax ForEachVariableStatement(SyntaxList attributeLists, ExpressionSyntax variable, ExpressionSyntax expression, StatementSyntax statement) + => SyntaxFactory.ForEachVariableStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), variable, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new ForEachVariableStatementSyntax instance. - public static ForEachVariableStatementSyntax ForEachVariableStatement(ExpressionSyntax variable, ExpressionSyntax expression, StatementSyntax statement) - => SyntaxFactory.ForEachVariableStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), variable, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new ForEachVariableStatementSyntax instance. + public static ForEachVariableStatementSyntax ForEachVariableStatement(ExpressionSyntax variable, ExpressionSyntax expression, StatementSyntax statement) + => SyntaxFactory.ForEachVariableStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), variable, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new UsingStatementSyntax instance. - public static UsingStatementSyntax UsingStatement(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + /// Creates a new UsingStatementSyntax instance. + public static UsingStatementSyntax UsingStatement(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + switch (awaitKeyword.Kind()) { - switch (awaitKeyword.Kind()) - { - case SyntaxKind.AwaitKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(awaitKeyword)); - } - if (usingKeyword.Kind() != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (UsingStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.UsingStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)awaitKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)usingKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, declaration == null ? null : (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, expression == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + case SyntaxKind.AwaitKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(awaitKeyword)); } + if (usingKeyword.Kind() != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (UsingStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.UsingStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)awaitKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)usingKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, declaration == null ? null : (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, expression == null ? null : (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + } - /// Creates a new UsingStatementSyntax instance. - public static UsingStatementSyntax UsingStatement(SyntaxList attributeLists, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, StatementSyntax statement) - => SyntaxFactory.UsingStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new UsingStatementSyntax instance. + public static UsingStatementSyntax UsingStatement(SyntaxList attributeLists, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, StatementSyntax statement) + => SyntaxFactory.UsingStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new UsingStatementSyntax instance. - public static UsingStatementSyntax UsingStatement(StatementSyntax statement) - => SyntaxFactory.UsingStatement(default, default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), default, default, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new UsingStatementSyntax instance. + public static UsingStatementSyntax UsingStatement(StatementSyntax statement) + => SyntaxFactory.UsingStatement(default, default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), default, default, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new FixedStatementSyntax instance. - public static FixedStatementSyntax FixedStatement(SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (fixedKeyword.Kind() != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (FixedStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.FixedStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)fixedKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); - } + /// Creates a new FixedStatementSyntax instance. + public static FixedStatementSyntax FixedStatement(SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (fixedKeyword.Kind() != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (FixedStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.FixedStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)fixedKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + } - /// Creates a new FixedStatementSyntax instance. - public static FixedStatementSyntax FixedStatement(SyntaxList attributeLists, VariableDeclarationSyntax declaration, StatementSyntax statement) - => SyntaxFactory.FixedStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new FixedStatementSyntax instance. + public static FixedStatementSyntax FixedStatement(SyntaxList attributeLists, VariableDeclarationSyntax declaration, StatementSyntax statement) + => SyntaxFactory.FixedStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new FixedStatementSyntax instance. - public static FixedStatementSyntax FixedStatement(VariableDeclarationSyntax declaration, StatementSyntax statement) - => SyntaxFactory.FixedStatement(default, SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new FixedStatementSyntax instance. + public static FixedStatementSyntax FixedStatement(VariableDeclarationSyntax declaration, StatementSyntax statement) + => SyntaxFactory.FixedStatement(default, SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new CheckedStatementSyntax instance. - public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + /// Creates a new CheckedStatementSyntax instance. + public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) + { + switch (kind) + { + case SyntaxKind.CheckedStatement: + case SyntaxKind.UncheckedStatement: break; + default: throw new ArgumentException(nameof(kind)); + } + switch (keyword.Kind()) { - switch (kind) - { - case SyntaxKind.CheckedStatement: - case SyntaxKind.UncheckedStatement: break; - default: throw new ArgumentException(nameof(kind)); - } - switch (keyword.Kind()) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.UncheckedKeyword: break; - default: throw new ArgumentException(nameof(keyword)); - } - if (block == null) throw new ArgumentNullException(nameof(block)); - return (CheckedStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.CheckedStatement(kind, attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.BlockSyntax)block.Green).CreateRed(); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.UncheckedKeyword: break; + default: throw new ArgumentException(nameof(keyword)); } + if (block == null) throw new ArgumentNullException(nameof(block)); + return (CheckedStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.CheckedStatement(kind, attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.BlockSyntax)block.Green).CreateRed(); + } - /// Creates a new CheckedStatementSyntax instance. - public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxList attributeLists, BlockSyntax block) - => SyntaxFactory.CheckedStatement(kind, attributeLists, SyntaxFactory.Token(GetCheckedStatementKeywordKind(kind)), block); + /// Creates a new CheckedStatementSyntax instance. + public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxList attributeLists, BlockSyntax block) + => SyntaxFactory.CheckedStatement(kind, attributeLists, SyntaxFactory.Token(GetCheckedStatementKeywordKind(kind)), block); #pragma warning disable RS0027 - /// Creates a new CheckedStatementSyntax instance. - public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, BlockSyntax? block = default) - => SyntaxFactory.CheckedStatement(kind, default, SyntaxFactory.Token(GetCheckedStatementKeywordKind(kind)), block ?? SyntaxFactory.Block()); + /// Creates a new CheckedStatementSyntax instance. + public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, BlockSyntax? block = default) + => SyntaxFactory.CheckedStatement(kind, default, SyntaxFactory.Token(GetCheckedStatementKeywordKind(kind)), block ?? SyntaxFactory.Block()); #pragma warning restore RS0027 - private static SyntaxKind GetCheckedStatementKeywordKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.CheckedStatement => SyntaxKind.CheckedKeyword, - SyntaxKind.UncheckedStatement => SyntaxKind.UncheckedKeyword, - _ => throw new ArgumentOutOfRangeException(), - }; - - /// Creates a new UnsafeStatementSyntax instance. - public static UnsafeStatementSyntax UnsafeStatement(SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + private static SyntaxKind GetCheckedStatementKeywordKind(SyntaxKind kind) + => kind switch { - if (unsafeKeyword.Kind() != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); - return (UnsafeStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.UnsafeStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)unsafeKeyword.Node!, (Syntax.InternalSyntax.BlockSyntax)block.Green).CreateRed(); - } + SyntaxKind.CheckedStatement => SyntaxKind.CheckedKeyword, + SyntaxKind.UncheckedStatement => SyntaxKind.UncheckedKeyword, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new UnsafeStatementSyntax instance. - public static UnsafeStatementSyntax UnsafeStatement(SyntaxList attributeLists, BlockSyntax block) - => SyntaxFactory.UnsafeStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), block); + /// Creates a new UnsafeStatementSyntax instance. + public static UnsafeStatementSyntax UnsafeStatement(SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) + { + if (unsafeKeyword.Kind() != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); + return (UnsafeStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.UnsafeStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)unsafeKeyword.Node!, (Syntax.InternalSyntax.BlockSyntax)block.Green).CreateRed(); + } + + /// Creates a new UnsafeStatementSyntax instance. + public static UnsafeStatementSyntax UnsafeStatement(SyntaxList attributeLists, BlockSyntax block) + => SyntaxFactory.UnsafeStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), block); #pragma warning disable RS0027 - /// Creates a new UnsafeStatementSyntax instance. - public static UnsafeStatementSyntax UnsafeStatement(BlockSyntax? block = default) - => SyntaxFactory.UnsafeStatement(default, SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), block ?? SyntaxFactory.Block()); + /// Creates a new UnsafeStatementSyntax instance. + public static UnsafeStatementSyntax UnsafeStatement(BlockSyntax? block = default) + => SyntaxFactory.UnsafeStatement(default, SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), block ?? SyntaxFactory.Block()); #pragma warning restore RS0027 - /// Creates a new LockStatementSyntax instance. - public static LockStatementSyntax LockStatement(SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (lockKeyword.Kind() != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (LockStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.LockStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)lockKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); - } + /// Creates a new LockStatementSyntax instance. + public static LockStatementSyntax LockStatement(SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (lockKeyword.Kind() != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (LockStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.LockStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)lockKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + } - /// Creates a new LockStatementSyntax instance. - public static LockStatementSyntax LockStatement(SyntaxList attributeLists, ExpressionSyntax expression, StatementSyntax statement) - => SyntaxFactory.LockStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new LockStatementSyntax instance. + public static LockStatementSyntax LockStatement(SyntaxList attributeLists, ExpressionSyntax expression, StatementSyntax statement) + => SyntaxFactory.LockStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new LockStatementSyntax instance. - public static LockStatementSyntax LockStatement(ExpressionSyntax expression, StatementSyntax statement) - => SyntaxFactory.LockStatement(default, SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); + /// Creates a new LockStatementSyntax instance. + public static LockStatementSyntax LockStatement(ExpressionSyntax expression, StatementSyntax statement) + => SyntaxFactory.LockStatement(default, SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); - /// Creates a new IfStatementSyntax instance. - public static IfStatementSyntax IfStatement(SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) - { - if (ifKeyword.Kind() != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (IfStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.IfStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)ifKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green, @else == null ? null : (Syntax.InternalSyntax.ElseClauseSyntax)@else.Green).CreateRed(); - } + /// Creates a new IfStatementSyntax instance. + public static IfStatementSyntax IfStatement(SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + { + if (ifKeyword.Kind() != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (IfStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.IfStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)ifKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green, @else == null ? null : (Syntax.InternalSyntax.ElseClauseSyntax)@else.Green).CreateRed(); + } - /// Creates a new IfStatementSyntax instance. - public static IfStatementSyntax IfStatement(SyntaxList attributeLists, ExpressionSyntax condition, StatementSyntax statement, ElseClauseSyntax? @else) - => SyntaxFactory.IfStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement, @else); + /// Creates a new IfStatementSyntax instance. + public static IfStatementSyntax IfStatement(SyntaxList attributeLists, ExpressionSyntax condition, StatementSyntax statement, ElseClauseSyntax? @else) + => SyntaxFactory.IfStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement, @else); - /// Creates a new IfStatementSyntax instance. - public static IfStatementSyntax IfStatement(ExpressionSyntax condition, StatementSyntax statement) - => SyntaxFactory.IfStatement(default, SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement, default); + /// Creates a new IfStatementSyntax instance. + public static IfStatementSyntax IfStatement(ExpressionSyntax condition, StatementSyntax statement) + => SyntaxFactory.IfStatement(default, SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement, default); - /// Creates a new ElseClauseSyntax instance. - public static ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement) - { - if (elseKeyword.Kind() != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); - if (statement == null) throw new ArgumentNullException(nameof(statement)); - return (ElseClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.ElseClause((Syntax.InternalSyntax.SyntaxToken)elseKeyword.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); - } + /// Creates a new ElseClauseSyntax instance. + public static ElseClauseSyntax ElseClause(SyntaxToken elseKeyword, StatementSyntax statement) + { + if (elseKeyword.Kind() != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); + if (statement == null) throw new ArgumentNullException(nameof(statement)); + return (ElseClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.ElseClause((Syntax.InternalSyntax.SyntaxToken)elseKeyword.Node!, (Syntax.InternalSyntax.StatementSyntax)statement.Green).CreateRed(); + } - /// Creates a new ElseClauseSyntax instance. - public static ElseClauseSyntax ElseClause(StatementSyntax statement) - => SyntaxFactory.ElseClause(SyntaxFactory.Token(SyntaxKind.ElseKeyword), statement); + /// Creates a new ElseClauseSyntax instance. + public static ElseClauseSyntax ElseClause(StatementSyntax statement) + => SyntaxFactory.ElseClause(SyntaxFactory.Token(SyntaxKind.ElseKeyword), statement); - /// Creates a new SwitchStatementSyntax instance. - public static SwitchStatementSyntax SwitchStatement(SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, SyntaxList sections, SyntaxToken closeBraceToken) + /// Creates a new SwitchStatementSyntax instance. + public static SwitchStatementSyntax SwitchStatement(SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, SyntaxList sections, SyntaxToken closeBraceToken) + { + if (switchKeyword.Kind() != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); + switch (openParenToken.Kind()) { - if (switchKeyword.Kind() != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); - switch (openParenToken.Kind()) - { - case SyntaxKind.OpenParenToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openParenToken)); - } - if (expression == null) throw new ArgumentNullException(nameof(expression)); - switch (closeParenToken.Kind()) - { - case SyntaxKind.CloseParenToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeParenToken)); - } - if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - return (SwitchStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.SwitchStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)switchKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)openParenToken.Node, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken?)closeParenToken.Node, (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, sections.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); + case SyntaxKind.OpenParenToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openParenToken)); } - - /// Creates a new SwitchSectionSyntax instance. - public static SwitchSectionSyntax SwitchSection(SyntaxList labels, SyntaxList statements) + if (expression == null) throw new ArgumentNullException(nameof(expression)); + switch (closeParenToken.Kind()) { - return (SwitchSectionSyntax)Syntax.InternalSyntax.SyntaxFactory.SwitchSection(labels.Node.ToGreenList(), statements.Node.ToGreenList()).CreateRed(); + case SyntaxKind.CloseParenToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeParenToken)); } + if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + return (SwitchStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.SwitchStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)switchKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)openParenToken.Node, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green, (Syntax.InternalSyntax.SyntaxToken?)closeParenToken.Node, (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, sections.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); + } - /// Creates a new SwitchSectionSyntax instance. - public static SwitchSectionSyntax SwitchSection() - => SyntaxFactory.SwitchSection(default, default); + /// Creates a new SwitchSectionSyntax instance. + public static SwitchSectionSyntax SwitchSection(SyntaxList labels, SyntaxList statements) + { + return (SwitchSectionSyntax)Syntax.InternalSyntax.SyntaxFactory.SwitchSection(labels.Node.ToGreenList(), statements.Node.ToGreenList()).CreateRed(); + } - /// Creates a new CasePatternSwitchLabelSyntax instance. - public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) - { - if (keyword.Kind() != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - return (CasePatternSwitchLabelSyntax)Syntax.InternalSyntax.SyntaxFactory.CasePatternSwitchLabel((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.PatternSyntax)pattern.Green, whenClause == null ? null : (Syntax.InternalSyntax.WhenClauseSyntax)whenClause.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); - } + /// Creates a new SwitchSectionSyntax instance. + public static SwitchSectionSyntax SwitchSection() + => SyntaxFactory.SwitchSection(default, default); - /// Creates a new CasePatternSwitchLabelSyntax instance. - public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) - => SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), pattern, whenClause, colonToken); + /// Creates a new CasePatternSwitchLabelSyntax instance. + public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + { + if (keyword.Kind() != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + return (CasePatternSwitchLabelSyntax)Syntax.InternalSyntax.SyntaxFactory.CasePatternSwitchLabel((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.PatternSyntax)pattern.Green, whenClause == null ? null : (Syntax.InternalSyntax.WhenClauseSyntax)whenClause.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); + } - /// Creates a new CasePatternSwitchLabelSyntax instance. - public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(PatternSyntax pattern, SyntaxToken colonToken) - => SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), pattern, default, colonToken); + /// Creates a new CasePatternSwitchLabelSyntax instance. + public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + => SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), pattern, whenClause, colonToken); - /// Creates a new CaseSwitchLabelSyntax instance. - public static CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) - { - if (keyword.Kind() != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); - if (value == null) throw new ArgumentNullException(nameof(value)); - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - return (CaseSwitchLabelSyntax)Syntax.InternalSyntax.SyntaxFactory.CaseSwitchLabel((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)value.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); - } + /// Creates a new CasePatternSwitchLabelSyntax instance. + public static CasePatternSwitchLabelSyntax CasePatternSwitchLabel(PatternSyntax pattern, SyntaxToken colonToken) + => SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), pattern, default, colonToken); - /// Creates a new CaseSwitchLabelSyntax instance. - public static CaseSwitchLabelSyntax CaseSwitchLabel(ExpressionSyntax value, SyntaxToken colonToken) - => SyntaxFactory.CaseSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), value, colonToken); + /// Creates a new CaseSwitchLabelSyntax instance. + public static CaseSwitchLabelSyntax CaseSwitchLabel(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + { + if (keyword.Kind() != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); + if (value == null) throw new ArgumentNullException(nameof(value)); + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + return (CaseSwitchLabelSyntax)Syntax.InternalSyntax.SyntaxFactory.CaseSwitchLabel((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)value.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); + } - /// Creates a new DefaultSwitchLabelSyntax instance. - public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken) - { - if (keyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - return (DefaultSwitchLabelSyntax)Syntax.InternalSyntax.SyntaxFactory.DefaultSwitchLabel((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); - } + /// Creates a new CaseSwitchLabelSyntax instance. + public static CaseSwitchLabelSyntax CaseSwitchLabel(ExpressionSyntax value, SyntaxToken colonToken) + => SyntaxFactory.CaseSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), value, colonToken); - /// Creates a new DefaultSwitchLabelSyntax instance. - public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken colonToken) - => SyntaxFactory.DefaultSwitchLabel(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), colonToken); + /// Creates a new DefaultSwitchLabelSyntax instance. + public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken keyword, SyntaxToken colonToken) + { + if (keyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + return (DefaultSwitchLabelSyntax)Syntax.InternalSyntax.SyntaxFactory.DefaultSwitchLabel((Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); + } - /// Creates a new SwitchExpressionSyntax instance. - public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList arms, SyntaxToken closeBraceToken) - { - if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); - if (switchKeyword.Kind() != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); - if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - return (SwitchExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.SwitchExpression((Syntax.InternalSyntax.ExpressionSyntax)governingExpression.Green, (Syntax.InternalSyntax.SyntaxToken)switchKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, arms.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); - } + /// Creates a new DefaultSwitchLabelSyntax instance. + public static DefaultSwitchLabelSyntax DefaultSwitchLabel(SyntaxToken colonToken) + => SyntaxFactory.DefaultSwitchLabel(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), colonToken); - /// Creates a new SwitchExpressionSyntax instance. - public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SeparatedSyntaxList arms) - => SyntaxFactory.SwitchExpression(governingExpression, SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), arms, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + /// Creates a new SwitchExpressionSyntax instance. + public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + { + if (governingExpression == null) throw new ArgumentNullException(nameof(governingExpression)); + if (switchKeyword.Kind() != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); + if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + return (SwitchExpressionSyntax)Syntax.InternalSyntax.SyntaxFactory.SwitchExpression((Syntax.InternalSyntax.ExpressionSyntax)governingExpression.Green, (Syntax.InternalSyntax.SyntaxToken)switchKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, arms.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); + } - /// Creates a new SwitchExpressionSyntax instance. - public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression) - => SyntaxFactory.SwitchExpression(governingExpression, SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + /// Creates a new SwitchExpressionSyntax instance. + public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression, SeparatedSyntaxList arms) + => SyntaxFactory.SwitchExpression(governingExpression, SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), arms, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); - /// Creates a new SwitchExpressionArmSyntax instance. - public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) - { - if (pattern == null) throw new ArgumentNullException(nameof(pattern)); - if (equalsGreaterThanToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (SwitchExpressionArmSyntax)Syntax.InternalSyntax.SyntaxFactory.SwitchExpressionArm((Syntax.InternalSyntax.PatternSyntax)pattern.Green, whenClause == null ? null : (Syntax.InternalSyntax.WhenClauseSyntax)whenClause.Green, (Syntax.InternalSyntax.SyntaxToken)equalsGreaterThanToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); - } + /// Creates a new SwitchExpressionSyntax instance. + public static SwitchExpressionSyntax SwitchExpression(ExpressionSyntax governingExpression) + => SyntaxFactory.SwitchExpression(governingExpression, SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); - /// Creates a new SwitchExpressionArmSyntax instance. - public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, ExpressionSyntax expression) - => SyntaxFactory.SwitchExpressionArm(pattern, whenClause, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); + /// Creates a new SwitchExpressionArmSyntax instance. + public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + { + if (pattern == null) throw new ArgumentNullException(nameof(pattern)); + if (equalsGreaterThanToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (SwitchExpressionArmSyntax)Syntax.InternalSyntax.SyntaxFactory.SwitchExpressionArm((Syntax.InternalSyntax.PatternSyntax)pattern.Green, whenClause == null ? null : (Syntax.InternalSyntax.WhenClauseSyntax)whenClause.Green, (Syntax.InternalSyntax.SyntaxToken)equalsGreaterThanToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new SwitchExpressionArmSyntax instance. - public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, ExpressionSyntax expression) - => SyntaxFactory.SwitchExpressionArm(pattern, default, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); + /// Creates a new SwitchExpressionArmSyntax instance. + public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, WhenClauseSyntax? whenClause, ExpressionSyntax expression) + => SyntaxFactory.SwitchExpressionArm(pattern, whenClause, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); - /// Creates a new TryStatementSyntax instance. - public static TryStatementSyntax TryStatement(SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, SyntaxList catches, FinallyClauseSyntax? @finally) - { - if (tryKeyword.Kind() != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); - return (TryStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.TryStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)tryKeyword.Node!, (Syntax.InternalSyntax.BlockSyntax)block.Green, catches.Node.ToGreenList(), @finally == null ? null : (Syntax.InternalSyntax.FinallyClauseSyntax)@finally.Green).CreateRed(); - } + /// Creates a new SwitchExpressionArmSyntax instance. + public static SwitchExpressionArmSyntax SwitchExpressionArm(PatternSyntax pattern, ExpressionSyntax expression) + => SyntaxFactory.SwitchExpressionArm(pattern, default, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); - /// Creates a new TryStatementSyntax instance. - public static TryStatementSyntax TryStatement(SyntaxList attributeLists, BlockSyntax block, SyntaxList catches, FinallyClauseSyntax? @finally) - => SyntaxFactory.TryStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.TryKeyword), block, catches, @finally); + /// Creates a new TryStatementSyntax instance. + public static TryStatementSyntax TryStatement(SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, SyntaxList catches, FinallyClauseSyntax? @finally) + { + if (tryKeyword.Kind() != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); + return (TryStatementSyntax)Syntax.InternalSyntax.SyntaxFactory.TryStatement(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)tryKeyword.Node!, (Syntax.InternalSyntax.BlockSyntax)block.Green, catches.Node.ToGreenList(), @finally == null ? null : (Syntax.InternalSyntax.FinallyClauseSyntax)@finally.Green).CreateRed(); + } + + /// Creates a new TryStatementSyntax instance. + public static TryStatementSyntax TryStatement(SyntaxList attributeLists, BlockSyntax block, SyntaxList catches, FinallyClauseSyntax? @finally) + => SyntaxFactory.TryStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.TryKeyword), block, catches, @finally); #pragma warning disable RS0027 - /// Creates a new TryStatementSyntax instance. - public static TryStatementSyntax TryStatement(SyntaxList catches = default) - => SyntaxFactory.TryStatement(default, SyntaxFactory.Token(SyntaxKind.TryKeyword), SyntaxFactory.Block(), catches, default); + /// Creates a new TryStatementSyntax instance. + public static TryStatementSyntax TryStatement(SyntaxList catches = default) + => SyntaxFactory.TryStatement(default, SyntaxFactory.Token(SyntaxKind.TryKeyword), SyntaxFactory.Block(), catches, default); #pragma warning restore RS0027 - /// Creates a new CatchClauseSyntax instance. - public static CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - { - if (catchKeyword.Kind() != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); - return (CatchClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.CatchClause((Syntax.InternalSyntax.SyntaxToken)catchKeyword.Node!, declaration == null ? null : (Syntax.InternalSyntax.CatchDeclarationSyntax)declaration.Green, filter == null ? null : (Syntax.InternalSyntax.CatchFilterClauseSyntax)filter.Green, (Syntax.InternalSyntax.BlockSyntax)block.Green).CreateRed(); - } + /// Creates a new CatchClauseSyntax instance. + public static CatchClauseSyntax CatchClause(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) + { + if (catchKeyword.Kind() != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); + return (CatchClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.CatchClause((Syntax.InternalSyntax.SyntaxToken)catchKeyword.Node!, declaration == null ? null : (Syntax.InternalSyntax.CatchDeclarationSyntax)declaration.Green, filter == null ? null : (Syntax.InternalSyntax.CatchFilterClauseSyntax)filter.Green, (Syntax.InternalSyntax.BlockSyntax)block.Green).CreateRed(); + } - /// Creates a new CatchClauseSyntax instance. - public static CatchClauseSyntax CatchClause(CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - => SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), declaration, filter, block); + /// Creates a new CatchClauseSyntax instance. + public static CatchClauseSyntax CatchClause(CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) + => SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), declaration, filter, block); - /// Creates a new CatchClauseSyntax instance. - public static CatchClauseSyntax CatchClause() - => SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), default, default, SyntaxFactory.Block()); + /// Creates a new CatchClauseSyntax instance. + public static CatchClauseSyntax CatchClause() + => SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), default, default, SyntaxFactory.Block()); - /// Creates a new CatchDeclarationSyntax instance. - public static CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) + /// Creates a new CatchDeclarationSyntax instance. + public static CatchDeclarationSyntax CatchDeclaration(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (type == null) throw new ArgumentNullException(nameof(type)); + switch (identifier.Kind()) { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (type == null) throw new ArgumentNullException(nameof(type)); - switch (identifier.Kind()) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(identifier)); - } - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (CatchDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.CatchDeclaration((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken?)identifier.Node, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + case SyntaxKind.IdentifierToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(identifier)); } + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (CatchDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.CatchDeclaration((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken?)identifier.Node, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new CatchDeclarationSyntax instance. - public static CatchDeclarationSyntax CatchDeclaration(TypeSyntax type, SyntaxToken identifier) - => SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new CatchDeclarationSyntax instance. + public static CatchDeclarationSyntax CatchDeclaration(TypeSyntax type, SyntaxToken identifier) + => SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new CatchDeclarationSyntax instance. - public static CatchDeclarationSyntax CatchDeclaration(TypeSyntax type) - => SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, default, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new CatchDeclarationSyntax instance. + public static CatchDeclarationSyntax CatchDeclaration(TypeSyntax type) + => SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, default, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new CatchFilterClauseSyntax instance. - public static CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) - { - if (whenKeyword.Kind() != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (CatchFilterClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.CatchFilterClause((Syntax.InternalSyntax.SyntaxToken)whenKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)filterExpression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new CatchFilterClauseSyntax instance. + public static CatchFilterClauseSyntax CatchFilterClause(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + { + if (whenKeyword.Kind() != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (filterExpression == null) throw new ArgumentNullException(nameof(filterExpression)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (CatchFilterClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.CatchFilterClause((Syntax.InternalSyntax.SyntaxToken)whenKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)filterExpression.Green, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new CatchFilterClauseSyntax instance. - public static CatchFilterClauseSyntax CatchFilterClause(ExpressionSyntax filterExpression) - => SyntaxFactory.CatchFilterClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), filterExpression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new CatchFilterClauseSyntax instance. + public static CatchFilterClauseSyntax CatchFilterClause(ExpressionSyntax filterExpression) + => SyntaxFactory.CatchFilterClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), filterExpression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new FinallyClauseSyntax instance. - public static FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block) - { - if (finallyKeyword.Kind() != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); - if (block == null) throw new ArgumentNullException(nameof(block)); - return (FinallyClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.FinallyClause((Syntax.InternalSyntax.SyntaxToken)finallyKeyword.Node!, (Syntax.InternalSyntax.BlockSyntax)block.Green).CreateRed(); - } + /// Creates a new FinallyClauseSyntax instance. + public static FinallyClauseSyntax FinallyClause(SyntaxToken finallyKeyword, BlockSyntax block) + { + if (finallyKeyword.Kind() != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); + if (block == null) throw new ArgumentNullException(nameof(block)); + return (FinallyClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.FinallyClause((Syntax.InternalSyntax.SyntaxToken)finallyKeyword.Node!, (Syntax.InternalSyntax.BlockSyntax)block.Green).CreateRed(); + } - /// Creates a new FinallyClauseSyntax instance. - public static FinallyClauseSyntax FinallyClause(BlockSyntax? block = default) - => SyntaxFactory.FinallyClause(SyntaxFactory.Token(SyntaxKind.FinallyKeyword), block ?? SyntaxFactory.Block()); + /// Creates a new FinallyClauseSyntax instance. + public static FinallyClauseSyntax FinallyClause(BlockSyntax? block = default) + => SyntaxFactory.FinallyClause(SyntaxFactory.Token(SyntaxKind.FinallyKeyword), block ?? SyntaxFactory.Block()); - /// Creates a new CompilationUnitSyntax instance. - public static CompilationUnitSyntax CompilationUnit(SyntaxList externs, SyntaxList usings, SyntaxList attributeLists, SyntaxList members, SyntaxToken endOfFileToken) - { - if (endOfFileToken.Kind() != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); - return (CompilationUnitSyntax)Syntax.InternalSyntax.SyntaxFactory.CompilationUnit(externs.Node.ToGreenList(), usings.Node.ToGreenList(), attributeLists.Node.ToGreenList(), members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)endOfFileToken.Node!).CreateRed(); - } + /// Creates a new CompilationUnitSyntax instance. + public static CompilationUnitSyntax CompilationUnit(SyntaxList externs, SyntaxList usings, SyntaxList attributeLists, SyntaxList members, SyntaxToken endOfFileToken) + { + if (endOfFileToken.Kind() != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); + return (CompilationUnitSyntax)Syntax.InternalSyntax.SyntaxFactory.CompilationUnit(externs.Node.ToGreenList(), usings.Node.ToGreenList(), attributeLists.Node.ToGreenList(), members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)endOfFileToken.Node!).CreateRed(); + } - /// Creates a new CompilationUnitSyntax instance. - public static CompilationUnitSyntax CompilationUnit(SyntaxList externs, SyntaxList usings, SyntaxList attributeLists, SyntaxList members) - => SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); + /// Creates a new CompilationUnitSyntax instance. + public static CompilationUnitSyntax CompilationUnit(SyntaxList externs, SyntaxList usings, SyntaxList attributeLists, SyntaxList members) + => SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); - /// Creates a new CompilationUnitSyntax instance. - public static CompilationUnitSyntax CompilationUnit() - => SyntaxFactory.CompilationUnit(default, default, default, default, SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); + /// Creates a new CompilationUnitSyntax instance. + public static CompilationUnitSyntax CompilationUnit() + => SyntaxFactory.CompilationUnit(default, default, default, default, SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); - /// Creates a new ExternAliasDirectiveSyntax instance. - public static ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) - { - if (externKeyword.Kind() != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); - if (aliasKeyword.Kind() != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (ExternAliasDirectiveSyntax)Syntax.InternalSyntax.SyntaxFactory.ExternAliasDirective((Syntax.InternalSyntax.SyntaxToken)externKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)aliasKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); - } + /// Creates a new ExternAliasDirectiveSyntax instance. + public static ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + { + if (externKeyword.Kind() != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); + if (aliasKeyword.Kind() != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (ExternAliasDirectiveSyntax)Syntax.InternalSyntax.SyntaxFactory.ExternAliasDirective((Syntax.InternalSyntax.SyntaxToken)externKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)aliasKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new ExternAliasDirectiveSyntax instance. - public static ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken identifier) - => SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), identifier, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new ExternAliasDirectiveSyntax instance. + public static ExternAliasDirectiveSyntax ExternAliasDirective(SyntaxToken identifier) + => SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), identifier, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new ExternAliasDirectiveSyntax instance. - public static ExternAliasDirectiveSyntax ExternAliasDirective(string identifier) - => SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new ExternAliasDirectiveSyntax instance. + public static ExternAliasDirectiveSyntax ExternAliasDirective(string identifier) + => SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new UsingDirectiveSyntax instance. - public static UsingDirectiveSyntax UsingDirective(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + /// Creates a new UsingDirectiveSyntax instance. + public static UsingDirectiveSyntax UsingDirective(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + { + switch (globalKeyword.Kind()) { - switch (globalKeyword.Kind()) - { - case SyntaxKind.GlobalKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(globalKeyword)); - } - if (usingKeyword.Kind() != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); - switch (staticKeyword.Kind()) - { - case SyntaxKind.StaticKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(staticKeyword)); - } - switch (unsafeKeyword.Kind()) - { - case SyntaxKind.UnsafeKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(unsafeKeyword)); - } - if (namespaceOrType == null) throw new ArgumentNullException(nameof(namespaceOrType)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (UsingDirectiveSyntax)Syntax.InternalSyntax.SyntaxFactory.UsingDirective((Syntax.InternalSyntax.SyntaxToken?)globalKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)usingKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)staticKeyword.Node, (Syntax.InternalSyntax.SyntaxToken?)unsafeKeyword.Node, alias == null ? null : (Syntax.InternalSyntax.NameEqualsSyntax)alias.Green, (Syntax.InternalSyntax.TypeSyntax)namespaceOrType.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + case SyntaxKind.GlobalKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(globalKeyword)); } + if (usingKeyword.Kind() != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); + switch (staticKeyword.Kind()) + { + case SyntaxKind.StaticKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(staticKeyword)); + } + switch (unsafeKeyword.Kind()) + { + case SyntaxKind.UnsafeKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(unsafeKeyword)); + } + if (namespaceOrType == null) throw new ArgumentNullException(nameof(namespaceOrType)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (UsingDirectiveSyntax)Syntax.InternalSyntax.SyntaxFactory.UsingDirective((Syntax.InternalSyntax.SyntaxToken?)globalKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)usingKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)staticKeyword.Node, (Syntax.InternalSyntax.SyntaxToken?)unsafeKeyword.Node, alias == null ? null : (Syntax.InternalSyntax.NameEqualsSyntax)alias.Green, (Syntax.InternalSyntax.TypeSyntax)namespaceOrType.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new UsingDirectiveSyntax instance. - public static UsingDirectiveSyntax UsingDirective(NameEqualsSyntax? alias, TypeSyntax namespaceOrType) - => SyntaxFactory.UsingDirective(default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), default, default, alias, namespaceOrType, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new UsingDirectiveSyntax instance. + public static UsingDirectiveSyntax UsingDirective(NameEqualsSyntax? alias, TypeSyntax namespaceOrType) + => SyntaxFactory.UsingDirective(default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), default, default, alias, namespaceOrType, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new UsingDirectiveSyntax instance. - public static UsingDirectiveSyntax UsingDirective(TypeSyntax namespaceOrType) - => SyntaxFactory.UsingDirective(default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), default, default, default, namespaceOrType, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new UsingDirectiveSyntax instance. + public static UsingDirectiveSyntax UsingDirective(TypeSyntax namespaceOrType) + => SyntaxFactory.UsingDirective(default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), default, default, default, namespaceOrType, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new NamespaceDeclarationSyntax instance. - public static NamespaceDeclarationSyntax NamespaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, SyntaxList externs, SyntaxList usings, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + /// Creates a new NamespaceDeclarationSyntax instance. + public static NamespaceDeclarationSyntax NamespaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, SyntaxList externs, SyntaxList usings, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (namespaceKeyword.Kind() != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + switch (semicolonToken.Kind()) { - if (namespaceKeyword.Kind() != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (NamespaceDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.NamespaceDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)namespaceKeyword.Node!, (Syntax.InternalSyntax.NameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, externs.Node.ToGreenList(), usings.Node.ToGreenList(), members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (NamespaceDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.NamespaceDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)namespaceKeyword.Node!, (Syntax.InternalSyntax.NameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, externs.Node.ToGreenList(), usings.Node.ToGreenList(), members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new NamespaceDeclarationSyntax instance. - public static NamespaceDeclarationSyntax NamespaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, NameSyntax name, SyntaxList externs, SyntaxList usings, SyntaxList members) - => SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), externs, usings, members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); + /// Creates a new NamespaceDeclarationSyntax instance. + public static NamespaceDeclarationSyntax NamespaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, NameSyntax name, SyntaxList externs, SyntaxList usings, SyntaxList members) + => SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), externs, usings, members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); - /// Creates a new NamespaceDeclarationSyntax instance. - public static NamespaceDeclarationSyntax NamespaceDeclaration(NameSyntax name) - => SyntaxFactory.NamespaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, default, default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); + /// Creates a new NamespaceDeclarationSyntax instance. + public static NamespaceDeclarationSyntax NamespaceDeclaration(NameSyntax name) + => SyntaxFactory.NamespaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, default, default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); - /// Creates a new FileScopedNamespaceDeclarationSyntax instance. - public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, SyntaxList externs, SyntaxList usings, SyntaxList members) - { - if (namespaceKeyword.Kind() != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (FileScopedNamespaceDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)namespaceKeyword.Node!, (Syntax.InternalSyntax.NameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!, externs.Node.ToGreenList(), usings.Node.ToGreenList(), members.Node.ToGreenList()).CreateRed(); - } + /// Creates a new FileScopedNamespaceDeclarationSyntax instance. + public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, SyntaxList externs, SyntaxList usings, SyntaxList members) + { + if (namespaceKeyword.Kind() != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (FileScopedNamespaceDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)namespaceKeyword.Node!, (Syntax.InternalSyntax.NameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!, externs.Node.ToGreenList(), usings.Node.ToGreenList(), members.Node.ToGreenList()).CreateRed(); + } - /// Creates a new FileScopedNamespaceDeclarationSyntax instance. - public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, NameSyntax name, SyntaxList externs, SyntaxList usings, SyntaxList members) - => SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken), externs, usings, members); + /// Creates a new FileScopedNamespaceDeclarationSyntax instance. + public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, NameSyntax name, SyntaxList externs, SyntaxList usings, SyntaxList members) + => SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken), externs, usings, members); - /// Creates a new FileScopedNamespaceDeclarationSyntax instance. - public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(NameSyntax name) - => SyntaxFactory.FileScopedNamespaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken), default, default, default); + /// Creates a new FileScopedNamespaceDeclarationSyntax instance. + public static FileScopedNamespaceDeclarationSyntax FileScopedNamespaceDeclaration(NameSyntax name) + => SyntaxFactory.FileScopedNamespaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken), default, default, default); - /// Creates a new AttributeListSyntax instance. - public static AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) - { - if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - return (AttributeListSyntax)Syntax.InternalSyntax.SyntaxFactory.AttributeList((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, target == null ? null : (Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)target.Green, attributes.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); - } + /// Creates a new AttributeListSyntax instance. + public static AttributeListSyntax AttributeList(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + { + if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + return (AttributeListSyntax)Syntax.InternalSyntax.SyntaxFactory.AttributeList((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, target == null ? null : (Syntax.InternalSyntax.AttributeTargetSpecifierSyntax)target.Green, attributes.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); + } - /// Creates a new AttributeListSyntax instance. - public static AttributeListSyntax AttributeList(AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList attributes) - => SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), target, attributes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); + /// Creates a new AttributeListSyntax instance. + public static AttributeListSyntax AttributeList(AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList attributes) + => SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), target, attributes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); - /// Creates a new AttributeListSyntax instance. - public static AttributeListSyntax AttributeList(SeparatedSyntaxList attributes = default) - => SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default, attributes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); + /// Creates a new AttributeListSyntax instance. + public static AttributeListSyntax AttributeList(SeparatedSyntaxList attributes = default) + => SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default, attributes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); - /// Creates a new AttributeTargetSpecifierSyntax instance. - public static AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken) - { - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - return (AttributeTargetSpecifierSyntax)Syntax.InternalSyntax.SyntaxFactory.AttributeTargetSpecifier((Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); - } + /// Creates a new AttributeTargetSpecifierSyntax instance. + public static AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier, SyntaxToken colonToken) + { + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + return (AttributeTargetSpecifierSyntax)Syntax.InternalSyntax.SyntaxFactory.AttributeTargetSpecifier((Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); + } + + /// Creates a new AttributeTargetSpecifierSyntax instance. + public static AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier) + => SyntaxFactory.AttributeTargetSpecifier(identifier, SyntaxFactory.Token(SyntaxKind.ColonToken)); + + /// Creates a new AttributeSyntax instance. + public static AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList) + { + if (name == null) throw new ArgumentNullException(nameof(name)); + return (AttributeSyntax)Syntax.InternalSyntax.SyntaxFactory.Attribute((Syntax.InternalSyntax.NameSyntax)name.Green, argumentList == null ? null : (Syntax.InternalSyntax.AttributeArgumentListSyntax)argumentList.Green).CreateRed(); + } + + /// Creates a new AttributeSyntax instance. + public static AttributeSyntax Attribute(NameSyntax name) + => SyntaxFactory.Attribute(name, default); + + /// Creates a new AttributeArgumentListSyntax instance. + public static AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (AttributeArgumentListSyntax)Syntax.InternalSyntax.SyntaxFactory.AttributeArgumentList((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, arguments.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } + + /// Creates a new AttributeArgumentListSyntax instance. + public static AttributeArgumentListSyntax AttributeArgumentList(SeparatedSyntaxList arguments = default) + => SyntaxFactory.AttributeArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + + /// Creates a new AttributeArgumentSyntax instance. + public static AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + { + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (AttributeArgumentSyntax)Syntax.InternalSyntax.SyntaxFactory.AttributeArgument(nameEquals == null ? null : (Syntax.InternalSyntax.NameEqualsSyntax)nameEquals.Green, nameColon == null ? null : (Syntax.InternalSyntax.NameColonSyntax)nameColon.Green, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } + + /// Creates a new AttributeArgumentSyntax instance. + public static AttributeArgumentSyntax AttributeArgument(ExpressionSyntax expression) + => SyntaxFactory.AttributeArgument(default, default, expression); + + /// Creates a new NameEqualsSyntax instance. + public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken) + { + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + return (NameEqualsSyntax)Syntax.InternalSyntax.SyntaxFactory.NameEquals((Syntax.InternalSyntax.IdentifierNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!).CreateRed(); + } - /// Creates a new AttributeTargetSpecifierSyntax instance. - public static AttributeTargetSpecifierSyntax AttributeTargetSpecifier(SyntaxToken identifier) - => SyntaxFactory.AttributeTargetSpecifier(identifier, SyntaxFactory.Token(SyntaxKind.ColonToken)); + /// Creates a new NameEqualsSyntax instance. + public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name) + => SyntaxFactory.NameEquals(name, SyntaxFactory.Token(SyntaxKind.EqualsToken)); - /// Creates a new AttributeSyntax instance. - public static AttributeSyntax Attribute(NameSyntax name, AttributeArgumentListSyntax? argumentList) + /// Creates a new NameEqualsSyntax instance. + public static NameEqualsSyntax NameEquals(string name) + => SyntaxFactory.NameEquals(SyntaxFactory.IdentifierName(name), SyntaxFactory.Token(SyntaxKind.EqualsToken)); + + /// Creates a new TypeParameterListSyntax instance. + public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + return (TypeParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeParameterList((Syntax.InternalSyntax.SyntaxToken)lessThanToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)greaterThanToken.Node!).CreateRed(); + } + + /// Creates a new TypeParameterListSyntax instance. + public static TypeParameterListSyntax TypeParameterList(SeparatedSyntaxList parameters = default) + => SyntaxFactory.TypeParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), parameters, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); + + /// Creates a new TypeParameterSyntax instance. + public static TypeParameterSyntax TypeParameter(SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) + { + switch (varianceKeyword.Kind()) { - if (name == null) throw new ArgumentNullException(nameof(name)); - return (AttributeSyntax)Syntax.InternalSyntax.SyntaxFactory.Attribute((Syntax.InternalSyntax.NameSyntax)name.Green, argumentList == null ? null : (Syntax.InternalSyntax.AttributeArgumentListSyntax)argumentList.Green).CreateRed(); + case SyntaxKind.InKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(varianceKeyword)); } + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + return (TypeParameterSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeParameter(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)varianceKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!).CreateRed(); + } + + /// Creates a new TypeParameterSyntax instance. + public static TypeParameterSyntax TypeParameter(SyntaxToken identifier) + => SyntaxFactory.TypeParameter(default, default, identifier); - /// Creates a new AttributeSyntax instance. - public static AttributeSyntax Attribute(NameSyntax name) - => SyntaxFactory.Attribute(name, default); + /// Creates a new TypeParameterSyntax instance. + public static TypeParameterSyntax TypeParameter(string identifier) + => SyntaxFactory.TypeParameter(default, default, SyntaxFactory.Identifier(identifier)); - /// Creates a new AttributeArgumentListSyntax instance. - public static AttributeArgumentListSyntax AttributeArgumentList(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + /// Creates a new ClassDeclarationSyntax instance. + public static ClassDeclarationSyntax ClassDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (keyword.Kind() != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + switch (openBraceToken.Kind()) { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (AttributeArgumentListSyntax)Syntax.InternalSyntax.SyntaxFactory.AttributeArgumentList((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, arguments.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } + switch (closeBraceToken.Kind()) + { + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); + } + switch (semicolonToken.Kind()) + { + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); + } + return (ClassDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.ClassDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new AttributeArgumentListSyntax instance. - public static AttributeArgumentListSyntax AttributeArgumentList(SeparatedSyntaxList arguments = default) - => SyntaxFactory.AttributeArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - - /// Creates a new AttributeArgumentSyntax instance. - public static AttributeArgumentSyntax AttributeArgument(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + /// Creates a new StructDeclarationSyntax instance. + public static StructDeclarationSyntax StructDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (keyword.Kind() != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + switch (openBraceToken.Kind()) { - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (AttributeArgumentSyntax)Syntax.InternalSyntax.SyntaxFactory.AttributeArgument(nameEquals == null ? null : (Syntax.InternalSyntax.NameEqualsSyntax)nameEquals.Green, nameColon == null ? null : (Syntax.InternalSyntax.NameColonSyntax)nameColon.Green, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); } + switch (closeBraceToken.Kind()) + { + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); + } + switch (semicolonToken.Kind()) + { + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); + } + return (StructDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.StructDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new AttributeArgumentSyntax instance. - public static AttributeArgumentSyntax AttributeArgument(ExpressionSyntax expression) - => SyntaxFactory.AttributeArgument(default, default, expression); + /// Creates a new InterfaceDeclarationSyntax instance. + public static InterfaceDeclarationSyntax InterfaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (keyword.Kind() != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + switch (openBraceToken.Kind()) + { + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); + } + switch (closeBraceToken.Kind()) + { + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); + } + switch (semicolonToken.Kind()) + { + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); + } + return (InterfaceDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.InterfaceDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new NameEqualsSyntax instance. - public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name, SyntaxToken equalsToken) + /// Creates a new RecordDeclarationSyntax instance. + public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + switch (kind) + { + case SyntaxKind.RecordDeclaration: + case SyntaxKind.RecordStructDeclaration: break; + default: throw new ArgumentException(nameof(kind)); + } + switch (classOrStructKeyword.Kind()) { - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - return (NameEqualsSyntax)Syntax.InternalSyntax.SyntaxFactory.NameEquals((Syntax.InternalSyntax.IdentifierNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!).CreateRed(); + case SyntaxKind.ClassKeyword: + case SyntaxKind.StructKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(classOrStructKeyword)); } + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + switch (openBraceToken.Kind()) + { + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); + } + switch (closeBraceToken.Kind()) + { + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); + } + switch (semicolonToken.Kind()) + { + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); + } + return (RecordDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.RecordDeclaration(kind, attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)classOrStructKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new NameEqualsSyntax instance. - public static NameEqualsSyntax NameEquals(IdentifierNameSyntax name) - => SyntaxFactory.NameEquals(name, SyntaxFactory.Token(SyntaxKind.EqualsToken)); + /// Creates a new RecordDeclarationSyntax instance. + public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxList members) + => SyntaxFactory.RecordDeclaration(kind, attributeLists, modifiers, keyword, default, identifier, typeParameterList, parameterList, baseList, constraintClauses, default, members, default, default); - /// Creates a new NameEqualsSyntax instance. - public static NameEqualsSyntax NameEquals(string name) - => SyntaxFactory.NameEquals(SyntaxFactory.IdentifierName(name), SyntaxFactory.Token(SyntaxKind.EqualsToken)); + /// Creates a new RecordDeclarationSyntax instance. + public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxToken keyword, SyntaxToken identifier) + => SyntaxFactory.RecordDeclaration(kind, default, default(SyntaxTokenList), keyword, default, identifier, default, default, default, default, default, default, default, default); - /// Creates a new TypeParameterListSyntax instance. - public static TypeParameterListSyntax TypeParameterList(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) - { - if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); - return (TypeParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeParameterList((Syntax.InternalSyntax.SyntaxToken)lessThanToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)greaterThanToken.Node!).CreateRed(); - } + /// Creates a new RecordDeclarationSyntax instance. + public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxToken keyword, string identifier) + => SyntaxFactory.RecordDeclaration(kind, default, default(SyntaxTokenList), keyword, default, SyntaxFactory.Identifier(identifier), default, default, default, default, default, default, default, default); - /// Creates a new TypeParameterListSyntax instance. - public static TypeParameterListSyntax TypeParameterList(SeparatedSyntaxList parameters = default) - => SyntaxFactory.TypeParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), parameters, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); + private static SyntaxKind GetRecordDeclarationClassOrStructKeywordKind(SyntaxKind kind) + => kind switch + { + SyntaxKind.RecordDeclaration => SyntaxKind.ClassKeyword, + SyntaxKind.RecordStructDeclaration => SyntaxKind.StructKeyword, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new TypeParameterSyntax instance. - public static TypeParameterSyntax TypeParameter(SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) + /// Creates a new EnumDeclarationSyntax instance. + public static EnumDeclarationSyntax EnumDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (enumKeyword.Kind() != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + switch (openBraceToken.Kind()) + { + case SyntaxKind.OpenBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(openBraceToken)); + } + switch (closeBraceToken.Kind()) + { + case SyntaxKind.CloseBraceToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(closeBraceToken)); + } + switch (semicolonToken.Kind()) { - switch (varianceKeyword.Kind()) - { - case SyntaxKind.InKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(varianceKeyword)); - } - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - return (TypeParameterSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeParameter(attributeLists.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)varianceKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (EnumDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.EnumDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)enumKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } + + /// Creates a new DelegateDeclarationSyntax instance. + public static DelegateDeclarationSyntax DelegateDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, SyntaxToken semicolonToken) + { + if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (DelegateDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.DelegateDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)delegateKeyword.Node!, (Syntax.InternalSyntax.TypeSyntax)returnType.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } + + /// Creates a new DelegateDeclarationSyntax instance. + public static DelegateDeclarationSyntax DelegateDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses) + => SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, identifier, typeParameterList, parameterList, constraintClauses, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + + /// Creates a new DelegateDeclarationSyntax instance. + public static DelegateDeclarationSyntax DelegateDeclaration(TypeSyntax returnType, SyntaxToken identifier) + => SyntaxFactory.DelegateDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, identifier, default, SyntaxFactory.ParameterList(), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + + /// Creates a new DelegateDeclarationSyntax instance. + public static DelegateDeclarationSyntax DelegateDeclaration(TypeSyntax returnType, string identifier) + => SyntaxFactory.DelegateDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, SyntaxFactory.Identifier(identifier), default, SyntaxFactory.ParameterList(), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new TypeParameterSyntax instance. - public static TypeParameterSyntax TypeParameter(SyntaxToken identifier) - => SyntaxFactory.TypeParameter(default, default, identifier); + /// Creates a new EnumMemberDeclarationSyntax instance. + public static EnumMemberDeclarationSyntax EnumMemberDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + { + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + return (EnumMemberDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.EnumMemberDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, equalsValue == null ? null : (Syntax.InternalSyntax.EqualsValueClauseSyntax)equalsValue.Green).CreateRed(); + } + + /// Creates a new EnumMemberDeclarationSyntax instance. + public static EnumMemberDeclarationSyntax EnumMemberDeclaration(SyntaxToken identifier) + => SyntaxFactory.EnumMemberDeclaration(default, default(SyntaxTokenList), identifier, default); + + /// Creates a new EnumMemberDeclarationSyntax instance. + public static EnumMemberDeclarationSyntax EnumMemberDeclaration(string identifier) + => SyntaxFactory.EnumMemberDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Identifier(identifier), default); - /// Creates a new TypeParameterSyntax instance. - public static TypeParameterSyntax TypeParameter(string identifier) - => SyntaxFactory.TypeParameter(default, default, SyntaxFactory.Identifier(identifier)); + /// Creates a new BaseListSyntax instance. + public static BaseListSyntax BaseList(SyntaxToken colonToken, SeparatedSyntaxList types) + { + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + return (BaseListSyntax)Syntax.InternalSyntax.SyntaxFactory.BaseList((Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, types.Node.ToGreenSeparatedList()).CreateRed(); + } - /// Creates a new ClassDeclarationSyntax instance. - public static ClassDeclarationSyntax ClassDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + /// Creates a new BaseListSyntax instance. + public static BaseListSyntax BaseList(SeparatedSyntaxList types = default) + => SyntaxFactory.BaseList(SyntaxFactory.Token(SyntaxKind.ColonToken), types); + + /// Creates a new SimpleBaseTypeSyntax instance. + public static SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + return (SimpleBaseTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.SimpleBaseType((Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + } + + /// Creates a new PrimaryConstructorBaseTypeSyntax instance. + public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + return (PrimaryConstructorBaseTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.PrimaryConstructorBaseType((Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.ArgumentListSyntax)argumentList.Green).CreateRed(); + } + + /// Creates a new PrimaryConstructorBaseTypeSyntax instance. + public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type) + => SyntaxFactory.PrimaryConstructorBaseType(type, SyntaxFactory.ArgumentList()); + + /// Creates a new TypeParameterConstraintClauseSyntax instance. + public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, SeparatedSyntaxList constraints) + { + if (whereKeyword.Kind() != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + return (TypeParameterConstraintClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeParameterConstraintClause((Syntax.InternalSyntax.SyntaxToken)whereKeyword.Node!, (Syntax.InternalSyntax.IdentifierNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, constraints.Node.ToGreenSeparatedList()).CreateRed(); + } + + /// Creates a new TypeParameterConstraintClauseSyntax instance. + public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(IdentifierNameSyntax name, SeparatedSyntaxList constraints) + => SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), name, SyntaxFactory.Token(SyntaxKind.ColonToken), constraints); + + /// Creates a new TypeParameterConstraintClauseSyntax instance. + public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(IdentifierNameSyntax name) + => SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), name, SyntaxFactory.Token(SyntaxKind.ColonToken), default); + + /// Creates a new TypeParameterConstraintClauseSyntax instance. + public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(string name) + => SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), SyntaxFactory.IdentifierName(name), SyntaxFactory.Token(SyntaxKind.ColonToken), default); + + /// Creates a new ConstructorConstraintSyntax instance. + public static ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + { + if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (ConstructorConstraintSyntax)Syntax.InternalSyntax.SyntaxFactory.ConstructorConstraint((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } + + /// Creates a new ConstructorConstraintSyntax instance. + public static ConstructorConstraintSyntax ConstructorConstraint() + => SyntaxFactory.ConstructorConstraint(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + + /// Creates a new ClassOrStructConstraintSyntax instance. + public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken questionToken) + { + switch (kind) { - if (keyword.Kind() != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - switch (openBraceToken.Kind()) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } - switch (closeBraceToken.Kind()) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (ClassDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.ClassDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + case SyntaxKind.ClassConstraint: + case SyntaxKind.StructConstraint: break; + default: throw new ArgumentException(nameof(kind)); } - - /// Creates a new StructDeclarationSyntax instance. - public static StructDeclarationSyntax StructDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + switch (classOrStructKeyword.Kind()) { - if (keyword.Kind() != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - switch (openBraceToken.Kind()) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } - switch (closeBraceToken.Kind()) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (StructDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.StructDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + case SyntaxKind.ClassKeyword: + case SyntaxKind.StructKeyword: break; + default: throw new ArgumentException(nameof(classOrStructKeyword)); } - - /// Creates a new InterfaceDeclarationSyntax instance. - public static InterfaceDeclarationSyntax InterfaceDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + switch (questionToken.Kind()) { - if (keyword.Kind() != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - switch (openBraceToken.Kind()) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } - switch (closeBraceToken.Kind()) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (InterfaceDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.InterfaceDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + case SyntaxKind.QuestionToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(questionToken)); } + return (ClassOrStructConstraintSyntax)Syntax.InternalSyntax.SyntaxFactory.ClassOrStructConstraint(kind, (Syntax.InternalSyntax.SyntaxToken)classOrStructKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)questionToken.Node).CreateRed(); + } + + /// Creates a new ClassOrStructConstraintSyntax instance. + public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind) + => SyntaxFactory.ClassOrStructConstraint(kind, SyntaxFactory.Token(GetClassOrStructConstraintClassOrStructKeywordKind(kind)), default); - /// Creates a new RecordDeclarationSyntax instance. - public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + private static SyntaxKind GetClassOrStructConstraintClassOrStructKeywordKind(SyntaxKind kind) + => kind switch { - switch (kind) - { - case SyntaxKind.RecordDeclaration: - case SyntaxKind.RecordStructDeclaration: break; - default: throw new ArgumentException(nameof(kind)); - } - switch (classOrStructKeyword.Kind()) - { - case SyntaxKind.ClassKeyword: - case SyntaxKind.StructKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(classOrStructKeyword)); - } - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - switch (openBraceToken.Kind()) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } - switch (closeBraceToken.Kind()) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (RecordDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.RecordDeclaration(kind, attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)classOrStructKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, parameterList == null ? null : (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); - } + SyntaxKind.ClassConstraint => SyntaxKind.ClassKeyword, + SyntaxKind.StructConstraint => SyntaxKind.StructKeyword, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new RecordDeclarationSyntax instance. - public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxList members) - => SyntaxFactory.RecordDeclaration(kind, attributeLists, modifiers, keyword, default, identifier, typeParameterList, parameterList, baseList, constraintClauses, default, members, default, default); + /// Creates a new TypeConstraintSyntax instance. + public static TypeConstraintSyntax TypeConstraint(TypeSyntax type) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + return (TypeConstraintSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeConstraint((Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + } + + /// Creates a new DefaultConstraintSyntax instance. + public static DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) + { + if (defaultKeyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); + return (DefaultConstraintSyntax)Syntax.InternalSyntax.SyntaxFactory.DefaultConstraint((Syntax.InternalSyntax.SyntaxToken)defaultKeyword.Node!).CreateRed(); + } + + /// Creates a new DefaultConstraintSyntax instance. + public static DefaultConstraintSyntax DefaultConstraint() + => SyntaxFactory.DefaultConstraint(SyntaxFactory.Token(SyntaxKind.DefaultKeyword)); + + /// Creates a new FieldDeclarationSyntax instance. + public static FieldDeclarationSyntax FieldDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (FieldDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.FieldDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } + + /// Creates a new FieldDeclarationSyntax instance. + public static FieldDeclarationSyntax FieldDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration) + => SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + + /// Creates a new FieldDeclarationSyntax instance. + public static FieldDeclarationSyntax FieldDeclaration(VariableDeclarationSyntax declaration) + => SyntaxFactory.FieldDeclaration(default, default(SyntaxTokenList), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + + /// Creates a new EventFieldDeclarationSyntax instance. + public static EventFieldDeclarationSyntax EventFieldDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + if (eventKeyword.Kind() != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); + if (declaration == null) throw new ArgumentNullException(nameof(declaration)); + if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); + return (EventFieldDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.EventFieldDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)eventKeyword.Node!, (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + } - /// Creates a new RecordDeclarationSyntax instance. - public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxToken keyword, SyntaxToken identifier) - => SyntaxFactory.RecordDeclaration(kind, default, default(SyntaxTokenList), keyword, default, identifier, default, default, default, default, default, default, default, default); + /// Creates a new EventFieldDeclarationSyntax instance. + public static EventFieldDeclarationSyntax EventFieldDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration) + => SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EventKeyword), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - /// Creates a new RecordDeclarationSyntax instance. - public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxToken keyword, string identifier) - => SyntaxFactory.RecordDeclaration(kind, default, default(SyntaxTokenList), keyword, default, SyntaxFactory.Identifier(identifier), default, default, default, default, default, default, default, default); + /// Creates a new EventFieldDeclarationSyntax instance. + public static EventFieldDeclarationSyntax EventFieldDeclaration(VariableDeclarationSyntax declaration) + => SyntaxFactory.EventFieldDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); - private static SyntaxKind GetRecordDeclarationClassOrStructKeywordKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.RecordDeclaration => SyntaxKind.ClassKeyword, - SyntaxKind.RecordStructDeclaration => SyntaxKind.StructKeyword, - _ => throw new ArgumentOutOfRangeException(), - }; + /// Creates a new ExplicitInterfaceSpecifierSyntax instance. + public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken) + { + if (name == null) throw new ArgumentNullException(nameof(name)); + if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + return (ExplicitInterfaceSpecifierSyntax)Syntax.InternalSyntax.SyntaxFactory.ExplicitInterfaceSpecifier((Syntax.InternalSyntax.NameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)dotToken.Node!).CreateRed(); + } - /// Creates a new EnumDeclarationSyntax instance. - public static EnumDeclarationSyntax EnumDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (enumKeyword.Kind() != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - switch (openBraceToken.Kind()) - { - case SyntaxKind.OpenBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(openBraceToken)); - } - switch (closeBraceToken.Kind()) - { - case SyntaxKind.CloseBraceToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(closeBraceToken)); - } - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (EnumDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.EnumDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)enumKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, baseList == null ? null : (Syntax.InternalSyntax.BaseListSyntax)baseList.Green, (Syntax.InternalSyntax.SyntaxToken?)openBraceToken.Node, members.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken?)closeBraceToken.Node, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); - } + /// Creates a new ExplicitInterfaceSpecifierSyntax instance. + public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name) + => SyntaxFactory.ExplicitInterfaceSpecifier(name, SyntaxFactory.Token(SyntaxKind.DotToken)); - /// Creates a new DelegateDeclarationSyntax instance. - public static DelegateDeclarationSyntax DelegateDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, SyntaxToken semicolonToken) + /// Creates a new MethodDeclarationSyntax instance. + public static MethodDeclarationSyntax MethodDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + switch (semicolonToken.Kind()) { - if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (DelegateDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.DelegateDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)delegateKeyword.Node!, (Syntax.InternalSyntax.TypeSyntax)returnType.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, constraintClauses.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (MethodDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.MethodDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)returnType.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, constraintClauses.Node.ToGreenList(), body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new DelegateDeclarationSyntax instance. - public static DelegateDeclarationSyntax DelegateDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses) - => SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, identifier, typeParameterList, parameterList, constraintClauses, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new MethodDeclarationSyntax instance. + public static MethodDeclarationSyntax MethodDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) + => SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, default); - /// Creates a new DelegateDeclarationSyntax instance. - public static DelegateDeclarationSyntax DelegateDeclaration(TypeSyntax returnType, SyntaxToken identifier) - => SyntaxFactory.DelegateDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, identifier, default, SyntaxFactory.ParameterList(), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new MethodDeclarationSyntax instance. + public static MethodDeclarationSyntax MethodDeclaration(TypeSyntax returnType, SyntaxToken identifier) + => SyntaxFactory.MethodDeclaration(default, default(SyntaxTokenList), returnType, default, identifier, default, SyntaxFactory.ParameterList(), default, default, default, default); - /// Creates a new DelegateDeclarationSyntax instance. - public static DelegateDeclarationSyntax DelegateDeclaration(TypeSyntax returnType, string identifier) - => SyntaxFactory.DelegateDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, SyntaxFactory.Identifier(identifier), default, SyntaxFactory.ParameterList(), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new MethodDeclarationSyntax instance. + public static MethodDeclarationSyntax MethodDeclaration(TypeSyntax returnType, string identifier) + => SyntaxFactory.MethodDeclaration(default, default(SyntaxTokenList), returnType, default, SyntaxFactory.Identifier(identifier), default, SyntaxFactory.ParameterList(), default, default, default, default); - /// Creates a new EnumMemberDeclarationSyntax instance. - public static EnumMemberDeclarationSyntax EnumMemberDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) - { - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - return (EnumMemberDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.EnumMemberDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, equalsValue == null ? null : (Syntax.InternalSyntax.EqualsValueClauseSyntax)equalsValue.Green).CreateRed(); - } + /// Creates a new OperatorDeclarationSyntax instance. + public static OperatorDeclarationSyntax OperatorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (returnType == null) throw new ArgumentNullException(nameof(returnType)); + if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + switch (checkedKeyword.Kind()) + { + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); + } + switch (operatorToken.Kind()) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.TildeToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: + case SyntaxKind.IsKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + switch (semicolonToken.Kind()) + { + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); + } + return (OperatorDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.OperatorDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)returnType.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)operatorKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)checkedKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new EnumMemberDeclarationSyntax instance. - public static EnumMemberDeclarationSyntax EnumMemberDeclaration(SyntaxToken identifier) - => SyntaxFactory.EnumMemberDeclaration(default, default(SyntaxTokenList), identifier, default); + /// Creates a new OperatorDeclarationSyntax instance. + public static OperatorDeclarationSyntax OperatorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) + => SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, parameterList, body, expressionBody, default); - /// Creates a new EnumMemberDeclarationSyntax instance. - public static EnumMemberDeclarationSyntax EnumMemberDeclaration(string identifier) - => SyntaxFactory.EnumMemberDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Identifier(identifier), default); + /// Creates a new OperatorDeclarationSyntax instance. + public static OperatorDeclarationSyntax OperatorDeclaration(TypeSyntax returnType, SyntaxToken operatorToken) + => SyntaxFactory.OperatorDeclaration(default, default(SyntaxTokenList), returnType, default, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, SyntaxFactory.ParameterList(), default, default, default); - /// Creates a new BaseListSyntax instance. - public static BaseListSyntax BaseList(SyntaxToken colonToken, SeparatedSyntaxList types) + /// Creates a new ConversionOperatorDeclarationSyntax instance. + public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + switch (implicitOrExplicitKeyword.Kind()) { - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - return (BaseListSyntax)Syntax.InternalSyntax.SyntaxFactory.BaseList((Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, types.Node.ToGreenSeparatedList()).CreateRed(); + case SyntaxKind.ImplicitKeyword: + case SyntaxKind.ExplicitKeyword: break; + default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); } - - /// Creates a new BaseListSyntax instance. - public static BaseListSyntax BaseList(SeparatedSyntaxList types = default) - => SyntaxFactory.BaseList(SyntaxFactory.Token(SyntaxKind.ColonToken), types); - - /// Creates a new SimpleBaseTypeSyntax instance. - public static SimpleBaseTypeSyntax SimpleBaseType(TypeSyntax type) + if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + switch (checkedKeyword.Kind()) { - if (type == null) throw new ArgumentNullException(nameof(type)); - return (SimpleBaseTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.SimpleBaseType((Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } - - /// Creates a new PrimaryConstructorBaseTypeSyntax instance. - public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type, ArgumentListSyntax argumentList) + if (type == null) throw new ArgumentNullException(nameof(type)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + switch (semicolonToken.Kind()) { - if (type == null) throw new ArgumentNullException(nameof(type)); - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); - return (PrimaryConstructorBaseTypeSyntax)Syntax.InternalSyntax.SyntaxFactory.PrimaryConstructorBaseType((Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.ArgumentListSyntax)argumentList.Green).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (ConversionOperatorDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.ConversionOperatorDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)implicitOrExplicitKeyword.Node!, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)operatorKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)checkedKeyword.Node, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } + + /// Creates a new ConversionOperatorDeclarationSyntax instance. + public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) + => SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, parameterList, body, expressionBody, default); - /// Creates a new PrimaryConstructorBaseTypeSyntax instance. - public static PrimaryConstructorBaseTypeSyntax PrimaryConstructorBaseType(TypeSyntax type) - => SyntaxFactory.PrimaryConstructorBaseType(type, SyntaxFactory.ArgumentList()); + /// Creates a new ConversionOperatorDeclarationSyntax instance. + public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(SyntaxToken implicitOrExplicitKeyword, TypeSyntax type) + => SyntaxFactory.ConversionOperatorDeclaration(default, default(SyntaxTokenList), implicitOrExplicitKeyword, default, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, SyntaxFactory.ParameterList(), default, default, default); - /// Creates a new TypeParameterConstraintClauseSyntax instance. - public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, SeparatedSyntaxList constraints) + /// Creates a new ConstructorDeclarationSyntax instance. + public static ConstructorDeclarationSyntax ConstructorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + switch (semicolonToken.Kind()) { - if (whereKeyword.Kind() != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - return (TypeParameterConstraintClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeParameterConstraintClause((Syntax.InternalSyntax.SyntaxToken)whereKeyword.Node!, (Syntax.InternalSyntax.IdentifierNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, constraints.Node.ToGreenSeparatedList()).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (ConstructorDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.ConstructorDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, initializer == null ? null : (Syntax.InternalSyntax.ConstructorInitializerSyntax)initializer.Green, body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new TypeParameterConstraintClauseSyntax instance. - public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(IdentifierNameSyntax name, SeparatedSyntaxList constraints) - => SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), name, SyntaxFactory.Token(SyntaxKind.ColonToken), constraints); + /// Creates a new ConstructorDeclarationSyntax instance. + public static ConstructorDeclarationSyntax ConstructorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) + => SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, default); - /// Creates a new TypeParameterConstraintClauseSyntax instance. - public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(IdentifierNameSyntax name) - => SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), name, SyntaxFactory.Token(SyntaxKind.ColonToken), default); + /// Creates a new ConstructorDeclarationSyntax instance. + public static ConstructorDeclarationSyntax ConstructorDeclaration(SyntaxToken identifier) + => SyntaxFactory.ConstructorDeclaration(default, default(SyntaxTokenList), identifier, SyntaxFactory.ParameterList(), default, default, default, default); - /// Creates a new TypeParameterConstraintClauseSyntax instance. - public static TypeParameterConstraintClauseSyntax TypeParameterConstraintClause(string name) - => SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), SyntaxFactory.IdentifierName(name), SyntaxFactory.Token(SyntaxKind.ColonToken), default); + /// Creates a new ConstructorDeclarationSyntax instance. + public static ConstructorDeclarationSyntax ConstructorDeclaration(string identifier) + => SyntaxFactory.ConstructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Identifier(identifier), SyntaxFactory.ParameterList(), default, default, default, default); - /// Creates a new ConstructorConstraintSyntax instance. - public static ConstructorConstraintSyntax ConstructorConstraint(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + /// Creates a new ConstructorInitializerSyntax instance. + public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + { + switch (kind) { - if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (ConstructorConstraintSyntax)Syntax.InternalSyntax.SyntaxFactory.ConstructorConstraint((Syntax.InternalSyntax.SyntaxToken)newKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + case SyntaxKind.BaseConstructorInitializer: + case SyntaxKind.ThisConstructorInitializer: break; + default: throw new ArgumentException(nameof(kind)); } - - /// Creates a new ConstructorConstraintSyntax instance. - public static ConstructorConstraintSyntax ConstructorConstraint() - => SyntaxFactory.ConstructorConstraint(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - - /// Creates a new ClassOrStructConstraintSyntax instance. - public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken questionToken) + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + switch (thisOrBaseKeyword.Kind()) { - switch (kind) - { - case SyntaxKind.ClassConstraint: - case SyntaxKind.StructConstraint: break; - default: throw new ArgumentException(nameof(kind)); - } - switch (classOrStructKeyword.Kind()) - { - case SyntaxKind.ClassKeyword: - case SyntaxKind.StructKeyword: break; - default: throw new ArgumentException(nameof(classOrStructKeyword)); - } - switch (questionToken.Kind()) - { - case SyntaxKind.QuestionToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(questionToken)); - } - return (ClassOrStructConstraintSyntax)Syntax.InternalSyntax.SyntaxFactory.ClassOrStructConstraint(kind, (Syntax.InternalSyntax.SyntaxToken)classOrStructKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)questionToken.Node).CreateRed(); + case SyntaxKind.BaseKeyword: + case SyntaxKind.ThisKeyword: break; + default: throw new ArgumentException(nameof(thisOrBaseKeyword)); } + if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); + return (ConstructorInitializerSyntax)Syntax.InternalSyntax.SyntaxFactory.ConstructorInitializer(kind, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.SyntaxToken)thisOrBaseKeyword.Node!, (Syntax.InternalSyntax.ArgumentListSyntax)argumentList.Green).CreateRed(); + } - /// Creates a new ClassOrStructConstraintSyntax instance. - public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind) - => SyntaxFactory.ClassOrStructConstraint(kind, SyntaxFactory.Token(GetClassOrStructConstraintClassOrStructKeywordKind(kind)), default); - - private static SyntaxKind GetClassOrStructConstraintClassOrStructKeywordKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.ClassConstraint => SyntaxKind.ClassKeyword, - SyntaxKind.StructConstraint => SyntaxKind.StructKeyword, - _ => throw new ArgumentOutOfRangeException(), - }; + /// Creates a new ConstructorInitializerSyntax instance. + public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, ArgumentListSyntax? argumentList = default) + => SyntaxFactory.ConstructorInitializer(kind, SyntaxFactory.Token(SyntaxKind.ColonToken), SyntaxFactory.Token(GetConstructorInitializerThisOrBaseKeywordKind(kind)), argumentList ?? SyntaxFactory.ArgumentList()); - /// Creates a new TypeConstraintSyntax instance. - public static TypeConstraintSyntax TypeConstraint(TypeSyntax type) + private static SyntaxKind GetConstructorInitializerThisOrBaseKeywordKind(SyntaxKind kind) + => kind switch { - if (type == null) throw new ArgumentNullException(nameof(type)); - return (TypeConstraintSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeConstraint((Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); - } + SyntaxKind.BaseConstructorInitializer => SyntaxKind.BaseKeyword, + SyntaxKind.ThisConstructorInitializer => SyntaxKind.ThisKeyword, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new DefaultConstraintSyntax instance. - public static DefaultConstraintSyntax DefaultConstraint(SyntaxToken defaultKeyword) + /// Creates a new DestructorDeclarationSyntax instance. + public static DestructorDeclarationSyntax DestructorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (tildeToken.Kind() != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + switch (semicolonToken.Kind()) { - if (defaultKeyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); - return (DefaultConstraintSyntax)Syntax.InternalSyntax.SyntaxFactory.DefaultConstraint((Syntax.InternalSyntax.SyntaxToken)defaultKeyword.Node!).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (DestructorDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.DestructorDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)tildeToken.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new DefaultConstraintSyntax instance. - public static DefaultConstraintSyntax DefaultConstraint() - => SyntaxFactory.DefaultConstraint(SyntaxFactory.Token(SyntaxKind.DefaultKeyword)); - - /// Creates a new FieldDeclarationSyntax instance. - public static FieldDeclarationSyntax FieldDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (FieldDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.FieldDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); - } + /// Creates a new DestructorDeclarationSyntax instance. + public static DestructorDeclarationSyntax DestructorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) + => SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.TildeToken), identifier, parameterList, body, expressionBody, default); - /// Creates a new FieldDeclarationSyntax instance. - public static FieldDeclarationSyntax FieldDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration) - => SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new DestructorDeclarationSyntax instance. + public static DestructorDeclarationSyntax DestructorDeclaration(SyntaxToken identifier) + => SyntaxFactory.DestructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.TildeToken), identifier, SyntaxFactory.ParameterList(), default, default, default); - /// Creates a new FieldDeclarationSyntax instance. - public static FieldDeclarationSyntax FieldDeclaration(VariableDeclarationSyntax declaration) - => SyntaxFactory.FieldDeclaration(default, default(SyntaxTokenList), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new DestructorDeclarationSyntax instance. + public static DestructorDeclarationSyntax DestructorDeclaration(string identifier) + => SyntaxFactory.DestructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.TildeToken), SyntaxFactory.Identifier(identifier), SyntaxFactory.ParameterList(), default, default, default); - /// Creates a new EventFieldDeclarationSyntax instance. - public static EventFieldDeclarationSyntax EventFieldDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + /// Creates a new PropertyDeclarationSyntax instance. + public static PropertyDeclarationSyntax PropertyDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + switch (semicolonToken.Kind()) { - if (eventKeyword.Kind() != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); - if (declaration == null) throw new ArgumentNullException(nameof(declaration)); - if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); - return (EventFieldDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.EventFieldDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)eventKeyword.Node!, (Syntax.InternalSyntax.VariableDeclarationSyntax)declaration.Green, (Syntax.InternalSyntax.SyntaxToken)semicolonToken.Node!).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (PropertyDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.PropertyDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)type.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, accessorList == null ? null : (Syntax.InternalSyntax.AccessorListSyntax)accessorList.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, initializer == null ? null : (Syntax.InternalSyntax.EqualsValueClauseSyntax)initializer.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new EventFieldDeclarationSyntax instance. - public static EventFieldDeclarationSyntax EventFieldDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration) - => SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EventKeyword), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new PropertyDeclarationSyntax instance. + public static PropertyDeclarationSyntax PropertyDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer) + => SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, default); - /// Creates a new EventFieldDeclarationSyntax instance. - public static EventFieldDeclarationSyntax EventFieldDeclaration(VariableDeclarationSyntax declaration) - => SyntaxFactory.EventFieldDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); + /// Creates a new PropertyDeclarationSyntax instance. + public static PropertyDeclarationSyntax PropertyDeclaration(TypeSyntax type, SyntaxToken identifier) + => SyntaxFactory.PropertyDeclaration(default, default(SyntaxTokenList), type, default, identifier, default, default, default, default); - /// Creates a new ExplicitInterfaceSpecifierSyntax instance. - public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name, SyntaxToken dotToken) - { - if (name == null) throw new ArgumentNullException(nameof(name)); - if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - return (ExplicitInterfaceSpecifierSyntax)Syntax.InternalSyntax.SyntaxFactory.ExplicitInterfaceSpecifier((Syntax.InternalSyntax.NameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)dotToken.Node!).CreateRed(); - } + /// Creates a new PropertyDeclarationSyntax instance. + public static PropertyDeclarationSyntax PropertyDeclaration(TypeSyntax type, string identifier) + => SyntaxFactory.PropertyDeclaration(default, default(SyntaxTokenList), type, default, SyntaxFactory.Identifier(identifier), default, default, default, default); + + /// Creates a new ArrowExpressionClauseSyntax instance. + public static ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression) + { + if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); + if (expression == null) throw new ArgumentNullException(nameof(expression)); + return (ArrowExpressionClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.ArrowExpressionClause((Syntax.InternalSyntax.SyntaxToken)arrowToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + } - /// Creates a new ExplicitInterfaceSpecifierSyntax instance. - public static ExplicitInterfaceSpecifierSyntax ExplicitInterfaceSpecifier(NameSyntax name) - => SyntaxFactory.ExplicitInterfaceSpecifier(name, SyntaxFactory.Token(SyntaxKind.DotToken)); + /// Creates a new ArrowExpressionClauseSyntax instance. + public static ArrowExpressionClauseSyntax ArrowExpressionClause(ExpressionSyntax expression) + => SyntaxFactory.ArrowExpressionClause(SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); - /// Creates a new MethodDeclarationSyntax instance. - public static MethodDeclarationSyntax MethodDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + /// Creates a new EventDeclarationSyntax instance. + public static EventDeclarationSyntax EventDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken semicolonToken) + { + if (eventKeyword.Kind() != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); + if (type == null) throw new ArgumentNullException(nameof(type)); + if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); + switch (semicolonToken.Kind()) { - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (MethodDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.MethodDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)returnType.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, typeParameterList == null ? null : (Syntax.InternalSyntax.TypeParameterListSyntax)typeParameterList.Green, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, constraintClauses.Node.ToGreenList(), body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (EventDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.EventDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)eventKeyword.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, accessorList == null ? null : (Syntax.InternalSyntax.AccessorListSyntax)accessorList.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new MethodDeclarationSyntax instance. - public static MethodDeclarationSyntax MethodDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) - => SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, default); + /// Creates a new EventDeclarationSyntax instance. + public static EventDeclarationSyntax EventDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList) + => SyntaxFactory.EventDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EventKeyword), type, explicitInterfaceSpecifier, identifier, accessorList, default); - /// Creates a new MethodDeclarationSyntax instance. - public static MethodDeclarationSyntax MethodDeclaration(TypeSyntax returnType, SyntaxToken identifier) - => SyntaxFactory.MethodDeclaration(default, default(SyntaxTokenList), returnType, default, identifier, default, SyntaxFactory.ParameterList(), default, default, default, default); + /// Creates a new EventDeclarationSyntax instance. + public static EventDeclarationSyntax EventDeclaration(TypeSyntax type, SyntaxToken identifier) + => SyntaxFactory.EventDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), type, default, identifier, default, default); - /// Creates a new MethodDeclarationSyntax instance. - public static MethodDeclarationSyntax MethodDeclaration(TypeSyntax returnType, string identifier) - => SyntaxFactory.MethodDeclaration(default, default(SyntaxTokenList), returnType, default, SyntaxFactory.Identifier(identifier), default, SyntaxFactory.ParameterList(), default, default, default, default); + /// Creates a new EventDeclarationSyntax instance. + public static EventDeclarationSyntax EventDeclaration(TypeSyntax type, string identifier) + => SyntaxFactory.EventDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), type, default, SyntaxFactory.Identifier(identifier), default, default); - /// Creates a new OperatorDeclarationSyntax instance. - public static OperatorDeclarationSyntax OperatorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + /// Creates a new IndexerDeclarationSyntax instance. + public static IndexerDeclarationSyntax IndexerDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + if (thisKeyword.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); + if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); + switch (semicolonToken.Kind()) { - if (returnType == null) throw new ArgumentNullException(nameof(returnType)); - if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - switch (checkedKeyword.Kind()) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - switch (operatorToken.Kind()) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.TildeToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.FalseKeyword: - case SyntaxKind.TrueKeyword: - case SyntaxKind.IsKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (OperatorDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.OperatorDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)returnType.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)operatorKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)checkedKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (IndexerDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.IndexerDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)type.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)thisKeyword.Node!, (Syntax.InternalSyntax.BracketedParameterListSyntax)parameterList.Green, accessorList == null ? null : (Syntax.InternalSyntax.AccessorListSyntax)accessorList.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new OperatorDeclarationSyntax instance. - public static OperatorDeclarationSyntax OperatorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) - => SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, parameterList, body, expressionBody, default); - - /// Creates a new OperatorDeclarationSyntax instance. - public static OperatorDeclarationSyntax OperatorDeclaration(TypeSyntax returnType, SyntaxToken operatorToken) - => SyntaxFactory.OperatorDeclaration(default, default(SyntaxTokenList), returnType, default, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, SyntaxFactory.ParameterList(), default, default, default); + /// Creates a new IndexerDeclarationSyntax instance. + public static IndexerDeclarationSyntax IndexerDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody) + => SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.ThisKeyword), parameterList, accessorList, expressionBody, default); - /// Creates a new ConversionOperatorDeclarationSyntax instance. - public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - switch (implicitOrExplicitKeyword.Kind()) - { - case SyntaxKind.ImplicitKeyword: - case SyntaxKind.ExplicitKeyword: break; - default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); - } - if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - switch (checkedKeyword.Kind()) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - if (type == null) throw new ArgumentNullException(nameof(type)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (ConversionOperatorDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.ConversionOperatorDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)implicitOrExplicitKeyword.Node!, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)operatorKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)checkedKeyword.Node, (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); - } + /// Creates a new IndexerDeclarationSyntax instance. + public static IndexerDeclarationSyntax IndexerDeclaration(TypeSyntax type) + => SyntaxFactory.IndexerDeclaration(default, default(SyntaxTokenList), type, default, SyntaxFactory.Token(SyntaxKind.ThisKeyword), SyntaxFactory.BracketedParameterList(), default, default, default); - /// Creates a new ConversionOperatorDeclarationSyntax instance. - public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) - => SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, parameterList, body, expressionBody, default); + /// Creates a new AccessorListSyntax instance. + public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, SyntaxList accessors, SyntaxToken closeBraceToken) + { + if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); + if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); + return (AccessorListSyntax)Syntax.InternalSyntax.SyntaxFactory.AccessorList((Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, accessors.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); + } - /// Creates a new ConversionOperatorDeclarationSyntax instance. - public static ConversionOperatorDeclarationSyntax ConversionOperatorDeclaration(SyntaxToken implicitOrExplicitKeyword, TypeSyntax type) - => SyntaxFactory.ConversionOperatorDeclaration(default, default(SyntaxTokenList), implicitOrExplicitKeyword, default, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, SyntaxFactory.ParameterList(), default, default, default); + /// Creates a new AccessorListSyntax instance. + public static AccessorListSyntax AccessorList(SyntaxList accessors = default) + => SyntaxFactory.AccessorList(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), accessors, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); - /// Creates a new ConstructorDeclarationSyntax instance. - public static ConstructorDeclarationSyntax ConstructorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + /// Creates a new AccessorDeclarationSyntax instance. + public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + switch (kind) { - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (ConstructorDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.ConstructorDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, initializer == null ? null : (Syntax.InternalSyntax.ConstructorInitializerSyntax)initializer.Green, body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + case SyntaxKind.GetAccessorDeclaration: + case SyntaxKind.SetAccessorDeclaration: + case SyntaxKind.InitAccessorDeclaration: + case SyntaxKind.AddAccessorDeclaration: + case SyntaxKind.RemoveAccessorDeclaration: + case SyntaxKind.UnknownAccessorDeclaration: break; + default: throw new ArgumentException(nameof(kind)); } - - /// Creates a new ConstructorDeclarationSyntax instance. - public static ConstructorDeclarationSyntax ConstructorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) - => SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, default); - - /// Creates a new ConstructorDeclarationSyntax instance. - public static ConstructorDeclarationSyntax ConstructorDeclaration(SyntaxToken identifier) - => SyntaxFactory.ConstructorDeclaration(default, default(SyntaxTokenList), identifier, SyntaxFactory.ParameterList(), default, default, default, default); - - /// Creates a new ConstructorDeclarationSyntax instance. - public static ConstructorDeclarationSyntax ConstructorDeclaration(string identifier) - => SyntaxFactory.ConstructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Identifier(identifier), SyntaxFactory.ParameterList(), default, default, default, default); - - /// Creates a new ConstructorInitializerSyntax instance. - public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + switch (keyword.Kind()) { - switch (kind) - { - case SyntaxKind.BaseConstructorInitializer: - case SyntaxKind.ThisConstructorInitializer: break; - default: throw new ArgumentException(nameof(kind)); - } - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - switch (thisOrBaseKeyword.Kind()) - { - case SyntaxKind.BaseKeyword: - case SyntaxKind.ThisKeyword: break; - default: throw new ArgumentException(nameof(thisOrBaseKeyword)); - } - if (argumentList == null) throw new ArgumentNullException(nameof(argumentList)); - return (ConstructorInitializerSyntax)Syntax.InternalSyntax.SyntaxFactory.ConstructorInitializer(kind, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!, (Syntax.InternalSyntax.SyntaxToken)thisOrBaseKeyword.Node!, (Syntax.InternalSyntax.ArgumentListSyntax)argumentList.Green).CreateRed(); + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + case SyntaxKind.InitKeyword: + case SyntaxKind.AddKeyword: + case SyntaxKind.RemoveKeyword: + case SyntaxKind.IdentifierToken: break; + default: throw new ArgumentException(nameof(keyword)); } - - /// Creates a new ConstructorInitializerSyntax instance. - public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, ArgumentListSyntax? argumentList = default) - => SyntaxFactory.ConstructorInitializer(kind, SyntaxFactory.Token(SyntaxKind.ColonToken), SyntaxFactory.Token(GetConstructorInitializerThisOrBaseKeywordKind(kind)), argumentList ?? SyntaxFactory.ArgumentList()); - - private static SyntaxKind GetConstructorInitializerThisOrBaseKeywordKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.BaseConstructorInitializer => SyntaxKind.BaseKeyword, - SyntaxKind.ThisConstructorInitializer => SyntaxKind.ThisKeyword, - _ => throw new ArgumentOutOfRangeException(), - }; - - /// Creates a new DestructorDeclarationSyntax instance. - public static DestructorDeclarationSyntax DestructorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + switch (semicolonToken.Kind()) { - if (tildeToken.Kind() != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (DestructorDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.DestructorDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)tildeToken.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.ParameterListSyntax)parameterList.Green, body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + case SyntaxKind.SemicolonToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(semicolonToken)); } + return (AccessorDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.AccessorDeclaration(kind, attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + } - /// Creates a new DestructorDeclarationSyntax instance. - public static DestructorDeclarationSyntax DestructorDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) - => SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.TildeToken), identifier, parameterList, body, expressionBody, default); - - /// Creates a new DestructorDeclarationSyntax instance. - public static DestructorDeclarationSyntax DestructorDeclaration(SyntaxToken identifier) - => SyntaxFactory.DestructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.TildeToken), identifier, SyntaxFactory.ParameterList(), default, default, default); + /// Creates a new AccessorDeclarationSyntax instance. + public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList attributeLists, SyntaxTokenList modifiers, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) + => SyntaxFactory.AccessorDeclaration(kind, attributeLists, modifiers, SyntaxFactory.Token(GetAccessorDeclarationKeywordKind(kind)), body, expressionBody, default); - /// Creates a new DestructorDeclarationSyntax instance. - public static DestructorDeclarationSyntax DestructorDeclaration(string identifier) - => SyntaxFactory.DestructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.TildeToken), SyntaxFactory.Identifier(identifier), SyntaxFactory.ParameterList(), default, default, default); + /// Creates a new AccessorDeclarationSyntax instance. + public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind) + => SyntaxFactory.AccessorDeclaration(kind, default, default(SyntaxTokenList), SyntaxFactory.Token(GetAccessorDeclarationKeywordKind(kind)), default, default, default); - /// Creates a new PropertyDeclarationSyntax instance. - public static PropertyDeclarationSyntax PropertyDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) + private static SyntaxKind GetAccessorDeclarationKeywordKind(SyntaxKind kind) + => kind switch { - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (PropertyDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.PropertyDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)type.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, accessorList == null ? null : (Syntax.InternalSyntax.AccessorListSyntax)accessorList.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, initializer == null ? null : (Syntax.InternalSyntax.EqualsValueClauseSyntax)initializer.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); - } + SyntaxKind.GetAccessorDeclaration => SyntaxKind.GetKeyword, + SyntaxKind.SetAccessorDeclaration => SyntaxKind.SetKeyword, + SyntaxKind.InitAccessorDeclaration => SyntaxKind.InitKeyword, + SyntaxKind.AddAccessorDeclaration => SyntaxKind.AddKeyword, + SyntaxKind.RemoveAccessorDeclaration => SyntaxKind.RemoveKeyword, + SyntaxKind.UnknownAccessorDeclaration => SyntaxKind.IdentifierToken, + _ => throw new ArgumentOutOfRangeException(), + }; - /// Creates a new PropertyDeclarationSyntax instance. - public static PropertyDeclarationSyntax PropertyDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer) - => SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, default); + /// Creates a new ParameterListSyntax instance. + public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (ParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.ParameterList((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new PropertyDeclarationSyntax instance. - public static PropertyDeclarationSyntax PropertyDeclaration(TypeSyntax type, SyntaxToken identifier) - => SyntaxFactory.PropertyDeclaration(default, default(SyntaxTokenList), type, default, identifier, default, default, default, default); + /// Creates a new ParameterListSyntax instance. + public static ParameterListSyntax ParameterList(SeparatedSyntaxList parameters = default) + => SyntaxFactory.ParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + + /// Creates a new BracketedParameterListSyntax instance. + public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + return (BracketedParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.BracketedParameterList((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); + } - /// Creates a new PropertyDeclarationSyntax instance. - public static PropertyDeclarationSyntax PropertyDeclaration(TypeSyntax type, string identifier) - => SyntaxFactory.PropertyDeclaration(default, default(SyntaxTokenList), type, default, SyntaxFactory.Identifier(identifier), default, default, default, default); + /// Creates a new BracketedParameterListSyntax instance. + public static BracketedParameterListSyntax BracketedParameterList(SeparatedSyntaxList parameters = default) + => SyntaxFactory.BracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); - /// Creates a new ArrowExpressionClauseSyntax instance. - public static ArrowExpressionClauseSyntax ArrowExpressionClause(SyntaxToken arrowToken, ExpressionSyntax expression) + /// Creates a new ParameterSyntax instance. + public static ParameterSyntax Parameter(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) + { + switch (identifier.Kind()) { - if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); - if (expression == null) throw new ArgumentNullException(nameof(expression)); - return (ArrowExpressionClauseSyntax)Syntax.InternalSyntax.SyntaxFactory.ArrowExpressionClause((Syntax.InternalSyntax.SyntaxToken)arrowToken.Node!, (Syntax.InternalSyntax.ExpressionSyntax)expression.Green).CreateRed(); + case SyntaxKind.IdentifierToken: + case SyntaxKind.ArgListKeyword: break; + default: throw new ArgumentException(nameof(identifier)); } + return (ParameterSyntax)Syntax.InternalSyntax.SyntaxFactory.Parameter(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), type == null ? null : (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, @default == null ? null : (Syntax.InternalSyntax.EqualsValueClauseSyntax)@default.Green).CreateRed(); + } - /// Creates a new ArrowExpressionClauseSyntax instance. - public static ArrowExpressionClauseSyntax ArrowExpressionClause(ExpressionSyntax expression) - => SyntaxFactory.ArrowExpressionClause(SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); + /// Creates a new ParameterSyntax instance. + public static ParameterSyntax Parameter(SyntaxToken identifier) + => SyntaxFactory.Parameter(default, default(SyntaxTokenList), default, identifier, default); - /// Creates a new EventDeclarationSyntax instance. - public static EventDeclarationSyntax EventDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken semicolonToken) - { - if (eventKeyword.Kind() != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); - if (type == null) throw new ArgumentNullException(nameof(type)); - if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (EventDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.EventDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)eventKeyword.Node!, (Syntax.InternalSyntax.TypeSyntax)type.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, accessorList == null ? null : (Syntax.InternalSyntax.AccessorListSyntax)accessorList.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); - } + /// Creates a new FunctionPointerParameterSyntax instance. + public static FunctionPointerParameterSyntax FunctionPointerParameter(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + return (FunctionPointerParameterSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerParameter(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + } + + /// Creates a new FunctionPointerParameterSyntax instance. + public static FunctionPointerParameterSyntax FunctionPointerParameter(TypeSyntax type) + => SyntaxFactory.FunctionPointerParameter(default, default(SyntaxTokenList), type); - /// Creates a new EventDeclarationSyntax instance. - public static EventDeclarationSyntax EventDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList) - => SyntaxFactory.EventDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EventKeyword), type, explicitInterfaceSpecifier, identifier, accessorList, default); + /// Creates a new IncompleteMemberSyntax instance. + public static IncompleteMemberSyntax IncompleteMember(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type) + { + return (IncompleteMemberSyntax)Syntax.InternalSyntax.SyntaxFactory.IncompleteMember(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), type == null ? null : (Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + } + +#pragma warning disable RS0027 + /// Creates a new IncompleteMemberSyntax instance. + public static IncompleteMemberSyntax IncompleteMember(TypeSyntax? type = default) + => SyntaxFactory.IncompleteMember(default, default(SyntaxTokenList), type); +#pragma warning restore RS0027 - /// Creates a new EventDeclarationSyntax instance. - public static EventDeclarationSyntax EventDeclaration(TypeSyntax type, SyntaxToken identifier) - => SyntaxFactory.EventDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), type, default, identifier, default, default); + /// Creates a new SkippedTokensTriviaSyntax instance. + public static SkippedTokensTriviaSyntax SkippedTokensTrivia(SyntaxTokenList tokens) + { + return (SkippedTokensTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.SkippedTokensTrivia(tokens.Node.ToGreenList()).CreateRed(); + } - /// Creates a new EventDeclarationSyntax instance. - public static EventDeclarationSyntax EventDeclaration(TypeSyntax type, string identifier) - => SyntaxFactory.EventDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), type, default, SyntaxFactory.Identifier(identifier), default, default); + /// Creates a new SkippedTokensTriviaSyntax instance. + public static SkippedTokensTriviaSyntax SkippedTokensTrivia() + => SyntaxFactory.SkippedTokensTrivia(default(SyntaxTokenList)); - /// Creates a new IndexerDeclarationSyntax instance. - public static IndexerDeclarationSyntax IndexerDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + /// Creates a new DocumentationCommentTriviaSyntax instance. + public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, SyntaxList content, SyntaxToken endOfComment) + { + switch (kind) { - if (type == null) throw new ArgumentNullException(nameof(type)); - if (thisKeyword.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); - if (parameterList == null) throw new ArgumentNullException(nameof(parameterList)); - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (IndexerDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.IndexerDeclaration(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)type.Green, explicitInterfaceSpecifier == null ? null : (Syntax.InternalSyntax.ExplicitInterfaceSpecifierSyntax)explicitInterfaceSpecifier.Green, (Syntax.InternalSyntax.SyntaxToken)thisKeyword.Node!, (Syntax.InternalSyntax.BracketedParameterListSyntax)parameterList.Green, accessorList == null ? null : (Syntax.InternalSyntax.AccessorListSyntax)accessorList.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); + case SyntaxKind.SingleLineDocumentationCommentTrivia: + case SyntaxKind.MultiLineDocumentationCommentTrivia: break; + default: throw new ArgumentException(nameof(kind)); } + if (endOfComment.Kind() != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); + return (DocumentationCommentTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.DocumentationCommentTrivia(kind, content.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)endOfComment.Node!).CreateRed(); + } - /// Creates a new IndexerDeclarationSyntax instance. - public static IndexerDeclarationSyntax IndexerDeclaration(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody) - => SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.ThisKeyword), parameterList, accessorList, expressionBody, default); + /// Creates a new DocumentationCommentTriviaSyntax instance. + public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, SyntaxList content = default) + => SyntaxFactory.DocumentationCommentTrivia(kind, content, SyntaxFactory.Token(SyntaxKind.EndOfDocumentationCommentToken)); - /// Creates a new IndexerDeclarationSyntax instance. - public static IndexerDeclarationSyntax IndexerDeclaration(TypeSyntax type) - => SyntaxFactory.IndexerDeclaration(default, default(SyntaxTokenList), type, default, SyntaxFactory.Token(SyntaxKind.ThisKeyword), SyntaxFactory.BracketedParameterList(), default, default, default); + /// Creates a new TypeCrefSyntax instance. + public static TypeCrefSyntax TypeCref(TypeSyntax type) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + return (TypeCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeCref((Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + } - /// Creates a new AccessorListSyntax instance. - public static AccessorListSyntax AccessorList(SyntaxToken openBraceToken, SyntaxList accessors, SyntaxToken closeBraceToken) - { - if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); - if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); - return (AccessorListSyntax)Syntax.InternalSyntax.SyntaxFactory.AccessorList((Syntax.InternalSyntax.SyntaxToken)openBraceToken.Node!, accessors.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)closeBraceToken.Node!).CreateRed(); - } + /// Creates a new QualifiedCrefSyntax instance. + public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + { + if (container == null) throw new ArgumentNullException(nameof(container)); + if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); + if (member == null) throw new ArgumentNullException(nameof(member)); + return (QualifiedCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.QualifiedCref((Syntax.InternalSyntax.TypeSyntax)container.Green, (Syntax.InternalSyntax.SyntaxToken)dotToken.Node!, (Syntax.InternalSyntax.MemberCrefSyntax)member.Green).CreateRed(); + } - /// Creates a new AccessorListSyntax instance. - public static AccessorListSyntax AccessorList(SyntaxList accessors = default) - => SyntaxFactory.AccessorList(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), accessors, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + /// Creates a new QualifiedCrefSyntax instance. + public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, MemberCrefSyntax member) + => SyntaxFactory.QualifiedCref(container, SyntaxFactory.Token(SyntaxKind.DotToken), member); - /// Creates a new AccessorDeclarationSyntax instance. - public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - switch (kind) - { - case SyntaxKind.GetAccessorDeclaration: - case SyntaxKind.SetAccessorDeclaration: - case SyntaxKind.InitAccessorDeclaration: - case SyntaxKind.AddAccessorDeclaration: - case SyntaxKind.RemoveAccessorDeclaration: - case SyntaxKind.UnknownAccessorDeclaration: break; - default: throw new ArgumentException(nameof(kind)); - } - switch (keyword.Kind()) - { - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - case SyntaxKind.InitKeyword: - case SyntaxKind.AddKeyword: - case SyntaxKind.RemoveKeyword: - case SyntaxKind.IdentifierToken: break; - default: throw new ArgumentException(nameof(keyword)); - } - switch (semicolonToken.Kind()) - { - case SyntaxKind.SemicolonToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(semicolonToken)); - } - return (AccessorDeclarationSyntax)Syntax.InternalSyntax.SyntaxFactory.AccessorDeclaration(kind, attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)keyword.Node!, body == null ? null : (Syntax.InternalSyntax.BlockSyntax)body.Green, expressionBody == null ? null : (Syntax.InternalSyntax.ArrowExpressionClauseSyntax)expressionBody.Green, (Syntax.InternalSyntax.SyntaxToken?)semicolonToken.Node).CreateRed(); - } + /// Creates a new NameMemberCrefSyntax instance. + public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) + { + if (name == null) throw new ArgumentNullException(nameof(name)); + return (NameMemberCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.NameMemberCref((Syntax.InternalSyntax.TypeSyntax)name.Green, parameters == null ? null : (Syntax.InternalSyntax.CrefParameterListSyntax)parameters.Green).CreateRed(); + } - /// Creates a new AccessorDeclarationSyntax instance. - public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList attributeLists, SyntaxTokenList modifiers, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) - => SyntaxFactory.AccessorDeclaration(kind, attributeLists, modifiers, SyntaxFactory.Token(GetAccessorDeclarationKeywordKind(kind)), body, expressionBody, default); - - /// Creates a new AccessorDeclarationSyntax instance. - public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind) - => SyntaxFactory.AccessorDeclaration(kind, default, default(SyntaxTokenList), SyntaxFactory.Token(GetAccessorDeclarationKeywordKind(kind)), default, default, default); - - private static SyntaxKind GetAccessorDeclarationKeywordKind(SyntaxKind kind) - => kind switch - { - SyntaxKind.GetAccessorDeclaration => SyntaxKind.GetKeyword, - SyntaxKind.SetAccessorDeclaration => SyntaxKind.SetKeyword, - SyntaxKind.InitAccessorDeclaration => SyntaxKind.InitKeyword, - SyntaxKind.AddAccessorDeclaration => SyntaxKind.AddKeyword, - SyntaxKind.RemoveAccessorDeclaration => SyntaxKind.RemoveKeyword, - SyntaxKind.UnknownAccessorDeclaration => SyntaxKind.IdentifierToken, - _ => throw new ArgumentOutOfRangeException(), - }; - - /// Creates a new ParameterListSyntax instance. - public static ParameterListSyntax ParameterList(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (ParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.ParameterList((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new NameMemberCrefSyntax instance. + public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name) + => SyntaxFactory.NameMemberCref(name, default); - /// Creates a new ParameterListSyntax instance. - public static ParameterListSyntax ParameterList(SeparatedSyntaxList parameters = default) - => SyntaxFactory.ParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new IndexerMemberCrefSyntax instance. + public static IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + { + if (thisKeyword.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); + return (IndexerMemberCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.IndexerMemberCref((Syntax.InternalSyntax.SyntaxToken)thisKeyword.Node!, parameters == null ? null : (Syntax.InternalSyntax.CrefBracketedParameterListSyntax)parameters.Green).CreateRed(); + } - /// Creates a new BracketedParameterListSyntax instance. - public static BracketedParameterListSyntax BracketedParameterList(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { - if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - return (BracketedParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.BracketedParameterList((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); - } + /// Creates a new IndexerMemberCrefSyntax instance. + public static IndexerMemberCrefSyntax IndexerMemberCref(CrefBracketedParameterListSyntax? parameters = default) + => SyntaxFactory.IndexerMemberCref(SyntaxFactory.Token(SyntaxKind.ThisKeyword), parameters); - /// Creates a new BracketedParameterListSyntax instance. - public static BracketedParameterListSyntax BracketedParameterList(SeparatedSyntaxList parameters = default) - => SyntaxFactory.BracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); + /// Creates a new OperatorMemberCrefSyntax instance. + public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + { + if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + switch (checkedKeyword.Kind()) + { + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); + } + switch (operatorToken.Kind()) + { + case SyntaxKind.PlusToken: + case SyntaxKind.MinusToken: + case SyntaxKind.ExclamationToken: + case SyntaxKind.TildeToken: + case SyntaxKind.PlusPlusToken: + case SyntaxKind.MinusMinusToken: + case SyntaxKind.AsteriskToken: + case SyntaxKind.SlashToken: + case SyntaxKind.PercentToken: + case SyntaxKind.LessThanLessThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: + case SyntaxKind.CaretToken: + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.LessThanToken: + case SyntaxKind.LessThanEqualsToken: + case SyntaxKind.GreaterThanToken: + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.FalseKeyword: + case SyntaxKind.TrueKeyword: break; + default: throw new ArgumentException(nameof(operatorToken)); + } + return (OperatorMemberCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.OperatorMemberCref((Syntax.InternalSyntax.SyntaxToken)operatorKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)checkedKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, parameters == null ? null : (Syntax.InternalSyntax.CrefParameterListSyntax)parameters.Green).CreateRed(); + } - /// Creates a new ParameterSyntax instance. - public static ParameterSyntax Parameter(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) - { - switch (identifier.Kind()) - { - case SyntaxKind.IdentifierToken: - case SyntaxKind.ArgListKeyword: break; - default: throw new ArgumentException(nameof(identifier)); - } - return (ParameterSyntax)Syntax.InternalSyntax.SyntaxFactory.Parameter(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), type == null ? null : (Syntax.InternalSyntax.TypeSyntax)type.Green, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, @default == null ? null : (Syntax.InternalSyntax.EqualsValueClauseSyntax)@default.Green).CreateRed(); - } + /// Creates a new OperatorMemberCrefSyntax instance. + public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + => SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, parameters); - /// Creates a new ParameterSyntax instance. - public static ParameterSyntax Parameter(SyntaxToken identifier) - => SyntaxFactory.Parameter(default, default(SyntaxTokenList), default, identifier, default); + /// Creates a new OperatorMemberCrefSyntax instance. + public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorToken) + => SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, default); - /// Creates a new FunctionPointerParameterSyntax instance. - public static FunctionPointerParameterSyntax FunctionPointerParameter(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type) + /// Creates a new ConversionOperatorMemberCrefSyntax instance. + public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + { + switch (implicitOrExplicitKeyword.Kind()) { - if (type == null) throw new ArgumentNullException(nameof(type)); - return (FunctionPointerParameterSyntax)Syntax.InternalSyntax.SyntaxFactory.FunctionPointerParameter(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), (Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + case SyntaxKind.ImplicitKeyword: + case SyntaxKind.ExplicitKeyword: break; + default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); } - - /// Creates a new FunctionPointerParameterSyntax instance. - public static FunctionPointerParameterSyntax FunctionPointerParameter(TypeSyntax type) - => SyntaxFactory.FunctionPointerParameter(default, default(SyntaxTokenList), type); - - /// Creates a new IncompleteMemberSyntax instance. - public static IncompleteMemberSyntax IncompleteMember(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type) + if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); + switch (checkedKeyword.Kind()) { - return (IncompleteMemberSyntax)Syntax.InternalSyntax.SyntaxFactory.IncompleteMember(attributeLists.Node.ToGreenList(), modifiers.Node.ToGreenList(), type == null ? null : (Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + case SyntaxKind.CheckedKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(checkedKeyword)); } + if (type == null) throw new ArgumentNullException(nameof(type)); + return (ConversionOperatorMemberCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.ConversionOperatorMemberCref((Syntax.InternalSyntax.SyntaxToken)implicitOrExplicitKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)operatorKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)checkedKeyword.Node, (Syntax.InternalSyntax.TypeSyntax)type.Green, parameters == null ? null : (Syntax.InternalSyntax.CrefParameterListSyntax)parameters.Green).CreateRed(); + } -#pragma warning disable RS0027 - /// Creates a new IncompleteMemberSyntax instance. - public static IncompleteMemberSyntax IncompleteMember(TypeSyntax? type = default) - => SyntaxFactory.IncompleteMember(default, default(SyntaxTokenList), type); -#pragma warning restore RS0027 + /// Creates a new ConversionOperatorMemberCrefSyntax instance. + public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + => SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, parameters); - /// Creates a new SkippedTokensTriviaSyntax instance. - public static SkippedTokensTriviaSyntax SkippedTokensTrivia(SyntaxTokenList tokens) - { - return (SkippedTokensTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.SkippedTokensTrivia(tokens.Node.ToGreenList()).CreateRed(); - } + /// Creates a new ConversionOperatorMemberCrefSyntax instance. + public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, TypeSyntax type) + => SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, default); - /// Creates a new SkippedTokensTriviaSyntax instance. - public static SkippedTokensTriviaSyntax SkippedTokensTrivia() - => SyntaxFactory.SkippedTokensTrivia(default(SyntaxTokenList)); + /// Creates a new CrefParameterListSyntax instance. + public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (CrefParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.CrefParameterList((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new DocumentationCommentTriviaSyntax instance. - public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, SyntaxList content, SyntaxToken endOfComment) - { - switch (kind) - { - case SyntaxKind.SingleLineDocumentationCommentTrivia: - case SyntaxKind.MultiLineDocumentationCommentTrivia: break; - default: throw new ArgumentException(nameof(kind)); - } - if (endOfComment.Kind() != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); - return (DocumentationCommentTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.DocumentationCommentTrivia(kind, content.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)endOfComment.Node!).CreateRed(); - } + /// Creates a new CrefParameterListSyntax instance. + public static CrefParameterListSyntax CrefParameterList(SeparatedSyntaxList parameters = default) + => SyntaxFactory.CrefParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + + /// Creates a new CrefBracketedParameterListSyntax instance. + public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); + if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); + return (CrefBracketedParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.CrefBracketedParameterList((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); + } - /// Creates a new DocumentationCommentTriviaSyntax instance. - public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, SyntaxList content = default) - => SyntaxFactory.DocumentationCommentTrivia(kind, content, SyntaxFactory.Token(SyntaxKind.EndOfDocumentationCommentToken)); + /// Creates a new CrefBracketedParameterListSyntax instance. + public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SeparatedSyntaxList parameters = default) + => SyntaxFactory.CrefBracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); - /// Creates a new TypeCrefSyntax instance. - public static TypeCrefSyntax TypeCref(TypeSyntax type) + /// Creates a new CrefParameterSyntax instance. + public static CrefParameterSyntax CrefParameter(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + { + switch (refKindKeyword.Kind()) { - if (type == null) throw new ArgumentNullException(nameof(type)); - return (TypeCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.TypeCref((Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + case SyntaxKind.RefKeyword: + case SyntaxKind.OutKeyword: + case SyntaxKind.InKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(refKindKeyword)); } - - /// Creates a new QualifiedCrefSyntax instance. - public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + switch (readOnlyKeyword.Kind()) { - if (container == null) throw new ArgumentNullException(nameof(container)); - if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); - if (member == null) throw new ArgumentNullException(nameof(member)); - return (QualifiedCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.QualifiedCref((Syntax.InternalSyntax.TypeSyntax)container.Green, (Syntax.InternalSyntax.SyntaxToken)dotToken.Node!, (Syntax.InternalSyntax.MemberCrefSyntax)member.Green).CreateRed(); + case SyntaxKind.ReadOnlyKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(readOnlyKeyword)); } + if (type == null) throw new ArgumentNullException(nameof(type)); + return (CrefParameterSyntax)Syntax.InternalSyntax.SyntaxFactory.CrefParameter((Syntax.InternalSyntax.SyntaxToken?)refKindKeyword.Node, (Syntax.InternalSyntax.SyntaxToken?)readOnlyKeyword.Node, (Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); + } - /// Creates a new QualifiedCrefSyntax instance. - public static QualifiedCrefSyntax QualifiedCref(TypeSyntax container, MemberCrefSyntax member) - => SyntaxFactory.QualifiedCref(container, SyntaxFactory.Token(SyntaxKind.DotToken), member); + /// Creates a new CrefParameterSyntax instance. + public static CrefParameterSyntax CrefParameter(SyntaxToken refKindKeyword, TypeSyntax type) + => SyntaxFactory.CrefParameter(refKindKeyword, default, type); - /// Creates a new NameMemberCrefSyntax instance. - public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name, CrefParameterListSyntax? parameters) - { - if (name == null) throw new ArgumentNullException(nameof(name)); - return (NameMemberCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.NameMemberCref((Syntax.InternalSyntax.TypeSyntax)name.Green, parameters == null ? null : (Syntax.InternalSyntax.CrefParameterListSyntax)parameters.Green).CreateRed(); - } + /// Creates a new CrefParameterSyntax instance. + public static CrefParameterSyntax CrefParameter(TypeSyntax type) + => SyntaxFactory.CrefParameter(default, default, type); - /// Creates a new NameMemberCrefSyntax instance. - public static NameMemberCrefSyntax NameMemberCref(TypeSyntax name) - => SyntaxFactory.NameMemberCref(name, default); + /// Creates a new XmlElementSyntax instance. + public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, SyntaxList content, XmlElementEndTagSyntax endTag) + { + if (startTag == null) throw new ArgumentNullException(nameof(startTag)); + if (endTag == null) throw new ArgumentNullException(nameof(endTag)); + return (XmlElementSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlElement((Syntax.InternalSyntax.XmlElementStartTagSyntax)startTag.Green, content.Node.ToGreenList(), (Syntax.InternalSyntax.XmlElementEndTagSyntax)endTag.Green).CreateRed(); + } - /// Creates a new IndexerMemberCrefSyntax instance. - public static IndexerMemberCrefSyntax IndexerMemberCref(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) - { - if (thisKeyword.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); - return (IndexerMemberCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.IndexerMemberCref((Syntax.InternalSyntax.SyntaxToken)thisKeyword.Node!, parameters == null ? null : (Syntax.InternalSyntax.CrefBracketedParameterListSyntax)parameters.Green).CreateRed(); - } + /// Creates a new XmlElementSyntax instance. + public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, XmlElementEndTagSyntax endTag) + => SyntaxFactory.XmlElement(startTag, default, endTag); - /// Creates a new IndexerMemberCrefSyntax instance. - public static IndexerMemberCrefSyntax IndexerMemberCref(CrefBracketedParameterListSyntax? parameters = default) - => SyntaxFactory.IndexerMemberCref(SyntaxFactory.Token(SyntaxKind.ThisKeyword), parameters); + /// Creates a new XmlElementStartTagSyntax instance. + public static XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken greaterThanToken) + { + if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + return (XmlElementStartTagSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlElementStartTag((Syntax.InternalSyntax.SyntaxToken)lessThanToken.Node!, (Syntax.InternalSyntax.XmlNameSyntax)name.Green, attributes.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)greaterThanToken.Node!).CreateRed(); + } - /// Creates a new OperatorMemberCrefSyntax instance. - public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) - { - if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - switch (checkedKeyword.Kind()) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - switch (operatorToken.Kind()) - { - case SyntaxKind.PlusToken: - case SyntaxKind.MinusToken: - case SyntaxKind.ExclamationToken: - case SyntaxKind.TildeToken: - case SyntaxKind.PlusPlusToken: - case SyntaxKind.MinusMinusToken: - case SyntaxKind.AsteriskToken: - case SyntaxKind.SlashToken: - case SyntaxKind.PercentToken: - case SyntaxKind.LessThanLessThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.BarToken: - case SyntaxKind.AmpersandToken: - case SyntaxKind.CaretToken: - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.LessThanToken: - case SyntaxKind.LessThanEqualsToken: - case SyntaxKind.GreaterThanToken: - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.FalseKeyword: - case SyntaxKind.TrueKeyword: break; - default: throw new ArgumentException(nameof(operatorToken)); - } - return (OperatorMemberCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.OperatorMemberCref((Syntax.InternalSyntax.SyntaxToken)operatorKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)checkedKeyword.Node, (Syntax.InternalSyntax.SyntaxToken)operatorToken.Node!, parameters == null ? null : (Syntax.InternalSyntax.CrefParameterListSyntax)parameters.Green).CreateRed(); - } + /// Creates a new XmlElementStartTagSyntax instance. + public static XmlElementStartTagSyntax XmlElementStartTag(XmlNameSyntax name, SyntaxList attributes) + => SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, attributes, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); - /// Creates a new OperatorMemberCrefSyntax instance. - public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorToken, CrefParameterListSyntax? parameters) - => SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, parameters); + /// Creates a new XmlElementStartTagSyntax instance. + public static XmlElementStartTagSyntax XmlElementStartTag(XmlNameSyntax name) + => SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, default, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); - /// Creates a new OperatorMemberCrefSyntax instance. - public static OperatorMemberCrefSyntax OperatorMemberCref(SyntaxToken operatorToken) - => SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, default); + /// Creates a new XmlElementEndTagSyntax instance. + public static XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + { + if (lessThanSlashToken.Kind() != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); + return (XmlElementEndTagSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlElementEndTag((Syntax.InternalSyntax.SyntaxToken)lessThanSlashToken.Node!, (Syntax.InternalSyntax.XmlNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)greaterThanToken.Node!).CreateRed(); + } - /// Creates a new ConversionOperatorMemberCrefSyntax instance. - public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) - { - switch (implicitOrExplicitKeyword.Kind()) - { - case SyntaxKind.ImplicitKeyword: - case SyntaxKind.ExplicitKeyword: break; - default: throw new ArgumentException(nameof(implicitOrExplicitKeyword)); - } - if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); - switch (checkedKeyword.Kind()) - { - case SyntaxKind.CheckedKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(checkedKeyword)); - } - if (type == null) throw new ArgumentNullException(nameof(type)); - return (ConversionOperatorMemberCrefSyntax)Syntax.InternalSyntax.SyntaxFactory.ConversionOperatorMemberCref((Syntax.InternalSyntax.SyntaxToken)implicitOrExplicitKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)operatorKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken?)checkedKeyword.Node, (Syntax.InternalSyntax.TypeSyntax)type.Green, parameters == null ? null : (Syntax.InternalSyntax.CrefParameterListSyntax)parameters.Green).CreateRed(); - } + /// Creates a new XmlElementEndTagSyntax instance. + public static XmlElementEndTagSyntax XmlElementEndTag(XmlNameSyntax name) + => SyntaxFactory.XmlElementEndTag(SyntaxFactory.Token(SyntaxKind.LessThanSlashToken), name, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); - /// Creates a new ConversionOperatorMemberCrefSyntax instance. - public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) - => SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, parameters); + /// Creates a new XmlEmptyElementSyntax instance. + public static XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken slashGreaterThanToken) + { + if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (slashGreaterThanToken.Kind() != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); + return (XmlEmptyElementSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlEmptyElement((Syntax.InternalSyntax.SyntaxToken)lessThanToken.Node!, (Syntax.InternalSyntax.XmlNameSyntax)name.Green, attributes.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)slashGreaterThanToken.Node!).CreateRed(); + } - /// Creates a new ConversionOperatorMemberCrefSyntax instance. - public static ConversionOperatorMemberCrefSyntax ConversionOperatorMemberCref(SyntaxToken implicitOrExplicitKeyword, TypeSyntax type) - => SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, default); + /// Creates a new XmlEmptyElementSyntax instance. + public static XmlEmptyElementSyntax XmlEmptyElement(XmlNameSyntax name, SyntaxList attributes) + => SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, attributes, SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); - /// Creates a new CrefParameterListSyntax instance. - public static CrefParameterListSyntax CrefParameterList(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (CrefParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.CrefParameterList((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new XmlEmptyElementSyntax instance. + public static XmlEmptyElementSyntax XmlEmptyElement(XmlNameSyntax name) + => SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, default, SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); - /// Creates a new CrefParameterListSyntax instance. - public static CrefParameterListSyntax CrefParameterList(SeparatedSyntaxList parameters = default) - => SyntaxFactory.CrefParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new XmlNameSyntax instance. + public static XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName) + { + if (localName.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); + return (XmlNameSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlName(prefix == null ? null : (Syntax.InternalSyntax.XmlPrefixSyntax)prefix.Green, (Syntax.InternalSyntax.SyntaxToken)localName.Node!).CreateRed(); + } - /// Creates a new CrefBracketedParameterListSyntax instance. - public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) - { - if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); - if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); - return (CrefBracketedParameterListSyntax)Syntax.InternalSyntax.SyntaxFactory.CrefBracketedParameterList((Syntax.InternalSyntax.SyntaxToken)openBracketToken.Node!, parameters.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)closeBracketToken.Node!).CreateRed(); - } + /// Creates a new XmlNameSyntax instance. + public static XmlNameSyntax XmlName(SyntaxToken localName) + => SyntaxFactory.XmlName(default, localName); - /// Creates a new CrefBracketedParameterListSyntax instance. - public static CrefBracketedParameterListSyntax CrefBracketedParameterList(SeparatedSyntaxList parameters = default) - => SyntaxFactory.CrefBracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); + /// Creates a new XmlNameSyntax instance. + public static XmlNameSyntax XmlName(string localName) + => SyntaxFactory.XmlName(default, SyntaxFactory.Identifier(localName)); - /// Creates a new CrefParameterSyntax instance. - public static CrefParameterSyntax CrefParameter(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) - { - switch (refKindKeyword.Kind()) - { - case SyntaxKind.RefKeyword: - case SyntaxKind.OutKeyword: - case SyntaxKind.InKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(refKindKeyword)); - } - switch (readOnlyKeyword.Kind()) - { - case SyntaxKind.ReadOnlyKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(readOnlyKeyword)); - } - if (type == null) throw new ArgumentNullException(nameof(type)); - return (CrefParameterSyntax)Syntax.InternalSyntax.SyntaxFactory.CrefParameter((Syntax.InternalSyntax.SyntaxToken?)refKindKeyword.Node, (Syntax.InternalSyntax.SyntaxToken?)readOnlyKeyword.Node, (Syntax.InternalSyntax.TypeSyntax)type.Green).CreateRed(); - } + /// Creates a new XmlPrefixSyntax instance. + public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) + { + if (prefix.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); + if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); + return (XmlPrefixSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlPrefix((Syntax.InternalSyntax.SyntaxToken)prefix.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); + } - /// Creates a new CrefParameterSyntax instance. - public static CrefParameterSyntax CrefParameter(SyntaxToken refKindKeyword, TypeSyntax type) - => SyntaxFactory.CrefParameter(refKindKeyword, default, type); + /// Creates a new XmlPrefixSyntax instance. + public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix) + => SyntaxFactory.XmlPrefix(prefix, SyntaxFactory.Token(SyntaxKind.ColonToken)); - /// Creates a new CrefParameterSyntax instance. - public static CrefParameterSyntax CrefParameter(TypeSyntax type) - => SyntaxFactory.CrefParameter(default, default, type); + /// Creates a new XmlPrefixSyntax instance. + public static XmlPrefixSyntax XmlPrefix(string prefix) + => SyntaxFactory.XmlPrefix(SyntaxFactory.Identifier(prefix), SyntaxFactory.Token(SyntaxKind.ColonToken)); - /// Creates a new XmlElementSyntax instance. - public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, SyntaxList content, XmlElementEndTagSyntax endTag) + /// Creates a new XmlTextAttributeSyntax instance. + public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, SyntaxTokenList textTokens, SyntaxToken endQuoteToken) + { + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + switch (startQuoteToken.Kind()) { - if (startTag == null) throw new ArgumentNullException(nameof(startTag)); - if (endTag == null) throw new ArgumentNullException(nameof(endTag)); - return (XmlElementSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlElement((Syntax.InternalSyntax.XmlElementStartTagSyntax)startTag.Green, content.Node.ToGreenList(), (Syntax.InternalSyntax.XmlElementEndTagSyntax)endTag.Green).CreateRed(); + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); } - - /// Creates a new XmlElementSyntax instance. - public static XmlElementSyntax XmlElement(XmlElementStartTagSyntax startTag, XmlElementEndTagSyntax endTag) - => SyntaxFactory.XmlElement(startTag, default, endTag); - - /// Creates a new XmlElementStartTagSyntax instance. - public static XmlElementStartTagSyntax XmlElementStartTag(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken greaterThanToken) + switch (endQuoteToken.Kind()) { - if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); - return (XmlElementStartTagSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlElementStartTag((Syntax.InternalSyntax.SyntaxToken)lessThanToken.Node!, (Syntax.InternalSyntax.XmlNameSyntax)name.Green, attributes.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)greaterThanToken.Node!).CreateRed(); + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); } + return (XmlTextAttributeSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlTextAttribute((Syntax.InternalSyntax.XmlNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!, (Syntax.InternalSyntax.SyntaxToken)startQuoteToken.Node!, textTokens.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)endQuoteToken.Node!).CreateRed(); + } - /// Creates a new XmlElementStartTagSyntax instance. - public static XmlElementStartTagSyntax XmlElementStartTag(XmlNameSyntax name, SyntaxList attributes) - => SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, attributes, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); + /// Creates a new XmlTextAttributeSyntax instance. + public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken startQuoteToken, SyntaxTokenList textTokens, SyntaxToken endQuoteToken) + => SyntaxFactory.XmlTextAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, textTokens, endQuoteToken); - /// Creates a new XmlElementStartTagSyntax instance. - public static XmlElementStartTagSyntax XmlElementStartTag(XmlNameSyntax name) - => SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, default, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); + /// Creates a new XmlTextAttributeSyntax instance. + public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken startQuoteToken, SyntaxToken endQuoteToken) + => SyntaxFactory.XmlTextAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, default(SyntaxTokenList), endQuoteToken); - /// Creates a new XmlElementEndTagSyntax instance. - public static XmlElementEndTagSyntax XmlElementEndTag(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + /// Creates a new XmlCrefAttributeSyntax instance. + public static XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + { + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + switch (startQuoteToken.Kind()) { - if (lessThanSlashToken.Kind() != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); - return (XmlElementEndTagSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlElementEndTag((Syntax.InternalSyntax.SyntaxToken)lessThanSlashToken.Node!, (Syntax.InternalSyntax.XmlNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)greaterThanToken.Node!).CreateRed(); + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); } - - /// Creates a new XmlElementEndTagSyntax instance. - public static XmlElementEndTagSyntax XmlElementEndTag(XmlNameSyntax name) - => SyntaxFactory.XmlElementEndTag(SyntaxFactory.Token(SyntaxKind.LessThanSlashToken), name, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); - - /// Creates a new XmlEmptyElementSyntax instance. - public static XmlEmptyElementSyntax XmlEmptyElement(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken slashGreaterThanToken) + if (cref == null) throw new ArgumentNullException(nameof(cref)); + switch (endQuoteToken.Kind()) { - if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (slashGreaterThanToken.Kind() != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); - return (XmlEmptyElementSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlEmptyElement((Syntax.InternalSyntax.SyntaxToken)lessThanToken.Node!, (Syntax.InternalSyntax.XmlNameSyntax)name.Green, attributes.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)slashGreaterThanToken.Node!).CreateRed(); + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); } + return (XmlCrefAttributeSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlCrefAttribute((Syntax.InternalSyntax.XmlNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!, (Syntax.InternalSyntax.SyntaxToken)startQuoteToken.Node!, (Syntax.InternalSyntax.CrefSyntax)cref.Green, (Syntax.InternalSyntax.SyntaxToken)endQuoteToken.Node!).CreateRed(); + } - /// Creates a new XmlEmptyElementSyntax instance. - public static XmlEmptyElementSyntax XmlEmptyElement(XmlNameSyntax name, SyntaxList attributes) - => SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, attributes, SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); - - /// Creates a new XmlEmptyElementSyntax instance. - public static XmlEmptyElementSyntax XmlEmptyElement(XmlNameSyntax name) - => SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, default, SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); + /// Creates a new XmlCrefAttributeSyntax instance. + public static XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + => SyntaxFactory.XmlCrefAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, cref, endQuoteToken); - /// Creates a new XmlNameSyntax instance. - public static XmlNameSyntax XmlName(XmlPrefixSyntax? prefix, SyntaxToken localName) + /// Creates a new XmlNameAttributeSyntax instance. + public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + { + if (name == null) throw new ArgumentNullException(nameof(name)); + if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); + switch (startQuoteToken.Kind()) { - if (localName.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); - return (XmlNameSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlName(prefix == null ? null : (Syntax.InternalSyntax.XmlPrefixSyntax)prefix.Green, (Syntax.InternalSyntax.SyntaxToken)localName.Node!).CreateRed(); + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(startQuoteToken)); } - - /// Creates a new XmlNameSyntax instance. - public static XmlNameSyntax XmlName(SyntaxToken localName) - => SyntaxFactory.XmlName(default, localName); - - /// Creates a new XmlNameSyntax instance. - public static XmlNameSyntax XmlName(string localName) - => SyntaxFactory.XmlName(default, SyntaxFactory.Identifier(localName)); - - /// Creates a new XmlPrefixSyntax instance. - public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix, SyntaxToken colonToken) + if (identifier == null) throw new ArgumentNullException(nameof(identifier)); + switch (endQuoteToken.Kind()) { - if (prefix.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); - if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); - return (XmlPrefixSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlPrefix((Syntax.InternalSyntax.SyntaxToken)prefix.Node!, (Syntax.InternalSyntax.SyntaxToken)colonToken.Node!).CreateRed(); + case SyntaxKind.SingleQuoteToken: + case SyntaxKind.DoubleQuoteToken: break; + default: throw new ArgumentException(nameof(endQuoteToken)); } + return (XmlNameAttributeSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlNameAttribute((Syntax.InternalSyntax.XmlNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!, (Syntax.InternalSyntax.SyntaxToken)startQuoteToken.Node!, (Syntax.InternalSyntax.IdentifierNameSyntax)identifier.Green, (Syntax.InternalSyntax.SyntaxToken)endQuoteToken.Node!).CreateRed(); + } - /// Creates a new XmlPrefixSyntax instance. - public static XmlPrefixSyntax XmlPrefix(SyntaxToken prefix) - => SyntaxFactory.XmlPrefix(prefix, SyntaxFactory.Token(SyntaxKind.ColonToken)); - - /// Creates a new XmlPrefixSyntax instance. - public static XmlPrefixSyntax XmlPrefix(string prefix) - => SyntaxFactory.XmlPrefix(SyntaxFactory.Identifier(prefix), SyntaxFactory.Token(SyntaxKind.ColonToken)); - - /// Creates a new XmlTextAttributeSyntax instance. - public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, SyntaxTokenList textTokens, SyntaxToken endQuoteToken) - { - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - switch (startQuoteToken.Kind()) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - switch (endQuoteToken.Kind()) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } - return (XmlTextAttributeSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlTextAttribute((Syntax.InternalSyntax.XmlNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!, (Syntax.InternalSyntax.SyntaxToken)startQuoteToken.Node!, textTokens.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)endQuoteToken.Node!).CreateRed(); - } + /// Creates a new XmlNameAttributeSyntax instance. + public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + => SyntaxFactory.XmlNameAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, identifier, endQuoteToken); - /// Creates a new XmlTextAttributeSyntax instance. - public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken startQuoteToken, SyntaxTokenList textTokens, SyntaxToken endQuoteToken) - => SyntaxFactory.XmlTextAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, textTokens, endQuoteToken); + /// Creates a new XmlNameAttributeSyntax instance. + public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken startQuoteToken, string identifier, SyntaxToken endQuoteToken) + => SyntaxFactory.XmlNameAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, SyntaxFactory.IdentifierName(identifier), endQuoteToken); - /// Creates a new XmlTextAttributeSyntax instance. - public static XmlTextAttributeSyntax XmlTextAttribute(XmlNameSyntax name, SyntaxToken startQuoteToken, SyntaxToken endQuoteToken) - => SyntaxFactory.XmlTextAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, default(SyntaxTokenList), endQuoteToken); + /// Creates a new XmlTextSyntax instance. + public static XmlTextSyntax XmlText(SyntaxTokenList textTokens) + { + return (XmlTextSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlText(textTokens.Node.ToGreenList()).CreateRed(); + } - /// Creates a new XmlCrefAttributeSyntax instance. - public static XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) - { - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - switch (startQuoteToken.Kind()) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (cref == null) throw new ArgumentNullException(nameof(cref)); - switch (endQuoteToken.Kind()) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } - return (XmlCrefAttributeSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlCrefAttribute((Syntax.InternalSyntax.XmlNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!, (Syntax.InternalSyntax.SyntaxToken)startQuoteToken.Node!, (Syntax.InternalSyntax.CrefSyntax)cref.Green, (Syntax.InternalSyntax.SyntaxToken)endQuoteToken.Node!).CreateRed(); - } + /// Creates a new XmlTextSyntax instance. + public static XmlTextSyntax XmlText() + => SyntaxFactory.XmlText(default(SyntaxTokenList)); - /// Creates a new XmlCrefAttributeSyntax instance. - public static XmlCrefAttributeSyntax XmlCrefAttribute(XmlNameSyntax name, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) - => SyntaxFactory.XmlCrefAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, cref, endQuoteToken); + /// Creates a new XmlCDataSectionSyntax instance. + public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, SyntaxTokenList textTokens, SyntaxToken endCDataToken) + { + if (startCDataToken.Kind() != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); + if (endCDataToken.Kind() != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); + return (XmlCDataSectionSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlCDataSection((Syntax.InternalSyntax.SyntaxToken)startCDataToken.Node!, textTokens.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)endCDataToken.Node!).CreateRed(); + } - /// Creates a new XmlNameAttributeSyntax instance. - public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) - { - if (name == null) throw new ArgumentNullException(nameof(name)); - if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); - switch (startQuoteToken.Kind()) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(startQuoteToken)); - } - if (identifier == null) throw new ArgumentNullException(nameof(identifier)); - switch (endQuoteToken.Kind()) - { - case SyntaxKind.SingleQuoteToken: - case SyntaxKind.DoubleQuoteToken: break; - default: throw new ArgumentException(nameof(endQuoteToken)); - } - return (XmlNameAttributeSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlNameAttribute((Syntax.InternalSyntax.XmlNameSyntax)name.Green, (Syntax.InternalSyntax.SyntaxToken)equalsToken.Node!, (Syntax.InternalSyntax.SyntaxToken)startQuoteToken.Node!, (Syntax.InternalSyntax.IdentifierNameSyntax)identifier.Green, (Syntax.InternalSyntax.SyntaxToken)endQuoteToken.Node!).CreateRed(); - } + /// Creates a new XmlCDataSectionSyntax instance. + public static XmlCDataSectionSyntax XmlCDataSection(SyntaxTokenList textTokens = default) + => SyntaxFactory.XmlCDataSection(SyntaxFactory.Token(SyntaxKind.XmlCDataStartToken), textTokens, SyntaxFactory.Token(SyntaxKind.XmlCDataEndToken)); - /// Creates a new XmlNameAttributeSyntax instance. - public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) - => SyntaxFactory.XmlNameAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, identifier, endQuoteToken); + /// Creates a new XmlProcessingInstructionSyntax instance. + public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, SyntaxTokenList textTokens, SyntaxToken endProcessingInstructionToken) + { + if (startProcessingInstructionToken.Kind() != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); + if (name == null) throw new ArgumentNullException(nameof(name)); + if (endProcessingInstructionToken.Kind() != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); + return (XmlProcessingInstructionSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlProcessingInstruction((Syntax.InternalSyntax.SyntaxToken)startProcessingInstructionToken.Node!, (Syntax.InternalSyntax.XmlNameSyntax)name.Green, textTokens.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)endProcessingInstructionToken.Node!).CreateRed(); + } - /// Creates a new XmlNameAttributeSyntax instance. - public static XmlNameAttributeSyntax XmlNameAttribute(XmlNameSyntax name, SyntaxToken startQuoteToken, string identifier, SyntaxToken endQuoteToken) - => SyntaxFactory.XmlNameAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, SyntaxFactory.IdentifierName(identifier), endQuoteToken); + /// Creates a new XmlProcessingInstructionSyntax instance. + public static XmlProcessingInstructionSyntax XmlProcessingInstruction(XmlNameSyntax name, SyntaxTokenList textTokens) + => SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), name, textTokens, SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); - /// Creates a new XmlTextSyntax instance. - public static XmlTextSyntax XmlText(SyntaxTokenList textTokens) - { - return (XmlTextSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlText(textTokens.Node.ToGreenList()).CreateRed(); - } + /// Creates a new XmlProcessingInstructionSyntax instance. + public static XmlProcessingInstructionSyntax XmlProcessingInstruction(XmlNameSyntax name) + => SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), name, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); - /// Creates a new XmlTextSyntax instance. - public static XmlTextSyntax XmlText() - => SyntaxFactory.XmlText(default(SyntaxTokenList)); + /// Creates a new XmlCommentSyntax instance. + public static XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, SyntaxTokenList textTokens, SyntaxToken minusMinusGreaterThanToken) + { + if (lessThanExclamationMinusMinusToken.Kind() != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); + if (minusMinusGreaterThanToken.Kind() != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); + return (XmlCommentSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlComment((Syntax.InternalSyntax.SyntaxToken)lessThanExclamationMinusMinusToken.Node!, textTokens.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)minusMinusGreaterThanToken.Node!).CreateRed(); + } - /// Creates a new XmlCDataSectionSyntax instance. - public static XmlCDataSectionSyntax XmlCDataSection(SyntaxToken startCDataToken, SyntaxTokenList textTokens, SyntaxToken endCDataToken) - { - if (startCDataToken.Kind() != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); - if (endCDataToken.Kind() != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); - return (XmlCDataSectionSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlCDataSection((Syntax.InternalSyntax.SyntaxToken)startCDataToken.Node!, textTokens.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)endCDataToken.Node!).CreateRed(); - } + /// Creates a new XmlCommentSyntax instance. + public static XmlCommentSyntax XmlComment(SyntaxTokenList textTokens = default) + => SyntaxFactory.XmlComment(SyntaxFactory.Token(SyntaxKind.XmlCommentStartToken), textTokens, SyntaxFactory.Token(SyntaxKind.XmlCommentEndToken)); - /// Creates a new XmlCDataSectionSyntax instance. - public static XmlCDataSectionSyntax XmlCDataSection(SyntaxTokenList textTokens = default) - => SyntaxFactory.XmlCDataSection(SyntaxFactory.Token(SyntaxKind.XmlCDataStartToken), textTokens, SyntaxFactory.Token(SyntaxKind.XmlCDataEndToken)); + /// Creates a new IfDirectiveTriviaSyntax instance. + public static IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (ifKeyword.Kind() != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (IfDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.IfDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)ifKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive, branchTaken, conditionValue).CreateRed(); + } - /// Creates a new XmlProcessingInstructionSyntax instance. - public static XmlProcessingInstructionSyntax XmlProcessingInstruction(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, SyntaxTokenList textTokens, SyntaxToken endProcessingInstructionToken) - { - if (startProcessingInstructionToken.Kind() != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); - if (name == null) throw new ArgumentNullException(nameof(name)); - if (endProcessingInstructionToken.Kind() != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); - return (XmlProcessingInstructionSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlProcessingInstruction((Syntax.InternalSyntax.SyntaxToken)startProcessingInstructionToken.Node!, (Syntax.InternalSyntax.XmlNameSyntax)name.Green, textTokens.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)endProcessingInstructionToken.Node!).CreateRed(); - } + /// Creates a new IfDirectiveTriviaSyntax instance. + public static IfDirectiveTriviaSyntax IfDirectiveTrivia(ExpressionSyntax condition, bool isActive, bool branchTaken, bool conditionValue) + => SyntaxFactory.IfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.IfKeyword), condition, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken, conditionValue); - /// Creates a new XmlProcessingInstructionSyntax instance. - public static XmlProcessingInstructionSyntax XmlProcessingInstruction(XmlNameSyntax name, SyntaxTokenList textTokens) - => SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), name, textTokens, SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); + /// Creates a new ElifDirectiveTriviaSyntax instance. + public static ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (elifKeyword.Kind() != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); + if (condition == null) throw new ArgumentNullException(nameof(condition)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (ElifDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.ElifDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)elifKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive, branchTaken, conditionValue).CreateRed(); + } - /// Creates a new XmlProcessingInstructionSyntax instance. - public static XmlProcessingInstructionSyntax XmlProcessingInstruction(XmlNameSyntax name) - => SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), name, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); + /// Creates a new ElifDirectiveTriviaSyntax instance. + public static ElifDirectiveTriviaSyntax ElifDirectiveTrivia(ExpressionSyntax condition, bool isActive, bool branchTaken, bool conditionValue) + => SyntaxFactory.ElifDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElifKeyword), condition, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken, conditionValue); - /// Creates a new XmlCommentSyntax instance. - public static XmlCommentSyntax XmlComment(SyntaxToken lessThanExclamationMinusMinusToken, SyntaxTokenList textTokens, SyntaxToken minusMinusGreaterThanToken) - { - if (lessThanExclamationMinusMinusToken.Kind() != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); - if (minusMinusGreaterThanToken.Kind() != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); - return (XmlCommentSyntax)Syntax.InternalSyntax.SyntaxFactory.XmlComment((Syntax.InternalSyntax.SyntaxToken)lessThanExclamationMinusMinusToken.Node!, textTokens.Node.ToGreenList(), (Syntax.InternalSyntax.SyntaxToken)minusMinusGreaterThanToken.Node!).CreateRed(); - } + /// Creates a new ElseDirectiveTriviaSyntax instance. + public static ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (elseKeyword.Kind() != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (ElseDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.ElseDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)elseKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive, branchTaken).CreateRed(); + } - /// Creates a new XmlCommentSyntax instance. - public static XmlCommentSyntax XmlComment(SyntaxTokenList textTokens = default) - => SyntaxFactory.XmlComment(SyntaxFactory.Token(SyntaxKind.XmlCommentStartToken), textTokens, SyntaxFactory.Token(SyntaxKind.XmlCommentEndToken)); + /// Creates a new ElseDirectiveTriviaSyntax instance. + public static ElseDirectiveTriviaSyntax ElseDirectiveTrivia(bool isActive, bool branchTaken) + => SyntaxFactory.ElseDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElseKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken); - /// Creates a new IfDirectiveTriviaSyntax instance. - public static IfDirectiveTriviaSyntax IfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (ifKeyword.Kind() != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (IfDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.IfDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)ifKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive, branchTaken, conditionValue).CreateRed(); - } + /// Creates a new EndIfDirectiveTriviaSyntax instance. + public static EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endIfKeyword.Kind() != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (EndIfDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.EndIfDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)endIfKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new IfDirectiveTriviaSyntax instance. - public static IfDirectiveTriviaSyntax IfDirectiveTrivia(ExpressionSyntax condition, bool isActive, bool branchTaken, bool conditionValue) - => SyntaxFactory.IfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.IfKeyword), condition, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken, conditionValue); + /// Creates a new EndIfDirectiveTriviaSyntax instance. + public static EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(bool isActive) + => SyntaxFactory.EndIfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndIfKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new ElifDirectiveTriviaSyntax instance. - public static ElifDirectiveTriviaSyntax ElifDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (elifKeyword.Kind() != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); - if (condition == null) throw new ArgumentNullException(nameof(condition)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (ElifDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.ElifDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)elifKeyword.Node!, (Syntax.InternalSyntax.ExpressionSyntax)condition.Green, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive, branchTaken, conditionValue).CreateRed(); - } + /// Creates a new RegionDirectiveTriviaSyntax instance. + public static RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (regionKeyword.Kind() != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (RegionDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.RegionDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)regionKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new ElifDirectiveTriviaSyntax instance. - public static ElifDirectiveTriviaSyntax ElifDirectiveTrivia(ExpressionSyntax condition, bool isActive, bool branchTaken, bool conditionValue) - => SyntaxFactory.ElifDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElifKeyword), condition, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken, conditionValue); + /// Creates a new RegionDirectiveTriviaSyntax instance. + public static RegionDirectiveTriviaSyntax RegionDirectiveTrivia(bool isActive) + => SyntaxFactory.RegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.RegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new ElseDirectiveTriviaSyntax instance. - public static ElseDirectiveTriviaSyntax ElseDirectiveTrivia(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (elseKeyword.Kind() != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (ElseDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.ElseDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)elseKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive, branchTaken).CreateRed(); - } + /// Creates a new EndRegionDirectiveTriviaSyntax instance. + public static EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endRegionKeyword.Kind() != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (EndRegionDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.EndRegionDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)endRegionKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new ElseDirectiveTriviaSyntax instance. - public static ElseDirectiveTriviaSyntax ElseDirectiveTrivia(bool isActive, bool branchTaken) - => SyntaxFactory.ElseDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElseKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken); + /// Creates a new EndRegionDirectiveTriviaSyntax instance. + public static EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(bool isActive) + => SyntaxFactory.EndRegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndRegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new EndIfDirectiveTriviaSyntax instance. - public static EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endIfKeyword.Kind() != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (EndIfDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.EndIfDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)endIfKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new ErrorDirectiveTriviaSyntax instance. + public static ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (errorKeyword.Kind() != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (ErrorDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.ErrorDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)errorKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new EndIfDirectiveTriviaSyntax instance. - public static EndIfDirectiveTriviaSyntax EndIfDirectiveTrivia(bool isActive) - => SyntaxFactory.EndIfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndIfKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new ErrorDirectiveTriviaSyntax instance. + public static ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(bool isActive) + => SyntaxFactory.ErrorDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ErrorKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new RegionDirectiveTriviaSyntax instance. - public static RegionDirectiveTriviaSyntax RegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (regionKeyword.Kind() != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (RegionDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.RegionDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)regionKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new WarningDirectiveTriviaSyntax instance. + public static WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (warningKeyword.Kind() != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (WarningDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.WarningDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)warningKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new RegionDirectiveTriviaSyntax instance. - public static RegionDirectiveTriviaSyntax RegionDirectiveTrivia(bool isActive) - => SyntaxFactory.RegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.RegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new WarningDirectiveTriviaSyntax instance. + public static WarningDirectiveTriviaSyntax WarningDirectiveTrivia(bool isActive) + => SyntaxFactory.WarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.WarningKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new EndRegionDirectiveTriviaSyntax instance. - public static EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endRegionKeyword.Kind() != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (EndRegionDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.EndRegionDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)endRegionKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new BadDirectiveTriviaSyntax instance. + public static BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (BadDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.BadDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new EndRegionDirectiveTriviaSyntax instance. - public static EndRegionDirectiveTriviaSyntax EndRegionDirectiveTrivia(bool isActive) - => SyntaxFactory.EndRegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndRegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new BadDirectiveTriviaSyntax instance. + public static BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken identifier, bool isActive) + => SyntaxFactory.BadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), identifier, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new ErrorDirectiveTriviaSyntax instance. - public static ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (errorKeyword.Kind() != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (ErrorDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.ErrorDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)errorKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new DefineDirectiveTriviaSyntax instance. + public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (defineKeyword.Kind() != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); + if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (DefineDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.DefineDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)defineKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)name.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new ErrorDirectiveTriviaSyntax instance. - public static ErrorDirectiveTriviaSyntax ErrorDirectiveTrivia(bool isActive) - => SyntaxFactory.ErrorDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ErrorKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new DefineDirectiveTriviaSyntax instance. + public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken name, bool isActive) + => SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), name, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new WarningDirectiveTriviaSyntax instance. - public static WarningDirectiveTriviaSyntax WarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (warningKeyword.Kind() != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (WarningDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.WarningDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)warningKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new DefineDirectiveTriviaSyntax instance. + public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(string name, bool isActive) + => SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), SyntaxFactory.Identifier(name), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new WarningDirectiveTriviaSyntax instance. - public static WarningDirectiveTriviaSyntax WarningDirectiveTrivia(bool isActive) - => SyntaxFactory.WarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.WarningKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new UndefDirectiveTriviaSyntax instance. + public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (undefKeyword.Kind() != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); + if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (UndefDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.UndefDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)undefKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)name.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new BadDirectiveTriviaSyntax instance. - public static BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (BadDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.BadDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)identifier.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new UndefDirectiveTriviaSyntax instance. + public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken name, bool isActive) + => SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), name, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new BadDirectiveTriviaSyntax instance. - public static BadDirectiveTriviaSyntax BadDirectiveTrivia(SyntaxToken identifier, bool isActive) - => SyntaxFactory.BadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), identifier, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new UndefDirectiveTriviaSyntax instance. + public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(string name, bool isActive) + => SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), SyntaxFactory.Identifier(name), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new DefineDirectiveTriviaSyntax instance. - public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + /// Creates a new LineDirectiveTriviaSyntax instance. + public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (lineKeyword.Kind() != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); + switch (line.Kind()) { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (defineKeyword.Kind() != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); - if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (DefineDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.DefineDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)defineKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)name.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.DefaultKeyword: + case SyntaxKind.HiddenKeyword: break; + default: throw new ArgumentException(nameof(line)); } - - /// Creates a new DefineDirectiveTriviaSyntax instance. - public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(SyntaxToken name, bool isActive) - => SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), name, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - - /// Creates a new DefineDirectiveTriviaSyntax instance. - public static DefineDirectiveTriviaSyntax DefineDirectiveTrivia(string name, bool isActive) - => SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), SyntaxFactory.Identifier(name), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - - /// Creates a new UndefDirectiveTriviaSyntax instance. - public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + switch (file.Kind()) { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (undefKeyword.Kind() != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); - if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (UndefDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.UndefDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)undefKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)name.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + case SyntaxKind.StringLiteralToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(file)); } + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (LineDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.LineDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)lineKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)line.Node!, (Syntax.InternalSyntax.SyntaxToken?)file.Node, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new UndefDirectiveTriviaSyntax instance. - public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(SyntaxToken name, bool isActive) - => SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), name, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new LineDirectiveTriviaSyntax instance. + public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken line, SyntaxToken file, bool isActive) + => SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), line, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new UndefDirectiveTriviaSyntax instance. - public static UndefDirectiveTriviaSyntax UndefDirectiveTrivia(string name, bool isActive) - => SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), SyntaxFactory.Identifier(name), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new LineDirectiveTriviaSyntax instance. + public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken line, bool isActive) + => SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), line, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new LineDirectiveTriviaSyntax instance. - public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (lineKeyword.Kind() != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); - switch (line.Kind()) - { - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.DefaultKeyword: - case SyntaxKind.HiddenKeyword: break; - default: throw new ArgumentException(nameof(line)); - } - switch (file.Kind()) - { - case SyntaxKind.StringLiteralToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(file)); - } - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (LineDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.LineDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)lineKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)line.Node!, (Syntax.InternalSyntax.SyntaxToken?)file.Node, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new LineDirectivePositionSyntax instance. + public static LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + { + if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); + if (line.Kind() != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); + if (commaToken.Kind() != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); + if (character.Kind() != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); + if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); + return (LineDirectivePositionSyntax)Syntax.InternalSyntax.SyntaxFactory.LineDirectivePosition((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.SyntaxToken)line.Node!, (Syntax.InternalSyntax.SyntaxToken)commaToken.Node!, (Syntax.InternalSyntax.SyntaxToken)character.Node!, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); + } - /// Creates a new LineDirectiveTriviaSyntax instance. - public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken line, SyntaxToken file, bool isActive) - => SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), line, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new LineDirectivePositionSyntax instance. + public static LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken line, SyntaxToken character) + => SyntaxFactory.LineDirectivePosition(SyntaxFactory.Token(SyntaxKind.OpenParenToken), line, SyntaxFactory.Token(SyntaxKind.CommaToken), character, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); - /// Creates a new LineDirectiveTriviaSyntax instance. - public static LineDirectiveTriviaSyntax LineDirectiveTrivia(SyntaxToken line, bool isActive) - => SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), line, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new LineSpanDirectiveTriviaSyntax instance. + public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (lineKeyword.Kind() != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); + if (start == null) throw new ArgumentNullException(nameof(start)); + if (minusToken.Kind() != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); + if (end == null) throw new ArgumentNullException(nameof(end)); + switch (characterOffset.Kind()) + { + case SyntaxKind.NumericLiteralToken: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(characterOffset)); + } + if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (LineSpanDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.LineSpanDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)lineKeyword.Node!, (Syntax.InternalSyntax.LineDirectivePositionSyntax)start.Green, (Syntax.InternalSyntax.SyntaxToken)minusToken.Node!, (Syntax.InternalSyntax.LineDirectivePositionSyntax)end.Green, (Syntax.InternalSyntax.SyntaxToken?)characterOffset.Node, (Syntax.InternalSyntax.SyntaxToken)file.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new LineDirectivePositionSyntax instance. - public static LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) - { - if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); - if (line.Kind() != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); - if (commaToken.Kind() != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); - if (character.Kind() != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); - if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); - return (LineDirectivePositionSyntax)Syntax.InternalSyntax.SyntaxFactory.LineDirectivePosition((Syntax.InternalSyntax.SyntaxToken)openParenToken.Node!, (Syntax.InternalSyntax.SyntaxToken)line.Node!, (Syntax.InternalSyntax.SyntaxToken)commaToken.Node!, (Syntax.InternalSyntax.SyntaxToken)character.Node!, (Syntax.InternalSyntax.SyntaxToken)closeParenToken.Node!).CreateRed(); - } + /// Creates a new LineSpanDirectiveTriviaSyntax instance. + public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(LineDirectivePositionSyntax start, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, bool isActive) + => SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), start, SyntaxFactory.Token(SyntaxKind.MinusToken), end, characterOffset, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new LineDirectivePositionSyntax instance. - public static LineDirectivePositionSyntax LineDirectivePosition(SyntaxToken line, SyntaxToken character) - => SyntaxFactory.LineDirectivePosition(SyntaxFactory.Token(SyntaxKind.OpenParenToken), line, SyntaxFactory.Token(SyntaxKind.CommaToken), character, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + /// Creates a new LineSpanDirectiveTriviaSyntax instance. + public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(LineDirectivePositionSyntax start, LineDirectivePositionSyntax end, SyntaxToken file, bool isActive) + => SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), start, SyntaxFactory.Token(SyntaxKind.MinusToken), end, default, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new LineSpanDirectiveTriviaSyntax instance. - public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + /// Creates a new PragmaWarningDirectiveTriviaSyntax instance. + public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (pragmaKeyword.Kind() != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); + if (warningKeyword.Kind() != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); + switch (disableOrRestoreKeyword.Kind()) { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (lineKeyword.Kind() != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); - if (start == null) throw new ArgumentNullException(nameof(start)); - if (minusToken.Kind() != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); - if (end == null) throw new ArgumentNullException(nameof(end)); - switch (characterOffset.Kind()) - { - case SyntaxKind.NumericLiteralToken: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(characterOffset)); - } - if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (LineSpanDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.LineSpanDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)lineKeyword.Node!, (Syntax.InternalSyntax.LineDirectivePositionSyntax)start.Green, (Syntax.InternalSyntax.SyntaxToken)minusToken.Node!, (Syntax.InternalSyntax.LineDirectivePositionSyntax)end.Green, (Syntax.InternalSyntax.SyntaxToken?)characterOffset.Node, (Syntax.InternalSyntax.SyntaxToken)file.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + case SyntaxKind.DisableKeyword: + case SyntaxKind.RestoreKeyword: break; + default: throw new ArgumentException(nameof(disableOrRestoreKeyword)); } + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (PragmaWarningDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.PragmaWarningDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)pragmaKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)warningKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)disableOrRestoreKeyword.Node!, errorCodes.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new LineSpanDirectiveTriviaSyntax instance. - public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(LineDirectivePositionSyntax start, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, bool isActive) - => SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), start, SyntaxFactory.Token(SyntaxKind.MinusToken), end, characterOffset, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - - /// Creates a new LineSpanDirectiveTriviaSyntax instance. - public static LineSpanDirectiveTriviaSyntax LineSpanDirectiveTrivia(LineDirectivePositionSyntax start, LineDirectivePositionSyntax end, SyntaxToken file, bool isActive) - => SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), start, SyntaxFactory.Token(SyntaxKind.MinusToken), end, default, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new PragmaWarningDirectiveTriviaSyntax instance. + public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken disableOrRestoreKeyword, SeparatedSyntaxList errorCodes, bool isActive) + => SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), disableOrRestoreKeyword, errorCodes, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new PragmaWarningDirectiveTriviaSyntax instance. - public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (pragmaKeyword.Kind() != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); - if (warningKeyword.Kind() != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); - switch (disableOrRestoreKeyword.Kind()) - { - case SyntaxKind.DisableKeyword: - case SyntaxKind.RestoreKeyword: break; - default: throw new ArgumentException(nameof(disableOrRestoreKeyword)); - } - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (PragmaWarningDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.PragmaWarningDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)pragmaKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)warningKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)disableOrRestoreKeyword.Node!, errorCodes.Node.ToGreenSeparatedList(), (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new PragmaWarningDirectiveTriviaSyntax instance. + public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken disableOrRestoreKeyword, bool isActive) + => SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), disableOrRestoreKeyword, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new PragmaWarningDirectiveTriviaSyntax instance. - public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken disableOrRestoreKeyword, SeparatedSyntaxList errorCodes, bool isActive) - => SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), disableOrRestoreKeyword, errorCodes, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new PragmaChecksumDirectiveTriviaSyntax instance. + public static PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (pragmaKeyword.Kind() != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); + if (checksumKeyword.Kind() != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); + if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (guid.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); + if (bytes.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (PragmaChecksumDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.PragmaChecksumDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)pragmaKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)checksumKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)file.Node!, (Syntax.InternalSyntax.SyntaxToken)guid.Node!, (Syntax.InternalSyntax.SyntaxToken)bytes.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new PragmaWarningDirectiveTriviaSyntax instance. - public static PragmaWarningDirectiveTriviaSyntax PragmaWarningDirectiveTrivia(SyntaxToken disableOrRestoreKeyword, bool isActive) - => SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), disableOrRestoreKeyword, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new PragmaChecksumDirectiveTriviaSyntax instance. + public static PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, bool isActive) + => SyntaxFactory.PragmaChecksumDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.ChecksumKeyword), file, guid, bytes, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new PragmaChecksumDirectiveTriviaSyntax instance. - public static PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (pragmaKeyword.Kind() != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); - if (checksumKeyword.Kind() != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); - if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (guid.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); - if (bytes.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (PragmaChecksumDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.PragmaChecksumDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)pragmaKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)checksumKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)file.Node!, (Syntax.InternalSyntax.SyntaxToken)guid.Node!, (Syntax.InternalSyntax.SyntaxToken)bytes.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new ReferenceDirectiveTriviaSyntax instance. + public static ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (referenceKeyword.Kind() != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); + if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (ReferenceDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.ReferenceDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)referenceKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)file.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new PragmaChecksumDirectiveTriviaSyntax instance. - public static PragmaChecksumDirectiveTriviaSyntax PragmaChecksumDirectiveTrivia(SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, bool isActive) - => SyntaxFactory.PragmaChecksumDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.ChecksumKeyword), file, guid, bytes, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new ReferenceDirectiveTriviaSyntax instance. + public static ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken file, bool isActive) + => SyntaxFactory.ReferenceDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ReferenceKeyword), file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new ReferenceDirectiveTriviaSyntax instance. - public static ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (referenceKeyword.Kind() != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); - if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (ReferenceDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.ReferenceDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)referenceKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)file.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new LoadDirectiveTriviaSyntax instance. + public static LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (loadKeyword.Kind() != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); + if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (LoadDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.LoadDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)loadKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)file.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new ReferenceDirectiveTriviaSyntax instance. - public static ReferenceDirectiveTriviaSyntax ReferenceDirectiveTrivia(SyntaxToken file, bool isActive) - => SyntaxFactory.ReferenceDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ReferenceKeyword), file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new LoadDirectiveTriviaSyntax instance. + public static LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken file, bool isActive) + => SyntaxFactory.LoadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LoadKeyword), file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new LoadDirectiveTriviaSyntax instance. - public static LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (loadKeyword.Kind() != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); - if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (LoadDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.LoadDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)loadKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)file.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); - } + /// Creates a new ShebangDirectiveTriviaSyntax instance. + public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (exclamationToken.Kind() != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (ShebangDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.ShebangDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)exclamationToken.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new LoadDirectiveTriviaSyntax instance. - public static LoadDirectiveTriviaSyntax LoadDirectiveTrivia(SyntaxToken file, bool isActive) - => SyntaxFactory.LoadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LoadKeyword), file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new ShebangDirectiveTriviaSyntax instance. + public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(bool isActive) + => SyntaxFactory.ShebangDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ExclamationToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new ShebangDirectiveTriviaSyntax instance. - public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + /// Creates a new NullableDirectiveTriviaSyntax instance. + public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); + if (nullableKeyword.Kind() != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); + switch (settingToken.Kind()) { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (exclamationToken.Kind() != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (ShebangDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.ShebangDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)exclamationToken.Node!, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + case SyntaxKind.EnableKeyword: + case SyntaxKind.DisableKeyword: + case SyntaxKind.RestoreKeyword: break; + default: throw new ArgumentException(nameof(settingToken)); } - - /// Creates a new ShebangDirectiveTriviaSyntax instance. - public static ShebangDirectiveTriviaSyntax ShebangDirectiveTrivia(bool isActive) - => SyntaxFactory.ShebangDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ExclamationToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - - /// Creates a new NullableDirectiveTriviaSyntax instance. - public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + switch (targetToken.Kind()) { - if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); - if (nullableKeyword.Kind() != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); - switch (settingToken.Kind()) - { - case SyntaxKind.EnableKeyword: - case SyntaxKind.DisableKeyword: - case SyntaxKind.RestoreKeyword: break; - default: throw new ArgumentException(nameof(settingToken)); - } - switch (targetToken.Kind()) - { - case SyntaxKind.WarningsKeyword: - case SyntaxKind.AnnotationsKeyword: - case SyntaxKind.None: break; - default: throw new ArgumentException(nameof(targetToken)); - } - if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); - return (NullableDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.NullableDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)nullableKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)settingToken.Node!, (Syntax.InternalSyntax.SyntaxToken?)targetToken.Node, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + case SyntaxKind.WarningsKeyword: + case SyntaxKind.AnnotationsKeyword: + case SyntaxKind.None: break; + default: throw new ArgumentException(nameof(targetToken)); } + if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); + return (NullableDirectiveTriviaSyntax)Syntax.InternalSyntax.SyntaxFactory.NullableDirectiveTrivia((Syntax.InternalSyntax.SyntaxToken)hashToken.Node!, (Syntax.InternalSyntax.SyntaxToken)nullableKeyword.Node!, (Syntax.InternalSyntax.SyntaxToken)settingToken.Node!, (Syntax.InternalSyntax.SyntaxToken?)targetToken.Node, (Syntax.InternalSyntax.SyntaxToken)endOfDirectiveToken.Node!, isActive).CreateRed(); + } - /// Creates a new NullableDirectiveTriviaSyntax instance. - public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken settingToken, SyntaxToken targetToken, bool isActive) - => SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), settingToken, targetToken, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); + /// Creates a new NullableDirectiveTriviaSyntax instance. + public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken settingToken, SyntaxToken targetToken, bool isActive) + => SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), settingToken, targetToken, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - /// Creates a new NullableDirectiveTriviaSyntax instance. - public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken settingToken, bool isActive) - => SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), settingToken, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); - } + /// Creates a new NullableDirectiveTriviaSyntax instance. + public static NullableDirectiveTriviaSyntax NullableDirectiveTrivia(SyntaxToken settingToken, bool isActive) + => SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), settingToken, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); } diff --git a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs index 9130442f9c4a8..ff8f7b840cb63 100644 --- a/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/CSharpSyntaxGenerator/CSharpSyntaxGenerator.SourceGenerator/Syntax.xml.Syntax.Generated.cs @@ -9,16329 +9,16326 @@ using Roslyn.Utilities; using CoreSyntax = Microsoft.CodeAnalysis.Syntax.InternalSyntax; -namespace Microsoft.CodeAnalysis.CSharp.Syntax -{ - +namespace Microsoft.CodeAnalysis.CSharp.Syntax; - /// Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. - public abstract partial class NameSyntax : TypeSyntax +/// Provides the base class from which the classes that represent name syntax nodes are derived. This is an abstract class. +public abstract partial class NameSyntax : TypeSyntax +{ + internal NameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal NameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } } +} - /// Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. - public abstract partial class SimpleNameSyntax : NameSyntax +/// Provides the base class from which the classes that represent simple name syntax nodes are derived. This is an abstract class. +public abstract partial class SimpleNameSyntax : NameSyntax +{ + internal SimpleNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal SimpleNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// SyntaxToken representing the identifier of the simple name. - public abstract SyntaxToken Identifier { get; } - public SimpleNameSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); - internal abstract SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier); } - /// Class which represents the syntax node for identifier name. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IdentifierNameSyntax : SimpleNameSyntax - { - - internal IdentifierNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// SyntaxToken representing the keyword for the kind of the identifier name. - public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.IdentifierNameSyntax)this.Green).identifier, Position, 0); + /// SyntaxToken representing the identifier of the simple name. + public abstract SyntaxToken Identifier { get; } + public SimpleNameSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); + internal abstract SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier); +} - internal override SyntaxNode? GetNodeSlot(int index) => null; +/// Class which represents the syntax node for identifier name. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IdentifierNameSyntax : SimpleNameSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal IdentifierNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIdentifierName(this); + /// SyntaxToken representing the keyword for the kind of the identifier name. + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.IdentifierNameSyntax)this.Green).identifier, Position, 0); - public IdentifierNameSyntax Update(SyntaxToken identifier) - { - if (identifier != this.Identifier) - { - var newNode = SyntaxFactory.IdentifierName(identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new IdentifierNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIdentifierName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIdentifierName(this); - /// Class which represents the syntax node for qualified name. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class QualifiedNameSyntax : NameSyntax + public IdentifierNameSyntax Update(SyntaxToken identifier) { - private NameSyntax? left; - private SimpleNameSyntax? right; - - internal QualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (identifier != this.Identifier) { + var newNode = SyntaxFactory.IdentifierName(identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// NameSyntax node representing the name on the left side of the dot token of the qualified name. - public NameSyntax Left => GetRedAtZero(ref this.left)!; + return this; + } + + internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new IdentifierNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); +} - /// SyntaxToken representing the dot. - public SyntaxToken DotToken => new SyntaxToken(this, ((InternalSyntax.QualifiedNameSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); +/// Class which represents the syntax node for qualified name. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class QualifiedNameSyntax : NameSyntax +{ + private NameSyntax? left; + private SimpleNameSyntax? right; - /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. - public SimpleNameSyntax Right => GetRed(ref this.right, 2)!; + internal QualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + /// NameSyntax node representing the name on the left side of the dot token of the qualified name. + public NameSyntax Left => GetRedAtZero(ref this.left)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.left, - 2 => this.right, - _ => null, - }; + /// SyntaxToken representing the dot. + public SyntaxToken DotToken => new SyntaxToken(this, ((InternalSyntax.QualifiedNameSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedName(this); + /// SimpleNameSyntax node representing the name on the right side of the dot token of the qualified name. + public SimpleNameSyntax Right => GetRed(ref this.right, 2)!; - public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (left != this.Left || dotToken != this.DotToken || right != this.Right) - { - var newNode = SyntaxFactory.QualifiedName(left, dotToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.left, + 2 => this.right, + _ => null, + }; - public QualifiedNameSyntax WithLeft(NameSyntax left) => Update(left, this.DotToken, this.Right); - public QualifiedNameSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Left, dotToken, this.Right); - public QualifiedNameSyntax WithRight(SimpleNameSyntax right) => Update(this.Left, this.DotToken, right); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedName(this); - /// Class which represents the syntax node for generic name. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class GenericNameSyntax : SimpleNameSyntax + public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) { - private TypeArgumentListSyntax? typeArgumentList; - - internal GenericNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (left != this.Left || dotToken != this.DotToken || right != this.Right) { + var newNode = SyntaxFactory.QualifiedName(left, dotToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the name of the identifier of the generic name. - public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.GenericNameSyntax)this.Green).identifier, Position, 0); + return this; + } - /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. - public TypeArgumentListSyntax TypeArgumentList => GetRed(ref this.typeArgumentList, 1)!; + public QualifiedNameSyntax WithLeft(NameSyntax left) => Update(left, this.DotToken, this.Right); + public QualifiedNameSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Left, dotToken, this.Right); + public QualifiedNameSyntax WithRight(SimpleNameSyntax right) => Update(this.Left, this.DotToken, right); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.typeArgumentList, 1)! : null; +/// Class which represents the syntax node for generic name. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class GenericNameSyntax : SimpleNameSyntax +{ + private TypeArgumentListSyntax? typeArgumentList; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.typeArgumentList : null; + internal GenericNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGenericName(this); + /// SyntaxToken representing the name of the identifier of the generic name. + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.GenericNameSyntax)this.Green).identifier, Position, 0); - public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) - { - if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList) - { - var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// TypeArgumentListSyntax node representing the list of type arguments of the generic name. + public TypeArgumentListSyntax TypeArgumentList => GetRed(ref this.typeArgumentList, 1)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.typeArgumentList, 1)! : null; - internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new GenericNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.TypeArgumentList); - public GenericNameSyntax WithTypeArgumentList(TypeArgumentListSyntax typeArgumentList) => Update(this.Identifier, typeArgumentList); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.typeArgumentList : null; - public GenericNameSyntax AddTypeArgumentListArguments(params TypeSyntax[] items) => WithTypeArgumentList(this.TypeArgumentList.WithArguments(this.TypeArgumentList.Arguments.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGenericName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGenericName(this); - /// Class which represents the syntax node for type argument list. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode + public GenericNameSyntax Update(SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) { - private SyntaxNode? arguments; - - internal TypeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// SyntaxToken representing less than. - public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); - - /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. - public SeparatedSyntaxList Arguments + if (identifier != this.Identifier || typeArgumentList != this.TypeArgumentList) { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.GenericName(identifier, typeArgumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing greater than. - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeArgumentList(this); + return this; + } - public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) - { - if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SimpleNameSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new GenericNameSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.TypeArgumentList); + public GenericNameSyntax WithTypeArgumentList(TypeArgumentListSyntax typeArgumentList) => Update(this.Identifier, typeArgumentList); - return this; - } + public GenericNameSyntax AddTypeArgumentListArguments(params TypeSyntax[] items) => WithTypeArgumentList(this.TypeArgumentList.WithArguments(this.TypeArgumentList.Arguments.AddRange(items))); +} - public TypeArgumentListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Arguments, this.GreaterThanToken); - public TypeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.LessThanToken, arguments, this.GreaterThanToken); - public TypeArgumentListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Arguments, greaterThanToken); +/// Class which represents the syntax node for type argument list. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeArgumentListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? arguments; - public TypeArgumentListSyntax AddArguments(params TypeSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); + internal TypeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents the syntax node for alias qualified name. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AliasQualifiedNameSyntax : NameSyntax - { - private IdentifierNameSyntax? alias; - private SimpleNameSyntax? name; + /// SyntaxToken representing less than. + public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).lessThanToken, Position, 0); - internal AliasQualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// SeparatedSyntaxList of TypeSyntax node representing the type arguments. + public SeparatedSyntaxList Arguments + { + get { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// IdentifierNameSyntax node representing the name of the alias - public IdentifierNameSyntax Alias => GetRedAtZero(ref this.alias)!; - - /// SyntaxToken representing colon colon. - public SyntaxToken ColonColonToken => new SyntaxToken(this, ((InternalSyntax.AliasQualifiedNameSyntax)this.Green).colonColonToken, GetChildPosition(1), GetChildIndex(1)); - - /// SimpleNameSyntax node representing the name that is being alias qualified. - public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; + /// SyntaxToken representing greater than. + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.TypeArgumentListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.alias)!, - 2 => GetRed(ref this.name, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.alias, - 2 => this.name, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAliasQualifiedName(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeArgumentList(this); - public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + public TypeArgumentListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList arguments, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || arguments != this.Arguments || greaterThanToken != this.GreaterThanToken) { - if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name) - { - var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TypeArgumentList(lessThanToken, arguments, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AliasQualifiedNameSyntax WithAlias(IdentifierNameSyntax alias) => Update(alias, this.ColonColonToken, this.Name); - public AliasQualifiedNameSyntax WithColonColonToken(SyntaxToken colonColonToken) => Update(this.Alias, colonColonToken, this.Name); - public AliasQualifiedNameSyntax WithName(SimpleNameSyntax name) => Update(this.Alias, this.ColonColonToken, name); + return this; } - /// Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. - public abstract partial class TypeSyntax : ExpressionSyntax + public TypeArgumentListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Arguments, this.GreaterThanToken); + public TypeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.LessThanToken, arguments, this.GreaterThanToken); + public TypeArgumentListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Arguments, greaterThanToken); + + public TypeArgumentListSyntax AddArguments(params TypeSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +} + +/// Class which represents the syntax node for alias qualified name. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AliasQualifiedNameSyntax : NameSyntax +{ + private IdentifierNameSyntax? alias; + private SimpleNameSyntax? name; + + internal AliasQualifiedNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal TypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } } - /// Class which represents the syntax node for predefined types. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PredefinedTypeSyntax : TypeSyntax - { + /// IdentifierNameSyntax node representing the name of the alias + public IdentifierNameSyntax Alias => GetRedAtZero(ref this.alias)!; - internal PredefinedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing colon colon. + public SyntaxToken ColonColonToken => new SyntaxToken(this, ((InternalSyntax.AliasQualifiedNameSyntax)this.Green).colonColonToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken which represents the keyword corresponding to the predefined type. - public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.PredefinedTypeSyntax)this.Green).keyword, Position, 0); + /// SimpleNameSyntax node representing the name that is being alias qualified. + public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.alias)!, + 2 => GetRed(ref this.name, 2)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.alias, + 2 => this.name, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPredefinedType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAliasQualifiedName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAliasQualifiedName(this); - public PredefinedTypeSyntax Update(SyntaxToken keyword) + public AliasQualifiedNameSyntax Update(IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) + { + if (alias != this.Alias || colonColonToken != this.ColonColonToken || name != this.Name) { - if (keyword != this.Keyword) - { - var newNode = SyntaxFactory.PredefinedType(keyword); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.AliasQualifiedName(alias, colonColonToken, name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PredefinedTypeSyntax WithKeyword(SyntaxToken keyword) => Update(keyword); + return this; } - /// Class which represents the syntax node for the array type. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArrayTypeSyntax : TypeSyntax + public AliasQualifiedNameSyntax WithAlias(IdentifierNameSyntax alias) => Update(alias, this.ColonColonToken, this.Name); + public AliasQualifiedNameSyntax WithColonColonToken(SyntaxToken colonColonToken) => Update(this.Alias, colonColonToken, this.Name); + public AliasQualifiedNameSyntax WithName(SimpleNameSyntax name) => Update(this.Alias, this.ColonColonToken, name); +} + +/// Provides the base class from which the classes that represent type syntax nodes are derived. This is an abstract class. +public abstract partial class TypeSyntax : ExpressionSyntax +{ + internal TypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private TypeSyntax? elementType; - private SyntaxNode? rankSpecifiers; + } +} - internal ArrayTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for predefined types. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PredefinedTypeSyntax : TypeSyntax +{ - /// TypeSyntax node representing the type of the element of the array. - public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; + internal PredefinedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. - public SyntaxList RankSpecifiers => new SyntaxList(GetRed(ref this.rankSpecifiers, 1)); + /// SyntaxToken which represents the keyword corresponding to the predefined type. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.PredefinedTypeSyntax)this.Green).keyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.elementType)!, - 1 => GetRed(ref this.rankSpecifiers, 1)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.elementType, - 1 => this.rankSpecifiers, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPredefinedType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPredefinedType(this); - public ArrayTypeSyntax Update(TypeSyntax elementType, SyntaxList rankSpecifiers) + public PredefinedTypeSyntax Update(SyntaxToken keyword) + { + if (keyword != this.Keyword) { - if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) - { - var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.PredefinedType(keyword); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ArrayTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.RankSpecifiers); - public ArrayTypeSyntax WithRankSpecifiers(SyntaxList rankSpecifiers) => Update(this.ElementType, rankSpecifiers); - - public ArrayTypeSyntax AddRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithRankSpecifiers(this.RankSpecifiers.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode + public PredefinedTypeSyntax WithKeyword(SyntaxToken keyword) => Update(keyword); +} + +/// Class which represents the syntax node for the array type. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArrayTypeSyntax : TypeSyntax +{ + private TypeSyntax? elementType; + private SyntaxNode? rankSpecifiers; + + internal ArrayTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? sizes; + } - internal ArrayRankSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// TypeSyntax node representing the type of the element of the array. + public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); + /// SyntaxList of ArrayRankSpecifierSyntax nodes representing the list of rank specifiers for the array. + public SyntaxList RankSpecifiers => new SyntaxList(GetRed(ref this.rankSpecifiers, 1)); - public SeparatedSyntaxList Sizes + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var red = GetRed(ref this.sizes, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + 0 => GetRedAtZero(ref this.elementType)!, + 1 => GetRed(ref this.rankSpecifiers, 1)!, + _ => null, + }; - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.elementType, + 1 => this.rankSpecifiers, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.sizes, 1)! : null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayType(this); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.sizes : null; + public ArrayTypeSyntax Update(TypeSyntax elementType, SyntaxList rankSpecifiers) + { + if (elementType != this.ElementType || rankSpecifiers != this.RankSpecifiers) + { + var newNode = SyntaxFactory.ArrayType(elementType, rankSpecifiers); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayRankSpecifier(this); + return this; + } - public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public ArrayTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.RankSpecifiers); + public ArrayTypeSyntax WithRankSpecifiers(SyntaxList rankSpecifiers) => Update(this.ElementType, rankSpecifiers); - return this; - } + public ArrayTypeSyntax AddRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithRankSpecifiers(this.RankSpecifiers.AddRange(items)); +} - public ArrayRankSpecifierSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Sizes, this.CloseBracketToken); - public ArrayRankSpecifierSyntax WithSizes(SeparatedSyntaxList sizes) => Update(this.OpenBracketToken, sizes, this.CloseBracketToken); - public ArrayRankSpecifierSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Sizes, closeBracketToken); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArrayRankSpecifierSyntax : CSharpSyntaxNode +{ + private SyntaxNode? sizes; - public ArrayRankSpecifierSyntax AddSizes(params ExpressionSyntax[] items) => WithSizes(this.Sizes.AddRange(items)); + internal ArrayRankSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents the syntax node for pointer type. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PointerTypeSyntax : TypeSyntax - { - private TypeSyntax? elementType; + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).openBracketToken, Position, 0); - internal PointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SeparatedSyntaxList Sizes + { + get { + var red = GetRed(ref this.sizes, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// TypeSyntax node that represents the element type of the pointer. - public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - - /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => new SyntaxToken(this, ((InternalSyntax.PointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ArrayRankSpecifierSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.sizes, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.sizes : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPointerType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayRankSpecifier(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayRankSpecifier(this); - public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) + public ArrayRankSpecifierSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList sizes, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || sizes != this.Sizes || closeBracketToken != this.CloseBracketToken) { - if (elementType != this.ElementType || asteriskToken != this.AsteriskToken) - { - var newNode = SyntaxFactory.PointerType(elementType, asteriskToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ArrayRankSpecifier(openBracketToken, sizes, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PointerTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.AsteriskToken); - public PointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.ElementType, asteriskToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerTypeSyntax : TypeSyntax - { - private FunctionPointerCallingConventionSyntax? callingConvention; - private FunctionPointerParameterListSyntax? parameterList; + public ArrayRankSpecifierSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Sizes, this.CloseBracketToken); + public ArrayRankSpecifierSyntax WithSizes(SeparatedSyntaxList sizes) => Update(this.OpenBracketToken, sizes, this.CloseBracketToken); + public ArrayRankSpecifierSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Sizes, closeBracketToken); - internal FunctionPointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public ArrayRankSpecifierSyntax AddSizes(params ExpressionSyntax[] items) => WithSizes(this.Sizes.AddRange(items)); +} - /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((InternalSyntax.FunctionPointerTypeSyntax)this.Green).delegateKeyword, Position, 0); +/// Class which represents the syntax node for pointer type. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PointerTypeSyntax : TypeSyntax +{ + private TypeSyntax? elementType; - /// SyntaxToken representing the asterisk. - public SyntaxToken AsteriskToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); + internal PointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Node representing the optional calling convention. - public FunctionPointerCallingConventionSyntax? CallingConvention => GetRed(ref this.callingConvention, 2); + /// TypeSyntax node that represents the element type of the pointer. + public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - /// List of the parameter types and return type of the function pointer. - public FunctionPointerParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; + /// SyntaxToken representing the asterisk. + public SyntaxToken AsteriskToken => new SyntaxToken(this, ((InternalSyntax.PointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 2 => GetRed(ref this.callingConvention, 2), - 3 => GetRed(ref this.parameterList, 3)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.callingConvention, - 3 => this.parameterList, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPointerType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPointerType(this); - public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) + public PointerTypeSyntax Update(TypeSyntax elementType, SyntaxToken asteriskToken) + { + if (elementType != this.ElementType || asteriskToken != this.AsteriskToken) { - if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList) - { - var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.PointerType(elementType, asteriskToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public FunctionPointerTypeSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(delegateKeyword, this.AsteriskToken, this.CallingConvention, this.ParameterList); - public FunctionPointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.DelegateKeyword, asteriskToken, this.CallingConvention, this.ParameterList); - public FunctionPointerTypeSyntax WithCallingConvention(FunctionPointerCallingConventionSyntax? callingConvention) => Update(this.DelegateKeyword, this.AsteriskToken, callingConvention, this.ParameterList); - public FunctionPointerTypeSyntax WithParameterList(FunctionPointerParameterListSyntax parameterList) => Update(this.DelegateKeyword, this.AsteriskToken, this.CallingConvention, parameterList); - - public FunctionPointerTypeSyntax AddParameterListParameters(params FunctionPointerParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + return this; } - /// Function pointer parameter list syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode - { - private SyntaxNode? parameters; - - internal FunctionPointerParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public PointerTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.AsteriskToken); + public PointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.ElementType, asteriskToken); +} - /// SyntaxToken representing the less than token. - public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerTypeSyntax : TypeSyntax +{ + private FunctionPointerCallingConventionSyntax? callingConvention; + private FunctionPointerParameterListSyntax? parameterList; - /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. - public SeparatedSyntaxList Parameters - { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + internal FunctionPointerTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the greater than token. - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + /// SyntaxToken representing the delegate keyword. + public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((InternalSyntax.FunctionPointerTypeSyntax)this.Green).delegateKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + /// SyntaxToken representing the asterisk. + public SyntaxToken AsteriskToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerTypeSyntax)this.Green).asteriskToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + /// Node representing the optional calling convention. + public FunctionPointerCallingConventionSyntax? CallingConvention => GetRed(ref this.callingConvention, 2); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameterList(this); + /// List of the parameter types and return type of the function pointer. + public FunctionPointerParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 2 => GetRed(ref this.callingConvention, 2), + 3 => GetRed(ref this.parameterList, 3)!, + _ => null, + }; - public FunctionPointerParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); - public FunctionPointerParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); - public FunctionPointerParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 2 => this.callingConvention, + 3 => this.parameterList, + _ => null, + }; - public FunctionPointerParameterListSyntax AddParameters(params FunctionPointerParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerType(this); - /// Function pointer calling convention syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode + public FunctionPointerTypeSyntax Update(SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) { - private FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList; - - internal FunctionPointerCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (delegateKeyword != this.DelegateKeyword || asteriskToken != this.AsteriskToken || callingConvention != this.CallingConvention || parameterList != this.ParameterList) { + var newNode = SyntaxFactory.FunctionPointerType(delegateKeyword, asteriskToken, callingConvention, parameterList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing whether the calling convention is managed or unmanaged. - public SyntaxToken ManagedOrUnmanagedKeyword => new SyntaxToken(this, ((InternalSyntax.FunctionPointerCallingConventionSyntax)this.Green).managedOrUnmanagedKeyword, Position, 0); - - /// Optional list of identifiers that will contribute to an unmanaged calling convention. - public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => GetRed(ref this.unmanagedCallingConventionList, 1); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.unmanagedCallingConventionList, 1) : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.unmanagedCallingConventionList : null; + public FunctionPointerTypeSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(delegateKeyword, this.AsteriskToken, this.CallingConvention, this.ParameterList); + public FunctionPointerTypeSyntax WithAsteriskToken(SyntaxToken asteriskToken) => Update(this.DelegateKeyword, asteriskToken, this.CallingConvention, this.ParameterList); + public FunctionPointerTypeSyntax WithCallingConvention(FunctionPointerCallingConventionSyntax? callingConvention) => Update(this.DelegateKeyword, this.AsteriskToken, callingConvention, this.ParameterList); + public FunctionPointerTypeSyntax WithParameterList(FunctionPointerParameterListSyntax parameterList) => Update(this.DelegateKeyword, this.AsteriskToken, this.CallingConvention, parameterList); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerCallingConvention(this); + public FunctionPointerTypeSyntax AddParameterListParameters(params FunctionPointerParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); +} - public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) - { - if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList) - { - var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// Function pointer parameter list syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerParameterListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? parameters; - return this; - } + internal FunctionPointerParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public FunctionPointerCallingConventionSyntax WithManagedOrUnmanagedKeyword(SyntaxToken managedOrUnmanagedKeyword) => Update(managedOrUnmanagedKeyword, this.UnmanagedCallingConventionList); - public FunctionPointerCallingConventionSyntax WithUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) => Update(this.ManagedOrUnmanagedKeyword, unmanagedCallingConventionList); + /// SyntaxToken representing the less than token. + public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).lessThanToken, Position, 0); - public FunctionPointerCallingConventionSyntax AddUnmanagedCallingConventionListCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) + /// SeparatedSyntaxList of ParameterSyntaxes representing the list of parameters and return type. + public SeparatedSyntaxList Parameters + { + get { - var unmanagedCallingConventionList = this.UnmanagedCallingConventionList ?? SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(); - return WithUnmanagedCallingConventionList(unmanagedCallingConventionList.WithCallingConventions(unmanagedCallingConventionList.CallingConventions.AddRange(items))); + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } } - /// Function pointer calling convention syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode - { - private SyntaxNode? callingConventions; + /// SyntaxToken representing the greater than token. + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - internal FunctionPointerUnmanagedCallingConventionListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameterList(this); - /// SeparatedSyntaxList of calling convention identifiers. - public SeparatedSyntaxList CallingConventions + public FunctionPointerParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) { - get - { - var red = GetRed(ref this.callingConventions, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.FunctionPointerParameterList(lessThanToken, parameters, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.callingConventions, 1)! : null; + public FunctionPointerParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); + public FunctionPointerParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); + public FunctionPointerParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.callingConventions : null; + public FunctionPointerParameterListSyntax AddParameters(params FunctionPointerParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); +/// Function pointer calling convention syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerCallingConventionSyntax : CSharpSyntaxNode +{ + private FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList; - public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal FunctionPointerCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + /// SyntaxToken representing whether the calling convention is managed or unmanaged. + public SyntaxToken ManagedOrUnmanagedKeyword => new SyntaxToken(this, ((InternalSyntax.FunctionPointerCallingConventionSyntax)this.Green).managedOrUnmanagedKeyword, Position, 0); - public FunctionPointerUnmanagedCallingConventionListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.CallingConventions, this.CloseBracketToken); - public FunctionPointerUnmanagedCallingConventionListSyntax WithCallingConventions(SeparatedSyntaxList callingConventions) => Update(this.OpenBracketToken, callingConventions, this.CloseBracketToken); - public FunctionPointerUnmanagedCallingConventionListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.CallingConventions, closeBracketToken); + /// Optional list of identifiers that will contribute to an unmanaged calling convention. + public FunctionPointerUnmanagedCallingConventionListSyntax? UnmanagedCallingConventionList => GetRed(ref this.unmanagedCallingConventionList, 1); - public FunctionPointerUnmanagedCallingConventionListSyntax AddCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) => WithCallingConventions(this.CallingConventions.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.unmanagedCallingConventionList, 1) : null; - /// Individual function pointer unmanaged calling convention. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode - { + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.unmanagedCallingConventionList : null; - internal FunctionPointerUnmanagedCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerCallingConvention(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerCallingConvention(this); + + public FunctionPointerCallingConventionSyntax Update(SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) + { + if (managedOrUnmanagedKeyword != this.ManagedOrUnmanagedKeyword || unmanagedCallingConventionList != this.UnmanagedCallingConventionList) { + var newNode = SyntaxFactory.FunctionPointerCallingConvention(managedOrUnmanagedKeyword, unmanagedCallingConventionList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the calling convention identifier. - public SyntaxToken Name => new SyntaxToken(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionSyntax)this.Green).name, Position, 0); - - internal override SyntaxNode? GetNodeSlot(int index) => null; - - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); + public FunctionPointerCallingConventionSyntax WithManagedOrUnmanagedKeyword(SyntaxToken managedOrUnmanagedKeyword) => Update(managedOrUnmanagedKeyword, this.UnmanagedCallingConventionList); + public FunctionPointerCallingConventionSyntax WithUnmanagedCallingConventionList(FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) => Update(this.ManagedOrUnmanagedKeyword, unmanagedCallingConventionList); - public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name) - { - if (name != this.Name) - { - var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public FunctionPointerCallingConventionSyntax AddUnmanagedCallingConventionListCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) + { + var unmanagedCallingConventionList = this.UnmanagedCallingConventionList ?? SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(); + return WithUnmanagedCallingConventionList(unmanagedCallingConventionList.WithCallingConventions(unmanagedCallingConventionList.CallingConventions.AddRange(items))); + } +} - return this; - } +/// Function pointer calling convention syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerUnmanagedCallingConventionListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? callingConventions; - public FunctionPointerUnmanagedCallingConventionSyntax WithName(SyntaxToken name) => Update(name); + internal FunctionPointerUnmanagedCallingConventionListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents the syntax node for a nullable type. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NullableTypeSyntax : TypeSyntax - { - private TypeSyntax? elementType; + /// SyntaxToken representing open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).openBracketToken, Position, 0); - internal NullableTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// SeparatedSyntaxList of calling convention identifiers. + public SeparatedSyntaxList CallingConventions + { + get { + var red = GetRed(ref this.callingConventions, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// TypeSyntax node representing the type of the element. - public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => new SyntaxToken(this, ((InternalSyntax.NullableTypeSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.callingConventions, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.callingConventions : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConventionList(this); - public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) + public FunctionPointerUnmanagedCallingConventionListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList callingConventions, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || callingConventions != this.CallingConventions || closeBracketToken != this.CloseBracketToken) { - if (elementType != this.ElementType || questionToken != this.QuestionToken) - { - var newNode = SyntaxFactory.NullableType(elementType, questionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(openBracketToken, callingConventions, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public NullableTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.QuestionToken); - public NullableTypeSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ElementType, questionToken); + return this; } - /// Class which represents the syntax node for tuple type. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TupleTypeSyntax : TypeSyntax - { - private SyntaxNode? elements; + public FunctionPointerUnmanagedCallingConventionListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.CallingConventions, this.CloseBracketToken); + public FunctionPointerUnmanagedCallingConventionListSyntax WithCallingConventions(SeparatedSyntaxList callingConventions) => Update(this.OpenBracketToken, callingConventions, this.CloseBracketToken); + public FunctionPointerUnmanagedCallingConventionListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.CallingConventions, closeBracketToken); - internal TupleTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public FunctionPointerUnmanagedCallingConventionListSyntax AddCallingConventions(params FunctionPointerUnmanagedCallingConventionSyntax[] items) => WithCallingConventions(this.CallingConventions.AddRange(items)); +} - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); +/// Individual function pointer unmanaged calling convention. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerUnmanagedCallingConventionSyntax : CSharpSyntaxNode +{ - public SeparatedSyntaxList Elements - { - get - { - var red = GetRed(ref this.elements, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + internal FunctionPointerUnmanagedCallingConventionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + /// SyntaxToken representing the calling convention identifier. + public SyntaxToken Name => new SyntaxToken(this, ((InternalSyntax.FunctionPointerUnmanagedCallingConventionSyntax)this.Green).name, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerUnmanagedCallingConvention(this); - public TupleTypeSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList elements, SyntaxToken closeParenToken) + public FunctionPointerUnmanagedCallingConventionSyntax Update(SyntaxToken name) + { + if (name != this.Name) { - if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.FunctionPointerUnmanagedCallingConvention(name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TupleTypeSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Elements, this.CloseParenToken); - public TupleTypeSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenParenToken, elements, this.CloseParenToken); - public TupleTypeSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Elements, closeParenToken); - - public TupleTypeSyntax AddElements(params TupleElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); + return this; } - /// Tuple type element. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TupleElementSyntax : CSharpSyntaxNode - { - private TypeSyntax? type; + public FunctionPointerUnmanagedCallingConventionSyntax WithName(SyntaxToken name) => Update(name); +} - internal TupleElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for a nullable type. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NullableTypeSyntax : TypeSyntax +{ + private TypeSyntax? elementType; - /// Gets the type of the tuple element. - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + internal NullableTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the name of the tuple element. - public SyntaxToken Identifier - { - get - { - var slot = ((Syntax.InternalSyntax.TupleElementSyntax)this.Green).identifier; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + /// TypeSyntax node representing the type of the element. + public TypeSyntax ElementType => GetRedAtZero(ref this.elementType)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken => new SyntaxToken(this, ((InternalSyntax.NullableTypeSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.elementType)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleElement(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.elementType : null; - public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) - { - if (type != this.Type || identifier != this.Identifier) - { - var newNode = SyntaxFactory.TupleElement(type, identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableType(this); - return this; + public NullableTypeSyntax Update(TypeSyntax elementType, SyntaxToken questionToken) + { + if (elementType != this.ElementType || questionToken != this.QuestionToken) + { + var newNode = SyntaxFactory.NullableType(elementType, questionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TupleElementSyntax WithType(TypeSyntax type) => Update(type, this.Identifier); - public TupleElementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.Type, identifier); + return this; } - /// Class which represents a placeholder in the type argument list of an unbound generic type. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class OmittedTypeArgumentSyntax : TypeSyntax + public NullableTypeSyntax WithElementType(TypeSyntax elementType) => Update(elementType, this.QuestionToken); + public NullableTypeSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ElementType, questionToken); +} + +/// Class which represents the syntax node for tuple type. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TupleTypeSyntax : TypeSyntax +{ + private SyntaxNode? elements; + + internal TupleTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { + } + + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.TupleTypeSyntax)this.Green).openParenToken, Position, 0); - internal OmittedTypeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SeparatedSyntaxList Elements + { + get { + var red = GetRed(ref this.elements, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// SyntaxToken representing the omitted type argument. - public SyntaxToken OmittedTypeArgumentToken => new SyntaxToken(this, ((InternalSyntax.OmittedTypeArgumentSyntax)this.Green).omittedTypeArgumentToken, Position, 0); + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.TupleTypeSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedTypeArgument(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleType(this); - public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken) + public TupleTypeSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList elements, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || elements != this.Elements || closeParenToken != this.CloseParenToken) { - if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken) - { - var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TupleType(openParenToken, elements, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public OmittedTypeArgumentSyntax WithOmittedTypeArgumentToken(SyntaxToken omittedTypeArgumentToken) => Update(omittedTypeArgumentToken); + return this; } - /// The ref modifier of a method's return value or a local. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RefTypeSyntax : TypeSyntax - { - private TypeSyntax? type; + public TupleTypeSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Elements, this.CloseParenToken); + public TupleTypeSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenParenToken, elements, this.CloseParenToken); + public TupleTypeSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Elements, closeParenToken); - internal RefTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TupleTypeSyntax AddElements(params TupleElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); +} + +/// Tuple type element. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TupleElementSyntax : CSharpSyntaxNode +{ + private TypeSyntax? type; - public SyntaxToken RefKeyword => new SyntaxToken(this, ((InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); + internal TupleElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the optional "readonly" keyword. - public SyntaxToken ReadOnlyKeyword + /// Gets the type of the tuple element. + public TypeSyntax Type => GetRedAtZero(ref this.type)!; + + /// Gets the name of the tuple element. + public SyntaxToken Identifier + { + get { - get - { - var slot = ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var slot = ((Syntax.InternalSyntax.TupleElementSyntax)this.Green).identifier; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public TypeSyntax Type => GetRed(ref this.type, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleElement(this); - public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier) + { + if (type != this.Type || identifier != this.Identifier) { - if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) - { - var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TupleElement(type, identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public RefTypeSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.ReadOnlyKeyword, this.Type); - public RefTypeSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKeyword, readOnlyKeyword, this.Type); - public RefTypeSyntax WithType(TypeSyntax type) => Update(this.RefKeyword, this.ReadOnlyKeyword, type); + return this; } - /// The 'scoped' modifier of a local. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ScopedTypeSyntax : TypeSyntax - { - private TypeSyntax? type; + public TupleElementSyntax WithType(TypeSyntax type) => Update(type, this.Identifier); + public TupleElementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.Type, identifier); +} - internal ScopedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents a placeholder in the type argument list of an unbound generic type. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class OmittedTypeArgumentSyntax : TypeSyntax +{ - public SyntaxToken ScopedKeyword => new SyntaxToken(this, ((InternalSyntax.ScopedTypeSyntax)this.Green).scopedKeyword, Position, 0); + internal OmittedTypeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public TypeSyntax Type => GetRed(ref this.type, 1)!; + /// SyntaxToken representing the omitted type argument. + public SyntaxToken OmittedTypeArgumentToken => new SyntaxToken(this, ((InternalSyntax.OmittedTypeArgumentSyntax)this.Green).omittedTypeArgumentToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitScopedType(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedTypeArgument(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedTypeArgument(this); - public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) + public OmittedTypeArgumentSyntax Update(SyntaxToken omittedTypeArgumentToken) + { + if (omittedTypeArgumentToken != this.OmittedTypeArgumentToken) { - if (scopedKeyword != this.ScopedKeyword || type != this.Type) - { - var newNode = SyntaxFactory.ScopedType(scopedKeyword, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.OmittedTypeArgument(omittedTypeArgumentToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ScopedTypeSyntax WithScopedKeyword(SyntaxToken scopedKeyword) => Update(scopedKeyword, this.Type); - public ScopedTypeSyntax WithType(TypeSyntax type) => Update(this.ScopedKeyword, type); + return this; } - public abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode + public OmittedTypeArgumentSyntax WithOmittedTypeArgumentToken(SyntaxToken omittedTypeArgumentToken) => Update(omittedTypeArgumentToken); +} + +/// The ref modifier of a method's return value or a local. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RefTypeSyntax : TypeSyntax +{ + private TypeSyntax? type; + + internal RefTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal ExpressionOrPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } } - /// Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. - public abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax + public SyntaxToken RefKeyword => new SyntaxToken(this, ((InternalSyntax.RefTypeSyntax)this.Green).refKeyword, Position, 0); + + /// Gets the optional "readonly" keyword. + public SyntaxToken ReadOnlyKeyword { - internal ExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = ((Syntax.InternalSyntax.RefTypeSyntax)this.Green).readOnlyKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - /// Class which represents the syntax node for parenthesized expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; + public TypeSyntax Type => GetRed(ref this.type, 2)!; + + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefType(this); - internal ParenthesizedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public RefTypeSyntax Update(SyntaxToken refKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + { + if (refKeyword != this.RefKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) { + var newNode = SyntaxFactory.RefType(refKeyword, readOnlyKeyword, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedExpressionSyntax)this.Green).openParenToken, Position, 0); + return this; + } - /// ExpressionSyntax node representing the expression enclosed within the parenthesis. - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public RefTypeSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.ReadOnlyKeyword, this.Type); + public RefTypeSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKeyword, readOnlyKeyword, this.Type); + public RefTypeSyntax WithType(TypeSyntax type) => Update(this.RefKeyword, this.ReadOnlyKeyword, type); +} - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); +/// The 'scoped' modifier of a local. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ScopedTypeSyntax : TypeSyntax +{ + private TypeSyntax? type; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + internal ScopedTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + public SyntaxToken ScopedKeyword => new SyntaxToken(this, ((InternalSyntax.ScopedTypeSyntax)this.Green).scopedKeyword, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedExpression(this); + public TypeSyntax Type => GetRed(ref this.type, 1)!; - public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; - public ParenthesizedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Expression, this.CloseParenToken); - public ParenthesizedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, expression, this.CloseParenToken); - public ParenthesizedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Expression, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitScopedType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitScopedType(this); - /// Class which represents the syntax node for tuple expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TupleExpressionSyntax : ExpressionSyntax + public ScopedTypeSyntax Update(SyntaxToken scopedKeyword, TypeSyntax type) { - private SyntaxNode? arguments; - - internal TupleExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); - - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public SeparatedSyntaxList Arguments + if (scopedKeyword != this.ScopedKeyword || type != this.Type) { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ScopedType(scopedKeyword, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleExpression(this); - - public TupleExpressionSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + return this; + } - return this; - } + public ScopedTypeSyntax WithScopedKeyword(SyntaxToken scopedKeyword) => Update(scopedKeyword, this.Type); + public ScopedTypeSyntax WithType(TypeSyntax type) => Update(this.ScopedKeyword, type); +} - public TupleExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); - public TupleExpressionSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); - public TupleExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); +public abstract partial class ExpressionOrPatternSyntax : CSharpSyntaxNode +{ + internal ExpressionOrPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public TupleExpressionSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +/// Provides the base class from which the classes that represent expression syntax nodes are derived. This is an abstract class. +public abstract partial class ExpressionSyntax : ExpressionOrPatternSyntax +{ + internal ExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } +} + +/// Class which represents the syntax node for parenthesized expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParenthesizedExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - /// Class which represents the syntax node for prefix unary expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax + internal ParenthesizedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? operand; + } - internal PrefixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedExpressionSyntax)this.Green).openParenToken, Position, 0); - /// SyntaxToken representing the kind of the operator of the prefix unary expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.PrefixUnaryExpressionSyntax)this.Green).operatorToken, Position, 0); + /// ExpressionSyntax node representing the expression enclosed within the parenthesis. + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - /// ExpressionSyntax representing the operand of the prefix unary expression. - public ExpressionSyntax Operand => GetRed(ref this.operand, 1)!; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.operand, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.operand : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrefixUnaryExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedExpression(this); - public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand) + public ParenthesizedExpressionSyntax Update(SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { - if (operatorToken != this.OperatorToken || operand != this.Operand) - { - var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind(), operatorToken, operand); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ParenthesizedExpression(openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PrefixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Operand); - public PrefixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(this.OperatorToken, operand); + return this; } - /// Class which represents the syntax node for an "await" expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AwaitExpressionSyntax : ExpressionSyntax + public ParenthesizedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Expression, this.CloseParenToken); + public ParenthesizedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, expression, this.CloseParenToken); + public ParenthesizedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Expression, closeParenToken); +} + +/// Class which represents the syntax node for tuple expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TupleExpressionSyntax : ExpressionSyntax +{ + private SyntaxNode? arguments; + + internal TupleExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? expression; + } + + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).openParenToken, Position, 0); - internal AwaitExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public SeparatedSyntaxList Arguments + { + get { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// SyntaxToken representing the kind "await" keyword. - public SyntaxToken AwaitKeyword => new SyntaxToken(this, ((InternalSyntax.AwaitExpressionSyntax)this.Green).awaitKeyword, Position, 0); - - /// ExpressionSyntax representing the operand of the "await" operator. - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.TupleExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAwaitExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTupleExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTupleExpression(this); - public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression) + public TupleExpressionSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { - if (awaitKeyword != this.AwaitKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TupleExpression(openParenToken, arguments, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AwaitExpressionSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(awaitKeyword, this.Expression); - public AwaitExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.AwaitKeyword, expression); + return this; } - /// Class which represents the syntax node for postfix unary expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - public sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? operand; + public TupleExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); + public TupleExpressionSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); + public TupleExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); - internal PostfixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TupleExpressionSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +} + +/// Class which represents the syntax node for prefix unary expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class PrefixUnaryExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? operand; - /// ExpressionSyntax representing the operand of the postfix unary expression. - public ExpressionSyntax Operand => GetRedAtZero(ref this.operand)!; + internal PrefixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the kind of the operator of the postfix unary expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.PostfixUnaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the kind of the operator of the prefix unary expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.PrefixUnaryExpressionSyntax)this.Green).operatorToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.operand)! : null; + /// ExpressionSyntax representing the operand of the prefix unary expression. + public ExpressionSyntax Operand => GetRed(ref this.operand, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.operand : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.operand, 1)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPostfixUnaryExpression(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.operand : null; - public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken) - { - if (operand != this.Operand || operatorToken != this.OperatorToken) - { - var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind(), operand, operatorToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrefixUnaryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrefixUnaryExpression(this); - return this; + public PrefixUnaryExpressionSyntax Update(SyntaxToken operatorToken, ExpressionSyntax operand) + { + if (operatorToken != this.OperatorToken || operand != this.Operand) + { + var newNode = SyntaxFactory.PrefixUnaryExpression(this.Kind(), operatorToken, operand); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PostfixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(operand, this.OperatorToken); - public PostfixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Operand, operatorToken); + return this; } - /// Class which represents the syntax node for member access expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; - private SimpleNameSyntax? name; + public PrefixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Operand); + public PrefixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(this.OperatorToken, operand); +} - internal MemberAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for an "await" expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AwaitExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - /// ExpressionSyntax node representing the object that the member belongs to. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal AwaitExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the kind of the operator in the member access expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.MemberAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the kind "await" keyword. + public SyntaxToken AwaitKeyword => new SyntaxToken(this, ((InternalSyntax.AwaitExpressionSyntax)this.Green).awaitKeyword, Position, 0); - /// SimpleNameSyntax node representing the member being accessed. - public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; + /// ExpressionSyntax representing the operand of the "await" operator. + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.name, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.name, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberAccessExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAwaitExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAwaitExpression(this); - public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + public AwaitExpressionSyntax Update(SyntaxToken awaitKeyword, ExpressionSyntax expression) + { + if (awaitKeyword != this.AwaitKeyword || expression != this.Expression) { - if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name) - { - var newNode = SyntaxFactory.MemberAccessExpression(this.Kind(), expression, operatorToken, name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.AwaitExpression(awaitKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public MemberAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.Name); - public MemberAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.Name); - public MemberAccessExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.Expression, this.OperatorToken, name); + return this; } - /// Class which represents the syntax node for conditional access expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; - private ExpressionSyntax? whenNotNull; + public AwaitExpressionSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(awaitKeyword, this.Expression); + public AwaitExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.AwaitKeyword, expression); +} - internal ConditionalAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for postfix unary expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +public sealed partial class PostfixUnaryExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? operand; - /// ExpressionSyntax node representing the object conditionally accessed. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal PostfixUnaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the question mark. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.ConditionalAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + /// ExpressionSyntax representing the operand of the postfix unary expression. + public ExpressionSyntax Operand => GetRedAtZero(ref this.operand)!; - /// ExpressionSyntax node representing the access expression to be executed when the object is not null. - public ExpressionSyntax WhenNotNull => GetRed(ref this.whenNotNull, 2)!; + /// SyntaxToken representing the kind of the operator of the postfix unary expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.PostfixUnaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.whenNotNull, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.operand)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.whenNotNull, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.operand : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalAccessExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPostfixUnaryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPostfixUnaryExpression(this); - public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) + public PostfixUnaryExpressionSyntax Update(ExpressionSyntax operand, SyntaxToken operatorToken) + { + if (operand != this.Operand || operatorToken != this.OperatorToken) { - if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull) - { - var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.PostfixUnaryExpression(this.Kind(), operand, operatorToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ConditionalAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.WhenNotNull); - public ConditionalAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.WhenNotNull); - public ConditionalAccessExpressionSyntax WithWhenNotNull(ExpressionSyntax whenNotNull) => Update(this.Expression, this.OperatorToken, whenNotNull); + return this; } - /// Class which represents the syntax node for member binding expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax - { - private SimpleNameSyntax? name; + public PostfixUnaryExpressionSyntax WithOperand(ExpressionSyntax operand) => Update(operand, this.OperatorToken); + public PostfixUnaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Operand, operatorToken); +} - internal MemberBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for member access expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class MemberAccessExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private SimpleNameSyntax? name; - /// SyntaxToken representing dot. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.MemberBindingExpressionSyntax)this.Green).operatorToken, Position, 0); + internal MemberAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SimpleNameSyntax node representing the member being bound to. - public SimpleNameSyntax Name => GetRed(ref this.name, 1)!; + /// ExpressionSyntax node representing the object that the member belongs to. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; + /// SyntaxToken representing the kind of the operator in the member access expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.MemberAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + /// SimpleNameSyntax node representing the member being accessed. + public SimpleNameSyntax Name => GetRed(ref this.name, 2)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberBindingExpression(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.name, 2)!, + _ => null, + }; - public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (operatorToken != this.OperatorToken || name != this.Name) - { - var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.expression, + 2 => this.name, + _ => null, + }; - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberAccessExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberAccessExpression(this); + + public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) + { + if (expression != this.Expression || operatorToken != this.OperatorToken || name != this.Name) + { + var newNode = SyntaxFactory.MemberAccessExpression(this.Kind(), expression, operatorToken, name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public MemberBindingExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Name); - public MemberBindingExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.OperatorToken, name); + return this; } - /// Class which represents the syntax node for element binding expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax - { - private BracketedArgumentListSyntax? argumentList; + public MemberAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.Name); + public MemberAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.Name); + public MemberAccessExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.Expression, this.OperatorToken, name); +} - internal ElementBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for conditional access expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConditionalAccessExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private ExpressionSyntax? whenNotNull; - /// BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. - public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; + internal ConditionalAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; + /// ExpressionSyntax node representing the object conditionally accessed. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; + /// SyntaxToken representing the question mark. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.ConditionalAccessExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementBindingExpression(this); + /// ExpressionSyntax node representing the access expression to be executed when the object is not null. + public ExpressionSyntax WhenNotNull => GetRed(ref this.whenNotNull, 2)!; - public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ElementBindingExpression(argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.whenNotNull, 2)!, + _ => null, + }; - public ElementBindingExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 2 => this.whenNotNull, + _ => null, + }; - public ElementBindingExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalAccessExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalAccessExpression(this); - /// Class which represents the syntax node for a range expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RangeExpressionSyntax : ExpressionSyntax + public ConditionalAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) { - private ExpressionSyntax? leftOperand; - private ExpressionSyntax? rightOperand; - - internal RangeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression || operatorToken != this.OperatorToken || whenNotNull != this.WhenNotNull) { + var newNode = SyntaxFactory.ConditionalAccessExpression(expression, operatorToken, whenNotNull); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ExpressionSyntax node representing the expression on the left of the range operator. - public ExpressionSyntax? LeftOperand => GetRedAtZero(ref this.leftOperand); + return this; + } - /// SyntaxToken representing the operator of the range expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.RangeExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); + public ConditionalAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.OperatorToken, this.WhenNotNull); + public ConditionalAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Expression, operatorToken, this.WhenNotNull); + public ConditionalAccessExpressionSyntax WithWhenNotNull(ExpressionSyntax whenNotNull) => Update(this.Expression, this.OperatorToken, whenNotNull); +} - /// ExpressionSyntax node representing the expression on the right of the range operator. - public ExpressionSyntax? RightOperand => GetRed(ref this.rightOperand, 2); +/// Class which represents the syntax node for member binding expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class MemberBindingExpressionSyntax : ExpressionSyntax +{ + private SimpleNameSyntax? name; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.leftOperand), - 2 => GetRed(ref this.rightOperand, 2), - _ => null, - }; + internal MemberBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.leftOperand, - 2 => this.rightOperand, - _ => null, - }; + /// SyntaxToken representing dot. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.MemberBindingExpressionSyntax)this.Green).operatorToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRangeExpression(this); + /// SimpleNameSyntax node representing the member being bound to. + public SimpleNameSyntax Name => GetRed(ref this.name, 1)!; - public RangeExpressionSyntax Update(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) - { - if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand) - { - var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; - public RangeExpressionSyntax WithLeftOperand(ExpressionSyntax? leftOperand) => Update(leftOperand, this.OperatorToken, this.RightOperand); - public RangeExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.LeftOperand, operatorToken, this.RightOperand); - public RangeExpressionSyntax WithRightOperand(ExpressionSyntax? rightOperand) => Update(this.LeftOperand, this.OperatorToken, rightOperand); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMemberBindingExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMemberBindingExpression(this); - /// Class which represents the syntax node for implicit element access expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax + public MemberBindingExpressionSyntax Update(SyntaxToken operatorToken, SimpleNameSyntax name) { - private BracketedArgumentListSyntax? argumentList; - - internal ImplicitElementAccessSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (operatorToken != this.OperatorToken || name != this.Name) { + var newNode = SyntaxFactory.MemberBindingExpression(operatorToken, name); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. - public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; + public MemberBindingExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Name); + public MemberBindingExpressionSyntax WithName(SimpleNameSyntax name) => Update(this.OperatorToken, name); +} - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; +/// Class which represents the syntax node for element binding expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ElementBindingExpressionSyntax : ExpressionSyntax +{ + private BracketedArgumentListSyntax? argumentList; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitElementAccess(this); + internal ElementBindingExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList) - { - if (argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ImplicitElementAccess(argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// BracketedArgumentListSyntax node representing the list of arguments of the element binding expression. + public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; - public ImplicitElementAccessSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; - public ImplicitElementAccessSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementBindingExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementBindingExpression(this); - /// Class which represents an expression that has a binary operator. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class BinaryExpressionSyntax : ExpressionSyntax + public ElementBindingExpressionSyntax Update(BracketedArgumentListSyntax argumentList) { - private ExpressionSyntax? left; - private ExpressionSyntax? right; - - internal BinaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (argumentList != this.ArgumentList) { + var newNode = SyntaxFactory.ElementBindingExpression(argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ExpressionSyntax node representing the expression on the left of the binary operator. - public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; - - /// SyntaxToken representing the operator of the binary expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.BinaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - - /// ExpressionSyntax node representing the expression on the right of the binary operator. - public ExpressionSyntax Right => GetRed(ref this.right, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.left, - 2 => this.right, - _ => null, - }; + public ElementBindingExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryExpression(this); + public ElementBindingExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} - public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) - { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.BinaryExpression(this.Kind(), left, operatorToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// Class which represents the syntax node for a range expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RangeExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? leftOperand; + private ExpressionSyntax? rightOperand; - return this; - } + internal RangeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public BinaryExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); - public BinaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); - public BinaryExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); - } - - /// Class which represents an expression that has an assignment operator. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class AssignmentExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? left; - private ExpressionSyntax? right; - - internal AssignmentExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// ExpressionSyntax node representing the expression on the left of the assignment operator. - public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; - - /// SyntaxToken representing the operator of the assignment expression. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.AssignmentExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - - /// ExpressionSyntax node representing the expression on the right of the assignment operator. - public ExpressionSyntax Right => GetRed(ref this.right, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + /// ExpressionSyntax node representing the expression on the left of the range operator. + public ExpressionSyntax? LeftOperand => GetRedAtZero(ref this.leftOperand); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.left, - 2 => this.right, - _ => null, - }; + /// SyntaxToken representing the operator of the range expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.RangeExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAssignmentExpression(this); + /// ExpressionSyntax node representing the expression on the right of the range operator. + public ExpressionSyntax? RightOperand => GetRed(ref this.rightOperand, 2); - public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.AssignmentExpression(this.Kind(), left, operatorToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.leftOperand), + 2 => GetRed(ref this.rightOperand, 2), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.leftOperand, + 2 => this.rightOperand, + _ => null, + }; - public AssignmentExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); - public AssignmentExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); - public AssignmentExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRangeExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRangeExpression(this); - /// Class which represents the syntax node for conditional expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConditionalExpressionSyntax : ExpressionSyntax + public RangeExpressionSyntax Update(ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) { - private ExpressionSyntax? condition; - private ExpressionSyntax? whenTrue; - private ExpressionSyntax? whenFalse; - - internal ConditionalExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (leftOperand != this.LeftOperand || operatorToken != this.OperatorToken || rightOperand != this.RightOperand) { + var newNode = SyntaxFactory.RangeExpression(leftOperand, operatorToken, rightOperand); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ExpressionSyntax node representing the condition of the conditional expression. - public ExpressionSyntax Condition => GetRedAtZero(ref this.condition)!; + return this; + } - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken => new SyntaxToken(this, ((InternalSyntax.ConditionalExpressionSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); + public RangeExpressionSyntax WithLeftOperand(ExpressionSyntax? leftOperand) => Update(leftOperand, this.OperatorToken, this.RightOperand); + public RangeExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.LeftOperand, operatorToken, this.RightOperand); + public RangeExpressionSyntax WithRightOperand(ExpressionSyntax? rightOperand) => Update(this.LeftOperand, this.OperatorToken, rightOperand); +} - /// ExpressionSyntax node representing the expression to be executed when the condition is true. - public ExpressionSyntax WhenTrue => GetRed(ref this.whenTrue, 2)!; +/// Class which represents the syntax node for implicit element access expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ImplicitElementAccessSyntax : ExpressionSyntax +{ + private BracketedArgumentListSyntax? argumentList; - /// SyntaxToken representing the colon. - public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.ConditionalExpressionSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); + internal ImplicitElementAccessSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// ExpressionSyntax node representing the expression to be executed when the condition is false. - public ExpressionSyntax WhenFalse => GetRed(ref this.whenFalse, 4)!; + /// BracketedArgumentListSyntax node representing the list of arguments of the implicit element access expression. + public BracketedArgumentListSyntax ArgumentList => GetRedAtZero(ref this.argumentList)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.condition)!, - 2 => GetRed(ref this.whenTrue, 2)!, - 4 => GetRed(ref this.whenFalse, 4)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.argumentList)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.condition, - 2 => this.whenTrue, - 4 => this.whenFalse, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.argumentList : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitElementAccess(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitElementAccess(this); - public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) + public ImplicitElementAccessSyntax Update(BracketedArgumentListSyntax argumentList) + { + if (argumentList != this.ArgumentList) { - if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse) - { - var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ImplicitElementAccess(argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ConditionalExpressionSyntax WithCondition(ExpressionSyntax condition) => Update(condition, this.QuestionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.Condition, questionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithWhenTrue(ExpressionSyntax whenTrue) => Update(this.Condition, this.QuestionToken, whenTrue, this.ColonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Condition, this.QuestionToken, this.WhenTrue, colonToken, this.WhenFalse); - public ConditionalExpressionSyntax WithWhenFalse(ExpressionSyntax whenFalse) => Update(this.Condition, this.QuestionToken, this.WhenTrue, this.ColonToken, whenFalse); + return this; } - /// Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. - public abstract partial class InstanceExpressionSyntax : ExpressionSyntax + public ImplicitElementAccessSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(argumentList); + + public ImplicitElementAccessSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} + +/// Class which represents an expression that has a binary operator. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class BinaryExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? left; + private ExpressionSyntax? right; + + internal BinaryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal InstanceExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } } - /// Class which represents the syntax node for a this expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax - { + /// ExpressionSyntax node representing the expression on the left of the binary operator. + public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; - internal ThisExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the operator of the binary expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.BinaryExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken representing the this keyword. - public SyntaxToken Token => new SyntaxToken(this, ((InternalSyntax.ThisExpressionSyntax)this.Green).token, Position, 0); + /// ExpressionSyntax node representing the expression on the right of the binary operator. + public ExpressionSyntax Right => GetRed(ref this.right, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.left, + 2 => this.right, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThisExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryExpression(this); - public ThisExpressionSyntax Update(SyntaxToken token) + public BinaryExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) { - if (token != this.Token) - { - var newNode = SyntaxFactory.ThisExpression(token); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.BinaryExpression(this.Kind(), left, operatorToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ThisExpressionSyntax WithToken(SyntaxToken token) => Update(token); + return this; } - /// Class which represents the syntax node for a base expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax - { + public BinaryExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); + public BinaryExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); + public BinaryExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); +} - internal BaseExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents an expression that has an assignment operator. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class AssignmentExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? left; + private ExpressionSyntax? right; - /// SyntaxToken representing the base keyword. - public SyntaxToken Token => new SyntaxToken(this, ((InternalSyntax.BaseExpressionSyntax)this.Green).token, Position, 0); + internal AssignmentExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + /// ExpressionSyntax node representing the expression on the left of the assignment operator. + public ExpressionSyntax Left => GetRedAtZero(ref this.left)!; - internal override SyntaxNode? GetCachedSlot(int index) => null; + /// SyntaxToken representing the operator of the assignment expression. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.AssignmentExpressionSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseExpression(this); + /// ExpressionSyntax node representing the expression on the right of the assignment operator. + public ExpressionSyntax Right => GetRed(ref this.right, 2)!; + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - public BaseExpressionSyntax Update(SyntaxToken token) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (token != this.Token) - { - var newNode = SyntaxFactory.BaseExpression(token); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.left, + 2 => this.right, + _ => null, + }; - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAssignmentExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAssignmentExpression(this); + + public AssignmentExpressionSyntax Update(ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) + { + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) + { + var newNode = SyntaxFactory.AssignmentExpression(this.Kind(), left, operatorToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public BaseExpressionSyntax WithToken(SyntaxToken token) => Update(token); + return this; } - /// Class which represents the syntax node for a literal expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class LiteralExpressionSyntax : ExpressionSyntax + public AssignmentExpressionSyntax WithLeft(ExpressionSyntax left) => Update(left, this.OperatorToken, this.Right); + public AssignmentExpressionSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); + public AssignmentExpressionSyntax WithRight(ExpressionSyntax right) => Update(this.Left, this.OperatorToken, right); +} + +/// Class which represents the syntax node for conditional expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConditionalExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? condition; + private ExpressionSyntax? whenTrue; + private ExpressionSyntax? whenFalse; + + internal ConditionalExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { + } - internal LiteralExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// ExpressionSyntax node representing the condition of the conditional expression. + public ExpressionSyntax Condition => GetRedAtZero(ref this.condition)!; - /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. - public SyntaxToken Token => new SyntaxToken(this, ((InternalSyntax.LiteralExpressionSyntax)this.Green).token, Position, 0); + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken => new SyntaxToken(this, ((InternalSyntax.ConditionalExpressionSyntax)this.Green).questionToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + /// ExpressionSyntax node representing the expression to be executed when the condition is true. + public ExpressionSyntax WhenTrue => GetRed(ref this.whenTrue, 2)!; - internal override SyntaxNode? GetCachedSlot(int index) => null; + /// SyntaxToken representing the colon. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.ConditionalExpressionSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLiteralExpression(this); + /// ExpressionSyntax node representing the expression to be executed when the condition is false. + public ExpressionSyntax WhenFalse => GetRed(ref this.whenFalse, 4)!; - public LiteralExpressionSyntax Update(SyntaxToken token) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (token != this.Token) - { - var newNode = SyntaxFactory.LiteralExpression(this.Kind(), token); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.condition)!, + 2 => GetRed(ref this.whenTrue, 2)!, + 4 => GetRed(ref this.whenFalse, 4)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.condition, + 2 => this.whenTrue, + 4 => this.whenFalse, + _ => null, + }; - public LiteralExpressionSyntax WithToken(SyntaxToken token) => Update(token); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConditionalExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConditionalExpression(this); - /// Class which represents the syntax node for MakeRef expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class MakeRefExpressionSyntax : ExpressionSyntax + public ConditionalExpressionSyntax Update(ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) { - private ExpressionSyntax? expression; - - internal MakeRefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (condition != this.Condition || questionToken != this.QuestionToken || whenTrue != this.WhenTrue || colonToken != this.ColonToken || whenFalse != this.WhenFalse) { + var newNode = SyntaxFactory.ConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the MakeRefKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).keyword, Position, 0); - - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + return this; + } - /// Argument of the primary function. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + public ConditionalExpressionSyntax WithCondition(ExpressionSyntax condition) => Update(condition, this.QuestionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.Condition, questionToken, this.WhenTrue, this.ColonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithWhenTrue(ExpressionSyntax whenTrue) => Update(this.Condition, this.QuestionToken, whenTrue, this.ColonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Condition, this.QuestionToken, this.WhenTrue, colonToken, this.WhenFalse); + public ConditionalExpressionSyntax WithWhenFalse(ExpressionSyntax whenFalse) => Update(this.Condition, this.QuestionToken, this.WhenTrue, this.ColonToken, whenFalse); +} - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); +/// Provides the base class from which the classes that represent instance expression syntax nodes are derived. This is an abstract class. +public abstract partial class InstanceExpressionSyntax : ExpressionSyntax +{ + internal InstanceExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; +/// Class which represents the syntax node for a this expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ThisExpressionSyntax : InstanceExpressionSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; + internal ThisExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMakeRefExpression(this); + /// SyntaxToken representing the this keyword. + public SyntaxToken Token => new SyntaxToken(this, ((InternalSyntax.ThisExpressionSyntax)this.Green).token, Position, 0); - public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public MakeRefExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); - public MakeRefExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); - public MakeRefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); - public MakeRefExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThisExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThisExpression(this); - /// Class which represents the syntax node for RefType expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RefTypeExpressionSyntax : ExpressionSyntax + public ThisExpressionSyntax Update(SyntaxToken token) { - private ExpressionSyntax? expression; - - internal RefTypeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (token != this.Token) { + var newNode = SyntaxFactory.ThisExpression(token); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the RefTypeKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).keyword, Position, 0); - - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - - /// Argument of the primary function. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + return this; + } - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + public ThisExpressionSyntax WithToken(SyntaxToken token) => Update(token); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; +/// Class which represents the syntax node for a base expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BaseExpressionSyntax : InstanceExpressionSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; + internal BaseExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefTypeExpression(this); + /// SyntaxToken representing the base keyword. + public SyntaxToken Token => new SyntaxToken(this, ((InternalSyntax.BaseExpressionSyntax)this.Green).token, Position, 0); - public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public RefTypeExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); - public RefTypeExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); - public RefTypeExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); - public RefTypeExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseExpression(this); - /// Class which represents the syntax node for RefValue expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RefValueExpressionSyntax : ExpressionSyntax + public BaseExpressionSyntax Update(SyntaxToken token) { - private ExpressionSyntax? expression; - private TypeSyntax? type; - - internal RefValueExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (token != this.Token) { + var newNode = SyntaxFactory.BaseExpression(token); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the RefValueKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).keyword, Position, 0); - - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + return this; + } - /// Typed reference expression. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + public BaseExpressionSyntax WithToken(SyntaxToken token) => Update(token); +} - /// Comma separating the arguments. - public SyntaxToken Comma => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).comma, GetChildPosition(3), GetChildIndex(3)); +/// Class which represents the syntax node for a literal expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class LiteralExpressionSyntax : ExpressionSyntax +{ - /// The type of the value. - public TypeSyntax Type => GetRed(ref this.type, 4)!; + internal LiteralExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).closeParenToken, GetChildPosition(5), GetChildIndex(5)); + /// SyntaxToken representing the keyword corresponding to the kind of the literal expression. + public SyntaxToken Token => new SyntaxToken(this, ((InternalSyntax.LiteralExpressionSyntax)this.Green).token, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 2 => GetRed(ref this.expression, 2)!, - 4 => GetRed(ref this.type, 4)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.expression, - 4 => this.type, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefValueExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLiteralExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLiteralExpression(this); - public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) + public LiteralExpressionSyntax Update(SyntaxToken token) + { + if (token != this.Token) { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.LiteralExpression(this.Kind(), token); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public RefValueExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.Comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithComma(SyntaxToken comma) => Update(this.Keyword, this.OpenParenToken, this.Expression, comma, this.Type, this.CloseParenToken); - public RefValueExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, type, this.CloseParenToken); - public RefValueExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, closeParenToken); + return this; } - /// Class which represents the syntax node for Checked or Unchecked expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class CheckedExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; + public LiteralExpressionSyntax WithToken(SyntaxToken token) => Update(token); +} - internal CheckedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for MakeRef expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class MakeRefExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - /// SyntaxToken representing the checked or unchecked keyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).keyword, Position, 0); + internal MakeRefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the MakeRefKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).keyword, Position, 0); - /// Argument of the primary function. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// Argument of the primary function. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.MakeRefExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedExpression(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; - public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CheckedExpression(this.Kind(), keyword, openParenToken, expression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMakeRefExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMakeRefExpression(this); - return this; + public MakeRefExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.MakeRefExpression(keyword, openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public CheckedExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); - public CheckedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); - public CheckedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); - public CheckedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); + return this; } - /// Class which represents the syntax node for Default expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DefaultExpressionSyntax : ExpressionSyntax - { - private TypeSyntax? type; + public MakeRefExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); + public MakeRefExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); + public MakeRefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); + public MakeRefExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); +} - internal DefaultExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for RefType expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RefTypeExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + + internal RefTypeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the DefaultKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).keyword, Position, 0); + /// SyntaxToken representing the RefTypeKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).keyword, Position, 0); - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - /// Argument of the primary function. - public TypeSyntax Type => GetRed(ref this.type, 2)!; + /// Argument of the primary function. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.RefTypeExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefTypeExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefTypeExpression(this); - public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + public RefTypeExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.RefTypeExpression(keyword, openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public DefaultExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); - public DefaultExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); - public DefaultExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); - public DefaultExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); + return this; } - /// Class which represents the syntax node for TypeOf expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeOfExpressionSyntax : ExpressionSyntax - { - private TypeSyntax? type; + public RefTypeExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); + public RefTypeExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); + public RefTypeExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); + public RefTypeExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); +} - internal TypeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Class which represents the syntax node for RefValue expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RefValueExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private TypeSyntax? type; - /// SyntaxToken representing the TypeOfKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).keyword, Position, 0); + internal RefValueExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing the RefValueKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).keyword, Position, 0); - /// The expression to return type of. - public TypeSyntax Type => GetRed(ref this.type, 2)!; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// Typed reference expression. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + /// Comma separating the arguments. + public SyntaxToken Comma => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).comma, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + /// The type of the value. + public TypeSyntax Type => GetRed(ref this.type, 4)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeOfExpression(this); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.RefValueExpressionSyntax)this.Green).closeParenToken, GetChildPosition(5), GetChildIndex(5)); - public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 2 => GetRed(ref this.expression, 2)!, + 4 => GetRed(ref this.type, 4)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 2 => this.expression, + 4 => this.type, + _ => null, + }; - public TypeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); - public TypeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); - public TypeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); - public TypeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefValueExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefValueExpression(this); - /// Class which represents the syntax node for SizeOf expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SizeOfExpressionSyntax : ExpressionSyntax + public RefValueExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) { - private TypeSyntax? type; - - internal SizeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || comma != this.Comma || type != this.Type || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.RefValueExpression(keyword, openParenToken, expression, comma, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the SizeOfKeyword. - public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).keyword, Position, 0); + return this; + } + + public RefValueExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.Comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.Comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithComma(SyntaxToken comma) => Update(this.Keyword, this.OpenParenToken, this.Expression, comma, this.Type, this.CloseParenToken); + public RefValueExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, type, this.CloseParenToken); + public RefValueExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, this.Comma, this.Type, closeParenToken); +} - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); +/// Class which represents the syntax node for Checked or Unchecked expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class CheckedExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - /// Argument of the primary function. - public TypeSyntax Type => GetRed(ref this.type, 2)!; + internal CheckedExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// SyntaxToken representing the checked or unchecked keyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).keyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + /// Argument of the primary function. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSizeOfExpression(this); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CheckedExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) - { - if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.expression, 2)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.expression : null; - public SizeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); - public SizeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); - public SizeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); - public SizeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedExpression(this); - /// Class which represents the syntax node for invocation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InvocationExpressionSyntax : ExpressionSyntax + public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) { - private ExpressionSyntax? expression; - private ArgumentListSyntax? argumentList; - - internal InvocationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.CheckedExpression(this.Kind(), keyword, openParenToken, expression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ExpressionSyntax node representing the expression part of the invocation. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + return this; + } - /// ArgumentListSyntax node representing the list of arguments of the invocation expression. - public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + public CheckedExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Expression, this.CloseParenToken); + public CheckedExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Expression, this.CloseParenToken); + public CheckedExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.Keyword, this.OpenParenToken, expression, this.CloseParenToken); + public CheckedExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Expression, closeParenToken); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 1 => GetRed(ref this.argumentList, 1)!, - _ => null, - }; +/// Class which represents the syntax node for Default expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DefaultExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.argumentList, - _ => null, - }; + internal DefaultExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInvocationExpression(this); + /// SyntaxToken representing the DefaultKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).keyword, Position, 0); - public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList) - { - if (expression != this.Expression || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.InvocationExpression(expression, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - return this; - } + /// Argument of the primary function. + public TypeSyntax Type => GetRed(ref this.type, 2)!; - public InvocationExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); - public InvocationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Expression, argumentList); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.DefaultExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - public InvocationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - /// Class which represents the syntax node for element access expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; - private BracketedArgumentListSyntax? argumentList; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultExpression(this); - internal ElementAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) + { + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ExpressionSyntax node representing the expression which is accessing the element. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + return this; + } - /// BracketedArgumentListSyntax node representing the list of arguments of the element access expression. - public BracketedArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + public DefaultExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); + public DefaultExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); + public DefaultExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); + public DefaultExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 1 => GetRed(ref this.argumentList, 1)!, - _ => null, - }; +/// Class which represents the syntax node for TypeOf expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeOfExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 1 => this.argumentList, - _ => null, - }; + internal TypeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementAccessExpression(this); + /// SyntaxToken representing the TypeOfKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).keyword, Position, 0); - public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) - { - if (expression != this.Expression || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - public ElementAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); - public ElementAccessExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(this.Expression, argumentList); + /// The expression to return type of. + public TypeSyntax Type => GetRed(ref this.type, 2)!; - public ElementAccessExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); - } + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.TypeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - /// Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. - public abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode - { - internal BaseArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. - public abstract SeparatedSyntaxList Arguments { get; } - public BaseArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => WithArgumentsCore(arguments); - internal abstract BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - public BaseArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => AddArgumentsCore(items); - internal abstract BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeOfExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeOfExpression(this); - /// Class which represents the syntax node for the list of arguments. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArgumentListSyntax : BaseArgumentListSyntax + public TypeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) { - private SyntaxNode? arguments; - - internal ArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.TypeOfExpression(keyword, openParenToken, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); + return this; + } - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override SeparatedSyntaxList Arguments - { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public TypeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); + public TypeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); + public TypeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); + public TypeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); +} + +/// Class which represents the syntax node for SizeOf expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SizeOfExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; - /// SyntaxToken representing close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + internal SizeOfExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + /// SyntaxToken representing the SizeOfKeyword. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).keyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgumentList(this); + /// Argument of the primary function. + public TypeSyntax Type => GetRed(ref this.type, 2)!; - public ArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.SizeOfExpressionSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - public ArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); - internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); - public new ArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); - public ArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); - public new ArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSizeOfExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSizeOfExpression(this); - /// Class which represents the syntax node for bracketed argument list. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax + public SizeOfExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) { - private SyntaxNode? arguments; - - internal BracketedArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.SizeOfExpression(keyword, openParenToken, type, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); + return this; + } - /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. - public override SeparatedSyntaxList Arguments - { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public SizeOfExpressionSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.OpenParenToken, this.Type, this.CloseParenToken); + public SizeOfExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.Keyword, openParenToken, this.Type, this.CloseParenToken); + public SizeOfExpressionSyntax WithType(TypeSyntax type) => Update(this.Keyword, this.OpenParenToken, type, this.CloseParenToken); + public SizeOfExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.Keyword, this.OpenParenToken, this.Type, closeParenToken); +} - /// SyntaxToken representing close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); +/// Class which represents the syntax node for invocation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InvocationExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private ArgumentListSyntax? argumentList; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + internal InvocationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + /// ExpressionSyntax node representing the expression part of the invocation. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedArgumentList(this); + /// ArgumentListSyntax node representing the list of arguments of the invocation expression. + public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.expression)!, + 1 => GetRed(ref this.argumentList, 1)!, + _ => null, + }; - return this; - } - - public BracketedArgumentListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Arguments, this.CloseBracketToken); - internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); - public new BracketedArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenBracketToken, arguments, this.CloseBracketToken); - public BracketedArgumentListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Arguments, closeBracketToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 1 => this.argumentList, + _ => null, + }; - internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); - public new BracketedArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInvocationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInvocationExpression(this); - /// Class which represents the syntax node for argument. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArgumentSyntax : CSharpSyntaxNode + public InvocationExpressionSyntax Update(ExpressionSyntax expression, ArgumentListSyntax argumentList) { - private NameColonSyntax? nameColon; - private ExpressionSyntax? expression; - - internal ArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression || argumentList != this.ArgumentList) { + var newNode = SyntaxFactory.InvocationExpression(expression, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// NameColonSyntax node representing the optional name arguments. - public NameColonSyntax? NameColon => GetRedAtZero(ref this.nameColon); + return this; + } - /// SyntaxToken representing the optional ref or out keyword. - public SyntaxToken RefKindKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public InvocationExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); + public InvocationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Expression, argumentList); - /// ExpressionSyntax node representing the argument. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + public InvocationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} + +/// Class which represents the syntax node for element access expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ElementAccessExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private BracketedArgumentListSyntax? argumentList; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.nameColon), - 2 => GetRed(ref this.expression, 2)!, - _ => null, - }; + internal ElementAccessExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.nameColon, - 2 => this.expression, - _ => null, - }; + /// ExpressionSyntax node representing the expression which is accessing the element. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgument(this); + /// BracketedArgumentListSyntax node representing the list of arguments of the element access expression. + public BracketedArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - public ArgumentSyntax Update(NameColonSyntax? nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.expression)!, + 1 => GetRed(ref this.argumentList, 1)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 1 => this.argumentList, + _ => null, + }; - public ArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(nameColon, this.RefKindKeyword, this.Expression); - public ArgumentSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(this.NameColon, refKindKeyword, this.Expression); - public ArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameColon, this.RefKindKeyword, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElementAccessExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElementAccessExpression(this); - public abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode + public ElementAccessExpressionSyntax Update(ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) { - internal BaseExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression || argumentList != this.ArgumentList) { + var newNode = SyntaxFactory.ElementAccessExpression(expression, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract ExpressionSyntax Expression { get; } - public BaseExpressionColonSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); - internal abstract BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression); + return this; + } + + public ElementAccessExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ArgumentList); + public ElementAccessExpressionSyntax WithArgumentList(BracketedArgumentListSyntax argumentList) => Update(this.Expression, argumentList); + + public ElementAccessExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} - public abstract SyntaxToken ColonToken { get; } - public BaseExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); - internal abstract BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken); +/// Provides the base class from which the classes that represent argument list syntax nodes are derived. This is an abstract class. +public abstract partial class BaseArgumentListSyntax : CSharpSyntaxNode +{ + internal BaseArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax + /// SeparatedSyntaxList of ArgumentSyntax nodes representing the list of arguments. + public abstract SeparatedSyntaxList Arguments { get; } + public BaseArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => WithArgumentsCore(arguments); + internal abstract BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments); + + public BaseArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => AddArgumentsCore(items); + internal abstract BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items); +} + +/// Class which represents the syntax node for the list of arguments. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArgumentListSyntax : BaseArgumentListSyntax +{ + private SyntaxNode? arguments; + + internal ArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? expression; + } - internal ExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// SyntaxToken representing open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ArgumentListSyntax)this.Green).openParenToken, Position, 0); + + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public override SeparatedSyntaxList Arguments + { + get { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - public override ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - - public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.ExpressionColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionColon(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgumentList(this); - public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken) + public ArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) { - if (expression != this.Expression || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.ExpressionColon(expression, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ArgumentList(openParenToken, arguments, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); - public new ExpressionColonSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ColonToken); - internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new ExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Expression, colonToken); + return this; } - /// Class which represents the syntax node for name colon syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NameColonSyntax : BaseExpressionColonSyntax + public ArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); + internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); + public new ArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); + public ArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); + + internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); + public new ArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +} + +/// Class which represents the syntax node for bracketed argument list. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BracketedArgumentListSyntax : BaseArgumentListSyntax +{ + private SyntaxNode? arguments; + + internal BracketedArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private IdentifierNameSyntax? name; + } - internal NameColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// SyntaxToken representing open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).openBracketToken, Position, 0); + + /// SeparatedSyntaxList of ArgumentSyntax representing the list of arguments. + public override SeparatedSyntaxList Arguments + { + get { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// IdentifierNameSyntax representing the identifier name. - public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; - - /// SyntaxToken representing colon. - public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.NameColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + /// SyntaxToken representing close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedArgumentListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameColon(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedArgumentList(this); - public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken) + public BracketedArgumentListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList arguments, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || arguments != this.Arguments || closeBracketToken != this.CloseBracketToken) { - if (name != this.Name || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.NameColon(name, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.BracketedArgumentList(openBracketToken, arguments, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public NameColonSyntax WithName(IdentifierNameSyntax name) => Update(name, this.ColonToken); - internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new NameColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Name, colonToken); + return this; } - /// Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DeclarationExpressionSyntax : ExpressionSyntax - { - private TypeSyntax? type; - private VariableDesignationSyntax? designation; + public BracketedArgumentListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Arguments, this.CloseBracketToken); + internal override BaseArgumentListSyntax WithArgumentsCore(SeparatedSyntaxList arguments) => WithArguments(arguments); + public new BracketedArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenBracketToken, arguments, this.CloseBracketToken); + public BracketedArgumentListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Arguments, closeBracketToken); - internal DeclarationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override BaseArgumentListSyntax AddArgumentsCore(params ArgumentSyntax[] items) => AddArguments(items); + public new BracketedArgumentListSyntax AddArguments(params ArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +} - public TypeSyntax Type => GetRedAtZero(ref this.type)!; +/// Class which represents the syntax node for argument. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArgumentSyntax : CSharpSyntaxNode +{ + private NameColonSyntax? nameColon; + private ExpressionSyntax? expression; - /// Declaration representing the variable declared in an out parameter or deconstruction. - public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; + internal ArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.designation, 1)!, - _ => null, - }; + /// NameColonSyntax node representing the optional name arguments. + public NameColonSyntax? NameColon => GetRedAtZero(ref this.nameColon); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.designation, - _ => null, - }; + /// SyntaxToken representing the optional ref or out keyword. + public SyntaxToken RefKindKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.ArgumentSyntax)this.Green).refKindKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationExpression(this); + /// ExpressionSyntax node representing the argument. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; - public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (type != this.Type || designation != this.Designation) - { - var newNode = SyntaxFactory.DeclarationExpression(type, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.nameColon), + 2 => GetRed(ref this.expression, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.nameColon, + 2 => this.expression, + _ => null, + }; - public DeclarationExpressionSyntax WithType(TypeSyntax type) => Update(type, this.Designation); - public DeclarationExpressionSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArgument(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArgument(this); - /// Class which represents the syntax node for cast expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CastExpressionSyntax : ExpressionSyntax + public ArgumentSyntax Update(NameColonSyntax? nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression) { - private TypeSyntax? type; - private ExpressionSyntax? expression; - - internal CastExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (nameColon != this.NameColon || refKindKeyword != this.RefKindKeyword || expression != this.Expression) { + var newNode = SyntaxFactory.Argument(nameColon, refKindKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the open parenthesis. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CastExpressionSyntax)this.Green).openParenToken, Position, 0); + return this; + } + + public ArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(nameColon, this.RefKindKeyword, this.Expression); + public ArgumentSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(this.NameColon, refKindKeyword, this.Expression); + public ArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameColon, this.RefKindKeyword, expression); +} + +public abstract partial class BaseExpressionColonSyntax : CSharpSyntaxNode +{ + internal BaseExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// TypeSyntax node representing the type to which the expression is being cast. - public TypeSyntax Type => GetRed(ref this.type, 1)!; + public abstract ExpressionSyntax Expression { get; } + public BaseExpressionColonSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); + internal abstract BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression); - /// SyntaxToken representing the close parenthesis. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CastExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public abstract SyntaxToken ColonToken { get; } + public BaseExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); + internal abstract BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken); +} - /// ExpressionSyntax node representing the expression that is being casted. - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ExpressionColonSyntax : BaseExpressionColonSyntax +{ + private ExpressionSyntax? expression; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1)!, - 3 => GetRed(ref this.expression, 3)!, - _ => null, - }; + internal ExpressionColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 3 => this.expression, - _ => null, - }; + public override ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCastExpression(this); + public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.ExpressionColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) - { - if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression) - { - var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public CastExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.CloseParenToken, this.Expression); - public CastExpressionSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.CloseParenToken, this.Expression); - public CastExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, closeParenToken, this.Expression); - public CastExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, this.Type, this.CloseParenToken, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionColon(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionColon(this); - /// Provides the base class from which the classes that represent anonymous function expressions are derived. - public abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax + public ExpressionColonSyntax Update(ExpressionSyntax expression, SyntaxToken colonToken) { - internal AnonymousFunctionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression || colonToken != this.ColonToken) { + var newNode = SyntaxFactory.ExpressionColon(expression, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxTokenList Modifiers { get; } - public AnonymousFunctionExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); - internal abstract AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers); + return this; + } - public AnonymousFunctionExpressionSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); - internal abstract AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items); + internal override BaseExpressionColonSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); + public new ExpressionColonSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.ColonToken); + internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new ExpressionColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Expression, colonToken); +} - /// - /// BlockSyntax node representing the body of the anonymous function. - /// Only one of Block or ExpressionBody will be non-null. - /// - public abstract BlockSyntax? Block { get; } - public AnonymousFunctionExpressionSyntax WithBlock(BlockSyntax? block) => WithBlockCore(block); - internal abstract AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block); +/// Class which represents the syntax node for name colon syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NameColonSyntax : BaseExpressionColonSyntax +{ + private IdentifierNameSyntax? name; - public AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); - internal abstract AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items); + internal NameColonSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); - internal abstract AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items); + /// IdentifierNameSyntax representing the identifier name. + public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; - /// - /// ExpressionSyntax node representing the body of the anonymous function. - /// Only one of Block or ExpressionBody will be non-null. - /// - public abstract ExpressionSyntax? ExpressionBody { get; } - public AnonymousFunctionExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); - internal abstract AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody); - } + /// SyntaxToken representing colon. + public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.NameColonSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - /// Class which represents the syntax node for anonymous method expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax - { - private ParameterListSyntax? parameterList; - private BlockSyntax? block; - private ExpressionSyntax? expressionBody; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - internal AnonymousMethodExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - public override SyntaxTokenList Modifiers + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameColon(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameColon(this); + + public NameColonSyntax Update(IdentifierNameSyntax name, SyntaxToken colonToken) + { + if (name != this.Name || colonToken != this.ColonToken) { - get - { - var slot = this.Green.GetSlot(0); - return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; - } + var newNode = SyntaxFactory.NameColon(name, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the delegate keyword. - public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); - - /// List of parameters of the anonymous method expression, or null if there no parameters are specified. - public ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 2); + return this; + } - /// - /// BlockSyntax node representing the body of the anonymous function. - /// This will never be null. - /// - public override BlockSyntax Block => GetRed(ref this.block, 3)!; + public NameColonSyntax WithName(IdentifierNameSyntax name) => Update(name, this.ColonToken); + internal override BaseExpressionColonSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new NameColonSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Name, colonToken); +} - /// - /// Inherited from AnonymousFunctionExpressionSyntax, but not used for - /// AnonymousMethodExpressionSyntax. This will always be null. - /// - public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); +/// Class which represents the syntax node for the variable declaration in an out var declaration or a deconstruction declaration. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DeclarationExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; + private VariableDesignationSyntax? designation; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 2 => GetRed(ref this.parameterList, 2), - 3 => GetRed(ref this.block, 3)!, - 4 => GetRed(ref this.expressionBody, 4), - _ => null, - }; + internal DeclarationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.parameterList, - 3 => this.block, - 4 => this.expressionBody, - _ => null, - }; + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousMethodExpression(this); + /// Declaration representing the variable declared in an out parameter or deconstruction. + public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; - public AnonymousMethodExpressionSyntax Update(SyntaxTokenList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.designation, 1)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.designation, + _ => null, + }; - internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new AnonymousMethodExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(modifiers, this.DelegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); - public AnonymousMethodExpressionSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.Modifiers, delegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); - public AnonymousMethodExpressionSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.Modifiers, this.DelegateKeyword, parameterList, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block ?? throw new ArgumentNullException(nameof(block))); - public new AnonymousMethodExpressionSyntax WithBlock(BlockSyntax block) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new AnonymousMethodExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, this.Block, expressionBody); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationExpression(this); - internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new AnonymousMethodExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public AnonymousMethodExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) + public DeclarationExpressionSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + { + if (type != this.Type || designation != this.Designation) { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + var newNode = SyntaxFactory.DeclarationExpression(type, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); - public new AnonymousMethodExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); - public new AnonymousMethodExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); + + return this; } - /// Provides the base class from which the classes that represent lambda expressions are derived. - public abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax - { - internal LambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public DeclarationExpressionSyntax WithType(TypeSyntax type) => Update(type, this.Designation); + public DeclarationExpressionSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); +} - public abstract SyntaxList AttributeLists { get; } - public LambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists); +/// Class which represents the syntax node for cast expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CastExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; + private ExpressionSyntax? expression; - public LambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + internal CastExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing equals greater than. - public abstract SyntaxToken ArrowToken { get; } - public LambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => WithArrowTokenCore(arrowToken); - internal abstract LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken); + /// SyntaxToken representing the open parenthesis. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CastExpressionSyntax)this.Green).openParenToken, Position, 0); - public new LambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => (LambdaExpressionSyntax)WithModifiersCore(modifiers); - public new LambdaExpressionSyntax WithBlock(BlockSyntax? block) => (LambdaExpressionSyntax)WithBlockCore(block); - public new LambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => (LambdaExpressionSyntax)WithExpressionBodyCore(expressionBody); + /// TypeSyntax node representing the type to which the expression is being cast. + public TypeSyntax Type => GetRed(ref this.type, 1)!; - public new LambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => (LambdaExpressionSyntax)AddModifiersCore(items); + /// SyntaxToken representing the close parenthesis. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CastExpressionSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - public new AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); - - public new AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); - } - - /// Class which represents the syntax node for a simple lambda expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax - { - private SyntaxNode? attributeLists; - private ParameterSyntax? parameter; - private BlockSyntax? block; - private ExpressionSyntax? expressionBody; + /// ExpressionSyntax node representing the expression that is being casted. + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - internal SimpleLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } + 1 => GetRed(ref this.type, 1)!, + 3 => GetRed(ref this.expression, 3)!, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 3 => this.expression, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCastExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCastExpression(this); - public override SyntaxTokenList Modifiers + public CastExpressionSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) + { + if (openParenToken != this.OpenParenToken || type != this.Type || closeParenToken != this.CloseParenToken || expression != this.Expression) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.CastExpression(openParenToken, type, closeParenToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// ParameterSyntax node representing the parameter of the lambda expression. - public ParameterSyntax Parameter => GetRed(ref this.parameter, 2)!; + return this; + } - /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => new SyntaxToken(this, ((InternalSyntax.SimpleLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(3), GetChildIndex(3)); + public CastExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.CloseParenToken, this.Expression); + public CastExpressionSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.CloseParenToken, this.Expression); + public CastExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, closeParenToken, this.Expression); + public CastExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenParenToken, this.Type, this.CloseParenToken, expression); +} - /// - /// BlockSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override BlockSyntax? Block => GetRed(ref this.block, 4); +/// Provides the base class from which the classes that represent anonymous function expressions are derived. +public abstract partial class AnonymousFunctionExpressionSyntax : ExpressionSyntax +{ + internal AnonymousFunctionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// - /// ExpressionSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 5); + public abstract SyntaxTokenList Modifiers { get; } + public AnonymousFunctionExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); + internal abstract AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.parameter, 2)!, - 4 => GetRed(ref this.block, 4), - 5 => GetRed(ref this.expressionBody, 5), - _ => null, - }; + public AnonymousFunctionExpressionSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); + internal abstract AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.parameter, - 4 => this.block, - 5 => this.expressionBody, - _ => null, - }; + /// + /// BlockSyntax node representing the body of the anonymous function. + /// Only one of Block or ExpressionBody will be non-null. + /// + public abstract BlockSyntax? Block { get; } + public AnonymousFunctionExpressionSyntax WithBlock(BlockSyntax? block) => WithBlockCore(block); + internal abstract AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleLambdaExpression(this); + public AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); + internal abstract AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items); - public SimpleLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); + internal abstract AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items); - return this; - } + /// + /// ExpressionSyntax node representing the body of the anonymous function. + /// Only one of Block or ExpressionBody will be non-null. + /// + public abstract ExpressionSyntax? ExpressionBody { get; } + public AnonymousFunctionExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); + internal abstract AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody); +} - internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new SimpleLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new SimpleLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); - public SimpleLambdaExpressionSyntax WithParameter(ParameterSyntax parameter) => Update(this.AttributeLists, this.Modifiers, parameter, this.ArrowToken, this.Block, this.ExpressionBody); - internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); - public new SimpleLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.Parameter, arrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); - public new SimpleLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new SimpleLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, expressionBody); +/// Class which represents the syntax node for anonymous method expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AnonymousMethodExpressionSyntax : AnonymousFunctionExpressionSyntax +{ + private ParameterListSyntax? parameterList; + private BlockSyntax? block; + private ExpressionSyntax? expressionBody; - internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new SimpleLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new SimpleLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public SimpleLambdaExpressionSyntax AddParameterAttributeLists(params AttributeListSyntax[] items) => WithParameter(this.Parameter.WithAttributeLists(this.Parameter.AttributeLists.AddRange(items))); - public SimpleLambdaExpressionSyntax AddParameterModifiers(params SyntaxToken[] items) => WithParameter(this.Parameter.WithModifiers(this.Parameter.Modifiers.AddRange(items))); - internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); - public new SimpleLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) - { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); - } - internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); - public new SimpleLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) - { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithStatements(block.Statements.AddRange(items))); - } + internal AnonymousMethodExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RefExpressionSyntax : ExpressionSyntax + public override SyntaxTokenList Modifiers { - private ExpressionSyntax? expression; - - internal RefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = this.Green.GetSlot(0); + return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; } + } - public SyntaxToken RefKeyword => new SyntaxToken(this, ((InternalSyntax.RefExpressionSyntax)this.Green).refKeyword, Position, 0); + /// SyntaxToken representing the delegate keyword. + public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((InternalSyntax.AnonymousMethodExpressionSyntax)this.Green).delegateKeyword, GetChildPosition(1), GetChildIndex(1)); - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + /// List of parameters of the anonymous method expression, or null if there no parameters are specified. + public ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 2); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + /// + /// BlockSyntax node representing the body of the anonymous function. + /// This will never be null. + /// + public override BlockSyntax Block => GetRed(ref this.block, 3)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + /// + /// Inherited from AnonymousFunctionExpressionSyntax, but not used for + /// AnonymousMethodExpressionSyntax. This will always be null. + /// + public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefExpression(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 2 => GetRed(ref this.parameterList, 2), + 3 => GetRed(ref this.block, 3)!, + 4 => GetRed(ref this.expressionBody, 4), + _ => null, + }; - public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (refKeyword != this.RefKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.RefExpression(refKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 2 => this.parameterList, + 3 => this.block, + 4 => this.expressionBody, + _ => null, + }; - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousMethodExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousMethodExpression(this); + + public AnonymousMethodExpressionSyntax Update(SyntaxTokenList modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) + { + if (modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || parameterList != this.ParameterList || block != this.Block || expressionBody != this.ExpressionBody) + { + var newNode = SyntaxFactory.AnonymousMethodExpression(modifiers, delegateKeyword, parameterList, block, expressionBody); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public RefExpressionSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.Expression); - public RefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.RefKeyword, expression); + return this; } - /// Class which represents the syntax node for parenthesized lambda expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax + internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new AnonymousMethodExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(modifiers, this.DelegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); + public AnonymousMethodExpressionSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.Modifiers, delegateKeyword, this.ParameterList, this.Block, this.ExpressionBody); + public AnonymousMethodExpressionSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.Modifiers, this.DelegateKeyword, parameterList, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block ?? throw new ArgumentNullException(nameof(block))); + public new AnonymousMethodExpressionSyntax WithBlock(BlockSyntax block) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new AnonymousMethodExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.Modifiers, this.DelegateKeyword, this.ParameterList, this.Block, expressionBody); + + internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new AnonymousMethodExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public AnonymousMethodExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) { - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private ParameterListSyntax? parameterList; - private BlockSyntax? block; - private ExpressionSyntax? expressionBody; + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); + public new AnonymousMethodExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); + public new AnonymousMethodExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); +} - internal ParenthesizedLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// Provides the base class from which the classes that represent lambda expressions are derived. +public abstract partial class LambdaExpressionSyntax : AnonymousFunctionExpressionSyntax +{ + internal LambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public abstract SyntaxList AttributeLists { get; } + public LambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists); - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public LambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items); - public TypeSyntax? ReturnType => GetRed(ref this.returnType, 2); + /// SyntaxToken representing equals greater than. + public abstract SyntaxToken ArrowToken { get; } + public LambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => WithArrowTokenCore(arrowToken); + internal abstract LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken); - /// ParameterListSyntax node representing the list of parameters for the lambda expression. - public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; + public new LambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => (LambdaExpressionSyntax)WithModifiersCore(modifiers); + public new LambdaExpressionSyntax WithBlock(BlockSyntax? block) => (LambdaExpressionSyntax)WithBlockCore(block); + public new LambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => (LambdaExpressionSyntax)WithExpressionBodyCore(expressionBody); - /// SyntaxToken representing equals greater than. - public override SyntaxToken ArrowToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(4), GetChildIndex(4)); + public new LambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => (LambdaExpressionSyntax)AddModifiersCore(items); - /// - /// BlockSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override BlockSyntax? Block => GetRed(ref this.block, 5); + public new AnonymousFunctionExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => AddBlockAttributeListsCore(items); - /// - /// ExpressionSyntax node representing the body of the lambda. - /// Only one of Block or ExpressionBody will be non-null. - /// - public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); + public new AnonymousFunctionExpressionSyntax AddBlockStatements(params StatementSyntax[] items) => AddBlockStatementsCore(items); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2), - 3 => GetRed(ref this.parameterList, 3)!, - 5 => GetRed(ref this.block, 5), - 6 => GetRed(ref this.expressionBody, 6), - _ => null, - }; +/// Class which represents the syntax node for a simple lambda expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SimpleLambdaExpressionSyntax : LambdaExpressionSyntax +{ + private SyntaxNode? attributeLists; + private ParameterSyntax? parameter; + private BlockSyntax? block; + private ExpressionSyntax? expressionBody; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.returnType, - 3 => this.parameterList, - 5 => this.block, - 6 => this.expressionBody, - _ => null, - }; + internal SimpleLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedLambdaExpression(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public ParenthesizedLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + public override SyntaxTokenList Modifiers + { + get { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) - { - var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } + + /// ParameterSyntax node representing the parameter of the lambda expression. + public ParameterSyntax Parameter => GetRed(ref this.parameter, 2)!; + + /// SyntaxToken representing equals greater than. + public override SyntaxToken ArrowToken => new SyntaxToken(this, ((InternalSyntax.SimpleLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(3), GetChildIndex(3)); + + /// + /// BlockSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override BlockSyntax? Block => GetRed(ref this.block, 4); - internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ParenthesizedLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ParenthesizedLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); - public ParenthesizedLambdaExpressionSyntax WithReturnType(TypeSyntax? returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); - public ParenthesizedLambdaExpressionSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, parameterList, this.ArrowToken, this.Block, this.ExpressionBody); - internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); - public new ParenthesizedLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, arrowToken, this.Block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); - public new ParenthesizedLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, block, this.ExpressionBody); - internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new ParenthesizedLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, expressionBody); + /// + /// ExpressionSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 5); - internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ParenthesizedLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ParenthesizedLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public ParenthesizedLambdaExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); - public new ParenthesizedLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); - } - internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); - public new ParenthesizedLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.parameter, 2)!, + 4 => GetRed(ref this.block, 4), + 5 => GetRed(ref this.expressionBody, 5), + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - var block = this.Block ?? SyntaxFactory.Block(); - return WithBlock(block.WithStatements(block.Statements.AddRange(items))); - } - } + 0 => this.attributeLists, + 2 => this.parameter, + 4 => this.block, + 5 => this.expressionBody, + _ => null, + }; - /// Class which represents the syntax node for initializer expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class InitializerExpressionSyntax : ExpressionSyntax - { - private SyntaxNode? expressions; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleLambdaExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleLambdaExpression(this); - internal InitializerExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SimpleLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || parameter != this.Parameter || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) { + var newNode = SyntaxFactory.SimpleLambdaExpression(attributeLists, modifiers, parameter, arrowToken, block, expressionBody); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); + return this; + } - /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. - public SeparatedSyntaxList Expressions - { - get - { - var red = GetRed(ref this.expressions, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new SimpleLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new SimpleLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Parameter, this.ArrowToken, this.Block, this.ExpressionBody); + public SimpleLambdaExpressionSyntax WithParameter(ParameterSyntax parameter) => Update(this.AttributeLists, this.Modifiers, parameter, this.ArrowToken, this.Block, this.ExpressionBody); + internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); + public new SimpleLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.Parameter, arrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); + public new SimpleLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new SimpleLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Parameter, this.ArrowToken, this.Block, expressionBody); - /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new SimpleLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new SimpleLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public SimpleLambdaExpressionSyntax AddParameterAttributeLists(params AttributeListSyntax[] items) => WithParameter(this.Parameter.WithAttributeLists(this.Parameter.AttributeLists.AddRange(items))); + public SimpleLambdaExpressionSyntax AddParameterModifiers(params SyntaxToken[] items) => WithParameter(this.Parameter.WithModifiers(this.Parameter.Modifiers.AddRange(items))); + internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); + public new SimpleLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) + { + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); + } + internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); + public new SimpleLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) + { + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithStatements(block.Statements.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expressions, 1)! : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RefExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expressions : null; + internal RefExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInitializerExpression(this); + public SyntaxToken RefKeyword => new SyntaxToken(this, ((InternalSyntax.RefExpressionSyntax)this.Green).refKeyword, Position, 0); - public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) - { - if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.InitializerExpression(this.Kind(), openBraceToken, expressions, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - public InitializerExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expressions, this.CloseBraceToken); - public InitializerExpressionSyntax WithExpressions(SeparatedSyntaxList expressions) => Update(this.OpenBraceToken, expressions, this.CloseBraceToken); - public InitializerExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expressions, closeBraceToken); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public InitializerExpressionSyntax AddExpressions(params ExpressionSyntax[] items) => WithExpressions(this.Expressions.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRefExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRefExpression(this); - public abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax + public RefExpressionSyntax Update(SyntaxToken refKeyword, ExpressionSyntax expression) { - internal BaseObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (refKeyword != this.RefKeyword || expression != this.Expression) { + var newNode = SyntaxFactory.RefExpression(refKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the new keyword. - public abstract SyntaxToken NewKeyword { get; } - public BaseObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => WithNewKeywordCore(newKeyword); - internal abstract BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword); + return this; + } - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public abstract ArgumentListSyntax? ArgumentList { get; } - public BaseObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => WithArgumentListCore(argumentList); - internal abstract BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList); + public RefExpressionSyntax WithRefKeyword(SyntaxToken refKeyword) => Update(refKeyword, this.Expression); + public RefExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.RefKeyword, expression); +} - public BaseObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => AddArgumentListArgumentsCore(items); - internal abstract BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items); +/// Class which represents the syntax node for parenthesized lambda expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParenthesizedLambdaExpressionSyntax : LambdaExpressionSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private ParameterListSyntax? parameterList; + private BlockSyntax? block; + private ExpressionSyntax? expressionBody; - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public abstract InitializerExpressionSyntax? Initializer { get; } - public BaseObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => WithInitializerCore(initializer); - internal abstract BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer); + internal ParenthesizedLambdaExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents the syntax node for implicit object creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax - { - private ArgumentListSyntax? argumentList; - private InitializerExpressionSyntax? initializer; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal ImplicitObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ImplicitObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public override ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + public TypeSyntax? ReturnType => GetRed(ref this.returnType, 2); - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); + /// ParameterListSyntax node representing the list of parameters for the lambda expression. + public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.argumentList, 1)!, - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; + /// SyntaxToken representing equals greater than. + public override SyntaxToken ArrowToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedLambdaExpressionSyntax)this.Green).arrowToken, GetChildPosition(4), GetChildIndex(4)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.argumentList, - 2 => this.initializer, - _ => null, - }; + /// + /// BlockSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override BlockSyntax? Block => GetRed(ref this.block, 5); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitObjectCreationExpression(this); + /// + /// ExpressionSyntax node representing the body of the lambda. + /// Only one of Block or ExpressionBody will be non-null. + /// + public override ExpressionSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2), + 3 => GetRed(ref this.parameterList, 3)!, + 5 => GetRed(ref this.block, 5), + 6 => GetRed(ref this.expressionBody, 6), + _ => null, + }; - internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); - public new ImplicitObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.ArgumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList ?? throw new ArgumentNullException(nameof(argumentList))); - public new ImplicitObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.NewKeyword, argumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); - public new ImplicitObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.ArgumentList, initializer); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.returnType, + 3 => this.parameterList, + 5 => this.block, + 6 => this.expressionBody, + _ => null, + }; - internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); - public new ImplicitObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedLambdaExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedLambdaExpression(this); - /// Class which represents the syntax node for object creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax + public ParenthesizedLambdaExpressionSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) { - private TypeSyntax? type; - private ArgumentListSyntax? argumentList; - private InitializerExpressionSyntax? initializer; - - internal ObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || parameterList != this.ParameterList || arrowToken != this.ArrowToken || block != this.Block || expressionBody != this.ExpressionBody) { + var newNode = SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, arrowToken, block, expressionBody); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the new keyword. - public override SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - - /// TypeSyntax representing the type of the object being created. - public TypeSyntax Type => GetRed(ref this.type, 1)!; + return this; + } - /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. - public override ArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 2); + internal override LambdaExpressionSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ParenthesizedLambdaExpressionSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ParenthesizedLambdaExpressionSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); + public ParenthesizedLambdaExpressionSyntax WithReturnType(TypeSyntax? returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ParameterList, this.ArrowToken, this.Block, this.ExpressionBody); + public ParenthesizedLambdaExpressionSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, parameterList, this.ArrowToken, this.Block, this.ExpressionBody); + internal override LambdaExpressionSyntax WithArrowTokenCore(SyntaxToken arrowToken) => WithArrowToken(arrowToken); + public new ParenthesizedLambdaExpressionSyntax WithArrowToken(SyntaxToken arrowToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, arrowToken, this.Block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithBlockCore(BlockSyntax? block) => WithBlock(block); + public new ParenthesizedLambdaExpressionSyntax WithBlock(BlockSyntax? block) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, block, this.ExpressionBody); + internal override AnonymousFunctionExpressionSyntax WithExpressionBodyCore(ExpressionSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new ParenthesizedLambdaExpressionSyntax WithExpressionBody(ExpressionSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ParameterList, this.ArrowToken, this.Block, expressionBody); - /// InitializerExpressionSyntax representing the initializer expression for the object being created. - public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 3); + internal override LambdaExpressionSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ParenthesizedLambdaExpressionSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override AnonymousFunctionExpressionSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ParenthesizedLambdaExpressionSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public ParenthesizedLambdaExpressionSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override AnonymousFunctionExpressionSyntax AddBlockAttributeListsCore(params AttributeListSyntax[] items) => AddBlockAttributeLists(items); + public new ParenthesizedLambdaExpressionSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) + { + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithAttributeLists(block.AttributeLists.AddRange(items))); + } + internal override AnonymousFunctionExpressionSyntax AddBlockStatementsCore(params StatementSyntax[] items) => AddBlockStatements(items); + public new ParenthesizedLambdaExpressionSyntax AddBlockStatements(params StatementSyntax[] items) + { + var block = this.Block ?? SyntaxFactory.Block(); + return WithBlock(block.WithStatements(block.Statements.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1)!, - 2 => GetRed(ref this.argumentList, 2), - 3 => GetRed(ref this.initializer, 3), - _ => null, - }; +/// Class which represents the syntax node for initializer expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class InitializerExpressionSyntax : ExpressionSyntax +{ + private SyntaxNode? expressions; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 2 => this.argumentList, - 3 => this.initializer, - _ => null, - }; + internal InitializerExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitObjectCreationExpression(this); + /// SyntaxToken representing the open brace. + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).openBraceToken, Position, 0); - public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) + /// SeparatedSyntaxList of ExpressionSyntax representing the list of expressions in the initializer expression. + public SeparatedSyntaxList Expressions + { + get { - if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.expressions, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); - public new ObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.ArgumentList, this.Initializer); - public ObjectCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.NewKeyword, type, this.ArgumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList); - public new ObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => Update(this.NewKeyword, this.Type, argumentList, this.Initializer); - internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); - public new ObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, this.ArgumentList, initializer); + /// SyntaxToken representing the close brace. + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.InitializerExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); - internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); - public new ObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) - { - var argumentList = this.ArgumentList ?? SyntaxFactory.ArgumentList(); - return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); - } - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expressions, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class WithExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; - private InitializerExpressionSyntax? initializer; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expressions : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInitializerExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInitializerExpression(this); - internal WithExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public InitializerExpressionSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList expressions, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || expressions != this.Expressions || closeBraceToken != this.CloseBraceToken) { + var newNode = SyntaxFactory.InitializerExpression(this.Kind(), openBraceToken, expressions, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + return this; + } - public SyntaxToken WithKeyword => new SyntaxToken(this, ((InternalSyntax.WithExpressionSyntax)this.Green).withKeyword, GetChildPosition(1), GetChildIndex(1)); + public InitializerExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expressions, this.CloseBraceToken); + public InitializerExpressionSyntax WithExpressions(SeparatedSyntaxList expressions) => Update(this.OpenBraceToken, expressions, this.CloseBraceToken); + public InitializerExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expressions, closeBraceToken); - /// InitializerExpressionSyntax representing the initializer expression for the with expression. - public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 2)!; + public InitializerExpressionSyntax AddExpressions(params ExpressionSyntax[] items) => WithExpressions(this.Expressions.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.initializer, 2)!, - _ => null, - }; +public abstract partial class BaseObjectCreationExpressionSyntax : ExpressionSyntax +{ + internal BaseObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.initializer, - _ => null, - }; + /// SyntaxToken representing the new keyword. + public abstract SyntaxToken NewKeyword { get; } + public BaseObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => WithNewKeywordCore(newKeyword); + internal abstract BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWithExpression(this); + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public abstract ArgumentListSyntax? ArgumentList { get; } + public BaseObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => WithArgumentListCore(argumentList); + internal abstract BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList); - public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) - { - if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer) - { - var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public BaseObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => AddArgumentListArgumentsCore(items); + internal abstract BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items); - return this; - } + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public abstract InitializerExpressionSyntax? Initializer { get; } + public BaseObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => WithInitializerCore(initializer); + internal abstract BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer); +} - public WithExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.WithKeyword, this.Initializer); - public WithExpressionSyntax WithWithKeyword(SyntaxToken withKeyword) => Update(this.Expression, withKeyword, this.Initializer); - public WithExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.Expression, this.WithKeyword, initializer); +/// Class which represents the syntax node for implicit object creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ImplicitObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax +{ + private ArgumentListSyntax? argumentList; + private InitializerExpressionSyntax? initializer; - public WithExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); + internal ImplicitObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode - { - private NameEqualsSyntax? nameEquals; - private ExpressionSyntax? expression; + /// SyntaxToken representing the new keyword. + public override SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ImplicitObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - internal AnonymousObjectMemberDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public override ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - /// NameEqualsSyntax representing the optional name of the member being initialized. - public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); - /// ExpressionSyntax representing the value the member is initialized with. - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.nameEquals), - 1 => GetRed(ref this.expression, 1)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.argumentList, 1)!, + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.nameEquals, - 1 => this.expression, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.argumentList, + 2 => this.initializer, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectMemberDeclarator(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitObjectCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitObjectCreationExpression(this); - public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) + public ImplicitObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) + { + if (newKeyword != this.NewKeyword || argumentList != this.ArgumentList || initializer != this.Initializer) { - if (nameEquals != this.NameEquals || expression != this.Expression) - { - var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ImplicitObjectCreationExpression(newKeyword, argumentList, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AnonymousObjectMemberDeclaratorSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.Expression); - public AnonymousObjectMemberDeclaratorSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, expression); + return this; } - /// Class which represents the syntax node for anonymous object creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax - { - private SyntaxNode? initializers; - - internal AnonymousObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); + public new ImplicitObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.ArgumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList ?? throw new ArgumentNullException(nameof(argumentList))); + public new ImplicitObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.NewKeyword, argumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); + public new ImplicitObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.ArgumentList, initializer); - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); + public new ImplicitObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} - /// SyntaxToken representing the open brace. - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); +/// Class which represents the syntax node for object creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ObjectCreationExpressionSyntax : BaseObjectCreationExpressionSyntax +{ + private TypeSyntax? type; + private ArgumentListSyntax? argumentList; + private InitializerExpressionSyntax? initializer; - /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. - public SeparatedSyntaxList Initializers - { - get - { - var red = GetRed(ref this.initializers, 2); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; - } - } + internal ObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// SyntaxToken representing the close brace. - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); + /// SyntaxToken representing the new keyword. + public override SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.initializers, 2)! : null; + /// TypeSyntax representing the type of the object being created. + public TypeSyntax Type => GetRed(ref this.type, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.initializers : null; + /// ArgumentListSyntax representing the list of arguments passed as part of the object creation expression. + public override ArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 2); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectCreationExpression(this); + /// InitializerExpressionSyntax representing the initializer expression for the object being created. + public override InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 3); - public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 1 => GetRed(ref this.type, 1)!, + 2 => GetRed(ref this.argumentList, 2), + 3 => GetRed(ref this.initializer, 3), + _ => null, + }; - public AnonymousObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBraceToken, this.Initializers, this.CloseBraceToken); - public AnonymousObjectCreationExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.NewKeyword, openBraceToken, this.Initializers, this.CloseBraceToken); - public AnonymousObjectCreationExpressionSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.NewKeyword, this.OpenBraceToken, initializers, this.CloseBraceToken); - public AnonymousObjectCreationExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.NewKeyword, this.OpenBraceToken, this.Initializers, closeBraceToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 2 => this.argumentList, + 3 => this.initializer, + _ => null, + }; - public AnonymousObjectCreationExpressionSyntax AddInitializers(params AnonymousObjectMemberDeclaratorSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitObjectCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitObjectCreationExpression(this); - /// Class which represents the syntax node for array creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax + public ObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) { - private ArrayTypeSyntax? type; - private InitializerExpressionSyntax? initializer; - - internal ArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (newKeyword != this.NewKeyword || type != this.Type || argumentList != this.ArgumentList || initializer != this.Initializer) { + var newNode = SyntaxFactory.ObjectCreationExpression(newKeyword, type, argumentList, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); + return this; + } - /// ArrayTypeSyntax node representing the type of the array. - public ArrayTypeSyntax Type => GetRed(ref this.type, 1)!; + internal override BaseObjectCreationExpressionSyntax WithNewKeywordCore(SyntaxToken newKeyword) => WithNewKeyword(newKeyword); + public new ObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.ArgumentList, this.Initializer); + public ObjectCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.NewKeyword, type, this.ArgumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithArgumentListCore(ArgumentListSyntax? argumentList) => WithArgumentList(argumentList); + public new ObjectCreationExpressionSyntax WithArgumentList(ArgumentListSyntax? argumentList) => Update(this.NewKeyword, this.Type, argumentList, this.Initializer); + internal override BaseObjectCreationExpressionSyntax WithInitializerCore(InitializerExpressionSyntax? initializer) => WithInitializer(initializer); + public new ObjectCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, this.ArgumentList, initializer); - /// InitializerExpressionSyntax node representing the initializer of the array creation expression. - public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); + internal override BaseObjectCreationExpressionSyntax AddArgumentListArgumentsCore(params ArgumentSyntax[] items) => AddArgumentListArguments(items); + public new ObjectCreationExpressionSyntax AddArgumentListArguments(params ArgumentSyntax[] items) + { + var argumentList = this.ArgumentList ?? SyntaxFactory.ArgumentList(); + return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1)!, - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class WithExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private InitializerExpressionSyntax? initializer; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 2 => this.initializer, - _ => null, - }; + internal WithExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayCreationExpression(this); + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) - { - if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken WithKeyword => new SyntaxToken(this, ((InternalSyntax.WithExpressionSyntax)this.Green).withKeyword, GetChildPosition(1), GetChildIndex(1)); - return this; - } + /// InitializerExpressionSyntax representing the initializer expression for the with expression. + public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 2)!; - public ArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.Initializer); - public ArrayCreationExpressionSyntax WithType(ArrayTypeSyntax type) => Update(this.NewKeyword, type, this.Initializer); - public ArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, initializer); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.initializer, 2)!, + _ => null, + }; - public ArrayCreationExpressionSyntax AddTypeRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithType(this.Type.WithRankSpecifiers(this.Type.RankSpecifiers.AddRange(items))); - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 2 => this.initializer, + _ => null, + }; - /// Class which represents the syntax node for implicit array creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax - { - private InitializerExpressionSyntax? initializer; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWithExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWithExpression(this); - internal ImplicitArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public WithExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) + { + if (expression != this.Expression || withKeyword != this.WithKeyword || initializer != this.Initializer) { + var newNode = SyntaxFactory.WithExpression(expression, withKeyword, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the new keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - - /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); + return this; + } - /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. - public SyntaxTokenList Commas - { - get - { - var slot = this.Green.GetSlot(2); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public WithExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.WithKeyword, this.Initializer); + public WithExpressionSyntax WithWithKeyword(SyntaxToken withKeyword) => Update(this.Expression, withKeyword, this.Initializer); + public WithExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.Expression, this.WithKeyword, initializer); - /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + public WithExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); +} - /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. - public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 4)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AnonymousObjectMemberDeclaratorSyntax : CSharpSyntaxNode +{ + private NameEqualsSyntax? nameEquals; + private ExpressionSyntax? expression; - internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.initializer, 4)! : null; + internal AnonymousObjectMemberDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.initializer : null; + /// NameEqualsSyntax representing the optional name of the member being initialized. + public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitArrayCreationExpression(this); + /// ExpressionSyntax representing the value the member is initialized with. + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, SyntaxTokenList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.nameEquals), + 1 => GetRed(ref this.expression, 1)!, + _ => null, + }; - public ImplicitArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.NewKeyword, openBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithCommas(SyntaxTokenList commas) => Update(this.NewKeyword, this.OpenBracketToken, commas, this.CloseBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, closeBracketToken, this.Initializer); - public ImplicitArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, initializer); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.nameEquals, + 1 => this.expression, + _ => null, + }; - public ImplicitArrayCreationExpressionSyntax AddCommas(params SyntaxToken[] items) => WithCommas(this.Commas.AddRange(items)); - public ImplicitArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectMemberDeclarator(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectMemberDeclarator(this); - /// Class which represents the syntax node for stackalloc array creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax + public AnonymousObjectMemberDeclaratorSyntax Update(NameEqualsSyntax? nameEquals, ExpressionSyntax expression) { - private TypeSyntax? type; - private InitializerExpressionSyntax? initializer; - - internal StackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (nameEquals != this.NameEquals || expression != this.Expression) { + var newNode = SyntaxFactory.AnonymousObjectMemberDeclarator(nameEquals, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((InternalSyntax.StackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); + return this; + } - /// TypeSyntax node representing the type of the stackalloc array. - public TypeSyntax Type => GetRed(ref this.type, 1)!; + public AnonymousObjectMemberDeclaratorSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.Expression); + public AnonymousObjectMemberDeclaratorSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, expression); +} - /// InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. - public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); +/// Class which represents the syntax node for anonymous object creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AnonymousObjectCreationExpressionSyntax : ExpressionSyntax +{ + private SyntaxNode? initializers; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1)!, - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; + internal AnonymousObjectCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 2 => this.initializer, - _ => null, - }; + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStackAllocArrayCreationExpression(this); + /// SyntaxToken representing the open brace. + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); - public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) + /// SeparatedSyntaxList of AnonymousObjectMemberDeclaratorSyntax representing the list of object member initializers. + public SeparatedSyntaxList Initializers + { + get { - if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer) - { - var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.initializers, 2); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; } - - public StackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.Type, this.Initializer); - public StackAllocArrayCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.StackAllocKeyword, type, this.Initializer); - public StackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.StackAllocKeyword, this.Type, initializer); } - /// Class which represents the syntax node for implicit stackalloc array creation expression. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax - { - private InitializerExpressionSyntax? initializer; + /// SyntaxToken representing the close brace. + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.AnonymousObjectCreationExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); - internal ImplicitStackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.initializers, 2)! : null; - /// SyntaxToken representing the stackalloc keyword. - public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.initializers : null; - /// SyntaxToken representing the open bracket. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAnonymousObjectCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAnonymousObjectCreationExpression(this); - /// SyntaxToken representing the close bracket. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public AnonymousObjectCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList initializers, SyntaxToken closeBraceToken) + { + if (newKeyword != this.NewKeyword || openBraceToken != this.OpenBraceToken || initializers != this.Initializers || closeBraceToken != this.CloseBraceToken) + { + var newNode = SyntaxFactory.AnonymousObjectCreationExpression(newKeyword, openBraceToken, initializers, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. - public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 3)!; + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.initializer, 3)! : null; + public AnonymousObjectCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBraceToken, this.Initializers, this.CloseBraceToken); + public AnonymousObjectCreationExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.NewKeyword, openBraceToken, this.Initializers, this.CloseBraceToken); + public AnonymousObjectCreationExpressionSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.NewKeyword, this.OpenBraceToken, initializers, this.CloseBraceToken); + public AnonymousObjectCreationExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.NewKeyword, this.OpenBraceToken, this.Initializers, closeBraceToken); - internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.initializer : null; + public AnonymousObjectCreationExpressionSyntax AddInitializers(params AnonymousObjectMemberDeclaratorSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitStackAllocArrayCreationExpression(this); +/// Class which represents the syntax node for array creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArrayCreationExpressionSyntax : ExpressionSyntax +{ + private ArrayTypeSyntax? type; + private InitializerExpressionSyntax? initializer; - public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) - { - if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) - { - var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal ArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - public ImplicitStackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, this.Initializer); - public ImplicitStackAllocArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.StackAllocKeyword, openBracketToken, this.CloseBracketToken, this.Initializer); - public ImplicitStackAllocArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.StackAllocKeyword, this.OpenBracketToken, closeBracketToken, this.Initializer); - public ImplicitStackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.StackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, initializer); + /// ArrayTypeSyntax node representing the type of the array. + public ArrayTypeSyntax Type => GetRed(ref this.type, 1)!; - public ImplicitStackAllocArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); - } + /// InitializerExpressionSyntax node representing the initializer of the array creation expression. + public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CollectionExpressionSyntax : ExpressionSyntax - { - private SyntaxNode? elements; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1)!, + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - internal CollectionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 1 => this.type, + 2 => this.initializer, + _ => null, + }; - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrayCreationExpression(this); - /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. - public SeparatedSyntaxList Elements + public ArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) + { + if (newKeyword != this.NewKeyword || type != this.Type || initializer != this.Initializer) { - get - { - var red = GetRed(ref this.elements, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ArrayCreationExpression(newKeyword, type, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; + public ArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.Type, this.Initializer); + public ArrayCreationExpressionSyntax WithType(ArrayTypeSyntax type) => Update(this.NewKeyword, type, this.Initializer); + public ArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.NewKeyword, this.Type, initializer); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCollectionExpression(this); + public ArrayCreationExpressionSyntax AddTypeRankSpecifiers(params ArrayRankSpecifierSyntax[] items) => WithType(this.Type.WithRankSpecifiers(this.Type.RankSpecifiers.AddRange(items))); +} - public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList elements, SyntaxToken closeBracketToken) - { - if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// Class which represents the syntax node for implicit array creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ImplicitArrayCreationExpressionSyntax : ExpressionSyntax +{ + private InitializerExpressionSyntax? initializer; - return this; - } + internal ImplicitArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public CollectionExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Elements, this.CloseBracketToken); - public CollectionExpressionSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenBracketToken, elements, this.CloseBracketToken); - public CollectionExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Elements, closeBracketToken); + /// SyntaxToken representing the new keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).newKeyword, Position, 0); - public CollectionExpressionSyntax AddElements(params CollectionElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); - } + /// SyntaxToken representing the open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); - public abstract partial class CollectionElementSyntax : CSharpSyntaxNode + /// SyntaxList of SyntaxToken representing the commas in the implicit array creation expression. + public SyntaxTokenList Commas { - internal CollectionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = this.Green.GetSlot(2); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ExpressionElementSyntax : CollectionElementSyntax - { - private ExpressionSyntax? expression; - - internal ExpressionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// SyntaxToken representing the close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + /// InitializerExpressionSyntax representing the initializer expression of the implicit array creation expression. + public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 4)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.initializer, 4)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.initializer : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionElement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitArrayCreationExpression(this); - public ExpressionElementSyntax Update(ExpressionSyntax expression) + public ImplicitArrayCreationExpressionSyntax Update(SyntaxToken newKeyword, SyntaxToken openBracketToken, SyntaxTokenList commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) + { + if (newKeyword != this.NewKeyword || openBracketToken != this.OpenBracketToken || commas != this.Commas || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) { - if (expression != this.Expression) - { - var newNode = SyntaxFactory.ExpressionElement(expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ImplicitArrayCreationExpression(newKeyword, openBracketToken, commas, closeBracketToken, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ExpressionElementSyntax WithExpression(ExpressionSyntax expression) => Update(expression); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SpreadElementSyntax : CollectionElementSyntax - { - private ExpressionSyntax? expression; + public ImplicitArrayCreationExpressionSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.NewKeyword, openBracketToken, this.Commas, this.CloseBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithCommas(SyntaxTokenList commas) => Update(this.NewKeyword, this.OpenBracketToken, commas, this.CloseBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, closeBracketToken, this.Initializer); + public ImplicitArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.NewKeyword, this.OpenBracketToken, this.Commas, this.CloseBracketToken, initializer); - internal SpreadElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public ImplicitArrayCreationExpressionSyntax AddCommas(params SyntaxToken[] items) => WithCommas(this.Commas.AddRange(items)); + public ImplicitArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); +} - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.SpreadElementSyntax)this.Green).operatorToken, Position, 0); +/// Class which represents the syntax node for stackalloc array creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class StackAllocArrayCreationExpressionSyntax : ExpressionSyntax +{ + private TypeSyntax? type; + private InitializerExpressionSyntax? initializer; - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + internal StackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + /// SyntaxToken representing the stackalloc keyword. + public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((InternalSyntax.StackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + /// TypeSyntax node representing the type of the stackalloc array. + public TypeSyntax Type => GetRed(ref this.type, 1)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSpreadElement(this); + /// InitializerExpressionSyntax node representing the initializer of the stackalloc array creation expression. + public InitializerExpressionSyntax? Initializer => GetRed(ref this.initializer, 2); - public SpreadElementSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (operatorToken != this.OperatorToken || expression != this.Expression) - { - var newNode = SyntaxFactory.SpreadElement(operatorToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 1 => GetRed(ref this.type, 1)!, + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 2 => this.initializer, + _ => null, + }; - public SpreadElementSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); - public SpreadElementSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStackAllocArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStackAllocArrayCreationExpression(this); - public abstract partial class QueryClauseSyntax : CSharpSyntaxNode + public StackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) { - internal QueryClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (stackAllocKeyword != this.StackAllocKeyword || type != this.Type || initializer != this.Initializer) { + var newNode = SyntaxFactory.StackAllocArrayCreationExpression(stackAllocKeyword, type, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - } - public abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode - { - internal SelectOrGroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class QueryExpressionSyntax : ExpressionSyntax - { - private FromClauseSyntax? fromClause; - private QueryBodySyntax? body; - - internal QueryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public StackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.Type, this.Initializer); + public StackAllocArrayCreationExpressionSyntax WithType(TypeSyntax type) => Update(this.StackAllocKeyword, type, this.Initializer); + public StackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax? initializer) => Update(this.StackAllocKeyword, this.Type, initializer); +} - public FromClauseSyntax FromClause => GetRedAtZero(ref this.fromClause)!; +/// Class which represents the syntax node for implicit stackalloc array creation expression. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ImplicitStackAllocArrayCreationExpressionSyntax : ExpressionSyntax +{ + private InitializerExpressionSyntax? initializer; - public QueryBodySyntax Body => GetRed(ref this.body, 1)!; + internal ImplicitStackAllocArrayCreationExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.fromClause)!, - 1 => GetRed(ref this.body, 1)!, - _ => null, - }; + /// SyntaxToken representing the stackalloc keyword. + public SyntaxToken StackAllocKeyword => new SyntaxToken(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).stackAllocKeyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.fromClause, - 1 => this.body, - _ => null, - }; + /// SyntaxToken representing the open bracket. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).openBracketToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryExpression(this); + /// SyntaxToken representing the close bracket. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ImplicitStackAllocArrayCreationExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body) - { - if (fromClause != this.FromClause || body != this.Body) - { - var newNode = SyntaxFactory.QueryExpression(fromClause, body); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// InitializerExpressionSyntax representing the initializer expression of the implicit stackalloc array creation expression. + public InitializerExpressionSyntax Initializer => GetRed(ref this.initializer, 3)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.initializer, 3)! : null; - public QueryExpressionSyntax WithFromClause(FromClauseSyntax fromClause) => Update(fromClause, this.Body); - public QueryExpressionSyntax WithBody(QueryBodySyntax body) => Update(this.FromClause, body); + internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.initializer : null; - public QueryExpressionSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitImplicitStackAllocArrayCreationExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitImplicitStackAllocArrayCreationExpression(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class QueryBodySyntax : CSharpSyntaxNode + public ImplicitStackAllocArrayCreationExpressionSyntax Update(SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) { - private SyntaxNode? clauses; - private SelectOrGroupClauseSyntax? selectOrGroup; - private QueryContinuationSyntax? continuation; - - internal QueryBodySyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (stackAllocKeyword != this.StackAllocKeyword || openBracketToken != this.OpenBracketToken || closeBracketToken != this.CloseBracketToken || initializer != this.Initializer) { + var newNode = SyntaxFactory.ImplicitStackAllocArrayCreationExpression(stackAllocKeyword, openBracketToken, closeBracketToken, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxList Clauses => new SyntaxList(GetRed(ref this.clauses, 0)); + return this; + } - public SelectOrGroupClauseSyntax SelectOrGroup => GetRed(ref this.selectOrGroup, 1)!; + public ImplicitStackAllocArrayCreationExpressionSyntax WithStackAllocKeyword(SyntaxToken stackAllocKeyword) => Update(stackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, this.Initializer); + public ImplicitStackAllocArrayCreationExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(this.StackAllocKeyword, openBracketToken, this.CloseBracketToken, this.Initializer); + public ImplicitStackAllocArrayCreationExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.StackAllocKeyword, this.OpenBracketToken, closeBracketToken, this.Initializer); + public ImplicitStackAllocArrayCreationExpressionSyntax WithInitializer(InitializerExpressionSyntax initializer) => Update(this.StackAllocKeyword, this.OpenBracketToken, this.CloseBracketToken, initializer); - public QueryContinuationSyntax? Continuation => GetRed(ref this.continuation, 2); + public ImplicitStackAllocArrayCreationExpressionSyntax AddInitializerExpressions(params ExpressionSyntax[] items) => WithInitializer(this.Initializer.WithExpressions(this.Initializer.Expressions.AddRange(items))); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.clauses)!, - 1 => GetRed(ref this.selectOrGroup, 1)!, - 2 => GetRed(ref this.continuation, 2), - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CollectionExpressionSyntax : ExpressionSyntax +{ + private SyntaxNode? elements; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.clauses, - 1 => this.selectOrGroup, - 2 => this.continuation, - _ => null, - }; + internal CollectionExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryBody(this); + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).openBracketToken, Position, 0); - public QueryBodySyntax Update(SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) + /// SeparatedSyntaxList of CollectionElementSyntax representing the list of elements in the collection expression. + public SeparatedSyntaxList Elements + { + get { - if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) - { - var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.elements, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - public QueryBodySyntax WithClauses(SyntaxList clauses) => Update(clauses, this.SelectOrGroup, this.Continuation); - public QueryBodySyntax WithSelectOrGroup(SelectOrGroupClauseSyntax selectOrGroup) => Update(this.Clauses, selectOrGroup, this.Continuation); - public QueryBodySyntax WithContinuation(QueryContinuationSyntax? continuation) => Update(this.Clauses, this.SelectOrGroup, continuation); + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.CollectionExpressionSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - public QueryBodySyntax AddClauses(params QueryClauseSyntax[] items) => WithClauses(this.Clauses.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.elements, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FromClauseSyntax : QueryClauseSyntax - { - private TypeSyntax? type; - private ExpressionSyntax? expression; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.elements : null; - internal FromClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCollectionExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCollectionExpression(this); + + public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList elements, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || elements != this.Elements || closeBracketToken != this.CloseBracketToken) { + var newNode = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken FromKeyword => new SyntaxToken(this, ((InternalSyntax.FromClauseSyntax)this.Green).fromKeyword, Position, 0); - - public TypeSyntax? Type => GetRed(ref this.type, 1); + return this; + } - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.FromClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + public CollectionExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Elements, this.CloseBracketToken); + public CollectionExpressionSyntax WithElements(SeparatedSyntaxList elements) => Update(this.OpenBracketToken, elements, this.CloseBracketToken); + public CollectionExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Elements, closeBracketToken); - public SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.FromClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); + public CollectionExpressionSyntax AddElements(params CollectionElementSyntax[] items) => WithElements(this.Elements.AddRange(items)); +} - public ExpressionSyntax Expression => GetRed(ref this.expression, 4)!; +public abstract partial class CollectionElementSyntax : CSharpSyntaxNode +{ + internal CollectionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1), - 4 => GetRed(ref this.expression, 4)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ExpressionElementSyntax : CollectionElementSyntax +{ + private ExpressionSyntax? expression; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 4 => this.expression, - _ => null, - }; + internal ExpressionElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFromClause(this); + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) - { - if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public FromClauseSyntax WithFromKeyword(SyntaxToken fromKeyword) => Update(fromKeyword, this.Type, this.Identifier, this.InKeyword, this.Expression); - public FromClauseSyntax WithType(TypeSyntax? type) => Update(this.FromKeyword, type, this.Identifier, this.InKeyword, this.Expression); - public FromClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.FromKeyword, this.Type, identifier, this.InKeyword, this.Expression); - public FromClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.FromKeyword, this.Type, this.Identifier, inKeyword, this.Expression); - public FromClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.FromKeyword, this.Type, this.Identifier, this.InKeyword, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionElement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LetClauseSyntax : QueryClauseSyntax + public ExpressionElementSyntax Update(ExpressionSyntax expression) { - private ExpressionSyntax? expression; - - internal LetClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression) { + var newNode = SyntaxFactory.ExpressionElement(expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken LetKeyword => new SyntaxToken(this, ((InternalSyntax.LetClauseSyntax)this.Green).letKeyword, Position, 0); - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.LetClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + return this; + } - public SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.LetClauseSyntax)this.Green).equalsToken, GetChildPosition(2), GetChildIndex(2)); + public ExpressionElementSyntax WithExpression(ExpressionSyntax expression) => Update(expression); +} - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SpreadElementSyntax : CollectionElementSyntax +{ + private ExpressionSyntax? expression; - internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.expression, 3)! : null; + internal SpreadElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.expression : null; + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.SpreadElementSyntax)this.Green).operatorToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLetClause(this); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) - { - if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression) - { - var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public LetClauseSyntax WithLetKeyword(SyntaxToken letKeyword) => Update(letKeyword, this.Identifier, this.EqualsToken, this.Expression); - public LetClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.LetKeyword, identifier, this.EqualsToken, this.Expression); - public LetClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.LetKeyword, this.Identifier, equalsToken, this.Expression); - public LetClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.LetKeyword, this.Identifier, this.EqualsToken, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSpreadElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSpreadElement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class JoinClauseSyntax : QueryClauseSyntax + public SpreadElementSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) { - private TypeSyntax? type; - private ExpressionSyntax? inExpression; - private ExpressionSyntax? leftExpression; - private ExpressionSyntax? rightExpression; - private JoinIntoClauseSyntax? into; - - internal JoinClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (operatorToken != this.OperatorToken || expression != this.Expression) { + var newNode = SyntaxFactory.SpreadElement(operatorToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken JoinKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).joinKeyword, Position, 0); - - public TypeSyntax? Type => GetRed(ref this.type, 1); - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); + public SpreadElementSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); + public SpreadElementSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); +} - public ExpressionSyntax InExpression => GetRed(ref this.inExpression, 4)!; +public abstract partial class QueryClauseSyntax : CSharpSyntaxNode +{ + internal QueryClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public SyntaxToken OnKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).onKeyword, GetChildPosition(5), GetChildIndex(5)); +public abstract partial class SelectOrGroupClauseSyntax : CSharpSyntaxNode +{ + internal SelectOrGroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public ExpressionSyntax LeftExpression => GetRed(ref this.leftExpression, 6)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class QueryExpressionSyntax : ExpressionSyntax +{ + private FromClauseSyntax? fromClause; + private QueryBodySyntax? body; - public SyntaxToken EqualsKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).equalsKeyword, GetChildPosition(7), GetChildIndex(7)); + internal QueryExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax RightExpression => GetRed(ref this.rightExpression, 8)!; + public FromClauseSyntax FromClause => GetRedAtZero(ref this.fromClause)!; - public JoinIntoClauseSyntax? Into => GetRed(ref this.into, 9); + public QueryBodySyntax Body => GetRed(ref this.body, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.type, 1), - 4 => GetRed(ref this.inExpression, 4)!, - 6 => GetRed(ref this.leftExpression, 6)!, - 8 => GetRed(ref this.rightExpression, 8)!, - 9 => GetRed(ref this.into, 9), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.fromClause)!, + 1 => GetRed(ref this.body, 1)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.type, - 4 => this.inExpression, - 6 => this.leftExpression, - 8 => this.rightExpression, - 9 => this.into, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.fromClause, + 1 => this.body, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryExpression(this); - public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + public QueryExpressionSyntax Update(FromClauseSyntax fromClause, QueryBodySyntax body) + { + if (fromClause != this.FromClause || body != this.Body) { - if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into) - { - var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.QueryExpression(fromClause, body); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public JoinClauseSyntax WithJoinKeyword(SyntaxToken joinKeyword) => Update(joinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithType(TypeSyntax? type) => Update(this.JoinKeyword, type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.JoinKeyword, this.Type, identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, inKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithInExpression(ExpressionSyntax inExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, inExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithOnKeyword(SyntaxToken onKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, onKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithLeftExpression(ExpressionSyntax leftExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, leftExpression, this.EqualsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithEqualsKeyword(SyntaxToken equalsKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, equalsKeyword, this.RightExpression, this.Into); - public JoinClauseSyntax WithRightExpression(ExpressionSyntax rightExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, rightExpression, this.Into); - public JoinClauseSyntax WithInto(JoinIntoClauseSyntax? into) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, into); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode - { + public QueryExpressionSyntax WithFromClause(FromClauseSyntax fromClause) => Update(fromClause, this.Body); + public QueryExpressionSyntax WithBody(QueryBodySyntax body) => Update(this.FromClause, body); - internal JoinIntoClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public QueryExpressionSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); +} - public SyntaxToken IntoKeyword => new SyntaxToken(this, ((InternalSyntax.JoinIntoClauseSyntax)this.Green).intoKeyword, Position, 0); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class QueryBodySyntax : CSharpSyntaxNode +{ + private SyntaxNode? clauses; + private SelectOrGroupClauseSyntax? selectOrGroup; + private QueryContinuationSyntax? continuation; - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.JoinIntoClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + internal QueryBodySyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxList Clauses => new SyntaxList(GetRed(ref this.clauses, 0)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SelectOrGroupClauseSyntax SelectOrGroup => GetRed(ref this.selectOrGroup, 1)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinIntoClause(this); + public QueryContinuationSyntax? Continuation => GetRed(ref this.continuation, 2); - public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (intoKeyword != this.IntoKeyword || identifier != this.Identifier) - { - var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.clauses)!, + 1 => GetRed(ref this.selectOrGroup, 1)!, + 2 => GetRed(ref this.continuation, 2), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.clauses, + 1 => this.selectOrGroup, + 2 => this.continuation, + _ => null, + }; - public JoinIntoClauseSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier); - public JoinIntoClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryBody(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryBody(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class WhereClauseSyntax : QueryClauseSyntax + public QueryBodySyntax Update(SyntaxList clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) { - private ExpressionSyntax? condition; - - internal WhereClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (clauses != this.Clauses || selectOrGroup != this.SelectOrGroup || continuation != this.Continuation) { + var newNode = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken WhereKeyword => new SyntaxToken(this, ((InternalSyntax.WhereClauseSyntax)this.Green).whereKeyword, Position, 0); - - public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; + public QueryBodySyntax WithClauses(SyntaxList clauses) => Update(clauses, this.SelectOrGroup, this.Continuation); + public QueryBodySyntax WithSelectOrGroup(SelectOrGroupClauseSyntax selectOrGroup) => Update(this.Clauses, selectOrGroup, this.Continuation); + public QueryBodySyntax WithContinuation(QueryContinuationSyntax? continuation) => Update(this.Clauses, this.SelectOrGroup, continuation); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; + public QueryBodySyntax AddClauses(params QueryClauseSyntax[] items) => WithClauses(this.Clauses.AddRange(items)); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhereClause(this); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FromClauseSyntax : QueryClauseSyntax +{ + private TypeSyntax? type; + private ExpressionSyntax? expression; - public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition) - { - if (whereKeyword != this.WhereKeyword || condition != this.Condition) - { - var newNode = SyntaxFactory.WhereClause(whereKeyword, condition); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal FromClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + public SyntaxToken FromKeyword => new SyntaxToken(this, ((InternalSyntax.FromClauseSyntax)this.Green).fromKeyword, Position, 0); - public WhereClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Condition); - public WhereClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhereKeyword, condition); - } + public TypeSyntax? Type => GetRed(ref this.type, 1); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class OrderByClauseSyntax : QueryClauseSyntax - { - private SyntaxNode? orderings; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.FromClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - internal OrderByClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.FromClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken OrderByKeyword => new SyntaxToken(this, ((InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); + public ExpressionSyntax Expression => GetRed(ref this.expression, 4)!; - public SeparatedSyntaxList Orderings + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var red = GetRed(ref this.orderings, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.orderings, 1)! : null; + 1 => GetRed(ref this.type, 1), + 4 => GetRed(ref this.expression, 4)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.orderings : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 4 => this.expression, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrderByClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFromClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFromClause(this); - public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, SeparatedSyntaxList orderings) + public FromClauseSyntax Update(SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) + { + if (fromKeyword != this.FromKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression) { - if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) - { - var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.FromClause(fromKeyword, type, identifier, inKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public OrderByClauseSyntax WithOrderByKeyword(SyntaxToken orderByKeyword) => Update(orderByKeyword, this.Orderings); - public OrderByClauseSyntax WithOrderings(SeparatedSyntaxList orderings) => Update(this.OrderByKeyword, orderings); - - public OrderByClauseSyntax AddOrderings(params OrderingSyntax[] items) => WithOrderings(this.Orderings.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class OrderingSyntax : CSharpSyntaxNode - { - private ExpressionSyntax? expression; + public FromClauseSyntax WithFromKeyword(SyntaxToken fromKeyword) => Update(fromKeyword, this.Type, this.Identifier, this.InKeyword, this.Expression); + public FromClauseSyntax WithType(TypeSyntax? type) => Update(this.FromKeyword, type, this.Identifier, this.InKeyword, this.Expression); + public FromClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.FromKeyword, this.Type, identifier, this.InKeyword, this.Expression); + public FromClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.FromKeyword, this.Type, this.Identifier, inKeyword, this.Expression); + public FromClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.FromKeyword, this.Type, this.Identifier, this.InKeyword, expression); +} - internal OrderingSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LetClauseSyntax : QueryClauseSyntax +{ + private ExpressionSyntax? expression; - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal LetClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken AscendingOrDescendingKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken LetKeyword => new SyntaxToken(this, ((InternalSyntax.LetClauseSyntax)this.Green).letKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.LetClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + public SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.LetClauseSyntax)this.Green).equalsToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrdering(this); + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) - { - if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword) - { - var newNode = SyntaxFactory.Ordering(this.Kind(), expression, ascendingOrDescendingKeyword); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.expression, 3)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.expression : null; - public OrderingSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.AscendingOrDescendingKeyword); - public OrderingSyntax WithAscendingOrDescendingKeyword(SyntaxToken ascendingOrDescendingKeyword) => Update(this.Expression, ascendingOrDescendingKeyword); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLetClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLetClause(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax + public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) { - private ExpressionSyntax? expression; - - internal SelectClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (letKeyword != this.LetKeyword || identifier != this.Identifier || equalsToken != this.EqualsToken || expression != this.Expression) { + var newNode = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken SelectKeyword => new SyntaxToken(this, ((InternalSyntax.SelectClauseSyntax)this.Green).selectKeyword, Position, 0); + return this; + } - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public LetClauseSyntax WithLetKeyword(SyntaxToken letKeyword) => Update(letKeyword, this.Identifier, this.EqualsToken, this.Expression); + public LetClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.LetKeyword, identifier, this.EqualsToken, this.Expression); + public LetClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.LetKeyword, this.Identifier, equalsToken, this.Expression); + public LetClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.LetKeyword, this.Identifier, this.EqualsToken, expression); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class JoinClauseSyntax : QueryClauseSyntax +{ + private TypeSyntax? type; + private ExpressionSyntax? inExpression; + private ExpressionSyntax? leftExpression; + private ExpressionSyntax? rightExpression; + private JoinIntoClauseSyntax? into; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal JoinClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSelectClause(this); + public SyntaxToken JoinKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).joinKeyword, Position, 0); - public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression) - { - if (selectKeyword != this.SelectKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.SelectClause(selectKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public TypeSyntax? Type => GetRed(ref this.type, 1); - return this; - } + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public SelectClauseSyntax WithSelectKeyword(SyntaxToken selectKeyword) => Update(selectKeyword, this.Expression); - public SelectClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.SelectKeyword, expression); - } + public SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).inKeyword, GetChildPosition(3), GetChildIndex(3)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax - { - private ExpressionSyntax? groupExpression; - private ExpressionSyntax? byExpression; + public ExpressionSyntax InExpression => GetRed(ref this.inExpression, 4)!; - internal GroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OnKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).onKeyword, GetChildPosition(5), GetChildIndex(5)); - public SyntaxToken GroupKeyword => new SyntaxToken(this, ((InternalSyntax.GroupClauseSyntax)this.Green).groupKeyword, Position, 0); + public ExpressionSyntax LeftExpression => GetRed(ref this.leftExpression, 6)!; - public ExpressionSyntax GroupExpression => GetRed(ref this.groupExpression, 1)!; + public SyntaxToken EqualsKeyword => new SyntaxToken(this, ((InternalSyntax.JoinClauseSyntax)this.Green).equalsKeyword, GetChildPosition(7), GetChildIndex(7)); - public SyntaxToken ByKeyword => new SyntaxToken(this, ((InternalSyntax.GroupClauseSyntax)this.Green).byKeyword, GetChildPosition(2), GetChildIndex(2)); + public ExpressionSyntax RightExpression => GetRed(ref this.rightExpression, 8)!; - public ExpressionSyntax ByExpression => GetRed(ref this.byExpression, 3)!; + public JoinIntoClauseSyntax? Into => GetRed(ref this.into, 9); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.groupExpression, 1)!, - 3 => GetRed(ref this.byExpression, 3)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.type, 1), + 4 => GetRed(ref this.inExpression, 4)!, + 6 => GetRed(ref this.leftExpression, 6)!, + 8 => GetRed(ref this.rightExpression, 8)!, + 9 => GetRed(ref this.into, 9), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.groupExpression, - 3 => this.byExpression, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.type, + 4 => this.inExpression, + 6 => this.leftExpression, + 8 => this.rightExpression, + 9 => this.into, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGroupClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinClause(this); - public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) + public JoinClauseSyntax Update(SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) + { + if (joinKeyword != this.JoinKeyword || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || inExpression != this.InExpression || onKeyword != this.OnKeyword || leftExpression != this.LeftExpression || equalsKeyword != this.EqualsKeyword || rightExpression != this.RightExpression || into != this.Into) { - if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression) - { - var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.JoinClause(joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public GroupClauseSyntax WithGroupKeyword(SyntaxToken groupKeyword) => Update(groupKeyword, this.GroupExpression, this.ByKeyword, this.ByExpression); - public GroupClauseSyntax WithGroupExpression(ExpressionSyntax groupExpression) => Update(this.GroupKeyword, groupExpression, this.ByKeyword, this.ByExpression); - public GroupClauseSyntax WithByKeyword(SyntaxToken byKeyword) => Update(this.GroupKeyword, this.GroupExpression, byKeyword, this.ByExpression); - public GroupClauseSyntax WithByExpression(ExpressionSyntax byExpression) => Update(this.GroupKeyword, this.GroupExpression, this.ByKeyword, byExpression); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class QueryContinuationSyntax : CSharpSyntaxNode - { - private QueryBodySyntax? body; + public JoinClauseSyntax WithJoinKeyword(SyntaxToken joinKeyword) => Update(joinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithType(TypeSyntax? type) => Update(this.JoinKeyword, type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.JoinKeyword, this.Type, identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, inKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithInExpression(ExpressionSyntax inExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, inExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithOnKeyword(SyntaxToken onKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, onKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithLeftExpression(ExpressionSyntax leftExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, leftExpression, this.EqualsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithEqualsKeyword(SyntaxToken equalsKeyword) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, equalsKeyword, this.RightExpression, this.Into); + public JoinClauseSyntax WithRightExpression(ExpressionSyntax rightExpression) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, rightExpression, this.Into); + public JoinClauseSyntax WithInto(JoinIntoClauseSyntax? into) => Update(this.JoinKeyword, this.Type, this.Identifier, this.InKeyword, this.InExpression, this.OnKeyword, this.LeftExpression, this.EqualsKeyword, this.RightExpression, into); +} - internal QueryContinuationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class JoinIntoClauseSyntax : CSharpSyntaxNode +{ - public SyntaxToken IntoKeyword => new SyntaxToken(this, ((InternalSyntax.QueryContinuationSyntax)this.Green).intoKeyword, Position, 0); + internal JoinIntoClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.QueryContinuationSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken IntoKeyword => new SyntaxToken(this, ((InternalSyntax.JoinIntoClauseSyntax)this.Green).intoKeyword, Position, 0); - public QueryBodySyntax Body => GetRed(ref this.body, 2)!; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.JoinIntoClauseSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.body, 2)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.body : null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryContinuation(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitJoinIntoClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitJoinIntoClause(this); - public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) + public JoinIntoClauseSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier) + { + if (intoKeyword != this.IntoKeyword || identifier != this.Identifier) { - if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body) - { - var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.JoinIntoClause(intoKeyword, identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public QueryContinuationSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier, this.Body); - public QueryContinuationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier, this.Body); - public QueryContinuationSyntax WithBody(QueryBodySyntax body) => Update(this.IntoKeyword, this.Identifier, body); - - public QueryContinuationSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); + return this; } - /// Class which represents a placeholder in an array size list. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax + public JoinIntoClauseSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier); + public JoinIntoClauseSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class WhereClauseSyntax : QueryClauseSyntax +{ + private ExpressionSyntax? condition; + + internal WhereClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { + } - internal OmittedArraySizeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken WhereKeyword => new SyntaxToken(this, ((InternalSyntax.WhereClauseSyntax)this.Green).whereKeyword, Position, 0); - /// SyntaxToken representing the omitted array size expression. - public SyntaxToken OmittedArraySizeExpressionToken => new SyntaxToken(this, ((InternalSyntax.OmittedArraySizeExpressionSyntax)this.Green).omittedArraySizeExpressionToken, Position, 0); + public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedArraySizeExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhereClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhereClause(this); - public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken) + public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition) + { + if (whereKeyword != this.WhereKeyword || condition != this.Condition) { - if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken) - { - var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.WhereClause(whereKeyword, condition); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public OmittedArraySizeExpressionSyntax WithOmittedArraySizeExpressionToken(SyntaxToken omittedArraySizeExpressionToken) => Update(omittedArraySizeExpressionToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax + public WhereClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Condition); + public WhereClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhereKeyword, condition); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class OrderByClauseSyntax : QueryClauseSyntax +{ + private SyntaxNode? orderings; + + internal OrderByClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? contents; + } - internal InterpolatedStringExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SyntaxToken OrderByKeyword => new SyntaxToken(this, ((InternalSyntax.OrderByClauseSyntax)this.Green).orderByKeyword, Position, 0); + + public SeparatedSyntaxList Orderings + { + get { + var red = GetRed(ref this.orderings, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// The first part of an interpolated string, $" or $@" or $""" - public SyntaxToken StringStartToken => new SyntaxToken(this, ((InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringStartToken, Position, 0); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.orderings, 1)! : null; - /// List of parts of the interpolated string, each one is either a literal part or an interpolation. - public SyntaxList Contents => new SyntaxList(GetRed(ref this.contents, 1)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.orderings : null; - /// The closing quote of the interpolated string. - public SyntaxToken StringEndToken => new SyntaxToken(this, ((InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringEndToken, GetChildPosition(2), GetChildIndex(2)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrderByClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrderByClause(this); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.contents, 1)! : null; + public OrderByClauseSyntax Update(SyntaxToken orderByKeyword, SeparatedSyntaxList orderings) + { + if (orderByKeyword != this.OrderByKeyword || orderings != this.Orderings) + { + var newNode = SyntaxFactory.OrderByClause(orderByKeyword, orderings); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.contents : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringExpression(this); + return this; + } - public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, SyntaxList contents, SyntaxToken stringEndToken) - { - if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) - { - var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public OrderByClauseSyntax WithOrderByKeyword(SyntaxToken orderByKeyword) => Update(orderByKeyword, this.Orderings); + public OrderByClauseSyntax WithOrderings(SeparatedSyntaxList orderings) => Update(this.OrderByKeyword, orderings); - return this; - } + public OrderByClauseSyntax AddOrderings(params OrderingSyntax[] items) => WithOrderings(this.Orderings.AddRange(items)); +} - public InterpolatedStringExpressionSyntax WithStringStartToken(SyntaxToken stringStartToken) => Update(stringStartToken, this.Contents, this.StringEndToken); - public InterpolatedStringExpressionSyntax WithContents(SyntaxList contents) => Update(this.StringStartToken, contents, this.StringEndToken); - public InterpolatedStringExpressionSyntax WithStringEndToken(SyntaxToken stringEndToken) => Update(this.StringStartToken, this.Contents, stringEndToken); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class OrderingSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? expression; - public InterpolatedStringExpressionSyntax AddContents(params InterpolatedStringContentSyntax[] items) => WithContents(this.Contents.AddRange(items)); + internal OrderingSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Class which represents a simple pattern-matching expression using the "is" keyword. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IsPatternExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; - private PatternSyntax? pattern; + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal IsPatternExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SyntaxToken AscendingOrDescendingKeyword + { + get { + var slot = ((Syntax.InternalSyntax.OrderingSyntax)this.Green).ascendingOrDescendingKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// ExpressionSyntax node representing the expression on the left of the "is" operator. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - - public SyntaxToken IsKeyword => new SyntaxToken(this, ((InternalSyntax.IsPatternExpressionSyntax)this.Green).isKeyword, GetChildPosition(1), GetChildIndex(1)); - - /// PatternSyntax node representing the pattern on the right of the "is" operator. - public PatternSyntax Pattern => GetRed(ref this.pattern, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expression)!, - 2 => GetRed(ref this.pattern, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expression, - 2 => this.pattern, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIsPatternExpression(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOrdering(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOrdering(this); - public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + public OrderingSyntax Update(ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) + { + if (expression != this.Expression || ascendingOrDescendingKeyword != this.AscendingOrDescendingKeyword) { - if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern) - { - var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.Ordering(this.Kind(), expression, ascendingOrDescendingKeyword); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public IsPatternExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.IsKeyword, this.Pattern); - public IsPatternExpressionSyntax WithIsKeyword(SyntaxToken isKeyword) => Update(this.Expression, isKeyword, this.Pattern); - public IsPatternExpressionSyntax WithPattern(PatternSyntax pattern) => Update(this.Expression, this.IsKeyword, pattern); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ThrowExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? expression; + public OrderingSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.AscendingOrDescendingKeyword); + public OrderingSyntax WithAscendingOrDescendingKeyword(SyntaxToken ascendingOrDescendingKeyword) => Update(this.Expression, ascendingOrDescendingKeyword); +} - internal ThrowExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SelectClauseSyntax : SelectOrGroupClauseSyntax +{ + private ExpressionSyntax? expression; - public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((InternalSyntax.ThrowExpressionSyntax)this.Green).throwKeyword, Position, 0); + internal SelectClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public SyntaxToken SelectKeyword => new SyntaxToken(this, ((InternalSyntax.SelectClauseSyntax)this.Green).selectKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowExpression(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression) - { - if (throwKeyword != this.ThrowKeyword || expression != this.Expression) - { - var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSelectClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSelectClause(this); - return this; + public SelectClauseSyntax Update(SyntaxToken selectKeyword, ExpressionSyntax expression) + { + if (selectKeyword != this.SelectKeyword || expression != this.Expression) + { + var newNode = SyntaxFactory.SelectClause(selectKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ThrowExpressionSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(throwKeyword, this.Expression); - public ThrowExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.ThrowKeyword, expression); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class WhenClauseSyntax : CSharpSyntaxNode - { - private ExpressionSyntax? condition; + public SelectClauseSyntax WithSelectKeyword(SyntaxToken selectKeyword) => Update(selectKeyword, this.Expression); + public SelectClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.SelectKeyword, expression); +} - internal WhenClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class GroupClauseSyntax : SelectOrGroupClauseSyntax +{ + private ExpressionSyntax? groupExpression; + private ExpressionSyntax? byExpression; - public SyntaxToken WhenKeyword => new SyntaxToken(this, ((InternalSyntax.WhenClauseSyntax)this.Green).whenKeyword, Position, 0); + internal GroupClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; + public SyntaxToken GroupKeyword => new SyntaxToken(this, ((InternalSyntax.GroupClauseSyntax)this.Green).groupKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; + public ExpressionSyntax GroupExpression => GetRed(ref this.groupExpression, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; + public SyntaxToken ByKeyword => new SyntaxToken(this, ((InternalSyntax.GroupClauseSyntax)this.Green).byKeyword, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhenClause(this); + public ExpressionSyntax ByExpression => GetRed(ref this.byExpression, 3)!; - public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (whenKeyword != this.WhenKeyword || condition != this.Condition) - { - var newNode = SyntaxFactory.WhenClause(whenKeyword, condition); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 1 => GetRed(ref this.groupExpression, 1)!, + 3 => GetRed(ref this.byExpression, 3)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.groupExpression, + 3 => this.byExpression, + _ => null, + }; - public WhenClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.Condition); - public WhenClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhenKeyword, condition); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGroupClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGroupClause(this); - public abstract partial class PatternSyntax : ExpressionOrPatternSyntax + public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) { - internal PatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (groupKeyword != this.GroupKeyword || groupExpression != this.GroupExpression || byKeyword != this.ByKeyword || byExpression != this.ByExpression) { + var newNode = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DiscardPatternSyntax : PatternSyntax - { + public GroupClauseSyntax WithGroupKeyword(SyntaxToken groupKeyword) => Update(groupKeyword, this.GroupExpression, this.ByKeyword, this.ByExpression); + public GroupClauseSyntax WithGroupExpression(ExpressionSyntax groupExpression) => Update(this.GroupKeyword, groupExpression, this.ByKeyword, this.ByExpression); + public GroupClauseSyntax WithByKeyword(SyntaxToken byKeyword) => Update(this.GroupKeyword, this.GroupExpression, byKeyword, this.ByExpression); + public GroupClauseSyntax WithByExpression(ExpressionSyntax byExpression) => Update(this.GroupKeyword, this.GroupExpression, this.ByKeyword, byExpression); +} - internal DiscardPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class QueryContinuationSyntax : CSharpSyntaxNode +{ + private QueryBodySyntax? body; - public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((InternalSyntax.DiscardPatternSyntax)this.Green).underscoreToken, Position, 0); + internal QueryContinuationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken IntoKeyword => new SyntaxToken(this, ((InternalSyntax.QueryContinuationSyntax)this.Green).intoKeyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => null; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.QueryContinuationSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardPattern(this); + public QueryBodySyntax Body => GetRed(ref this.body, 2)!; - public DiscardPatternSyntax Update(SyntaxToken underscoreToken) - { - if (underscoreToken != this.UnderscoreToken) - { - var newNode = SyntaxFactory.DiscardPattern(underscoreToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.body, 2)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.body : null; - public DiscardPatternSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQueryContinuation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQueryContinuation(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DeclarationPatternSyntax : PatternSyntax + public QueryContinuationSyntax Update(SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) { - private TypeSyntax? type; - private VariableDesignationSyntax? designation; - - internal DeclarationPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (intoKeyword != this.IntoKeyword || identifier != this.Identifier || body != this.Body) { + var newNode = SyntaxFactory.QueryContinuation(intoKeyword, identifier, body); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + return this; + } + + public QueryContinuationSyntax WithIntoKeyword(SyntaxToken intoKeyword) => Update(intoKeyword, this.Identifier, this.Body); + public QueryContinuationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.IntoKeyword, identifier, this.Body); + public QueryContinuationSyntax WithBody(QueryBodySyntax body) => Update(this.IntoKeyword, this.Identifier, body); - public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; + public QueryContinuationSyntax AddBodyClauses(params QueryClauseSyntax[] items) => WithBody(this.Body.WithClauses(this.Body.Clauses.AddRange(items))); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.designation, 1)!, - _ => null, - }; +/// Class which represents a placeholder in an array size list. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class OmittedArraySizeExpressionSyntax : ExpressionSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.designation, - _ => null, - }; + internal OmittedArraySizeExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationPattern(this); + /// SyntaxToken representing the omitted array size expression. + public SyntaxToken OmittedArraySizeExpressionToken => new SyntaxToken(this, ((InternalSyntax.OmittedArraySizeExpressionSyntax)this.Green).omittedArraySizeExpressionToken, Position, 0); - public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) - { - if (type != this.Type || designation != this.Designation) - { - var newNode = SyntaxFactory.DeclarationPattern(type, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public DeclarationPatternSyntax WithType(TypeSyntax type) => Update(type, this.Designation); - public DeclarationPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOmittedArraySizeExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOmittedArraySizeExpression(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class VarPatternSyntax : PatternSyntax + public OmittedArraySizeExpressionSyntax Update(SyntaxToken omittedArraySizeExpressionToken) { - private VariableDesignationSyntax? designation; - - internal VarPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (omittedArraySizeExpressionToken != this.OmittedArraySizeExpressionToken) { + var newNode = SyntaxFactory.OmittedArraySizeExpression(omittedArraySizeExpressionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken VarKeyword => new SyntaxToken(this, ((InternalSyntax.VarPatternSyntax)this.Green).varKeyword, Position, 0); + return this; + } - public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; + public OmittedArraySizeExpressionSyntax WithOmittedArraySizeExpressionToken(SyntaxToken omittedArraySizeExpressionToken) => Update(omittedArraySizeExpressionToken); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.designation, 1)! : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterpolatedStringExpressionSyntax : ExpressionSyntax +{ + private SyntaxNode? contents; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.designation : null; + internal InterpolatedStringExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVarPattern(this); + /// The first part of an interpolated string, $" or $@" or $""" + public SyntaxToken StringStartToken => new SyntaxToken(this, ((InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringStartToken, Position, 0); - public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation) - { - if (varKeyword != this.VarKeyword || designation != this.Designation) - { - var newNode = SyntaxFactory.VarPattern(varKeyword, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// List of parts of the interpolated string, each one is either a literal part or an interpolation. + public SyntaxList Contents => new SyntaxList(GetRed(ref this.contents, 1)); - return this; - } + /// The closing quote of the interpolated string. + public SyntaxToken StringEndToken => new SyntaxToken(this, ((InternalSyntax.InterpolatedStringExpressionSyntax)this.Green).stringEndToken, GetChildPosition(2), GetChildIndex(2)); - public VarPatternSyntax WithVarKeyword(SyntaxToken varKeyword) => Update(varKeyword, this.Designation); - public VarPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.VarKeyword, designation); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.contents, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RecursivePatternSyntax : PatternSyntax - { - private TypeSyntax? type; - private PositionalPatternClauseSyntax? positionalPatternClause; - private PropertyPatternClauseSyntax? propertyPatternClause; - private VariableDesignationSyntax? designation; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.contents : null; - internal RecursivePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringExpression(this); + + public InterpolatedStringExpressionSyntax Update(SyntaxToken stringStartToken, SyntaxList contents, SyntaxToken stringEndToken) + { + if (stringStartToken != this.StringStartToken || contents != this.Contents || stringEndToken != this.StringEndToken) { + var newNode = SyntaxFactory.InterpolatedStringExpression(stringStartToken, contents, stringEndToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TypeSyntax? Type => GetRedAtZero(ref this.type); + return this; + } + + public InterpolatedStringExpressionSyntax WithStringStartToken(SyntaxToken stringStartToken) => Update(stringStartToken, this.Contents, this.StringEndToken); + public InterpolatedStringExpressionSyntax WithContents(SyntaxList contents) => Update(this.StringStartToken, contents, this.StringEndToken); + public InterpolatedStringExpressionSyntax WithStringEndToken(SyntaxToken stringEndToken) => Update(this.StringStartToken, this.Contents, stringEndToken); - public PositionalPatternClauseSyntax? PositionalPatternClause => GetRed(ref this.positionalPatternClause, 1); + public InterpolatedStringExpressionSyntax AddContents(params InterpolatedStringContentSyntax[] items) => WithContents(this.Contents.AddRange(items)); +} - public PropertyPatternClauseSyntax? PropertyPatternClause => GetRed(ref this.propertyPatternClause, 2); +/// Class which represents a simple pattern-matching expression using the "is" keyword. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IsPatternExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; + private PatternSyntax? pattern; - public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); + internal IsPatternExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type), - 1 => GetRed(ref this.positionalPatternClause, 1), - 2 => GetRed(ref this.propertyPatternClause, 2), - 3 => GetRed(ref this.designation, 3), - _ => null, - }; + /// ExpressionSyntax node representing the expression on the left of the "is" operator. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.positionalPatternClause, - 2 => this.propertyPatternClause, - 3 => this.designation, - _ => null, - }; + public SyntaxToken IsKeyword => new SyntaxToken(this, ((InternalSyntax.IsPatternExpressionSyntax)this.Green).isKeyword, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecursivePattern(this); + /// PatternSyntax node representing the pattern on the right of the "is" operator. + public PatternSyntax Pattern => GetRed(ref this.pattern, 2)!; - public RecursivePatternSyntax Update(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation) - { - var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.expression)!, + 2 => GetRed(ref this.pattern, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expression, + 2 => this.pattern, + _ => null, + }; - public RecursivePatternSyntax WithType(TypeSyntax? type) => Update(type, this.PositionalPatternClause, this.PropertyPatternClause, this.Designation); - public RecursivePatternSyntax WithPositionalPatternClause(PositionalPatternClauseSyntax? positionalPatternClause) => Update(this.Type, positionalPatternClause, this.PropertyPatternClause, this.Designation); - public RecursivePatternSyntax WithPropertyPatternClause(PropertyPatternClauseSyntax? propertyPatternClause) => Update(this.Type, this.PositionalPatternClause, propertyPatternClause, this.Designation); - public RecursivePatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.Type, this.PositionalPatternClause, this.PropertyPatternClause, designation); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIsPatternExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIsPatternExpression(this); - public RecursivePatternSyntax AddPositionalPatternClauseSubpatterns(params SubpatternSyntax[] items) - { - var positionalPatternClause = this.PositionalPatternClause ?? SyntaxFactory.PositionalPatternClause(); - return WithPositionalPatternClause(positionalPatternClause.WithSubpatterns(positionalPatternClause.Subpatterns.AddRange(items))); - } - public RecursivePatternSyntax AddPropertyPatternClauseSubpatterns(params SubpatternSyntax[] items) + public IsPatternExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) + { + if (expression != this.Expression || isKeyword != this.IsKeyword || pattern != this.Pattern) { - var propertyPatternClause = this.PropertyPatternClause ?? SyntaxFactory.PropertyPatternClause(); - return WithPropertyPatternClause(propertyPatternClause.WithSubpatterns(propertyPatternClause.Subpatterns.AddRange(items))); + var newNode = SyntaxFactory.IsPatternExpression(expression, isKeyword, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode - { - private SyntaxNode? subpatterns; + public IsPatternExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(expression, this.IsKeyword, this.Pattern); + public IsPatternExpressionSyntax WithIsKeyword(SyntaxToken isKeyword) => Update(this.Expression, isKeyword, this.Pattern); + public IsPatternExpressionSyntax WithPattern(PatternSyntax pattern) => Update(this.Expression, this.IsKeyword, pattern); +} - internal PositionalPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ThrowExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? expression; - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); + internal ThrowExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SeparatedSyntaxList Subpatterns - { - get - { - var red = GetRed(ref this.subpatterns, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((InternalSyntax.ThrowExpressionSyntax)this.Green).throwKeyword, Position, 0); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPositionalPatternClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowExpression(this); - public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + public ThrowExpressionSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression) + { + if (throwKeyword != this.ThrowKeyword || expression != this.Expression) { - if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ThrowExpression(throwKeyword, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PositionalPatternClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Subpatterns, this.CloseParenToken); - public PositionalPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenParenToken, subpatterns, this.CloseParenToken); - public PositionalPatternClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Subpatterns, closeParenToken); - - public PositionalPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode - { - private SyntaxNode? subpatterns; + public ThrowExpressionSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(throwKeyword, this.Expression); + public ThrowExpressionSyntax WithExpression(ExpressionSyntax expression) => Update(this.ThrowKeyword, expression); +} - internal PropertyPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class WhenClauseSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? condition; - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); + internal WhenClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SeparatedSyntaxList Subpatterns - { - get - { - var red = GetRed(ref this.subpatterns, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public SyntaxToken WhenKeyword => new SyntaxToken(this, ((InternalSyntax.WhenClauseSyntax)this.Green).whenKeyword, Position, 0); - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + public ExpressionSyntax Condition => GetRed(ref this.condition, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.condition, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.condition : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyPatternClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhenClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhenClause(this); - public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) + public WhenClauseSyntax Update(SyntaxToken whenKeyword, ExpressionSyntax condition) + { + if (whenKeyword != this.WhenKeyword || condition != this.Condition) { - if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.WhenClause(whenKeyword, condition); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PropertyPatternClauseSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Subpatterns, this.CloseBraceToken); - public PropertyPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenBraceToken, subpatterns, this.CloseBraceToken); - public PropertyPatternClauseSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Subpatterns, closeBraceToken); - - public PropertyPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SubpatternSyntax : CSharpSyntaxNode + public WhenClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.Condition); + public WhenClauseSyntax WithCondition(ExpressionSyntax condition) => Update(this.WhenKeyword, condition); +} + +public abstract partial class PatternSyntax : ExpressionOrPatternSyntax +{ + internal PatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private BaseExpressionColonSyntax? expressionColon; - private PatternSyntax? pattern; + } +} - internal SubpatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DiscardPatternSyntax : PatternSyntax +{ - public BaseExpressionColonSyntax? ExpressionColon => GetRedAtZero(ref this.expressionColon); + internal DiscardPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((InternalSyntax.DiscardPatternSyntax)this.Green).underscoreToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.expressionColon), - 1 => GetRed(ref this.pattern, 1)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.expressionColon, - 1 => this.pattern, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSubpattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardPattern(this); - public SubpatternSyntax Update(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) + public DiscardPatternSyntax Update(SyntaxToken underscoreToken) + { + if (underscoreToken != this.UnderscoreToken) { - if (expressionColon != this.ExpressionColon || pattern != this.Pattern) - { - var newNode = SyntaxFactory.Subpattern(expressionColon, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.DiscardPattern(underscoreToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SubpatternSyntax WithExpressionColon(BaseExpressionColonSyntax? expressionColon) => Update(expressionColon, this.Pattern); - public SubpatternSyntax WithPattern(PatternSyntax pattern) => Update(this.ExpressionColon, pattern); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConstantPatternSyntax : PatternSyntax - { - private ExpressionSyntax? expression; + public DiscardPatternSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); +} - internal ConstantPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DeclarationPatternSyntax : PatternSyntax +{ + private TypeSyntax? type; + private VariableDesignationSyntax? designation; - /// ExpressionSyntax node representing the constant expression. - public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; + internal DeclarationPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; + public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstantPattern(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.designation, 1)!, + _ => null, + }; - public ConstantPatternSyntax Update(ExpressionSyntax expression) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (expression != this.Expression) - { - var newNode = SyntaxFactory.ConstantPattern(expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.type, + 1 => this.designation, + _ => null, + }; - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDeclarationPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDeclarationPattern(this); + + public DeclarationPatternSyntax Update(TypeSyntax type, VariableDesignationSyntax designation) + { + if (type != this.Type || designation != this.Designation) + { + var newNode = SyntaxFactory.DeclarationPattern(type, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ConstantPatternSyntax WithExpression(ExpressionSyntax expression) => Update(expression); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParenthesizedPatternSyntax : PatternSyntax - { - private PatternSyntax? pattern; + public DeclarationPatternSyntax WithType(TypeSyntax type) => Update(type, this.Designation); + public DeclarationPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.Type, designation); +} - internal ParenthesizedPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class VarPatternSyntax : PatternSyntax +{ + private VariableDesignationSyntax? designation; - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedPatternSyntax)this.Green).openParenToken, Position, 0); + internal VarPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + public SyntaxToken VarKeyword => new SyntaxToken(this, ((InternalSyntax.VarPatternSyntax)this.Green).varKeyword, Position, 0); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedPatternSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public VariableDesignationSyntax Designation => GetRed(ref this.designation, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.designation, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.designation : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVarPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVarPattern(this); - public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) + public VarPatternSyntax Update(SyntaxToken varKeyword, VariableDesignationSyntax designation) + { + if (varKeyword != this.VarKeyword || designation != this.Designation) { - if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.VarPattern(varKeyword, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ParenthesizedPatternSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Pattern, this.CloseParenToken); - public ParenthesizedPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OpenParenToken, pattern, this.CloseParenToken); - public ParenthesizedPatternSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Pattern, closeParenToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RelationalPatternSyntax : PatternSyntax - { - private ExpressionSyntax? expression; + public VarPatternSyntax WithVarKeyword(SyntaxToken varKeyword) => Update(varKeyword, this.Designation); + public VarPatternSyntax WithDesignation(VariableDesignationSyntax designation) => Update(this.VarKeyword, designation); +} - internal RelationalPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RecursivePatternSyntax : PatternSyntax +{ + private TypeSyntax? type; + private PositionalPatternClauseSyntax? positionalPatternClause; + private PropertyPatternClauseSyntax? propertyPatternClause; + private VariableDesignationSyntax? designation; - /// SyntaxToken representing the operator of the relational pattern. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.RelationalPatternSyntax)this.Green).operatorToken, Position, 0); + internal RecursivePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + public TypeSyntax? Type => GetRedAtZero(ref this.type); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; + public PositionalPatternClauseSyntax? PositionalPatternClause => GetRed(ref this.positionalPatternClause, 1); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + public PropertyPatternClauseSyntax? PropertyPatternClause => GetRed(ref this.propertyPatternClause, 2); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRelationalPattern(this); + public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); - public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (operatorToken != this.OperatorToken || expression != this.Expression) - { - var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.type), + 1 => GetRed(ref this.positionalPatternClause, 1), + 2 => GetRed(ref this.propertyPatternClause, 2), + 3 => GetRed(ref this.designation, 3), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.positionalPatternClause, + 2 => this.propertyPatternClause, + 3 => this.designation, + _ => null, + }; - public RelationalPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); - public RelationalPatternSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecursivePattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecursivePattern(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypePatternSyntax : PatternSyntax + public RecursivePatternSyntax Update(TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) { - private TypeSyntax? type; - - internal TypePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (type != this.Type || positionalPatternClause != this.PositionalPatternClause || propertyPatternClause != this.PropertyPatternClause || designation != this.Designation) { + var newNode = SyntaxFactory.RecursivePattern(type, positionalPatternClause, propertyPatternClause, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// The type for the type pattern. - public TypeSyntax Type => GetRedAtZero(ref this.type)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypePattern(this); + public RecursivePatternSyntax WithType(TypeSyntax? type) => Update(type, this.PositionalPatternClause, this.PropertyPatternClause, this.Designation); + public RecursivePatternSyntax WithPositionalPatternClause(PositionalPatternClauseSyntax? positionalPatternClause) => Update(this.Type, positionalPatternClause, this.PropertyPatternClause, this.Designation); + public RecursivePatternSyntax WithPropertyPatternClause(PropertyPatternClauseSyntax? propertyPatternClause) => Update(this.Type, this.PositionalPatternClause, propertyPatternClause, this.Designation); + public RecursivePatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.Type, this.PositionalPatternClause, this.PropertyPatternClause, designation); - public TypePatternSyntax Update(TypeSyntax type) - { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypePattern(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public RecursivePatternSyntax AddPositionalPatternClauseSubpatterns(params SubpatternSyntax[] items) + { + var positionalPatternClause = this.PositionalPatternClause ?? SyntaxFactory.PositionalPatternClause(); + return WithPositionalPatternClause(positionalPatternClause.WithSubpatterns(positionalPatternClause.Subpatterns.AddRange(items))); + } + public RecursivePatternSyntax AddPropertyPatternClauseSubpatterns(params SubpatternSyntax[] items) + { + var propertyPatternClause = this.PropertyPatternClause ?? SyntaxFactory.PropertyPatternClause(); + return WithPropertyPatternClause(propertyPatternClause.WithSubpatterns(propertyPatternClause.Subpatterns.AddRange(items))); + } +} - return this; - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PositionalPatternClauseSyntax : CSharpSyntaxNode +{ + private SyntaxNode? subpatterns; - public TypePatternSyntax WithType(TypeSyntax type) => Update(type); + internal PositionalPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class BinaryPatternSyntax : PatternSyntax - { - private PatternSyntax? left; - private PatternSyntax? right; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).openParenToken, Position, 0); - internal BinaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SeparatedSyntaxList Subpatterns + { + get { + var red = GetRed(ref this.subpatterns, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - public PatternSyntax Left => GetRedAtZero(ref this.left)!; - - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.BinaryPatternSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - - public PatternSyntax Right => GetRed(ref this.right, 2)!; + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.PositionalPatternClauseSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.left)!, - 2 => GetRed(ref this.right, 2)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.left, - 2 => this.right, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryPattern(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPositionalPatternClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPositionalPatternClause(this); - public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) + public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList subpatterns, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || subpatterns != this.Subpatterns || closeParenToken != this.CloseParenToken) { - if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) - { - var newNode = SyntaxFactory.BinaryPattern(this.Kind(), left, operatorToken, right); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public BinaryPatternSyntax WithLeft(PatternSyntax left) => Update(left, this.OperatorToken, this.Right); - public BinaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); - public BinaryPatternSyntax WithRight(PatternSyntax right) => Update(this.Left, this.OperatorToken, right); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class UnaryPatternSyntax : PatternSyntax - { - private PatternSyntax? pattern; + public PositionalPatternClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Subpatterns, this.CloseParenToken); + public PositionalPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenParenToken, subpatterns, this.CloseParenToken); + public PositionalPatternClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Subpatterns, closeParenToken); - internal UnaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public PositionalPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); +} - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.UnaryPatternSyntax)this.Green).operatorToken, Position, 0); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PropertyPatternClauseSyntax : CSharpSyntaxNode +{ + private SyntaxNode? subpatterns; - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + internal PropertyPatternClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).openBraceToken, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; + public SeparatedSyntaxList Subpatterns + { + get + { + var red = GetRed(ref this.subpatterns, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnaryPattern(this); + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.PropertyPatternClauseSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); - public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern) - { - if (operatorToken != this.OperatorToken || pattern != this.Pattern) - { - var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.subpatterns, 1)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.subpatterns : null; - public UnaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Pattern); - public UnaryPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OperatorToken, pattern); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyPatternClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyPatternClause(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ListPatternSyntax : PatternSyntax + public PropertyPatternClauseSyntax Update(SyntaxToken openBraceToken, SeparatedSyntaxList subpatterns, SyntaxToken closeBraceToken) { - private SyntaxNode? patterns; - private VariableDesignationSyntax? designation; - - internal ListPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (openBraceToken != this.OpenBraceToken || subpatterns != this.Subpatterns || closeBraceToken != this.CloseBraceToken) { + var newNode = SyntaxFactory.PropertyPatternClause(openBraceToken, subpatterns, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); + return this; + } - public SeparatedSyntaxList Patterns - { - get - { - var red = GetRed(ref this.patterns, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public PropertyPatternClauseSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Subpatterns, this.CloseBraceToken); + public PropertyPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList subpatterns) => Update(this.OpenBraceToken, subpatterns, this.CloseBraceToken); + public PropertyPatternClauseSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Subpatterns, closeBraceToken); - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public PropertyPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] items) => WithSubpatterns(this.Subpatterns.AddRange(items)); +} - public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SubpatternSyntax : CSharpSyntaxNode +{ + private BaseExpressionColonSyntax? expressionColon; + private PatternSyntax? pattern; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.patterns, 1)!, - 3 => GetRed(ref this.designation, 3), - _ => null, - }; + internal SubpatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.patterns, - 3 => this.designation, - _ => null, - }; + public BaseExpressionColonSyntax? ExpressionColon => GetRedAtZero(ref this.expressionColon); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitListPattern(this); + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - public ListPatternSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) - { - var newNode = SyntaxFactory.ListPattern(openBracketToken, patterns, closeBracketToken, designation); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.expressionColon), + 1 => GetRed(ref this.pattern, 1)!, + _ => null, + }; - return this; - } - - public ListPatternSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Patterns, this.CloseBracketToken, this.Designation); - public ListPatternSyntax WithPatterns(SeparatedSyntaxList patterns) => Update(this.OpenBracketToken, patterns, this.CloseBracketToken, this.Designation); - public ListPatternSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Patterns, closeBracketToken, this.Designation); - public ListPatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.OpenBracketToken, this.Patterns, this.CloseBracketToken, designation); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.expressionColon, + 1 => this.pattern, + _ => null, + }; - public ListPatternSyntax AddPatterns(params PatternSyntax[] items) => WithPatterns(this.Patterns.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSubpattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSubpattern(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SlicePatternSyntax : PatternSyntax + public SubpatternSyntax Update(BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) { - private PatternSyntax? pattern; - - internal SlicePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expressionColon != this.ExpressionColon || pattern != this.Pattern) { + var newNode = SyntaxFactory.Subpattern(expressionColon, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken DotDotToken => new SyntaxToken(this, ((InternalSyntax.SlicePatternSyntax)this.Green).dotDotToken, Position, 0); + return this; + } - public PatternSyntax? Pattern => GetRed(ref this.pattern, 1); + public SubpatternSyntax WithExpressionColon(BaseExpressionColonSyntax? expressionColon) => Update(expressionColon, this.Pattern); + public SubpatternSyntax WithPattern(PatternSyntax pattern) => Update(this.ExpressionColon, pattern); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1) : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConstantPatternSyntax : PatternSyntax +{ + private ExpressionSyntax? expression; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; + internal ConstantPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSlicePattern(this); + /// ExpressionSyntax node representing the constant expression. + public ExpressionSyntax Expression => GetRedAtZero(ref this.expression)!; - public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax? pattern) - { - if (dotDotToken != this.DotDotToken || pattern != this.Pattern) - { - var newNode = SyntaxFactory.SlicePattern(dotDotToken, pattern); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.expression)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.expression : null; - public SlicePatternSyntax WithDotDotToken(SyntaxToken dotDotToken) => Update(dotDotToken, this.Pattern); - public SlicePatternSyntax WithPattern(PatternSyntax? pattern) => Update(this.DotDotToken, pattern); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstantPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstantPattern(this); - public abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode + public ConstantPatternSyntax Update(ExpressionSyntax expression) { - internal InterpolatedStringContentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (expression != this.Expression) { + var newNode = SyntaxFactory.ConstantPattern(expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax - { + public ConstantPatternSyntax WithExpression(ExpressionSyntax expression) => Update(expression); +} - internal InterpolatedStringTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParenthesizedPatternSyntax : PatternSyntax +{ + private PatternSyntax? pattern; - /// The text contents of a part of the interpolated string. - public SyntaxToken TextToken => new SyntaxToken(this, ((InternalSyntax.InterpolatedStringTextSyntax)this.Green).textToken, Position, 0); + internal ParenthesizedPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedPatternSyntax)this.Green).openParenToken, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringText(this); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedPatternSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - public InterpolatedStringTextSyntax Update(SyntaxToken textToken) - { - if (textToken != this.TextToken) - { - var newNode = SyntaxFactory.InterpolatedStringText(textToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; - public InterpolatedStringTextSyntax WithTextToken(SyntaxToken textToken) => Update(textToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedPattern(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax + public ParenthesizedPatternSyntax Update(SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) { - private ExpressionSyntax? expression; - private InterpolationAlignmentClauseSyntax? alignmentClause; - private InterpolationFormatClauseSyntax? formatClause; - - internal InterpolationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (openParenToken != this.OpenParenToken || pattern != this.Pattern || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.ParenthesizedPattern(openParenToken, pattern, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.InterpolationSyntax)this.Green).openBraceToken, Position, 0); + return this; + } + + public ParenthesizedPatternSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Pattern, this.CloseParenToken); + public ParenthesizedPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OpenParenToken, pattern, this.CloseParenToken); + public ParenthesizedPatternSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Pattern, closeParenToken); +} - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RelationalPatternSyntax : PatternSyntax +{ + private ExpressionSyntax? expression; - public InterpolationAlignmentClauseSyntax? AlignmentClause => GetRed(ref this.alignmentClause, 2); + internal RelationalPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public InterpolationFormatClauseSyntax? FormatClause => GetRed(ref this.formatClause, 3); + /// SyntaxToken representing the operator of the relational pattern. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.RelationalPatternSyntax)this.Green).operatorToken, Position, 0); - /// - /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). - /// - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.InterpolationSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.expression, 1)!, - 2 => GetRed(ref this.alignmentClause, 2), - 3 => GetRed(ref this.formatClause, 3), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.expression, - 2 => this.alignmentClause, - 3 => this.formatClause, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolation(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRelationalPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRelationalPattern(this); - public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + public RelationalPatternSyntax Update(SyntaxToken operatorToken, ExpressionSyntax expression) + { + if (operatorToken != this.OperatorToken || expression != this.Expression) { - if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.RelationalPattern(operatorToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public InterpolationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); - public InterpolationSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenBraceToken, expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); - public InterpolationSyntax WithAlignmentClause(InterpolationAlignmentClauseSyntax? alignmentClause) => Update(this.OpenBraceToken, this.Expression, alignmentClause, this.FormatClause, this.CloseBraceToken); - public InterpolationSyntax WithFormatClause(InterpolationFormatClauseSyntax? formatClause) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, formatClause, this.CloseBraceToken); - public InterpolationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, closeBraceToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode - { - private ExpressionSyntax? value; + public RelationalPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Expression); + public RelationalPatternSyntax WithExpression(ExpressionSyntax expression) => Update(this.OperatorToken, expression); +} - internal InterpolationAlignmentClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypePatternSyntax : PatternSyntax +{ + private TypeSyntax? type; - public SyntaxToken CommaToken => new SyntaxToken(this, ((InternalSyntax.InterpolationAlignmentClauseSyntax)this.Green).commaToken, Position, 0); + internal TypePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax Value => GetRed(ref this.value, 1)!; + /// The type for the type pattern. + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationAlignmentClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypePattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypePattern(this); - public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value) + public TypePatternSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - if (commaToken != this.CommaToken || value != this.Value) - { - var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TypePattern(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public InterpolationAlignmentClauseSyntax WithCommaToken(SyntaxToken commaToken) => Update(commaToken, this.Value); - public InterpolationAlignmentClauseSyntax WithValue(ExpressionSyntax value) => Update(this.CommaToken, value); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode - { - - internal InterpolationFormatClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public TypePatternSyntax WithType(TypeSyntax type) => Update(type); +} - public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.InterpolationFormatClauseSyntax)this.Green).colonToken, Position, 0); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class BinaryPatternSyntax : PatternSyntax +{ + private PatternSyntax? left; + private PatternSyntax? right; - /// The text contents of the format specifier for an interpolation. - public SyntaxToken FormatStringToken => new SyntaxToken(this, ((InternalSyntax.InterpolationFormatClauseSyntax)this.Green).formatStringToken, GetChildPosition(1), GetChildIndex(1)); + internal BinaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public PatternSyntax Left => GetRedAtZero(ref this.left)!; - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.BinaryPatternSyntax)this.Green).operatorToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationFormatClause(this); + public PatternSyntax Right => GetRed(ref this.right, 2)!; - public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken) - { - var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.left)!, + 2 => GetRed(ref this.right, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.left, + 2 => this.right, + _ => null, + }; - public InterpolationFormatClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.FormatStringToken); - public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken) => Update(this.ColonToken, formatStringToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBinaryPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBinaryPattern(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax + public BinaryPatternSyntax Update(PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) { - private SyntaxNode? attributeLists; - private StatementSyntax? statement; - - internal GlobalStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (left != this.Left || operatorToken != this.OperatorToken || right != this.Right) { + var newNode = SyntaxFactory.BinaryPattern(this.Kind(), left, operatorToken, right); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + return this; + } - public StatementSyntax Statement => GetRed(ref this.statement, 2)!; + public BinaryPatternSyntax WithLeft(PatternSyntax left) => Update(left, this.OperatorToken, this.Right); + public BinaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.Left, operatorToken, this.Right); + public BinaryPatternSyntax WithRight(PatternSyntax right) => Update(this.Left, this.OperatorToken, right); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.statement, 2)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class UnaryPatternSyntax : PatternSyntax +{ + private PatternSyntax? pattern; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.statement, - _ => null, - }; + internal UnaryPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGlobalStatement(this); + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.UnaryPatternSyntax)this.Green).operatorToken, Position, 0); - public GlobalStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) - { - var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1)! : null; - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new GlobalStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Statement); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new GlobalStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Statement); - public GlobalStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Modifiers, statement); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new GlobalStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new GlobalStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnaryPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnaryPattern(this); - /// Represents the base class for all statements syntax classes. - public abstract partial class StatementSyntax : CSharpSyntaxNode + public UnaryPatternSyntax Update(SyntaxToken operatorToken, PatternSyntax pattern) { - internal StatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (operatorToken != this.OperatorToken || pattern != this.Pattern) { + var newNode = SyntaxFactory.UnaryPattern(operatorToken, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxList AttributeLists { get; } - public StatementSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract StatementSyntax WithAttributeListsCore(SyntaxList attributeLists); - - public StatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BlockSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private SyntaxNode? statements; + public UnaryPatternSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(operatorToken, this.Pattern); + public UnaryPatternSyntax WithPattern(PatternSyntax pattern) => Update(this.OperatorToken, pattern); +} - internal BlockSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.BlockSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); - - public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 2)); - - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.BlockSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.statements, 2)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ListPatternSyntax : PatternSyntax +{ + private SyntaxNode? patterns; + private VariableDesignationSyntax? designation; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.statements, - _ => null, - }; + internal ListPatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBlock(this); + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.ListPatternSyntax)this.Green).openBracketToken, Position, 0); - public BlockSyntax Update(SyntaxList attributeLists, SyntaxToken openBraceToken, SyntaxList statements, SyntaxToken closeBraceToken) + public SeparatedSyntaxList Patterns + { + get { - if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.patterns, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new BlockSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.OpenBraceToken, this.Statements, this.CloseBraceToken); - public BlockSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, openBraceToken, this.Statements, this.CloseBraceToken); - public BlockSyntax WithStatements(SyntaxList statements) => Update(this.AttributeLists, this.OpenBraceToken, statements, this.CloseBraceToken); - public BlockSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.OpenBraceToken, this.Statements, closeBraceToken); + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.ListPatternSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new BlockSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public BlockSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); - } + public VariableDesignationSyntax? Designation => GetRed(ref this.designation, 3); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LocalFunctionStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private SyntaxNode? constraintClauses; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.patterns, 1)!, + 3 => GetRed(ref this.designation, 3), + _ => null, + }; - internal LocalFunctionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 1 => this.patterns, + 3 => this.designation, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitListPattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitListPattern(this); - public SyntaxTokenList Modifiers + public ListPatternSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) + { + if (openBracketToken != this.OpenBracketToken || patterns != this.Patterns || closeBracketToken != this.CloseBracketToken || designation != this.Designation) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ListPattern(openBracketToken, patterns, closeBracketToken, designation); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.LocalFunctionStatementSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + return this; + } - public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + public ListPatternSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Patterns, this.CloseBracketToken, this.Designation); + public ListPatternSyntax WithPatterns(SeparatedSyntaxList patterns) => Update(this.OpenBracketToken, patterns, this.CloseBracketToken, this.Designation); + public ListPatternSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Patterns, closeBracketToken, this.Designation); + public ListPatternSyntax WithDesignation(VariableDesignationSyntax? designation) => Update(this.OpenBracketToken, this.Patterns, this.CloseBracketToken, designation); - public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; + public ListPatternSyntax AddPatterns(params PatternSyntax[] items) => WithPatterns(this.Patterns.AddRange(items)); +} - public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 6)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SlicePatternSyntax : PatternSyntax +{ + private PatternSyntax? pattern; - public BlockSyntax? Body => GetRed(ref this.body, 7); + internal SlicePatternSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 8); + public SyntaxToken DotDotToken => new SyntaxToken(this, ((InternalSyntax.SlicePatternSyntax)this.Green).dotDotToken, Position, 0); - /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken - { - get - { - var slot = ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; - } - } + public PatternSyntax? Pattern => GetRed(ref this.pattern, 1); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5)!, - 6 => GetRed(ref this.constraintClauses, 6)!, - 7 => GetRed(ref this.body, 7), - 8 => GetRed(ref this.expressionBody, 8), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.pattern, 1) : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.returnType, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.constraintClauses, - 7 => this.body, - 8 => this.expressionBody, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.pattern : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalFunctionStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSlicePattern(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSlicePattern(this); - public LocalFunctionStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax? pattern) + { + if (dotDotToken != this.DotDotToken || pattern != this.Pattern) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.SlicePattern(dotDotToken, pattern); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LocalFunctionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); - public LocalFunctionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); + return this; + } - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LocalFunctionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public LocalFunctionStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public LocalFunctionStatementSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) - { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - public LocalFunctionStatementSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - public LocalFunctionStatementSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - public LocalFunctionStatementSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - public LocalFunctionStatementSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } + public SlicePatternSyntax WithDotDotToken(SyntaxToken dotDotToken) => Update(dotDotToken, this.Pattern); + public SlicePatternSyntax WithPattern(PatternSyntax? pattern) => Update(this.DotDotToken, pattern); +} + +public abstract partial class InterpolatedStringContentSyntax : CSharpSyntaxNode +{ + internal InterpolatedStringContentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } +} - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LocalDeclarationStatementSyntax : StatementSyntax +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterpolatedStringTextSyntax : InterpolatedStringContentSyntax +{ + + internal InterpolatedStringTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; + } - internal LocalDeclarationStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// The text contents of a part of the interpolated string. + public SyntaxToken TextToken => new SyntaxToken(this, ((InternalSyntax.InterpolatedStringTextSyntax)this.Green).textToken, Position, 0); - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public SyntaxToken AwaitKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public SyntaxToken UsingKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolatedStringText(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolatedStringText(this); - /// Gets the modifier list. - public SyntaxTokenList Modifiers + public InterpolatedStringTextSyntax Update(SyntaxToken textToken) + { + if (textToken != this.TextToken) { - get - { - var slot = this.Green.GetSlot(3); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } + var newNode = SyntaxFactory.InterpolatedStringText(textToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 4)!; + return this; + } - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).semicolonToken, GetChildPosition(5), GetChildIndex(5)); + public InterpolatedStringTextSyntax WithTextToken(SyntaxToken textToken) => Update(textToken); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.declaration, 4)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterpolationSyntax : InterpolatedStringContentSyntax +{ + private ExpressionSyntax? expression; + private InterpolationAlignmentClauseSyntax? alignmentClause; + private InterpolationFormatClauseSyntax? formatClause; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.declaration, - _ => null, - }; + internal InterpolationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalDeclarationStatement(this); + /// This could be a single { or multiple in a row (in the case of an interpolation in a raw interpolated string). + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.InterpolationSyntax)this.Green).openBraceToken, Position, 0); - public LocalDeclarationStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - return this; - } + public InterpolationAlignmentClauseSyntax? AlignmentClause => GetRed(ref this.alignmentClause, 2); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LocalDeclarationStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, modifiers, this.Declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, declaration, this.SemicolonToken); - public LocalDeclarationStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, semicolonToken); + public InterpolationFormatClauseSyntax? FormatClause => GetRed(ref this.formatClause, 3); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LocalDeclarationStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public LocalDeclarationStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public LocalDeclarationStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); - } + /// + /// This could be a single } or multiple in a row (in the case of an interpolation in a raw interpolated string). + /// + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.InterpolationSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode - { - private TypeSyntax? type; - private SyntaxNode? variables; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.expression, 1)!, + 2 => GetRed(ref this.alignmentClause, 2), + 3 => GetRed(ref this.formatClause, 3), + _ => null, + }; - internal VariableDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 1 => this.expression, + 2 => this.alignmentClause, + 3 => this.formatClause, + _ => null, + }; - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolation(this); - public SeparatedSyntaxList Variables + public InterpolationSyntax Update(SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || expression != this.Expression || alignmentClause != this.AlignmentClause || formatClause != this.FormatClause || closeBraceToken != this.CloseBraceToken) { - get - { - var red = GetRed(ref this.variables, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.Interpolation(openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.variables, 1)!, - _ => null, - }; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.variables, - _ => null, - }; + public InterpolationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); + public InterpolationSyntax WithExpression(ExpressionSyntax expression) => Update(this.OpenBraceToken, expression, this.AlignmentClause, this.FormatClause, this.CloseBraceToken); + public InterpolationSyntax WithAlignmentClause(InterpolationAlignmentClauseSyntax? alignmentClause) => Update(this.OpenBraceToken, this.Expression, alignmentClause, this.FormatClause, this.CloseBraceToken); + public InterpolationSyntax WithFormatClause(InterpolationFormatClauseSyntax? formatClause) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, formatClause, this.CloseBraceToken); + public InterpolationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Expression, this.AlignmentClause, this.FormatClause, closeBraceToken); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclaration(this); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterpolationAlignmentClauseSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? value; - public VariableDeclarationSyntax Update(TypeSyntax type, SeparatedSyntaxList variables) - { - if (type != this.Type || variables != this.Variables) - { - var newNode = SyntaxFactory.VariableDeclaration(type, variables); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal InterpolationAlignmentClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + public SyntaxToken CommaToken => new SyntaxToken(this, ((InternalSyntax.InterpolationAlignmentClauseSyntax)this.Green).commaToken, Position, 0); - public VariableDeclarationSyntax WithType(TypeSyntax type) => Update(type, this.Variables); - public VariableDeclarationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.Type, variables); + public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - public VariableDeclarationSyntax AddVariables(params VariableDeclaratorSyntax[] items) => WithVariables(this.Variables.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode - { - private BracketedArgumentListSyntax? argumentList; - private EqualsValueClauseSyntax? initializer; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationAlignmentClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationAlignmentClause(this); - internal VariableDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public InterpolationAlignmentClauseSyntax Update(SyntaxToken commaToken, ExpressionSyntax value) + { + if (commaToken != this.CommaToken || value != this.Value) { + var newNode = SyntaxFactory.InterpolationAlignmentClause(commaToken, value); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.VariableDeclaratorSyntax)this.Green).identifier, Position, 0); + return this; + } - public BracketedArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); + public InterpolationAlignmentClauseSyntax WithCommaToken(SyntaxToken commaToken) => Update(commaToken, this.Value); + public InterpolationAlignmentClauseSyntax WithValue(ExpressionSyntax value) => Update(this.CommaToken, value); +} - public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 2); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterpolationFormatClauseSyntax : CSharpSyntaxNode +{ - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.argumentList, 1), - 2 => GetRed(ref this.initializer, 2), - _ => null, - }; + internal InterpolationFormatClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.argumentList, - 2 => this.initializer, - _ => null, - }; + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.InterpolationFormatClauseSyntax)this.Green).colonToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclarator(this); + /// The text contents of the format specifier for an interpolation. + public SyntaxToken FormatStringToken => new SyntaxToken(this, ((InternalSyntax.InterpolationFormatClauseSyntax)this.Green).formatStringToken, GetChildPosition(1), GetChildIndex(1)); - public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) - { - if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer) - { - var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public VariableDeclaratorSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ArgumentList, this.Initializer); - public VariableDeclaratorSyntax WithArgumentList(BracketedArgumentListSyntax? argumentList) => Update(this.Identifier, argumentList, this.Initializer); - public VariableDeclaratorSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.Identifier, this.ArgumentList, initializer); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterpolationFormatClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterpolationFormatClause(this); - public VariableDeclaratorSyntax AddArgumentListArguments(params ArgumentSyntax[] items) + public InterpolationFormatClauseSyntax Update(SyntaxToken colonToken, SyntaxToken formatStringToken) + { + if (colonToken != this.ColonToken || formatStringToken != this.FormatStringToken) { - var argumentList = this.ArgumentList ?? SyntaxFactory.BracketedArgumentList(); - return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); + var newNode = SyntaxFactory.InterpolationFormatClause(colonToken, formatStringToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode + public InterpolationFormatClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.FormatStringToken); + public InterpolationFormatClauseSyntax WithFormatStringToken(SyntaxToken formatStringToken) => Update(this.ColonToken, formatStringToken); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class GlobalStatementSyntax : MemberDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private StatementSyntax? statement; + + internal GlobalStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? value; + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal EqualsValueClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.EqualsValueClauseSyntax)this.Green).equalsToken, Position, 0); - - public ExpressionSyntax Value => GetRed(ref this.value, 1)!; + public StatementSyntax Statement => GetRed(ref this.statement, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.statement, 2)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.statement, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEqualsValueClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGlobalStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGlobalStatement(this); - public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value) + public GlobalStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || statement != this.Statement) { - if (equalsToken != this.EqualsToken || value != this.Value) - { - var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.GlobalStatement(attributeLists, modifiers, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public EqualsValueClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(equalsToken, this.Value); - public EqualsValueClauseSyntax WithValue(ExpressionSyntax value) => Update(this.EqualsToken, value); + return this; } - public abstract partial class VariableDesignationSyntax : CSharpSyntaxNode + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new GlobalStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Statement); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new GlobalStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Statement); + public GlobalStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Modifiers, statement); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new GlobalStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new GlobalStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); +} + +/// Represents the base class for all statements syntax classes. +public abstract partial class StatementSyntax : CSharpSyntaxNode +{ + internal StatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal VariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax - { + public abstract SyntaxList AttributeLists { get; } + public StatementSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract StatementSyntax WithAttributeListsCore(SyntaxList attributeLists); - internal SingleVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public StatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BlockSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private SyntaxNode? statements; + + internal BlockSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.SingleVariableDesignationSyntax)this.Green).identifier, Position, 0); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.BlockSyntax)this.Green).openBraceToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSingleVariableDesignation(this); + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.BlockSyntax)this.Green).closeBraceToken, GetChildPosition(3), GetChildIndex(3)); - public SingleVariableDesignationSyntax Update(SyntaxToken identifier) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (identifier != this.Identifier) - { - var newNode = SyntaxFactory.SingleVariableDesignation(identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.statements, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.statements, + _ => null, + }; - public SingleVariableDesignationSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBlock(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBlock(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax + public BlockSyntax Update(SyntaxList attributeLists, SyntaxToken openBraceToken, SyntaxList statements, SyntaxToken closeBraceToken) { - - internal DiscardDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || openBraceToken != this.OpenBraceToken || statements != this.Statements || closeBraceToken != this.CloseBraceToken) { + var newNode = SyntaxFactory.Block(attributeLists, openBraceToken, statements, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((InternalSyntax.DiscardDesignationSyntax)this.Green).underscoreToken, Position, 0); - - internal override SyntaxNode? GetNodeSlot(int index) => null; - - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardDesignation(this); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new BlockSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.OpenBraceToken, this.Statements, this.CloseBraceToken); + public BlockSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, openBraceToken, this.Statements, this.CloseBraceToken); + public BlockSyntax WithStatements(SyntaxList statements) => Update(this.AttributeLists, this.OpenBraceToken, statements, this.CloseBraceToken); + public BlockSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.OpenBraceToken, this.Statements, closeBraceToken); - public DiscardDesignationSyntax Update(SyntaxToken underscoreToken) - { - if (underscoreToken != this.UnderscoreToken) - { - var newNode = SyntaxFactory.DiscardDesignation(underscoreToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new BlockSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public BlockSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); +} - return this; - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LocalFunctionStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private SyntaxNode? constraintClauses; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public DiscardDesignationSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); + internal LocalFunctionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax - { - private SyntaxNode? variables; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal ParenthesizedVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); + public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - public SeparatedSyntaxList Variables - { - get - { - var red = GetRed(ref this.variables, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.LocalFunctionStatementSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.variables, 1)! : null; + public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.variables : null; + public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 6)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedVariableDesignation(this); + public BlockSyntax? Body => GetRed(ref this.body, 7); - public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList variables, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 8); - return this; + /// Gets the optional semicolon token. + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.LocalFunctionStatementSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; } + } - public ParenthesizedVariableDesignationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Variables, this.CloseParenToken); - public ParenthesizedVariableDesignationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.OpenParenToken, variables, this.CloseParenToken); - public ParenthesizedVariableDesignationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Variables, closeParenToken); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5)!, + 6 => GetRed(ref this.constraintClauses, 6)!, + 7 => GetRed(ref this.body, 7), + 8 => GetRed(ref this.expressionBody, 8), + _ => null, + }; - public ParenthesizedVariableDesignationSyntax AddVariables(params VariableDesignationSyntax[] items) => WithVariables(this.Variables.AddRange(items)); - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.returnType, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.constraintClauses, + 7 => this.body, + 8 => this.expressionBody, + _ => null, + }; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ExpressionStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalFunctionStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalFunctionStatement(this); - internal ExpressionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public LocalFunctionStatementSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.LocalFunctionStatement(attributeLists, modifiers, returnType, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LocalFunctionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); + public LocalFunctionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ExpressionStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LocalFunctionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public LocalFunctionStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public LocalFunctionStatementSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + public LocalFunctionStatementSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + public LocalFunctionStatementSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + public LocalFunctionStatementSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + public LocalFunctionStatementSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 1 => GetRed(ref this.expression, 1)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LocalDeclarationStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 1 => this.expression, - _ => null, - }; + internal LocalDeclarationStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionStatement(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public ExpressionStatementSyntax Update(SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) + public SyntaxToken AwaitKeyword + { + get { - if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ExpressionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Expression, this.SemicolonToken); - public ExpressionStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, expression, this.SemicolonToken); - public ExpressionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Expression, semicolonToken); - - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ExpressionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EmptyStatementSyntax : StatementSyntax + public SyntaxToken UsingKeyword { - private SyntaxNode? attributeLists; - - internal EmptyStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = ((Syntax.InternalSyntax.LocalDeclarationStatementSyntax)this.Green).usingKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } + } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.EmptyStatementSyntax)this.Green).semicolonToken, GetChildPosition(1), GetChildIndex(1)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + /// Gets the modifier list. + public SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(3); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 4)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEmptyStatement(this); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.LocalDeclarationStatementSyntax)this.Green).semicolonToken, GetChildPosition(5), GetChildIndex(5)); - public EmptyStatementSyntax Update(SyntaxList attributeLists, SyntaxToken semicolonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.declaration, 4)!, + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EmptyStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SemicolonToken); - public EmptyStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.declaration, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EmptyStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLocalDeclarationStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLocalDeclarationStatement(this); - /// Represents a labeled statement syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LabeledStatementSyntax : StatementSyntax + public LocalDeclarationStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { - private SyntaxNode? attributeLists; - private StatementSyntax? statement; - - internal LabeledStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.LocalDeclarationStatement(attributeLists, awaitKeyword, usingKeyword, modifiers, declaration, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.LabeledStatementSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); + return this; + } - /// Gets a SyntaxToken that represents the colon following the statement's label. - public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.LabeledStatementSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LocalDeclarationStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.Modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, modifiers, this.Declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, declaration, this.SemicolonToken); + public LocalDeclarationStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.Modifiers, this.Declaration, semicolonToken); - public StatementSyntax Statement => GetRed(ref this.statement, 3)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LocalDeclarationStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public LocalDeclarationStatementSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public LocalDeclarationStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.statement, 3)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class VariableDeclarationSyntax : CSharpSyntaxNode +{ + private TypeSyntax? type; + private SyntaxNode? variables; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.statement, - _ => null, - }; + internal VariableDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLabeledStatement(this); + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public LabeledStatementSyntax Update(SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) + public SeparatedSyntaxList Variables + { + get { - if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) - { - var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.variables, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.variables, 1)!, + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LabeledStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Identifier, this.ColonToken, this.Statement); - public LabeledStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, identifier, this.ColonToken, this.Statement); - public LabeledStatementSyntax WithColonToken(SyntaxToken colonToken) => Update(this.AttributeLists, this.Identifier, colonToken, this.Statement); - public LabeledStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Identifier, this.ColonToken, statement); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.variables, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LabeledStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclaration(this); - /// - /// Represents a goto statement syntax - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - public sealed partial class GotoStatementSyntax : StatementSyntax + public VariableDeclarationSyntax Update(TypeSyntax type, SeparatedSyntaxList variables) { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - - internal GotoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (type != this.Type || variables != this.Variables) { + var newNode = SyntaxFactory.VariableDeclaration(type, variables); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - /// - /// Gets a SyntaxToken that represents the goto keyword. - /// - public SyntaxToken GotoKeyword => new SyntaxToken(this, ((InternalSyntax.GotoStatementSyntax)this.Green).gotoKeyword, GetChildPosition(1), GetChildIndex(1)); + public VariableDeclarationSyntax WithType(TypeSyntax type) => Update(type, this.Variables); + public VariableDeclarationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.Type, variables); - /// - /// Gets a SyntaxToken that represents the case or default keywords if any exists. - /// - public SyntaxToken CaseOrDefaultKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public VariableDeclarationSyntax AddVariables(params VariableDeclaratorSyntax[] items) => WithVariables(this.Variables.AddRange(items)); +} - /// - /// Gets a constant expression for a goto case statement. - /// - public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class VariableDeclaratorSyntax : CSharpSyntaxNode +{ + private BracketedArgumentListSyntax? argumentList; + private EqualsValueClauseSyntax? initializer; - /// - /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. - /// - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.GotoStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + internal VariableDeclaratorSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3), - _ => null, - }; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.VariableDeclaratorSyntax)this.Green).identifier, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.expression, - _ => null, - }; + public BracketedArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGotoStatement(this); + public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 2); - public GotoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.GotoStatement(this.Kind(), attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 1 => GetRed(ref this.argumentList, 1), + 2 => GetRed(ref this.initializer, 2), + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new GotoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); - public GotoStatementSyntax WithGotoKeyword(SyntaxToken gotoKeyword) => Update(this.AttributeLists, gotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); - public GotoStatementSyntax WithCaseOrDefaultKeyword(SyntaxToken caseOrDefaultKeyword) => Update(this.AttributeLists, this.GotoKeyword, caseOrDefaultKeyword, this.Expression, this.SemicolonToken); - public GotoStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, expression, this.SemicolonToken); - public GotoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.argumentList, + 2 => this.initializer, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new GotoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitVariableDeclarator(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitVariableDeclarator(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BreakStatementSyntax : StatementSyntax + public VariableDeclaratorSyntax Update(SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) { - private SyntaxNode? attributeLists; - - internal BreakStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (identifier != this.Identifier || argumentList != this.ArgumentList || initializer != this.Initializer) { + var newNode = SyntaxFactory.VariableDeclarator(identifier, argumentList, initializer); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken BreakKeyword => new SyntaxToken(this, ((InternalSyntax.BreakStatementSyntax)this.Green).breakKeyword, GetChildPosition(1), GetChildIndex(1)); + public VariableDeclaratorSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ArgumentList, this.Initializer); + public VariableDeclaratorSyntax WithArgumentList(BracketedArgumentListSyntax? argumentList) => Update(this.Identifier, argumentList, this.Initializer); + public VariableDeclaratorSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.Identifier, this.ArgumentList, initializer); - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.BreakStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public VariableDeclaratorSyntax AddArgumentListArguments(params ArgumentSyntax[] items) + { + var argumentList = this.ArgumentList ?? SyntaxFactory.BracketedArgumentList(); + return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EqualsValueClauseSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? value; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + internal EqualsValueClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBreakStatement(this); + public SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.EqualsValueClauseSyntax)this.Green).equalsToken, Position, 0); - public BreakStatementSyntax Update(SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new BreakStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.BreakKeyword, this.SemicolonToken); - public BreakStatementSyntax WithBreakKeyword(SyntaxToken breakKeyword) => Update(this.AttributeLists, breakKeyword, this.SemicolonToken); - public BreakStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.BreakKeyword, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new BreakStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEqualsValueClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEqualsValueClause(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ContinueStatementSyntax : StatementSyntax + public EqualsValueClauseSyntax Update(SyntaxToken equalsToken, ExpressionSyntax value) { - private SyntaxNode? attributeLists; - - internal ContinueStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (equalsToken != this.EqualsToken || value != this.Value) { + var newNode = SyntaxFactory.EqualsValueClause(equalsToken, value); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken ContinueKeyword => new SyntaxToken(this, ((InternalSyntax.ContinueStatementSyntax)this.Green).continueKeyword, GetChildPosition(1), GetChildIndex(1)); + return this; + } - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ContinueStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); + public EqualsValueClauseSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(equalsToken, this.Value); + public EqualsValueClauseSyntax WithValue(ExpressionSyntax value) => Update(this.EqualsToken, value); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; +public abstract partial class VariableDesignationSyntax : CSharpSyntaxNode +{ + internal VariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SingleVariableDesignationSyntax : VariableDesignationSyntax +{ - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitContinueStatement(this); + internal SingleVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ContinueStatementSyntax Update(SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.SingleVariableDesignationSyntax)this.Green).identifier, Position, 0); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ContinueStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ContinueKeyword, this.SemicolonToken); - public ContinueStatementSyntax WithContinueKeyword(SyntaxToken continueKeyword) => Update(this.AttributeLists, continueKeyword, this.SemicolonToken); - public ContinueStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ContinueKeyword, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ContinueStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSingleVariableDesignation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSingleVariableDesignation(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ReturnStatementSyntax : StatementSyntax + public SingleVariableDesignationSyntax Update(SyntaxToken identifier) { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - - internal ReturnStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (identifier != this.Identifier) { + var newNode = SyntaxFactory.SingleVariableDesignation(identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken ReturnKeyword => new SyntaxToken(this, ((InternalSyntax.ReturnStatementSyntax)this.Green).returnKeyword, GetChildPosition(1), GetChildIndex(1)); - - public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); - - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ReturnStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.expression, 2), - _ => null, - }; + public SingleVariableDesignationSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier); +} - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.expression, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DiscardDesignationSyntax : VariableDesignationSyntax +{ - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReturnStatement(this); + internal DiscardDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ReturnStatementSyntax Update(SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken UnderscoreToken => new SyntaxToken(this, ((InternalSyntax.DiscardDesignationSyntax)this.Green).underscoreToken, Position, 0); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ReturnStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ReturnKeyword, this.Expression, this.SemicolonToken); - public ReturnStatementSyntax WithReturnKeyword(SyntaxToken returnKeyword) => Update(this.AttributeLists, returnKeyword, this.Expression, this.SemicolonToken); - public ReturnStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ReturnKeyword, expression, this.SemicolonToken); - public ReturnStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ReturnKeyword, this.Expression, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ReturnStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDiscardDesignation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDiscardDesignation(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ThrowStatementSyntax : StatementSyntax + public DiscardDesignationSyntax Update(SyntaxToken underscoreToken) { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - - internal ThrowStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (underscoreToken != this.UnderscoreToken) { + var newNode = SyntaxFactory.DiscardDesignation(underscoreToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((InternalSyntax.ThrowStatementSyntax)this.Green).throwKeyword, GetChildPosition(1), GetChildIndex(1)); - - public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); + return this; + } - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ThrowStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + public DiscardDesignationSyntax WithUnderscoreToken(SyntaxToken underscoreToken) => Update(underscoreToken); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.expression, 2), - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParenthesizedVariableDesignationSyntax : VariableDesignationSyntax +{ + private SyntaxNode? variables; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.expression, - _ => null, - }; + internal ParenthesizedVariableDesignationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowStatement(this); + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).openParenToken, Position, 0); - public ThrowStatementSyntax Update(SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + public SeparatedSyntaxList Variables + { + get { - if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.variables, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ThrowStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ThrowKeyword, this.Expression, this.SemicolonToken); - public ThrowStatementSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(this.AttributeLists, throwKeyword, this.Expression, this.SemicolonToken); - public ThrowStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ThrowKeyword, expression, this.SemicolonToken); - public ThrowStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ThrowKeyword, this.Expression, semicolonToken); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParenthesizedVariableDesignationSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ThrowStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.variables, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class YieldStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.variables : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParenthesizedVariableDesignation(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParenthesizedVariableDesignation(this); - internal YieldStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public ParenthesizedVariableDesignationSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList variables, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || variables != this.Variables || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.ParenthesizedVariableDesignation(openParenToken, variables, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken YieldKeyword => new SyntaxToken(this, ((InternalSyntax.YieldStatementSyntax)this.Green).yieldKeyword, GetChildPosition(1), GetChildIndex(1)); + public ParenthesizedVariableDesignationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Variables, this.CloseParenToken); + public ParenthesizedVariableDesignationSyntax WithVariables(SeparatedSyntaxList variables) => Update(this.OpenParenToken, variables, this.CloseParenToken); + public ParenthesizedVariableDesignationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Variables, closeParenToken); - public SyntaxToken ReturnOrBreakKeyword => new SyntaxToken(this, ((InternalSyntax.YieldStatementSyntax)this.Green).returnOrBreakKeyword, GetChildPosition(2), GetChildIndex(2)); + public ParenthesizedVariableDesignationSyntax AddVariables(params VariableDesignationSyntax[] items) => WithVariables(this.Variables.AddRange(items)); +} - public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ExpressionStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.YieldStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + internal ExpressionStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3), - _ => null, - }; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.expression, - _ => null, - }; + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitYieldStatement(this); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ExpressionStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); - public YieldStatementSyntax Update(SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.YieldStatement(this.Kind(), attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 1 => GetRed(ref this.expression, 1)!, + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new YieldStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); - public YieldStatementSyntax WithYieldKeyword(SyntaxToken yieldKeyword) => Update(this.AttributeLists, yieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); - public YieldStatementSyntax WithReturnOrBreakKeyword(SyntaxToken returnOrBreakKeyword) => Update(this.AttributeLists, this.YieldKeyword, returnOrBreakKeyword, this.Expression, this.SemicolonToken); - public YieldStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, expression, this.SemicolonToken); - public YieldStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 1 => this.expression, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new YieldStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExpressionStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExpressionStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class WhileStatementSyntax : StatementSyntax + public ExpressionStatementSyntax Update(SyntaxList attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) { - private SyntaxNode? attributeLists; - private ExpressionSyntax? condition; - private StatementSyntax? statement; - - internal WhileStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || expression != this.Expression || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.ExpressionStatement(attributeLists, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken WhileKeyword => new SyntaxToken(this, ((InternalSyntax.WhileStatementSyntax)this.Green).whileKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ExpressionStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Expression, this.SemicolonToken); + public ExpressionStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, expression, this.SemicolonToken); + public ExpressionStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Expression, semicolonToken); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.WhileStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - - public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; - - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.WhileStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ExpressionStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.condition, 3)!, - 5 => GetRed(ref this.statement, 5)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EmptyStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.condition, - 5 => this.statement, - _ => null, - }; + internal EmptyStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhileStatement(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public WhileStatementSyntax Update(SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.EmptyStatementSyntax)this.Green).semicolonToken, GetChildPosition(1), GetChildIndex(1)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new WhileStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement); - public WhileStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement); - public WhileStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new WhileStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEmptyStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEmptyStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DoStatementSyntax : StatementSyntax + public EmptyStatementSyntax Update(SyntaxList attributeLists, SyntaxToken semicolonToken) { - private SyntaxNode? attributeLists; - private StatementSyntax? statement; - private ExpressionSyntax? condition; - - internal DoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.EmptyStatement(attributeLists, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken DoKeyword => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).doKeyword, GetChildPosition(1), GetChildIndex(1)); - - public StatementSyntax Statement => GetRed(ref this.statement, 2)!; + return this; + } - public SyntaxToken WhileKeyword => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).whileKeyword, GetChildPosition(3), GetChildIndex(3)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EmptyStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SemicolonToken); + public EmptyStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, semicolonToken); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).openParenToken, GetChildPosition(4), GetChildIndex(4)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EmptyStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public ExpressionSyntax Condition => GetRed(ref this.condition, 5)!; +/// Represents a labeled statement syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LabeledStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private StatementSyntax? statement; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); + internal LabeledStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).semicolonToken, GetChildPosition(7), GetChildIndex(7)); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.statement, 2)!, - 5 => GetRed(ref this.condition, 5)!, - _ => null, - }; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.LabeledStatementSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.statement, - 5 => this.condition, - _ => null, - }; + /// Gets a SyntaxToken that represents the colon following the statement's label. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.LabeledStatementSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDoStatement(this); + public StatementSyntax Statement => GetRed(ref this.statement, 3)!; - public DoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.statement, 3)!, + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new DoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithDoKeyword(SyntaxToken doKeyword) => Update(this.AttributeLists, doKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.DoKeyword, statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, this.DoKeyword, this.Statement, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.SemicolonToken); - public DoStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.SemicolonToken); - public DoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, semicolonToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.statement, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new DoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLabeledStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLabeledStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ForStatementSyntax : StatementSyntax + public LabeledStatementSyntax Update(SyntaxList attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - private SyntaxNode? initializers; - private ExpressionSyntax? condition; - private SyntaxNode? incrementors; - private StatementSyntax? statement; - - internal ForStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || identifier != this.Identifier || colonToken != this.ColonToken || statement != this.Statement) { + var newNode = SyntaxFactory.LabeledStatement(attributeLists, identifier, colonToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken ForKeyword => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).forKeyword, GetChildPosition(1), GetChildIndex(1)); + return this; + } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LabeledStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Identifier, this.ColonToken, this.Statement); + public LabeledStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, identifier, this.ColonToken, this.Statement); + public LabeledStatementSyntax WithColonToken(SyntaxToken colonToken) => Update(this.AttributeLists, this.Identifier, colonToken, this.Statement); + public LabeledStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.Identifier, this.ColonToken, statement); - public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 3); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LabeledStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public SeparatedSyntaxList Initializers - { - get - { - var red = GetRed(ref this.initializers, 4); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; - } - } +/// +/// Represents a goto statement syntax +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +public sealed partial class GotoStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - public SyntaxToken FirstSemicolonToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); + internal GotoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ExpressionSyntax? Condition => GetRed(ref this.condition, 6); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public SyntaxToken SecondSemicolonToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); + /// + /// Gets a SyntaxToken that represents the goto keyword. + /// + public SyntaxToken GotoKeyword => new SyntaxToken(this, ((InternalSyntax.GotoStatementSyntax)this.Green).gotoKeyword, GetChildPosition(1), GetChildIndex(1)); - public SeparatedSyntaxList Incrementors + /// + /// Gets a SyntaxToken that represents the case or default keywords if any exists. + /// + public SyntaxToken CaseOrDefaultKeyword + { + get { - get - { - var red = GetRed(ref this.incrementors, 8); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(8)) : default; - } + var slot = ((Syntax.InternalSyntax.GotoStatementSyntax)this.Green).caseOrDefaultKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } + } - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); - - public StatementSyntax Statement => GetRed(ref this.statement, 10)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.declaration, 3), - 4 => GetRed(ref this.initializers, 4)!, - 6 => GetRed(ref this.condition, 6), - 8 => GetRed(ref this.incrementors, 8)!, - 10 => GetRed(ref this.statement, 10)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.declaration, - 4 => this.initializers, - 6 => this.condition, - 8 => this.incrementors, - 10 => this.statement, - _ => null, - }; + /// + /// Gets a constant expression for a goto case statement. + /// + public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForStatement(this); + /// + /// Gets a SyntaxToken that represents the semi-colon at the end of the statement. + /// + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.GotoStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - public ForStatementSyntax Update(SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3), + _ => null, + }; - return this; - } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ForStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithForKeyword(SyntaxToken forKeyword) => Update(this.AttributeLists, forKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.ForKeyword, openParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithFirstSemicolonToken(SyntaxToken firstSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, firstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithCondition(ExpressionSyntax? condition) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithSecondSemicolonToken(SyntaxToken secondSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, secondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithIncrementors(SeparatedSyntaxList incrementors) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, incrementors, this.CloseParenToken, this.Statement); - public ForStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, closeParenToken, this.Statement); - public ForStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, statement); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ForStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public ForStatementSyntax AddInitializers(params ExpressionSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); - public ForStatementSyntax AddIncrementors(params ExpressionSyntax[] items) => WithIncrementors(this.Incrementors.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitGotoStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitGotoStatement(this); - public abstract partial class CommonForEachStatementSyntax : StatementSyntax + public GotoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { - internal CommonForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || gotoKeyword != this.GotoKeyword || caseOrDefaultKeyword != this.CaseOrDefaultKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.GotoStatement(this.Kind(), attributeLists, gotoKeyword, caseOrDefaultKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxToken AwaitKeyword { get; } - public CommonForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => WithAwaitKeywordCore(awaitKeyword); - internal abstract CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword); - - public abstract SyntaxToken ForEachKeyword { get; } - public CommonForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => WithForEachKeywordCore(forEachKeyword); - internal abstract CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword); + return this; + } - public abstract SyntaxToken OpenParenToken { get; } - public CommonForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => WithOpenParenTokenCore(openParenToken); - internal abstract CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new GotoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); + public GotoStatementSyntax WithGotoKeyword(SyntaxToken gotoKeyword) => Update(this.AttributeLists, gotoKeyword, this.CaseOrDefaultKeyword, this.Expression, this.SemicolonToken); + public GotoStatementSyntax WithCaseOrDefaultKeyword(SyntaxToken caseOrDefaultKeyword) => Update(this.AttributeLists, this.GotoKeyword, caseOrDefaultKeyword, this.Expression, this.SemicolonToken); + public GotoStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, expression, this.SemicolonToken); + public GotoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.GotoKeyword, this.CaseOrDefaultKeyword, this.Expression, semicolonToken); - public abstract SyntaxToken InKeyword { get; } - public CommonForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => WithInKeywordCore(inKeyword); - internal abstract CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new GotoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public abstract ExpressionSyntax Expression { get; } - public CommonForEachStatementSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); - internal abstract CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BreakStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; - public abstract SyntaxToken CloseParenToken { get; } - public CommonForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => WithCloseParenTokenCore(closeParenToken); - internal abstract CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken); + internal BreakStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public abstract StatementSyntax Statement { get; } - public CommonForEachStatementSyntax WithStatement(StatementSyntax statement) => WithStatementCore(statement); - internal abstract CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public new CommonForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => (CommonForEachStatementSyntax)WithAttributeListsCore(attributeLists); + public SyntaxToken BreakKeyword => new SyntaxToken(this, ((InternalSyntax.BreakStatementSyntax)this.Green).breakKeyword, GetChildPosition(1), GetChildIndex(1)); - public new CommonForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => (CommonForEachStatementSyntax)AddAttributeListsCore(items); - } + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.BreakStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExpressionSyntax? expression; - private StatementSyntax? statement; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; - internal ForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBreakStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBreakStatement(this); - public override SyntaxToken AwaitKeyword + public BreakStatementSyntax Update(SyntaxList attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || breakKeyword != this.BreakKeyword || semicolonToken != this.SemicolonToken) { - get - { - var slot = ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.BreakStatement(attributeLists, breakKeyword, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new BreakStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.BreakKeyword, this.SemicolonToken); + public BreakStatementSyntax WithBreakKeyword(SyntaxToken breakKeyword) => Update(this.AttributeLists, breakKeyword, this.SemicolonToken); + public BreakStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.BreakKeyword, semicolonToken); - public TypeSyntax Type => GetRed(ref this.type, 4)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new BreakStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ContinueStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; - public override SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).inKeyword, GetChildPosition(6), GetChildIndex(6)); + internal ContinueStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override ExpressionSyntax Expression => GetRed(ref this.expression, 7)!; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).closeParenToken, GetChildPosition(8), GetChildIndex(8)); + public SyntaxToken ContinueKeyword => new SyntaxToken(this, ((InternalSyntax.ContinueStatementSyntax)this.Green).continueKeyword, GetChildPosition(1), GetChildIndex(1)); - public override StatementSyntax Statement => GetRed(ref this.statement, 9)!; + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ContinueStatementSyntax)this.Green).semicolonToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.type, 4)!, - 7 => GetRed(ref this.expression, 7)!, - 9 => GetRed(ref this.statement, 9)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.type, - 7 => this.expression, - 9 => this.statement, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitContinueStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitContinueStatement(this); - public ForEachStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public ContinueStatementSyntax Update(SyntaxList attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || continueKeyword != this.ContinueKeyword || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ContinueStatement(attributeLists, continueKeyword, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); - public new ForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); - public new ForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); - public new ForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - public ForEachStatementSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - public ForEachStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); - public new ForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, inKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); - public new ForEachStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); - public new ForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, closeParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); - public new ForEachStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, statement); - - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? variable; - private ExpressionSyntax? expression; - private StatementSyntax? statement; - - internal ForEachVariableStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxToken AwaitKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - - public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); - - /// - /// The variable(s) of the loop. In correct code this is a tuple - /// literal, declaration expression with a tuple designator, or - /// a discard syntax in the form of a simple identifier. In broken - /// code it could be something else. - /// - public ExpressionSyntax Variable => GetRed(ref this.variable, 4)!; - - public override SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).inKeyword, GetChildPosition(5), GetChildIndex(5)); - - public override ExpressionSyntax Expression => GetRed(ref this.expression, 6)!; - - public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).closeParenToken, GetChildPosition(7), GetChildIndex(7)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ContinueStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ContinueKeyword, this.SemicolonToken); + public ContinueStatementSyntax WithContinueKeyword(SyntaxToken continueKeyword) => Update(this.AttributeLists, continueKeyword, this.SemicolonToken); + public ContinueStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ContinueKeyword, semicolonToken); - public override StatementSyntax Statement => GetRed(ref this.statement, 8)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ContinueStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.variable, 4)!, - 6 => GetRed(ref this.expression, 6)!, - 8 => GetRed(ref this.statement, 8)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ReturnStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.variable, - 6 => this.expression, - 8 => this.statement, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachVariableStatement(this); + internal ReturnStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ForEachVariableStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) - { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - return this; - } + public SyntaxToken ReturnKeyword => new SyntaxToken(this, ((InternalSyntax.ReturnStatementSyntax)this.Green).returnKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ForEachVariableStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); - public new ForEachVariableStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); - public new ForEachVariableStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); - public new ForEachVariableStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - public ForEachVariableStatementSyntax WithVariable(ExpressionSyntax variable) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); - public new ForEachVariableStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, inKeyword, this.Expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); - public new ForEachVariableStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, expression, this.CloseParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); - public new ForEachVariableStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, closeParenToken, this.Statement); - internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); - public new ForEachVariableStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, statement); + public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ForEachVariableStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ReturnStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class UsingStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - private ExpressionSyntax? expression; - private StatementSyntax? statement; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.expression, 2), + _ => null, + }; - internal UsingStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 0 => this.attributeLists, + 2 => this.expression, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReturnStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReturnStatement(this); - public SyntaxToken AwaitKeyword + public ReturnStatementSyntax Update(SyntaxList attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || returnKeyword != this.ReturnKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { - get - { - var slot = ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ReturnStatement(attributeLists, returnKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken UsingKeyword => new SyntaxToken(this, ((InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.UsingStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ReturnStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ReturnKeyword, this.Expression, this.SemicolonToken); + public ReturnStatementSyntax WithReturnKeyword(SyntaxToken returnKeyword) => Update(this.AttributeLists, returnKeyword, this.Expression, this.SemicolonToken); + public ReturnStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ReturnKeyword, expression, this.SemicolonToken); + public ReturnStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ReturnKeyword, this.Expression, semicolonToken); - public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 4); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ReturnStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public ExpressionSyntax? Expression => GetRed(ref this.expression, 5); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ThrowStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.UsingStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); + internal ThrowStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public StatementSyntax Statement => GetRed(ref this.statement, 7)!; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.declaration, 4), - 5 => GetRed(ref this.expression, 5), - 7 => GetRed(ref this.statement, 7)!, - _ => null, - }; + public SyntaxToken ThrowKeyword => new SyntaxToken(this, ((InternalSyntax.ThrowStatementSyntax)this.Green).throwKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.declaration, - 5 => this.expression, - 7 => this.statement, - _ => null, - }; + public ExpressionSyntax? Expression => GetRed(ref this.expression, 2); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingStatement(this); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ThrowStatementSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - public UsingStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.expression, 2), + _ => null, + }; - return this; - } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new UsingStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, openParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, declaration, this.Expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, expression, this.CloseParenToken, this.Statement); - public UsingStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, closeParenToken, this.Statement); - public UsingStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, statement); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.expression, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new UsingStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitThrowStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitThrowStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FixedStatementSyntax : StatementSyntax + public ThrowStatementSyntax Update(SyntaxList attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; - private StatementSyntax? statement; - - internal FixedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || throwKeyword != this.ThrowKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.ThrowStatement(attributeLists, throwKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ThrowStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ThrowKeyword, this.Expression, this.SemicolonToken); + public ThrowStatementSyntax WithThrowKeyword(SyntaxToken throwKeyword) => Update(this.AttributeLists, throwKeyword, this.Expression, this.SemicolonToken); + public ThrowStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.ThrowKeyword, expression, this.SemicolonToken); + public ThrowStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.ThrowKeyword, this.Expression, semicolonToken); - public SyntaxToken FixedKeyword => new SyntaxToken(this, ((InternalSyntax.FixedStatementSyntax)this.Green).fixedKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ThrowStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.FixedStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class YieldStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; - public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; + internal YieldStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.FixedStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + public SyntaxToken YieldKeyword => new SyntaxToken(this, ((InternalSyntax.YieldStatementSyntax)this.Green).yieldKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.declaration, 3)!, - 5 => GetRed(ref this.statement, 5)!, - _ => null, - }; + public SyntaxToken ReturnOrBreakKeyword => new SyntaxToken(this, ((InternalSyntax.YieldStatementSyntax)this.Green).returnOrBreakKeyword, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.declaration, - 5 => this.statement, - _ => null, - }; + public ExpressionSyntax? Expression => GetRed(ref this.expression, 3); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFixedStatement(this); + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.YieldStatementSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - public FixedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3), + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FixedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithFixedKeyword(SyntaxToken fixedKeyword) => Update(this.AttributeLists, fixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.FixedKeyword, openParenToken, this.Declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, declaration, this.CloseParenToken, this.Statement); - public FixedStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, closeParenToken, this.Statement); - public FixedStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, statement); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FixedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public FixedStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitYieldStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitYieldStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class CheckedStatementSyntax : StatementSyntax + public YieldStatementSyntax Update(SyntaxList attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) { - private SyntaxNode? attributeLists; - private BlockSyntax? block; - - internal CheckedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || yieldKeyword != this.YieldKeyword || returnOrBreakKeyword != this.ReturnOrBreakKeyword || expression != this.Expression || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.YieldStatement(this.Kind(), attributeLists, yieldKeyword, returnOrBreakKeyword, expression, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CheckedStatementSyntax)this.Green).keyword, GetChildPosition(1), GetChildIndex(1)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new YieldStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); + public YieldStatementSyntax WithYieldKeyword(SyntaxToken yieldKeyword) => Update(this.AttributeLists, yieldKeyword, this.ReturnOrBreakKeyword, this.Expression, this.SemicolonToken); + public YieldStatementSyntax WithReturnOrBreakKeyword(SyntaxToken returnOrBreakKeyword) => Update(this.AttributeLists, this.YieldKeyword, returnOrBreakKeyword, this.Expression, this.SemicolonToken); + public YieldStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, expression, this.SemicolonToken); + public YieldStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.YieldKeyword, this.ReturnOrBreakKeyword, this.Expression, semicolonToken); - public BlockSyntax Block => GetRed(ref this.block, 2)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new YieldStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.block, 2)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class WhileStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? condition; + private StatementSyntax? statement; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.block, - _ => null, - }; + internal WhileStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedStatement(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public CheckedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) - { - if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) - { - var newNode = SyntaxFactory.CheckedStatement(this.Kind(), attributeLists, keyword, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken WhileKeyword => new SyntaxToken(this, ((InternalSyntax.WhileStatementSyntax)this.Green).whileKeyword, GetChildPosition(1), GetChildIndex(1)); - return this; - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.WhileStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new CheckedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Keyword, this.Block); - public CheckedStatementSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, keyword, this.Block); - public CheckedStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.Keyword, block); + public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new CheckedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public CheckedStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public CheckedStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); - } + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.WhileStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class UnsafeStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private BlockSyntax? block; + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - internal UnsafeStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public SyntaxToken UnsafeKeyword => new SyntaxToken(this, ((InternalSyntax.UnsafeStatementSyntax)this.Green).unsafeKeyword, GetChildPosition(1), GetChildIndex(1)); + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.condition, 3)!, + 5 => GetRed(ref this.statement, 5)!, + _ => null, + }; - public BlockSyntax Block => GetRed(ref this.block, 2)!; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.condition, + 5 => this.statement, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.block, 2)!, - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWhileStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWhileStatement(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.block, - _ => null, - }; + public WhileStatementSyntax Update(SyntaxList attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.WhileStatement(attributeLists, whileKeyword, openParenToken, condition, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnsafeStatement(this); + return this; + } - public UnsafeStatementSyntax Update(SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) - { - if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) - { - var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new WhileStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement); + public WhileStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement); + public WhileStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement); - return this; - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new WhileStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new UnsafeStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.UnsafeKeyword, this.Block); - public UnsafeStatementSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.AttributeLists, unsafeKeyword, this.Block); - public UnsafeStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.UnsafeKeyword, block); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DoStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private StatementSyntax? statement; + private ExpressionSyntax? condition; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new UnsafeStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public UnsafeStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public UnsafeStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); + internal DoStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LockStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - private StatementSyntax? statement; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal LockStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken DoKeyword => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).doKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public StatementSyntax Statement => GetRed(ref this.statement, 2)!; - public SyntaxToken LockKeyword => new SyntaxToken(this, ((InternalSyntax.LockStatementSyntax)this.Green).lockKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken WhileKeyword => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).whileKeyword, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.LockStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).openParenToken, GetChildPosition(4), GetChildIndex(4)); - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + public ExpressionSyntax Condition => GetRed(ref this.condition, 5)!; - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.LockStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.DoStatementSyntax)this.Green).semicolonToken, GetChildPosition(7), GetChildIndex(7)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3)!, - 5 => GetRed(ref this.statement, 5)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.statement, 2)!, + 5 => GetRed(ref this.condition, 5)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.expression, - 5 => this.statement, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.statement, + 5 => this.condition, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLockStatement(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDoStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDoStatement(this); - public LockStatementSyntax Update(SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + public DoStatementSyntax Update(SyntaxList attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || doKeyword != this.DoKeyword || statement != this.Statement || whileKeyword != this.WhileKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) - { - var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.DoStatement(attributeLists, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new LockStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithLockKeyword(SyntaxToken lockKeyword) => Update(this.AttributeLists, lockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.LockKeyword, openParenToken, this.Expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.Statement); - public LockStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.Statement); - public LockStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, statement); - - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new LockStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + return this; } - /// - /// Represents an if statement syntax. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IfStatementSyntax : StatementSyntax - { - private SyntaxNode? attributeLists; - private ExpressionSyntax? condition; - private StatementSyntax? statement; - private ElseClauseSyntax? @else; - - internal IfStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - /// - /// Gets a SyntaxToken that represents the if keyword. - /// - public SyntaxToken IfKeyword => new SyntaxToken(this, ((InternalSyntax.IfStatementSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); - - /// - /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. - /// - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.IfStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new DoStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithDoKeyword(SyntaxToken doKeyword) => Update(this.AttributeLists, doKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.DoKeyword, statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithWhileKeyword(SyntaxToken whileKeyword) => Update(this.AttributeLists, this.DoKeyword, this.Statement, whileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, openParenToken, this.Condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.SemicolonToken); + public DoStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.SemicolonToken); + public DoStatementSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.DoKeyword, this.Statement, this.WhileKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, semicolonToken); - /// - /// Gets an ExpressionSyntax that represents the condition of the if statement. - /// - public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new DoStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - /// - /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. - /// - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.IfStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ForStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + private SyntaxNode? initializers; + private ExpressionSyntax? condition; + private SyntaxNode? incrementors; + private StatementSyntax? statement; - /// - /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. - /// - public StatementSyntax Statement => GetRed(ref this.statement, 5)!; + internal ForStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// - /// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. - /// - public ElseClauseSyntax? Else => GetRed(ref this.@else, 6); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.condition, 3)!, - 5 => GetRed(ref this.statement, 5)!, - 6 => GetRed(ref this.@else, 6), - _ => null, - }; + public SyntaxToken ForKeyword => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).forKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.condition, - 5 => this.statement, - 6 => this.@else, - _ => null, - }; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfStatement(this); + public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 3); - public IfStatementSyntax Update(SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) + public SeparatedSyntaxList Initializers + { + get { - if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) - { - var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var red = GetRed(ref this.initializers, 4); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; } + } - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new IfStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.AttributeLists, ifKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.IfKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement, this.Else); - public IfStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement, this.Else); - public IfStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement, this.Else); - public IfStatementSyntax WithElse(ElseClauseSyntax? @else) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, @else); + public SyntaxToken FirstSemicolonToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).firstSemicolonToken, GetChildPosition(5), GetChildIndex(5)); - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new IfStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public ExpressionSyntax? Condition => GetRed(ref this.condition, 6); - /// Represents an else statement syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ElseClauseSyntax : CSharpSyntaxNode - { - private StatementSyntax? statement; + public SyntaxToken SecondSemicolonToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).secondSemicolonToken, GetChildPosition(7), GetChildIndex(7)); - internal ElseClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SeparatedSyntaxList Incrementors + { + get { + var red = GetRed(ref this.incrementors, 8); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(8)) : default; } + } - /// - /// Gets a syntax token - /// - public SyntaxToken ElseKeyword => new SyntaxToken(this, ((InternalSyntax.ElseClauseSyntax)this.Green).elseKeyword, Position, 0); - - public StatementSyntax Statement => GetRed(ref this.statement, 1)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.statement, 1)! : null; + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ForStatementSyntax)this.Green).closeParenToken, GetChildPosition(9), GetChildIndex(9)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.statement : null; + public StatementSyntax Statement => GetRed(ref this.statement, 10)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseClause(this); - - public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement) - { - if (elseKeyword != this.ElseKeyword || statement != this.Statement) - { - var newNode = SyntaxFactory.ElseClause(elseKeyword, statement); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.declaration, 3), + 4 => GetRed(ref this.initializers, 4)!, + 6 => GetRed(ref this.condition, 6), + 8 => GetRed(ref this.incrementors, 8)!, + 10 => GetRed(ref this.statement, 10)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.declaration, + 4 => this.initializers, + 6 => this.condition, + 8 => this.incrementors, + 10 => this.statement, + _ => null, + }; - public ElseClauseSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(elseKeyword, this.Statement); - public ElseClauseSyntax WithStatement(StatementSyntax statement) => Update(this.ElseKeyword, statement); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForStatement(this); - /// Represents a switch statement syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SwitchStatementSyntax : StatementSyntax + public ForStatementSyntax Update(SyntaxList attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, SeparatedSyntaxList initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, SeparatedSyntaxList incrementors, SyntaxToken closeParenToken, StatementSyntax statement) { - private SyntaxNode? attributeLists; - private ExpressionSyntax? expression; - private SyntaxNode? sections; - - internal SwitchStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || forKeyword != this.ForKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || initializers != this.Initializers || firstSemicolonToken != this.FirstSemicolonToken || condition != this.Condition || secondSemicolonToken != this.SecondSemicolonToken || incrementors != this.Incrementors || closeParenToken != this.CloseParenToken || statement != this.Statement) { + var newNode = SyntaxFactory.ForStatement(attributeLists, forKeyword, openParenToken, declaration, initializers, firstSemicolonToken, condition, secondSemicolonToken, incrementors, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - /// - /// Gets a SyntaxToken that represents the switch keyword. - /// - public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ForStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithForKeyword(SyntaxToken forKeyword) => Update(this.AttributeLists, forKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.ForKeyword, openParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithInitializers(SeparatedSyntaxList initializers) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithFirstSemicolonToken(SyntaxToken firstSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, firstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithCondition(ExpressionSyntax? condition) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithSecondSemicolonToken(SyntaxToken secondSemicolonToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, secondSemicolonToken, this.Incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithIncrementors(SeparatedSyntaxList incrementors) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, incrementors, this.CloseParenToken, this.Statement); + public ForStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, closeParenToken, this.Statement); + public ForStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.ForKeyword, this.OpenParenToken, this.Declaration, this.Initializers, this.FirstSemicolonToken, this.Condition, this.SecondSemicolonToken, this.Incrementors, this.CloseParenToken, statement); - /// - /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. - /// - public SyntaxToken OpenParenToken - { - get - { - var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ForStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public ForStatementSyntax AddInitializers(params ExpressionSyntax[] items) => WithInitializers(this.Initializers.AddRange(items)); + public ForStatementSyntax AddIncrementors(params ExpressionSyntax[] items) => WithIncrementors(this.Incrementors.AddRange(items)); +} + +public abstract partial class CommonForEachStatementSyntax : StatementSyntax +{ + internal CommonForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// - /// Gets an ExpressionSyntax representing the expression of the switch statement. - /// - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + public abstract SyntaxToken AwaitKeyword { get; } + public CommonForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => WithAwaitKeywordCore(awaitKeyword); + internal abstract CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword); - /// - /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. - /// - public SyntaxToken CloseParenToken - { - get - { - var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; - } - } + public abstract SyntaxToken ForEachKeyword { get; } + public CommonForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => WithForEachKeywordCore(forEachKeyword); + internal abstract CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword); - /// - /// Gets a SyntaxToken that represents the open braces preceding the switch sections. - /// - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).openBraceToken, GetChildPosition(5), GetChildIndex(5)); + public abstract SyntaxToken OpenParenToken { get; } + public CommonForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => WithOpenParenTokenCore(openParenToken); + internal abstract CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken); - /// - /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. - /// - public SyntaxList Sections => new SyntaxList(GetRed(ref this.sections, 6)); + public abstract SyntaxToken InKeyword { get; } + public CommonForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => WithInKeywordCore(inKeyword); + internal abstract CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword); - /// - /// Gets a SyntaxToken that represents the open braces following the switch sections. - /// - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).closeBraceToken, GetChildPosition(7), GetChildIndex(7)); + public abstract ExpressionSyntax Expression { get; } + public CommonForEachStatementSyntax WithExpression(ExpressionSyntax expression) => WithExpressionCore(expression); + internal abstract CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.expression, 3)!, - 6 => GetRed(ref this.sections, 6)!, - _ => null, - }; + public abstract SyntaxToken CloseParenToken { get; } + public CommonForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => WithCloseParenTokenCore(closeParenToken); + internal abstract CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.expression, - 6 => this.sections, - _ => null, - }; + public abstract StatementSyntax Statement { get; } + public CommonForEachStatementSyntax WithStatement(StatementSyntax statement) => WithStatementCore(statement); + internal abstract CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchStatement(this); + public new CommonForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => (CommonForEachStatementSyntax)WithAttributeListsCore(attributeLists); - public SwitchStatementSyntax Update(SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, SyntaxList sections, SyntaxToken closeBraceToken) - { - if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public new CommonForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => (CommonForEachStatementSyntax)AddAttributeListsCore(items); +} - return this; - } - - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new SwitchStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.AttributeLists, switchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.SwitchKeyword, openParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, openBraceToken, this.Sections, this.CloseBraceToken); - public SwitchStatementSyntax WithSections(SyntaxList sections) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, sections, this.CloseBraceToken); - public SwitchStatementSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, closeBraceToken); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ForEachStatementSyntax : CommonForEachStatementSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExpressionSyntax? expression; + private StatementSyntax? statement; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new SwitchStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public SwitchStatementSyntax AddSections(params SwitchSectionSyntax[] items) => WithSections(this.Sections.AddRange(items)); + internal ForEachStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Represents a switch section syntax of a switch statement. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SwitchSectionSyntax : CSharpSyntaxNode - { - private SyntaxNode? labels; - private SyntaxNode? statements; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal SwitchSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxToken AwaitKeyword + { + get { + var slot = ((Syntax.InternalSyntax.ForEachStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// - /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. - /// - public SyntaxList Labels => new SyntaxList(GetRed(ref this.labels, 0)); + public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - /// - /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. - /// - public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 1)); + public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.labels)!, - 1 => GetRed(ref this.statements, 1)!, - _ => null, - }; + public TypeSyntax Type => GetRed(ref this.type, 4)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.labels, - 1 => this.statements, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchSection(this); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); - public SwitchSectionSyntax Update(SyntaxList labels, SyntaxList statements) - { - if (labels != this.Labels || statements != this.Statements) - { - var newNode = SyntaxFactory.SwitchSection(labels, statements); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).inKeyword, GetChildPosition(6), GetChildIndex(6)); - return this; - } + public override ExpressionSyntax Expression => GetRed(ref this.expression, 7)!; - public SwitchSectionSyntax WithLabels(SyntaxList labels) => Update(labels, this.Statements); - public SwitchSectionSyntax WithStatements(SyntaxList statements) => Update(this.Labels, statements); + public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachStatementSyntax)this.Green).closeParenToken, GetChildPosition(8), GetChildIndex(8)); - public SwitchSectionSyntax AddLabels(params SwitchLabelSyntax[] items) => WithLabels(this.Labels.AddRange(items)); - public SwitchSectionSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); - } + public override StatementSyntax Statement => GetRed(ref this.statement, 9)!; + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.type, 4)!, + 7 => GetRed(ref this.expression, 7)!, + 9 => GetRed(ref this.statement, 9)!, + _ => null, + }; - /// Represents a switch label within a switch statement. - public abstract partial class SwitchLabelSyntax : CSharpSyntaxNode + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.type, + 7 => this.expression, + 9 => this.statement, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachStatement(this); + + public ForEachStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { - internal SwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { + var newNode = SyntaxFactory.ForEachStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// - /// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. - /// - public abstract SyntaxToken Keyword { get; } - public SwitchLabelSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); - internal abstract SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword); - - /// - /// Gets a SyntaxToken that represents the colon that terminates the switch label. - /// - public abstract SyntaxToken ColonToken { get; } - public SwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); - internal abstract SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken); + return this; } - /// Represents a case label within a switch statement. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ForEachStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); + public new ForEachStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); + public new ForEachStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); + public new ForEachStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + public ForEachStatementSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + public ForEachStatementSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, identifier, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); + public new ForEachStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, inKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); + public new ForEachStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); + public new ForEachStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, closeParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); + public new ForEachStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Type, this.Identifier, this.InKeyword, this.Expression, this.CloseParenToken, statement); + + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ForEachStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ForEachVariableStatementSyntax : CommonForEachStatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? variable; + private ExpressionSyntax? expression; + private StatementSyntax? statement; + + internal ForEachVariableStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private PatternSyntax? pattern; - private WhenClauseSyntax? whenClause; + } - internal CasePatternSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxToken AwaitKeyword + { + get { + var slot = ((Syntax.InternalSyntax.ForEachVariableStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the case keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).keyword, Position, 0); + public override SyntaxToken ForEachKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).forEachKeyword, GetChildPosition(2), GetChildIndex(2)); - /// - /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. - /// - public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; + public override SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); - public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 2); + /// + /// The variable(s) of the loop. In correct code this is a tuple + /// literal, declaration expression with a tuple designator, or + /// a discard syntax in the form of a simple identifier. In broken + /// code it could be something else. + /// + public ExpressionSyntax Variable => GetRed(ref this.variable, 4)!; - public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken InKeyword => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).inKeyword, GetChildPosition(5), GetChildIndex(5)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.pattern, 1)!, - 2 => GetRed(ref this.whenClause, 2), - _ => null, - }; + public override ExpressionSyntax Expression => GetRed(ref this.expression, 6)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.pattern, - 2 => this.whenClause, - _ => null, - }; + public override SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ForEachVariableStatementSyntax)this.Green).closeParenToken, GetChildPosition(7), GetChildIndex(7)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCasePatternSwitchLabel(this); + public override StatementSyntax Statement => GetRed(ref this.statement, 8)!; - public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.variable, 4)!, + 6 => GetRed(ref this.expression, 6)!, + 8 => GetRed(ref this.statement, 8)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.variable, + 6 => this.expression, + 8 => this.statement, + _ => null, + }; - internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new CasePatternSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Pattern, this.WhenClause, this.ColonToken); - public CasePatternSwitchLabelSyntax WithPattern(PatternSyntax pattern) => Update(this.Keyword, pattern, this.WhenClause, this.ColonToken); - public CasePatternSwitchLabelSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Keyword, this.Pattern, whenClause, this.ColonToken); - internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new CasePatternSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Pattern, this.WhenClause, colonToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitForEachVariableStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitForEachVariableStatement(this); - /// Represents a case label within a switch statement. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax + public ForEachVariableStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) { - private ExpressionSyntax? value; - - internal CaseSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || forEachKeyword != this.ForEachKeyword || openParenToken != this.OpenParenToken || variable != this.Variable || inKeyword != this.InKeyword || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { + var newNode = SyntaxFactory.ForEachVariableStatement(attributeLists, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the case keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CaseSwitchLabelSyntax)this.Green).keyword, Position, 0); + return this; + } - /// - /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. - /// - public ExpressionSyntax Value => GetRed(ref this.value, 1)!; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ForEachVariableStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithAwaitKeywordCore(SyntaxToken awaitKeyword) => WithAwaitKeyword(awaitKeyword); + public new ForEachVariableStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithForEachKeywordCore(SyntaxToken forEachKeyword) => WithForEachKeyword(forEachKeyword); + public new ForEachVariableStatementSyntax WithForEachKeyword(SyntaxToken forEachKeyword) => Update(this.AttributeLists, this.AwaitKeyword, forEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithOpenParenTokenCore(SyntaxToken openParenToken) => WithOpenParenToken(openParenToken); + public new ForEachVariableStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, openParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + public ForEachVariableStatementSyntax WithVariable(ExpressionSyntax variable) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, variable, this.InKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithInKeywordCore(SyntaxToken inKeyword) => WithInKeyword(inKeyword); + public new ForEachVariableStatementSyntax WithInKeyword(SyntaxToken inKeyword) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, inKeyword, this.Expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithExpressionCore(ExpressionSyntax expression) => WithExpression(expression); + public new ForEachVariableStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, expression, this.CloseParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithCloseParenTokenCore(SyntaxToken closeParenToken) => WithCloseParenToken(closeParenToken); + public new ForEachVariableStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, closeParenToken, this.Statement); + internal override CommonForEachStatementSyntax WithStatementCore(StatementSyntax statement) => WithStatement(statement); + public new ForEachVariableStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.ForEachKeyword, this.OpenParenToken, this.Variable, this.InKeyword, this.Expression, this.CloseParenToken, statement); - public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.CaseSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ForEachVariableStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class UsingStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + private ExpressionSyntax? expression; + private StatementSyntax? statement; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; + internal UsingStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCaseSwitchLabel(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) + public SyntaxToken AwaitKeyword + { + get { - if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.UsingStatementSyntax)this.Green).awaitKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } - - internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new CaseSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Value, this.ColonToken); - public CaseSwitchLabelSyntax WithValue(ExpressionSyntax value) => Update(this.Keyword, value, this.ColonToken); - internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new CaseSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Value, colonToken); } - /// Represents a default label within a switch statement. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax - { + public SyntaxToken UsingKeyword => new SyntaxToken(this, ((InternalSyntax.UsingStatementSyntax)this.Green).usingKeyword, GetChildPosition(2), GetChildIndex(2)); - internal DefaultSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.UsingStatementSyntax)this.Green).openParenToken, GetChildPosition(3), GetChildIndex(3)); - /// Gets the default keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.DefaultSwitchLabelSyntax)this.Green).keyword, Position, 0); + public VariableDeclarationSyntax? Declaration => GetRed(ref this.declaration, 4); - public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.DefaultSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public ExpressionSyntax? Expression => GetRed(ref this.expression, 5); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.UsingStatementSyntax)this.Green).closeParenToken, GetChildPosition(6), GetChildIndex(6)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public StatementSyntax Statement => GetRed(ref this.statement, 7)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultSwitchLabel(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.declaration, 4), + 5 => GetRed(ref this.expression, 5), + 7 => GetRed(ref this.statement, 7)!, + _ => null, + }; - public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (keyword != this.Keyword || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.attributeLists, + 4 => this.declaration, + 5 => this.expression, + 7 => this.statement, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingStatement(this); - return this; + public UsingStatementSyntax Update(SyntaxList attributeLists, SyntaxToken awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || awaitKeyword != this.AwaitKeyword || usingKeyword != this.UsingKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) + { + var newNode = SyntaxFactory.UsingStatement(attributeLists, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new DefaultSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.ColonToken); - internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); - public new DefaultSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, colonToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SwitchExpressionSyntax : ExpressionSyntax - { - private ExpressionSyntax? governingExpression; - private SyntaxNode? arms; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new UsingStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithAwaitKeyword(SyntaxToken awaitKeyword) => Update(this.AttributeLists, awaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.AttributeLists, this.AwaitKeyword, usingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, openParenToken, this.Declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithDeclaration(VariableDeclarationSyntax? declaration) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, declaration, this.Expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithExpression(ExpressionSyntax? expression) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, expression, this.CloseParenToken, this.Statement); + public UsingStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, closeParenToken, this.Statement); + public UsingStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.AwaitKeyword, this.UsingKeyword, this.OpenParenToken, this.Declaration, this.Expression, this.CloseParenToken, statement); - internal SwitchExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new UsingStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public ExpressionSyntax GoverningExpression => GetRedAtZero(ref this.governingExpression)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FixedStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + private StatementSyntax? statement; - public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); + internal FixedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public SeparatedSyntaxList Arms - { - get - { - var red = GetRed(ref this.arms, 3); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; - } - } + public SyntaxToken FixedKeyword => new SyntaxToken(this, ((InternalSyntax.FixedStatementSyntax)this.Green).fixedKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.FixedStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.governingExpression)!, - 3 => GetRed(ref this.arms, 3)!, - _ => null, - }; + public VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.governingExpression, - 3 => this.arms, - _ => null, - }; + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.FixedStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpression(this); + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.declaration, 3)!, + 5 => GetRed(ref this.statement, 5)!, + _ => null, + }; - public SwitchExpressionSyntax WithGoverningExpression(ExpressionSyntax governingExpression) => Update(governingExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.GoverningExpression, switchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, openBraceToken, this.Arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithArms(SeparatedSyntaxList arms) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, arms, this.CloseBraceToken); - public SwitchExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, closeBraceToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.declaration, + 5 => this.statement, + _ => null, + }; - public SwitchExpressionSyntax AddArms(params SwitchExpressionArmSyntax[] items) => WithArms(this.Arms.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFixedStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFixedStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode + public FixedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) { - private PatternSyntax? pattern; - private WhenClauseSyntax? whenClause; - private ExpressionSyntax? expression; - - internal SwitchExpressionArmSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || fixedKeyword != this.FixedKeyword || openParenToken != this.OpenParenToken || declaration != this.Declaration || closeParenToken != this.CloseParenToken || statement != this.Statement) { + var newNode = SyntaxFactory.FixedStatement(attributeLists, fixedKeyword, openParenToken, declaration, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public PatternSyntax Pattern => GetRedAtZero(ref this.pattern)!; + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FixedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithFixedKeyword(SyntaxToken fixedKeyword) => Update(this.AttributeLists, fixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.FixedKeyword, openParenToken, this.Declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, declaration, this.CloseParenToken, this.Statement); + public FixedStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, closeParenToken, this.Statement); + public FixedStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.FixedKeyword, this.OpenParenToken, this.Declaration, this.CloseParenToken, statement); - public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 1); + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FixedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public FixedStatementSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); +} - public SyntaxToken EqualsGreaterThanToken => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionArmSyntax)this.Green).equalsGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class CheckedStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private BlockSyntax? block; - public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; + internal CheckedStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.pattern)!, - 1 => GetRed(ref this.whenClause, 1), - 3 => GetRed(ref this.expression, 3)!, - _ => null, - }; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.pattern, - 1 => this.whenClause, - 3 => this.expression, - _ => null, - }; + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CheckedStatementSyntax)this.Green).keyword, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpressionArm(this); + public BlockSyntax Block => GetRed(ref this.block, 2)!; - public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression) - { - var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.block, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.block, + _ => null, + }; - public SwitchExpressionArmSyntax WithPattern(PatternSyntax pattern) => Update(pattern, this.WhenClause, this.EqualsGreaterThanToken, this.Expression); - public SwitchExpressionArmSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Pattern, whenClause, this.EqualsGreaterThanToken, this.Expression); - public SwitchExpressionArmSyntax WithEqualsGreaterThanToken(SyntaxToken equalsGreaterThanToken) => Update(this.Pattern, this.WhenClause, equalsGreaterThanToken, this.Expression); - public SwitchExpressionArmSyntax WithExpression(ExpressionSyntax expression) => Update(this.Pattern, this.WhenClause, this.EqualsGreaterThanToken, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCheckedStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCheckedStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TryStatementSyntax : StatementSyntax + public CheckedStatementSyntax Update(SyntaxList attributeLists, SyntaxToken keyword, BlockSyntax block) { - private SyntaxNode? attributeLists; - private BlockSyntax? block; - private SyntaxNode? catches; - private FinallyClauseSyntax? @finally; - - internal TryStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || keyword != this.Keyword || block != this.Block) { + var newNode = SyntaxFactory.CheckedStatement(this.Kind(), attributeLists, keyword, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public SyntaxToken TryKeyword => new SyntaxToken(this, ((InternalSyntax.TryStatementSyntax)this.Green).tryKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new CheckedStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Keyword, this.Block); + public CheckedStatementSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, keyword, this.Block); + public CheckedStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.Keyword, block); - public BlockSyntax Block => GetRed(ref this.block, 2)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new CheckedStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public CheckedStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public CheckedStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); +} - public SyntaxList Catches => new SyntaxList(GetRed(ref this.catches, 3)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class UnsafeStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private BlockSyntax? block; - public FinallyClauseSyntax? Finally => GetRed(ref this.@finally, 4); + internal UnsafeStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.block, 2)!, - 3 => GetRed(ref this.catches, 3)!, - 4 => GetRed(ref this.@finally, 4), - _ => null, - }; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.block, - 3 => this.catches, - 4 => this.@finally, - _ => null, - }; + public SyntaxToken UnsafeKeyword => new SyntaxToken(this, ((InternalSyntax.UnsafeStatementSyntax)this.Green).unsafeKeyword, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTryStatement(this); + public BlockSyntax Block => GetRed(ref this.block, 2)!; - public TryStatementSyntax Update(SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, SyntaxList catches, FinallyClauseSyntax? @finally) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) - { - var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.block, 2)!, + _ => null, + }; - internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new TryStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.TryKeyword, this.Block, this.Catches, this.Finally); - public TryStatementSyntax WithTryKeyword(SyntaxToken tryKeyword) => Update(this.AttributeLists, tryKeyword, this.Block, this.Catches, this.Finally); - public TryStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.TryKeyword, block, this.Catches, this.Finally); - public TryStatementSyntax WithCatches(SyntaxList catches) => Update(this.AttributeLists, this.TryKeyword, this.Block, catches, this.Finally); - public TryStatementSyntax WithFinally(FinallyClauseSyntax? @finally) => Update(this.AttributeLists, this.TryKeyword, this.Block, this.Catches, @finally); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.block, + _ => null, + }; - internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new TryStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public TryStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public TryStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); - public TryStatementSyntax AddCatches(params CatchClauseSyntax[] items) => WithCatches(this.Catches.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUnsafeStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUnsafeStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CatchClauseSyntax : CSharpSyntaxNode + public UnsafeStatementSyntax Update(SyntaxList attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) { - private CatchDeclarationSyntax? declaration; - private CatchFilterClauseSyntax? filter; - private BlockSyntax? block; - - internal CatchClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || unsafeKeyword != this.UnsafeKeyword || block != this.Block) { + var newNode = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken CatchKeyword => new SyntaxToken(this, ((InternalSyntax.CatchClauseSyntax)this.Green).catchKeyword, Position, 0); - - public CatchDeclarationSyntax? Declaration => GetRed(ref this.declaration, 1); + return this; + } - public CatchFilterClauseSyntax? Filter => GetRed(ref this.filter, 2); + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new UnsafeStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.UnsafeKeyword, this.Block); + public UnsafeStatementSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.AttributeLists, unsafeKeyword, this.Block); + public UnsafeStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.UnsafeKeyword, block); - public BlockSyntax Block => GetRed(ref this.block, 3)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new UnsafeStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public UnsafeStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public UnsafeStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.declaration, 1), - 2 => GetRed(ref this.filter, 2), - 3 => GetRed(ref this.block, 3)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LockStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; + private StatementSyntax? statement; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.declaration, - 2 => this.filter, - 3 => this.block, - _ => null, - }; + internal LockStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchClause(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) - { - if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block) - { - var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken LockKeyword => new SyntaxToken(this, ((InternalSyntax.LockStatementSyntax)this.Green).lockKeyword, GetChildPosition(1), GetChildIndex(1)); - return this; - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.LockStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - public CatchClauseSyntax WithCatchKeyword(SyntaxToken catchKeyword) => Update(catchKeyword, this.Declaration, this.Filter, this.Block); - public CatchClauseSyntax WithDeclaration(CatchDeclarationSyntax? declaration) => Update(this.CatchKeyword, declaration, this.Filter, this.Block); - public CatchClauseSyntax WithFilter(CatchFilterClauseSyntax? filter) => Update(this.CatchKeyword, this.Declaration, filter, this.Block); - public CatchClauseSyntax WithBlock(BlockSyntax block) => Update(this.CatchKeyword, this.Declaration, this.Filter, block); + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public CatchClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public CatchClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); - } + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.LockStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode - { - private TypeSyntax? type; + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - internal CatchDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3)!, + 5 => GetRed(ref this.statement, 5)!, + _ => null, + }; - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).openParenToken, Position, 0); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + 5 => this.statement, + _ => null, + }; - public TypeSyntax Type => GetRed(ref this.type, 1)!; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLockStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLockStatement(this); - public SyntaxToken Identifier + public LockStatementSyntax Update(SyntaxList attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) + { + if (attributeLists != this.AttributeLists || lockKeyword != this.LockKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || statement != this.Statement) { - get - { - var slot = ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).identifier; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } + var newNode = SyntaxFactory.LockStatement(attributeLists, lockKeyword, openParenToken, expression, closeParenToken, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchDeclaration(this); + return this; + } - public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new LockStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithLockKeyword(SyntaxToken lockKeyword) => Update(this.AttributeLists, lockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.LockKeyword, openParenToken, this.Expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.Statement); + public LockStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.Statement); + public LockStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.LockKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, statement); - return this; - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new LockStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - public CatchDeclarationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.Identifier, this.CloseParenToken); - public CatchDeclarationSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.Identifier, this.CloseParenToken); - public CatchDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.OpenParenToken, this.Type, identifier, this.CloseParenToken); - public CatchDeclarationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, this.Identifier, closeParenToken); - } +/// +/// Represents an if statement syntax. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IfStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? condition; + private StatementSyntax? statement; + private ElseClauseSyntax? @else; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode + internal IfStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? filterExpression; - - internal CatchFilterClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - public SyntaxToken WhenKeyword => new SyntaxToken(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).whenKeyword, Position, 0); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + /// + /// Gets a SyntaxToken that represents the if keyword. + /// + public SyntaxToken IfKeyword => new SyntaxToken(this, ((InternalSyntax.IfStatementSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); - public ExpressionSyntax FilterExpression => GetRed(ref this.filterExpression, 2)!; + /// + /// Gets a SyntaxToken that represents the open parenthesis before the if statement's condition expression. + /// + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.IfStatementSyntax)this.Green).openParenToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); + /// + /// Gets an ExpressionSyntax that represents the condition of the if statement. + /// + public ExpressionSyntax Condition => GetRed(ref this.condition, 3)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.filterExpression, 2)! : null; + /// + /// Gets a SyntaxToken that represents the close parenthesis after the if statement's condition expression. + /// + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.IfStatementSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.filterExpression : null; + /// + /// Gets a StatementSyntax the represents the statement to be executed when the condition is true. + /// + public StatementSyntax Statement => GetRed(ref this.statement, 5)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchFilterClause(this); + /// + /// Gets an ElseClauseSyntax that represents the statement to be executed when the condition is false if such statement exists. + /// + public ElseClauseSyntax? Else => GetRed(ref this.@else, 6); - public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.condition, 3)!, + 5 => GetRed(ref this.statement, 5)!, + 6 => GetRed(ref this.@else, 6), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.condition, + 5 => this.statement, + 6 => this.@else, + _ => null, + }; - public CatchFilterClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.OpenParenToken, this.FilterExpression, this.CloseParenToken); - public CatchFilterClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.WhenKeyword, openParenToken, this.FilterExpression, this.CloseParenToken); - public CatchFilterClauseSyntax WithFilterExpression(ExpressionSyntax filterExpression) => Update(this.WhenKeyword, this.OpenParenToken, filterExpression, this.CloseParenToken); - public CatchFilterClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.WhenKeyword, this.OpenParenToken, this.FilterExpression, closeParenToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfStatement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FinallyClauseSyntax : CSharpSyntaxNode + public IfStatementSyntax Update(SyntaxList attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) { - private BlockSyntax? block; - - internal FinallyClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || ifKeyword != this.IfKeyword || openParenToken != this.OpenParenToken || condition != this.Condition || closeParenToken != this.CloseParenToken || statement != this.Statement || @else != this.Else) { + var newNode = SyntaxFactory.IfStatement(attributeLists, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken FinallyKeyword => new SyntaxToken(this, ((InternalSyntax.FinallyClauseSyntax)this.Green).finallyKeyword, Position, 0); + return this; + } + + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new IfStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.AttributeLists, ifKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.IfKeyword, openParenToken, this.Condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithCondition(ExpressionSyntax condition) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, condition, this.CloseParenToken, this.Statement, this.Else); + public IfStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, closeParenToken, this.Statement, this.Else); + public IfStatementSyntax WithStatement(StatementSyntax statement) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, statement, this.Else); + public IfStatementSyntax WithElse(ElseClauseSyntax? @else) => Update(this.AttributeLists, this.IfKeyword, this.OpenParenToken, this.Condition, this.CloseParenToken, this.Statement, @else); - public BlockSyntax Block => GetRed(ref this.block, 1)!; + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new IfStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.block, 1)! : null; +/// Represents an else statement syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ElseClauseSyntax : CSharpSyntaxNode +{ + private StatementSyntax? statement; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.block : null; + internal ElseClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFinallyClause(this); + /// + /// Gets a syntax token + /// + public SyntaxToken ElseKeyword => new SyntaxToken(this, ((InternalSyntax.ElseClauseSyntax)this.Green).elseKeyword, Position, 0); - public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block) - { - if (finallyKeyword != this.FinallyKeyword || block != this.Block) - { - var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public StatementSyntax Statement => GetRed(ref this.statement, 1)!; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.statement, 1)! : null; - public FinallyClauseSyntax WithFinallyKeyword(SyntaxToken finallyKeyword) => Update(finallyKeyword, this.Block); - public FinallyClauseSyntax WithBlock(BlockSyntax block) => Update(this.FinallyKeyword, block); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.statement : null; - public FinallyClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); - public FinallyClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseClause(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CompilationUnitSyntax : CSharpSyntaxNode + public ElseClauseSyntax Update(SyntaxToken elseKeyword, StatementSyntax statement) { - private SyntaxNode? externs; - private SyntaxNode? usings; - private SyntaxNode? attributeLists; - private SyntaxNode? members; - - internal CompilationUnitSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (elseKeyword != this.ElseKeyword || statement != this.Statement) { + var newNode = SyntaxFactory.ElseClause(elseKeyword, statement); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 0)); - - public SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 1)); - - /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 2)); + return this; + } - public SyntaxList Members => new SyntaxList(GetRed(ref this.members, 3)); + public ElseClauseSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(elseKeyword, this.Statement); + public ElseClauseSyntax WithStatement(StatementSyntax statement) => Update(this.ElseKeyword, statement); +} - public SyntaxToken EndOfFileToken => new SyntaxToken(this, ((InternalSyntax.CompilationUnitSyntax)this.Green).endOfFileToken, GetChildPosition(4), GetChildIndex(4)); +/// Represents a switch statement syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SwitchStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private ExpressionSyntax? expression; + private SyntaxNode? sections; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.externs)!, - 1 => GetRed(ref this.usings, 1)!, - 2 => GetRed(ref this.attributeLists, 2)!, - 3 => GetRed(ref this.members, 3)!, - _ => null, - }; + internal SwitchStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.externs, - 1 => this.usings, - 2 => this.attributeLists, - 3 => this.members, - _ => null, - }; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCompilationUnit(this); + /// + /// Gets a SyntaxToken that represents the switch keyword. + /// + public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); - public CompilationUnitSyntax Update(SyntaxList externs, SyntaxList usings, SyntaxList attributeLists, SyntaxList members, SyntaxToken endOfFileToken) + /// + /// Gets a SyntaxToken that represents the open parenthesis preceding the switch governing expression. + /// + public SyntaxToken OpenParenToken + { + get { - if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) - { - var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).openParenToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } - - public CompilationUnitSyntax WithExterns(SyntaxList externs) => Update(externs, this.Usings, this.AttributeLists, this.Members, this.EndOfFileToken); - public CompilationUnitSyntax WithUsings(SyntaxList usings) => Update(this.Externs, usings, this.AttributeLists, this.Members, this.EndOfFileToken); - public CompilationUnitSyntax WithAttributeLists(SyntaxList attributeLists) => Update(this.Externs, this.Usings, attributeLists, this.Members, this.EndOfFileToken); - public CompilationUnitSyntax WithMembers(SyntaxList members) => Update(this.Externs, this.Usings, this.AttributeLists, members, this.EndOfFileToken); - public CompilationUnitSyntax WithEndOfFileToken(SyntaxToken endOfFileToken) => Update(this.Externs, this.Usings, this.AttributeLists, this.Members, endOfFileToken); - - public CompilationUnitSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); - public CompilationUnitSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); - public CompilationUnitSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public CompilationUnitSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); } /// - /// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. + /// Gets an ExpressionSyntax representing the expression of the switch statement. /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode - { + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - internal ExternAliasDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// + /// Gets a SyntaxToken that represents the close parenthesis following the switch governing expression. + /// + public SyntaxToken CloseParenToken + { + get { + var slot = ((Syntax.InternalSyntax.SwitchStatementSyntax)this.Green).closeParenToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(4), GetChildIndex(4)) : default; } + } - /// SyntaxToken representing the extern keyword. - public SyntaxToken ExternKeyword => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).externKeyword, Position, 0); - - /// SyntaxToken representing the alias keyword. - public SyntaxToken AliasKeyword => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).aliasKeyword, GetChildPosition(1), GetChildIndex(1)); + /// + /// Gets a SyntaxToken that represents the open braces preceding the switch sections. + /// + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).openBraceToken, GetChildPosition(5), GetChildIndex(5)); - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + /// + /// Gets a SyntaxList of SwitchSectionSyntax's that represents the switch sections of the switch statement. + /// + public SyntaxList Sections => new SyntaxList(GetRed(ref this.sections, 6)); - /// SyntaxToken representing the semicolon token. - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + /// + /// Gets a SyntaxToken that represents the open braces following the switch sections. + /// + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchStatementSyntax)this.Green).closeBraceToken, GetChildPosition(7), GetChildIndex(7)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.expression, 3)!, + 6 => GetRed(ref this.sections, 6)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.expression, + 6 => this.sections, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExternAliasDirective(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchStatement(this); - public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + public SwitchStatementSyntax Update(SyntaxList attributeLists, SyntaxToken switchKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxToken openBraceToken, SyntaxList sections, SyntaxToken closeBraceToken) + { + if (attributeLists != this.AttributeLists || switchKeyword != this.SwitchKeyword || openParenToken != this.OpenParenToken || expression != this.Expression || closeParenToken != this.CloseParenToken || openBraceToken != this.OpenBraceToken || sections != this.Sections || closeBraceToken != this.CloseBraceToken) { - if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.SwitchStatement(attributeLists, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ExternAliasDirectiveSyntax WithExternKeyword(SyntaxToken externKeyword) => Update(externKeyword, this.AliasKeyword, this.Identifier, this.SemicolonToken); - public ExternAliasDirectiveSyntax WithAliasKeyword(SyntaxToken aliasKeyword) => Update(this.ExternKeyword, aliasKeyword, this.Identifier, this.SemicolonToken); - public ExternAliasDirectiveSyntax WithIdentifier(SyntaxToken identifier) => Update(this.ExternKeyword, this.AliasKeyword, identifier, this.SemicolonToken); - public ExternAliasDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.ExternKeyword, this.AliasKeyword, this.Identifier, semicolonToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new SwitchStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.AttributeLists, switchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.AttributeLists, this.SwitchKeyword, openParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithExpression(ExpressionSyntax expression) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, closeParenToken, this.OpenBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, openBraceToken, this.Sections, this.CloseBraceToken); + public SwitchStatementSyntax WithSections(SyntaxList sections) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, sections, this.CloseBraceToken); + public SwitchStatementSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.SwitchKeyword, this.OpenParenToken, this.Expression, this.CloseParenToken, this.OpenBraceToken, this.Sections, closeBraceToken); + + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new SwitchStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public SwitchStatementSyntax AddSections(params SwitchSectionSyntax[] items) => WithSections(this.Sections.AddRange(items)); +} + +/// Represents a switch section syntax of a switch statement. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SwitchSectionSyntax : CSharpSyntaxNode +{ + private SyntaxNode? labels; + private SyntaxNode? statements; + + internal SwitchSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private NameEqualsSyntax? alias; - private TypeSyntax? namespaceOrType; + } + + /// + /// Gets a SyntaxList of SwitchLabelSyntax's the represents the possible labels that control can transfer to within the section. + /// + public SyntaxList Labels => new SyntaxList(GetRed(ref this.labels, 0)); + + /// + /// Gets a SyntaxList of StatementSyntax's the represents the statements to be executed when control transfer to a label the belongs to the section. + /// + public SyntaxList Statements => new SyntaxList(GetRed(ref this.statements, 1)); - internal UsingDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } + 0 => GetRedAtZero(ref this.labels)!, + 1 => GetRed(ref this.statements, 1)!, + _ => null, + }; - public SyntaxToken GlobalKeyword + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - get - { - var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword; - return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; - } - } + 0 => this.labels, + 1 => this.statements, + _ => null, + }; - public SyntaxToken UsingKeyword => new SyntaxToken(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchSection(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchSection(this); - public SyntaxToken StaticKeyword + public SwitchSectionSyntax Update(SyntaxList labels, SyntaxList statements) + { + if (labels != this.Labels || statements != this.Statements) { - get - { - var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } + var newNode = SyntaxFactory.SwitchSection(labels, statements); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken UnsafeKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } - } + return this; + } - public NameEqualsSyntax? Alias => GetRed(ref this.alias, 4); + public SwitchSectionSyntax WithLabels(SyntaxList labels) => Update(labels, this.Statements); + public SwitchSectionSyntax WithStatements(SyntaxList statements) => Update(this.Labels, statements); - public TypeSyntax NamespaceOrType => GetRed(ref this.namespaceOrType, 5)!; + public SwitchSectionSyntax AddLabels(params SwitchLabelSyntax[] items) => WithLabels(this.Labels.AddRange(items)); + public SwitchSectionSyntax AddStatements(params StatementSyntax[] items) => WithStatements(this.Statements.AddRange(items)); +} - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(6), GetChildIndex(6)); +/// Represents a switch label within a switch statement. +public abstract partial class SwitchLabelSyntax : CSharpSyntaxNode +{ + internal SwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 4 => GetRed(ref this.alias, 4), - 5 => GetRed(ref this.namespaceOrType, 5)!, - _ => null, - }; + /// + /// Gets a SyntaxToken that represents a case or default keyword that belongs to a switch label. + /// + public abstract SyntaxToken Keyword { get; } + public SwitchLabelSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); + internal abstract SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 4 => this.alias, - 5 => this.namespaceOrType, - _ => null, - }; + /// + /// Gets a SyntaxToken that represents the colon that terminates the switch label. + /// + public abstract SyntaxToken ColonToken { get; } + public SwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => WithColonTokenCore(colonToken); + internal abstract SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken); +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingDirective(this); +/// Represents a case label within a switch statement. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CasePatternSwitchLabelSyntax : SwitchLabelSyntax +{ + private PatternSyntax? pattern; + private WhenClauseSyntax? whenClause; - public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) - { - if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || unsafeKeyword != this.UnsafeKeyword || alias != this.Alias || namespaceOrType != this.NamespaceOrType || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal CasePatternSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + /// Gets the case keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).keyword, Position, 0); - public UsingDirectiveSyntax WithGlobalKeyword(SyntaxToken globalKeyword) => Update(globalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.GlobalKeyword, usingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithStaticKeyword(SyntaxToken staticKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, staticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, unsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithAlias(NameEqualsSyntax? alias) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, alias, this.NamespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithNamespaceOrType(TypeSyntax namespaceOrType) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, namespaceOrType, this.SemicolonToken); - public UsingDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, semicolonToken); - } + /// + /// Gets a PatternSyntax that represents the pattern that gets matched for the case label. + /// + public PatternSyntax Pattern => GetRed(ref this.pattern, 1)!; - /// Member declaration syntax. - public abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode - { - internal MemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 2); - /// Gets the attribute declaration list. - public abstract SyntaxList AttributeLists { get; } - public MemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists); + public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.CasePatternSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(3), GetChildIndex(3)); - public MemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.pattern, 1)!, + 2 => GetRed(ref this.whenClause, 2), + _ => null, + }; - /// Gets the modifier list. - public abstract SyntaxTokenList Modifiers { get; } - public MemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); - internal abstract MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.pattern, + 2 => this.whenClause, + _ => null, + }; - public MemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); - internal abstract MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCasePatternSwitchLabel(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCasePatternSwitchLabel(this); - public abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax + public CasePatternSwitchLabelSyntax Update(SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) { - internal BaseNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || pattern != this.Pattern || whenClause != this.WhenClause || colonToken != this.ColonToken) { + var newNode = SyntaxFactory.CasePatternSwitchLabel(keyword, pattern, whenClause, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxToken NamespaceKeyword { get; } - public BaseNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => WithNamespaceKeywordCore(namespaceKeyword); - internal abstract BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword); - - public abstract NameSyntax Name { get; } - public BaseNamespaceDeclarationSyntax WithName(NameSyntax name) => WithNameCore(name); - internal abstract BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name); + return this; + } - public abstract SyntaxList Externs { get; } - public BaseNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => WithExternsCore(externs); - internal abstract BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs); + internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new CasePatternSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Pattern, this.WhenClause, this.ColonToken); + public CasePatternSwitchLabelSyntax WithPattern(PatternSyntax pattern) => Update(this.Keyword, pattern, this.WhenClause, this.ColonToken); + public CasePatternSwitchLabelSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Keyword, this.Pattern, whenClause, this.ColonToken); + internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new CasePatternSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Pattern, this.WhenClause, colonToken); +} - public BaseNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => AddExternsCore(items); - internal abstract BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items); +/// Represents a case label within a switch statement. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CaseSwitchLabelSyntax : SwitchLabelSyntax +{ + private ExpressionSyntax? value; - public abstract SyntaxList Usings { get; } - public BaseNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => WithUsingsCore(usings); - internal abstract BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings); + internal CaseSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public BaseNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => AddUsingsCore(items); - internal abstract BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items); + /// Gets the case keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.CaseSwitchLabelSyntax)this.Green).keyword, Position, 0); - public abstract SyntaxList Members { get; } - public BaseNamespaceDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); - internal abstract BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members); + /// + /// Gets an ExpressionSyntax that represents the constant expression that gets matched for the case label. + /// + public ExpressionSyntax Value => GetRed(ref this.value, 1)!; - public BaseNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); - internal abstract BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); + public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.CaseSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); - public new BaseNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseNamespaceDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseNamespaceDeclarationSyntax)WithModifiersCore(modifiers); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.value, 1)! : null; - public new BaseNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseNamespaceDeclarationSyntax)AddAttributeListsCore(items); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.value : null; - public new BaseNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseNamespaceDeclarationSyntax)AddModifiersCore(items); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCaseSwitchLabel(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCaseSwitchLabel(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax + public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) { - private SyntaxNode? attributeLists; - private NameSyntax? name; - private SyntaxNode? externs; - private SyntaxNode? usings; - private SyntaxNode? members; - - internal NamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (keyword != this.Keyword || value != this.Value || colonToken != this.ColonToken) { + var newNode = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new CaseSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.Value, this.ColonToken); + public CaseSwitchLabelSyntax WithValue(ExpressionSyntax value) => Update(this.Keyword, value, this.ColonToken); + internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new CaseSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, this.Value, colonToken); +} - public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); +/// Represents a default label within a switch statement. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DefaultSwitchLabelSyntax : SwitchLabelSyntax +{ - public override NameSyntax Name => GetRed(ref this.name, 3)!; + internal DefaultSwitchLabelSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).openBraceToken, GetChildPosition(4), GetChildIndex(4)); + /// Gets the default keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.DefaultSwitchLabelSyntax)this.Green).keyword, Position, 0); - public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); + public override SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.DefaultSwitchLabelSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultSwitchLabel(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultSwitchLabel(this); - /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken + public DefaultSwitchLabelSyntax Update(SyntaxToken keyword, SyntaxToken colonToken) + { + if (keyword != this.Keyword || colonToken != this.ColonToken) { - get - { - var slot = ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; - } + var newNode = SyntaxFactory.DefaultSwitchLabel(keyword, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.name, 3)!, - 5 => GetRed(ref this.externs, 5)!, - 6 => GetRed(ref this.usings, 6)!, - 7 => GetRed(ref this.members, 7)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.name, - 5 => this.externs, - 6 => this.usings, - 7 => this.members, - _ => null, - }; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNamespaceDeclaration(this); + internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new DefaultSwitchLabelSyntax WithKeyword(SyntaxToken keyword) => Update(keyword, this.ColonToken); + internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken) => WithColonToken(colonToken); + public new DefaultSwitchLabelSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Keyword, colonToken); +} - public NamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, SyntaxList externs, SyntaxList usings, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SwitchExpressionSyntax : ExpressionSyntax +{ + private ExpressionSyntax? governingExpression; + private SyntaxNode? arms; - return this; - } + internal SwitchExpressionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new NamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new NamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); - public new NamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); - public new NamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - public NamespaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, openBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); - public new NamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); - public new NamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, usings, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new NamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, members, this.CloseBraceToken, this.SemicolonToken); - public NamespaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, closeBraceToken, this.SemicolonToken); - public NamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, semicolonToken); + public ExpressionSyntax GoverningExpression => GetRedAtZero(ref this.governingExpression)!; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new NamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new NamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); - public new NamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); - public new NamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new NamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax - { - private SyntaxNode? attributeLists; - private NameSyntax? name; - private SyntaxNode? externs; - private SyntaxNode? usings; - private SyntaxNode? members; - - internal FileScopedNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); - - public override NameSyntax Name => GetRed(ref this.name, 3)!; - - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - - public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); - - public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); - - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.name, 3)!, - 5 => GetRed(ref this.externs, 5)!, - 6 => GetRed(ref this.usings, 6)!, - 7 => GetRed(ref this.members, 7)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.name, - 5 => this.externs, - 6 => this.usings, - 7 => this.members, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFileScopedNamespaceDeclaration(this); - - public FileScopedNamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, SyntaxList externs, SyntaxList usings, SyntaxList members) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) - { - var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FileScopedNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new FileScopedNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); - public new FileScopedNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); - public new FileScopedNamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.SemicolonToken, this.Externs, this.Usings, this.Members); - public FileScopedNamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, semicolonToken, this.Externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); - public new FileScopedNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, externs, this.Usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); - public new FileScopedNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, usings, this.Members); - internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new FileScopedNamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, members); + public SyntaxToken SwitchKeyword => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).switchKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FileScopedNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new FileScopedNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); - public new FileScopedNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); - public new FileScopedNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); - internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new FileScopedNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).openBraceToken, GetChildPosition(2), GetChildIndex(2)); - /// Class representing one or more attributes applied to a language construct. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AttributeListSyntax : CSharpSyntaxNode + public SeparatedSyntaxList Arms { - private AttributeTargetSpecifierSyntax? target; - private SyntaxNode? attributes; - - internal AttributeListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var red = GetRed(ref this.arms, 3); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; } + } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.AttributeListSyntax)this.Green).openBracketToken, Position, 0); - - /// Gets the optional construct targeted by the attribute. - public AttributeTargetSpecifierSyntax? Target => GetRed(ref this.target, 1); + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionSyntax)this.Green).closeBraceToken, GetChildPosition(4), GetChildIndex(4)); - /// Gets the attribute declaration list. - public SeparatedSyntaxList Attributes + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var red = GetRed(ref this.attributes, 2); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; - } - } - - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + 0 => GetRedAtZero(ref this.governingExpression)!, + 3 => GetRed(ref this.arms, 3)!, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.target, 1), - 2 => GetRed(ref this.attributes, 2)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.target, - 2 => this.attributes, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.governingExpression, + 3 => this.arms, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpression(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpression(this); - public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList arms, SyntaxToken closeBraceToken) + { + if (governingExpression != this.GoverningExpression || switchKeyword != this.SwitchKeyword || openBraceToken != this.OpenBraceToken || arms != this.Arms || closeBraceToken != this.CloseBraceToken) { - if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AttributeListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Target, this.Attributes, this.CloseBracketToken); - public AttributeListSyntax WithTarget(AttributeTargetSpecifierSyntax? target) => Update(this.OpenBracketToken, target, this.Attributes, this.CloseBracketToken); - public AttributeListSyntax WithAttributes(SeparatedSyntaxList attributes) => Update(this.OpenBracketToken, this.Target, attributes, this.CloseBracketToken); - public AttributeListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Target, this.Attributes, closeBracketToken); - - public AttributeListSyntax AddAttributes(params AttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); + return this; } - /// Class representing what language construct an attribute targets. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode - { + public SwitchExpressionSyntax WithGoverningExpression(ExpressionSyntax governingExpression) => Update(governingExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithSwitchKeyword(SyntaxToken switchKeyword) => Update(this.GoverningExpression, switchKeyword, this.OpenBraceToken, this.Arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, openBraceToken, this.Arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithArms(SeparatedSyntaxList arms) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, arms, this.CloseBraceToken); + public SwitchExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.GoverningExpression, this.SwitchKeyword, this.OpenBraceToken, this.Arms, closeBraceToken); - internal AttributeTargetSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SwitchExpressionSyntax AddArms(params SwitchExpressionArmSyntax[] items) => WithArms(this.Arms.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SwitchExpressionArmSyntax : CSharpSyntaxNode +{ + private PatternSyntax? pattern; + private WhenClauseSyntax? whenClause; + private ExpressionSyntax? expression; - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).identifier, Position, 0); + internal SwitchExpressionArmSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public PatternSyntax Pattern => GetRedAtZero(ref this.pattern)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + public WhenClauseSyntax? WhenClause => GetRed(ref this.whenClause, 1); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken EqualsGreaterThanToken => new SyntaxToken(this, ((InternalSyntax.SwitchExpressionArmSyntax)this.Green).equalsGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeTargetSpecifier(this); + public ExpressionSyntax Expression => GetRed(ref this.expression, 3)!; - public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (identifier != this.Identifier || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.pattern)!, + 1 => GetRed(ref this.whenClause, 1), + 3 => GetRed(ref this.expression, 3)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.pattern, + 1 => this.whenClause, + 3 => this.expression, + _ => null, + }; - public AttributeTargetSpecifierSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ColonToken); - public AttributeTargetSpecifierSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Identifier, colonToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSwitchExpressionArm(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSwitchExpressionArm(this); - /// Attribute syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AttributeSyntax : CSharpSyntaxNode + public SwitchExpressionArmSyntax Update(PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) { - private NameSyntax? name; - private AttributeArgumentListSyntax? argumentList; - - internal AttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (pattern != this.Pattern || whenClause != this.WhenClause || equalsGreaterThanToken != this.EqualsGreaterThanToken || expression != this.Expression) { + var newNode = SyntaxFactory.SwitchExpressionArm(pattern, whenClause, equalsGreaterThanToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the name. - public NameSyntax Name => GetRedAtZero(ref this.name)!; - - public AttributeArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 1 => GetRed(ref this.argumentList, 1), - _ => null, - }; + public SwitchExpressionArmSyntax WithPattern(PatternSyntax pattern) => Update(pattern, this.WhenClause, this.EqualsGreaterThanToken, this.Expression); + public SwitchExpressionArmSyntax WithWhenClause(WhenClauseSyntax? whenClause) => Update(this.Pattern, whenClause, this.EqualsGreaterThanToken, this.Expression); + public SwitchExpressionArmSyntax WithEqualsGreaterThanToken(SyntaxToken equalsGreaterThanToken) => Update(this.Pattern, this.WhenClause, equalsGreaterThanToken, this.Expression); + public SwitchExpressionArmSyntax WithExpression(ExpressionSyntax expression) => Update(this.Pattern, this.WhenClause, this.EqualsGreaterThanToken, expression); +} - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.argumentList, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TryStatementSyntax : StatementSyntax +{ + private SyntaxNode? attributeLists; + private BlockSyntax? block; + private SyntaxNode? catches; + private FinallyClauseSyntax? @finally; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttribute(this); + internal TryStatementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax? argumentList) - { - if (name != this.Name || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.Attribute(name, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - return this; - } + public SyntaxToken TryKeyword => new SyntaxToken(this, ((InternalSyntax.TryStatementSyntax)this.Green).tryKeyword, GetChildPosition(1), GetChildIndex(1)); - public AttributeSyntax WithName(NameSyntax name) => Update(name, this.ArgumentList); - public AttributeSyntax WithArgumentList(AttributeArgumentListSyntax? argumentList) => Update(this.Name, argumentList); + public BlockSyntax Block => GetRed(ref this.block, 2)!; - public AttributeSyntax AddArgumentListArguments(params AttributeArgumentSyntax[] items) - { - var argumentList = this.ArgumentList ?? SyntaxFactory.AttributeArgumentList(); - return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); - } - } + public SyntaxList Catches => new SyntaxList(GetRed(ref this.catches, 3)); - /// Attribute argument list syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode - { - private SyntaxNode? arguments; + public FinallyClauseSyntax? Finally => GetRed(ref this.@finally, 4); - internal AttributeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.block, 2)!, + 3 => GetRed(ref this.catches, 3)!, + 4 => GetRed(ref this.@finally, 4), + _ => null, + }; - /// Gets the open paren token. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); - - /// Gets the arguments syntax list. - public SeparatedSyntaxList Arguments + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - get - { - var red = GetRed(ref this.arguments, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } - - /// Gets the close paren token. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + 0 => this.attributeLists, + 2 => this.block, + 3 => this.catches, + 4 => this.@finally, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTryStatement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTryStatement(this); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgumentList(this); - - public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + public TryStatementSyntax Update(SyntaxList attributeLists, SyntaxToken tryKeyword, BlockSyntax block, SyntaxList catches, FinallyClauseSyntax? @finally) + { + if (attributeLists != this.AttributeLists || tryKeyword != this.TryKeyword || block != this.Block || catches != this.Catches || @finally != this.Finally) { - if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.TryStatement(attributeLists, tryKeyword, block, catches, @finally); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public AttributeArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); - public AttributeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); - public AttributeArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); - - public AttributeArgumentListSyntax AddArguments(params AttributeArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); + return this; } - /// Attribute argument syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode - { - private NameEqualsSyntax? nameEquals; - private NameColonSyntax? nameColon; - private ExpressionSyntax? expression; + internal override StatementSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new TryStatementSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.TryKeyword, this.Block, this.Catches, this.Finally); + public TryStatementSyntax WithTryKeyword(SyntaxToken tryKeyword) => Update(this.AttributeLists, tryKeyword, this.Block, this.Catches, this.Finally); + public TryStatementSyntax WithBlock(BlockSyntax block) => Update(this.AttributeLists, this.TryKeyword, block, this.Catches, this.Finally); + public TryStatementSyntax WithCatches(SyntaxList catches) => Update(this.AttributeLists, this.TryKeyword, this.Block, catches, this.Finally); + public TryStatementSyntax WithFinally(FinallyClauseSyntax? @finally) => Update(this.AttributeLists, this.TryKeyword, this.Block, this.Catches, @finally); - internal AttributeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new TryStatementSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public TryStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public TryStatementSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); + public TryStatementSyntax AddCatches(params CatchClauseSyntax[] items) => WithCatches(this.Catches.AddRange(items)); +} - public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CatchClauseSyntax : CSharpSyntaxNode +{ + private CatchDeclarationSyntax? declaration; + private CatchFilterClauseSyntax? filter; + private BlockSyntax? block; - public NameColonSyntax? NameColon => GetRed(ref this.nameColon, 1); + internal CatchClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the expression. - public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + public SyntaxToken CatchKeyword => new SyntaxToken(this, ((InternalSyntax.CatchClauseSyntax)this.Green).catchKeyword, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.nameEquals), - 1 => GetRed(ref this.nameColon, 1), - 2 => GetRed(ref this.expression, 2)!, - _ => null, - }; + public CatchDeclarationSyntax? Declaration => GetRed(ref this.declaration, 1); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.nameEquals, - 1 => this.nameColon, - 2 => this.expression, - _ => null, - }; + public CatchFilterClauseSyntax? Filter => GetRed(ref this.filter, 2); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgument(this); + public BlockSyntax Block => GetRed(ref this.block, 3)!; - public AttributeArgumentSyntax Update(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression) - { - var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 1 => GetRed(ref this.declaration, 1), + 2 => GetRed(ref this.filter, 2), + 3 => GetRed(ref this.block, 3)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.declaration, + 2 => this.filter, + 3 => this.block, + _ => null, + }; - public AttributeArgumentSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.NameColon, this.Expression); - public AttributeArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(this.NameEquals, nameColon, this.Expression); - public AttributeArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, this.NameColon, expression); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchClause(this); - /// Class representing an identifier name followed by an equals token. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NameEqualsSyntax : CSharpSyntaxNode + public CatchClauseSyntax Update(SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) { - private IdentifierNameSyntax? name; - - internal NameEqualsSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (catchKeyword != this.CatchKeyword || declaration != this.Declaration || filter != this.Filter || block != this.Block) { + var newNode = SyntaxFactory.CatchClause(catchKeyword, declaration, filter, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the identifier name. - public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; - - public SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.NameEqualsSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameEquals(this); + return this; + } - public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken) - { - if (name != this.Name || equalsToken != this.EqualsToken) - { - var newNode = SyntaxFactory.NameEquals(name, equalsToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public CatchClauseSyntax WithCatchKeyword(SyntaxToken catchKeyword) => Update(catchKeyword, this.Declaration, this.Filter, this.Block); + public CatchClauseSyntax WithDeclaration(CatchDeclarationSyntax? declaration) => Update(this.CatchKeyword, declaration, this.Filter, this.Block); + public CatchClauseSyntax WithFilter(CatchFilterClauseSyntax? filter) => Update(this.CatchKeyword, this.Declaration, filter, this.Block); + public CatchClauseSyntax WithBlock(BlockSyntax block) => Update(this.CatchKeyword, this.Declaration, this.Filter, block); - return this; - } + public CatchClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public CatchClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); +} - public NameEqualsSyntax WithName(IdentifierNameSyntax name) => Update(name, this.EqualsToken); - public NameEqualsSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken); - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CatchDeclarationSyntax : CSharpSyntaxNode +{ + private TypeSyntax? type; - /// Type parameter list syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeParameterListSyntax : CSharpSyntaxNode + internal CatchDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? parameters; + } - internal TypeParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).openParenToken, Position, 0); - /// Gets the < token. - public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); + public TypeSyntax Type => GetRed(ref this.type, 1)!; - /// Gets the parameter list. - public SeparatedSyntaxList Parameters + public SyntaxToken Identifier + { + get { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var slot = ((Syntax.InternalSyntax.CatchDeclarationSyntax)this.Green).identifier; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } + } - /// Gets the > token. - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CatchDeclarationSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.type, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchDeclaration(this); - public TypeParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + public CatchDeclarationSyntax Update(SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || type != this.Type || identifier != this.Identifier || closeParenToken != this.CloseParenToken) { - if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.CatchDeclaration(openParenToken, type, identifier, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TypeParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); - public TypeParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); - public TypeParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); - - public TypeParameterListSyntax AddParameters(params TypeParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); + return this; } - /// Type parameter syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeParameterSyntax : CSharpSyntaxNode - { - private SyntaxNode? attributeLists; - - internal TypeParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public CatchDeclarationSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Type, this.Identifier, this.CloseParenToken); + public CatchDeclarationSyntax WithType(TypeSyntax type) => Update(this.OpenParenToken, type, this.Identifier, this.CloseParenToken); + public CatchDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.OpenParenToken, this.Type, identifier, this.CloseParenToken); + public CatchDeclarationSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Type, this.Identifier, closeParenToken); +} - public SyntaxToken VarianceKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CatchFilterClauseSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? filterExpression; - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + internal CatchFilterClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + public SyntaxToken WhenKeyword => new SyntaxToken(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).whenKeyword, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameter(this); + public ExpressionSyntax FilterExpression => GetRed(ref this.filterExpression, 2)!; - public TypeParameterSyntax Update(SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) - { - if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) - { - var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CatchFilterClauseSyntax)this.Green).closeParenToken, GetChildPosition(3), GetChildIndex(3)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.filterExpression, 2)! : null; - public TypeParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.VarianceKeyword, this.Identifier); - public TypeParameterSyntax WithVarianceKeyword(SyntaxToken varianceKeyword) => Update(this.AttributeLists, varianceKeyword, this.Identifier); - public TypeParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.VarianceKeyword, identifier); + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.filterExpression : null; - public TypeParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCatchFilterClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCatchFilterClause(this); - /// Base class for type declaration syntax. - public abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax + public CatchFilterClauseSyntax Update(SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) { - internal BaseTypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (whenKeyword != this.WhenKeyword || openParenToken != this.OpenParenToken || filterExpression != this.FilterExpression || closeParenToken != this.CloseParenToken) { + var newNode = SyntaxFactory.CatchFilterClause(whenKeyword, openParenToken, filterExpression, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the identifier. - public abstract SyntaxToken Identifier { get; } - public BaseTypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); - internal abstract BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier); + return this; + } - /// Gets the base type list. - public abstract BaseListSyntax? BaseList { get; } - public BaseTypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => WithBaseListCore(baseList); - internal abstract BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList); + public CatchFilterClauseSyntax WithWhenKeyword(SyntaxToken whenKeyword) => Update(whenKeyword, this.OpenParenToken, this.FilterExpression, this.CloseParenToken); + public CatchFilterClauseSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.WhenKeyword, openParenToken, this.FilterExpression, this.CloseParenToken); + public CatchFilterClauseSyntax WithFilterExpression(ExpressionSyntax filterExpression) => Update(this.WhenKeyword, this.OpenParenToken, filterExpression, this.CloseParenToken); + public CatchFilterClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.WhenKeyword, this.OpenParenToken, this.FilterExpression, closeParenToken); +} - public BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); - internal abstract BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FinallyClauseSyntax : CSharpSyntaxNode +{ + private BlockSyntax? block; - /// Gets the open brace token. - public abstract SyntaxToken OpenBraceToken { get; } - public BaseTypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => WithOpenBraceTokenCore(openBraceToken); - internal abstract BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken); + internal FinallyClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the close brace token. - public abstract SyntaxToken CloseBraceToken { get; } - public BaseTypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => WithCloseBraceTokenCore(closeBraceToken); - internal abstract BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken); + public SyntaxToken FinallyKeyword => new SyntaxToken(this, ((InternalSyntax.FinallyClauseSyntax)this.Green).finallyKeyword, Position, 0); - /// Gets the optional semicolon token. - public abstract SyntaxToken SemicolonToken { get; } - public BaseTypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); - internal abstract BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); + public BlockSyntax Block => GetRed(ref this.block, 1)!; - public new BaseTypeDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseTypeDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseTypeDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseTypeDeclarationSyntax)WithModifiersCore(modifiers); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.block, 1)! : null; - public new BaseTypeDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseTypeDeclarationSyntax)AddAttributeListsCore(items); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.block : null; - public new BaseTypeDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseTypeDeclarationSyntax)AddModifiersCore(items); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFinallyClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFinallyClause(this); - /// Base class for type declaration syntax (class, struct, interface, record). - public abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax + public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, BlockSyntax block) { - internal TypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (finallyKeyword != this.FinallyKeyword || block != this.Block) { + var newNode = SyntaxFactory.FinallyClause(finallyKeyword, block); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the type keyword token ("class", "struct", "interface", "record"). - public abstract SyntaxToken Keyword { get; } - public TypeDeclarationSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); - internal abstract TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword); - - public abstract TypeParameterListSyntax? TypeParameterList { get; } - public TypeDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => WithTypeParameterListCore(typeParameterList); - internal abstract TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList); + return this; + } - public TypeDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) => AddTypeParameterListParametersCore(items); - internal abstract TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items); + public FinallyClauseSyntax WithFinallyKeyword(SyntaxToken finallyKeyword) => Update(finallyKeyword, this.Block); + public FinallyClauseSyntax WithBlock(BlockSyntax block) => Update(this.FinallyKeyword, block); - public abstract ParameterListSyntax? ParameterList { get; } - public TypeDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => WithParameterListCore(parameterList); - internal abstract TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList); + public FinallyClauseSyntax AddBlockAttributeLists(params AttributeListSyntax[] items) => WithBlock(this.Block.WithAttributeLists(this.Block.AttributeLists.AddRange(items))); + public FinallyClauseSyntax AddBlockStatements(params StatementSyntax[] items) => WithBlock(this.Block.WithStatements(this.Block.Statements.AddRange(items))); +} - public TypeDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); - internal abstract TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CompilationUnitSyntax : CSharpSyntaxNode +{ + private SyntaxNode? externs; + private SyntaxNode? usings; + private SyntaxNode? attributeLists; + private SyntaxNode? members; - /// Gets the type constraint list. - public abstract SyntaxList ConstraintClauses { get; } - public TypeDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => WithConstraintClausesCore(constraintClauses); - internal abstract TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses); + internal CompilationUnitSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public TypeDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClausesCore(items); - internal abstract TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items); + public SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 0)); - /// Gets the member declarations. - public abstract SyntaxList Members { get; } - public TypeDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); - internal abstract TypeDeclarationSyntax WithMembersCore(SyntaxList members); + public SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 1)); - public TypeDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); - internal abstract TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); + /// Gets the attribute declaration list. + public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 2)); - public new TypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => (TypeDeclarationSyntax)WithIdentifierCore(identifier); - public new TypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => (TypeDeclarationSyntax)WithBaseListCore(baseList); - public new TypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => (TypeDeclarationSyntax)WithOpenBraceTokenCore(openBraceToken); - public new TypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => (TypeDeclarationSyntax)WithCloseBraceTokenCore(closeBraceToken); - public new TypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => (TypeDeclarationSyntax)WithSemicolonTokenCore(semicolonToken); + public SyntaxList Members => new SyntaxList(GetRed(ref this.members, 3)); - public new BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); - } + public SyntaxToken EndOfFileToken => new SyntaxToken(this, ((InternalSyntax.CompilationUnitSyntax)this.Green).endOfFileToken, GetChildPosition(4), GetChildIndex(4)); - /// Class type declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.externs)!, + 1 => GetRed(ref this.usings, 1)!, + 2 => GetRed(ref this.attributeLists, 2)!, + 3 => GetRed(ref this.members, 3)!, + _ => null, + }; - internal ClassDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 0 => this.externs, + 1 => this.usings, + 2 => this.attributeLists, + 3 => this.members, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCompilationUnit(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCompilationUnit(this); - public override SyntaxTokenList Modifiers + public CompilationUnitSyntax Update(SyntaxList externs, SyntaxList usings, SyntaxList attributeLists, SyntaxList members, SyntaxToken endOfFileToken) + { + if (externs != this.Externs || usings != this.Usings || attributeLists != this.AttributeLists || members != this.Members || endOfFileToken != this.EndOfFileToken) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, endOfFileToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the class keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public CompilationUnitSyntax WithExterns(SyntaxList externs) => Update(externs, this.Usings, this.AttributeLists, this.Members, this.EndOfFileToken); + public CompilationUnitSyntax WithUsings(SyntaxList usings) => Update(this.Externs, usings, this.AttributeLists, this.Members, this.EndOfFileToken); + public CompilationUnitSyntax WithAttributeLists(SyntaxList attributeLists) => Update(this.Externs, this.Usings, attributeLists, this.Members, this.EndOfFileToken); + public CompilationUnitSyntax WithMembers(SyntaxList members) => Update(this.Externs, this.Usings, this.AttributeLists, members, this.EndOfFileToken); + public CompilationUnitSyntax WithEndOfFileToken(SyntaxToken endOfFileToken) => Update(this.Externs, this.Usings, this.AttributeLists, this.Members, endOfFileToken); - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + public CompilationUnitSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); + public CompilationUnitSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); + public CompilationUnitSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public CompilationUnitSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); +/// +/// Represents an ExternAlias directive syntax, e.g. "extern alias MyAlias;" with specifying "/r:MyAlias=SomeAssembly.dll " on the compiler command line. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ExternAliasDirectiveSyntax : CSharpSyntaxNode +{ - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + internal ExternAliasDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + /// SyntaxToken representing the extern keyword. + public SyntaxToken ExternKeyword => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).externKeyword, Position, 0); - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } + /// SyntaxToken representing the alias keyword. + public SyntaxToken AliasKeyword => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).aliasKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } + /// SyntaxToken representing the semicolon token. + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.ExternAliasDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } - } - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5), - 6 => GetRed(ref this.baseList, 6), - 7 => GetRed(ref this.constraintClauses, 7)!, - 9 => GetRed(ref this.members, 9)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 9 => this.members, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExternAliasDirective(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExternAliasDirective(this); - public ClassDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public ExternAliasDirectiveSyntax Update(SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) + { + if (externKeyword != this.ExternKeyword || aliasKeyword != this.AliasKeyword || identifier != this.Identifier || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ExternAliasDirective(externKeyword, aliasKeyword, identifier, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ClassDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ClassDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new ClassDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new ClassDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new ClassDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new ClassDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new ClassDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new ClassDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new ClassDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new ClassDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new ClassDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new ClassDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + return this; + } + + public ExternAliasDirectiveSyntax WithExternKeyword(SyntaxToken externKeyword) => Update(externKeyword, this.AliasKeyword, this.Identifier, this.SemicolonToken); + public ExternAliasDirectiveSyntax WithAliasKeyword(SyntaxToken aliasKeyword) => Update(this.ExternKeyword, aliasKeyword, this.Identifier, this.SemicolonToken); + public ExternAliasDirectiveSyntax WithIdentifier(SyntaxToken identifier) => Update(this.ExternKeyword, this.AliasKeyword, identifier, this.SemicolonToken); + public ExternAliasDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.ExternKeyword, this.AliasKeyword, this.Identifier, semicolonToken); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class UsingDirectiveSyntax : CSharpSyntaxNode +{ + private NameEqualsSyntax? alias; + private TypeSyntax? namespaceOrType; + + internal UsingDirectiveSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public SyntaxToken GlobalKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).globalKeyword; + return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; + } + } + + public SyntaxToken UsingKeyword => new SyntaxToken(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).usingKeyword, GetChildPosition(1), GetChildIndex(1)); + + public SyntaxToken StaticKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).staticKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; + } + } + + public SyntaxToken UnsafeKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.UsingDirectiveSyntax)this.Green).unsafeKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } + + public NameEqualsSyntax? Alias => GetRed(ref this.alias, 4); + + public TypeSyntax NamespaceOrType => GetRed(ref this.namespaceOrType, 5)!; + + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.UsingDirectiveSyntax)this.Green).semicolonToken, GetChildPosition(6), GetChildIndex(6)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 4 => GetRed(ref this.alias, 4), + 5 => GetRed(ref this.namespaceOrType, 5)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 4 => this.alias, + 5 => this.namespaceOrType, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUsingDirective(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUsingDirective(this); + + public UsingDirectiveSyntax Update(SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) + { + if (globalKeyword != this.GlobalKeyword || usingKeyword != this.UsingKeyword || staticKeyword != this.StaticKeyword || unsafeKeyword != this.UnsafeKeyword || alias != this.Alias || namespaceOrType != this.NamespaceOrType || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.UsingDirective(globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public UsingDirectiveSyntax WithGlobalKeyword(SyntaxToken globalKeyword) => Update(globalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithUsingKeyword(SyntaxToken usingKeyword) => Update(this.GlobalKeyword, usingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithStaticKeyword(SyntaxToken staticKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, staticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, unsafeKeyword, this.Alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithAlias(NameEqualsSyntax? alias) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, alias, this.NamespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithNamespaceOrType(TypeSyntax namespaceOrType) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, namespaceOrType, this.SemicolonToken); + public UsingDirectiveSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.GlobalKeyword, this.UsingKeyword, this.StaticKeyword, this.UnsafeKeyword, this.Alias, this.NamespaceOrType, semicolonToken); +} + +/// Member declaration syntax. +public abstract partial class MemberDeclarationSyntax : CSharpSyntaxNode +{ + internal MemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the attribute declaration list. + public abstract SyntaxList AttributeLists { get; } + public MemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists); + + public MemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + + /// Gets the modifier list. + public abstract SyntaxTokenList Modifiers { get; } + public MemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); + internal abstract MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers); + + public MemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); + internal abstract MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items); +} + +public abstract partial class BaseNamespaceDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public abstract SyntaxToken NamespaceKeyword { get; } + public BaseNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => WithNamespaceKeywordCore(namespaceKeyword); + internal abstract BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword); + + public abstract NameSyntax Name { get; } + public BaseNamespaceDeclarationSyntax WithName(NameSyntax name) => WithNameCore(name); + internal abstract BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name); + + public abstract SyntaxList Externs { get; } + public BaseNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => WithExternsCore(externs); + internal abstract BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs); + + public BaseNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => AddExternsCore(items); + internal abstract BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items); + + public abstract SyntaxList Usings { get; } + public BaseNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => WithUsingsCore(usings); + internal abstract BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings); + + public BaseNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => AddUsingsCore(items); + internal abstract BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items); + + public abstract SyntaxList Members { get; } + public BaseNamespaceDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); + internal abstract BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members); + + public BaseNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); + internal abstract BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); + + public new BaseNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseNamespaceDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseNamespaceDeclarationSyntax)WithModifiersCore(modifiers); + + public new BaseNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseNamespaceDeclarationSyntax)AddAttributeListsCore(items); + + public new BaseNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseNamespaceDeclarationSyntax)AddModifiersCore(items); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private NameSyntax? name; + private SyntaxNode? externs; + private SyntaxNode? usings; + private SyntaxNode? members; + + internal NamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + + public override NameSyntax Name => GetRed(ref this.name, 3)!; + + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).openBraceToken, GetChildPosition(4), GetChildIndex(4)); + + public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); + + public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); + + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.NamespaceDeclarationSyntax)this.Green).closeBraceToken, GetChildPosition(8), GetChildIndex(8)); + + /// Gets the optional semicolon token. + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.NamespaceDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.name, 3)!, + 5 => GetRed(ref this.externs, 5)!, + 6 => GetRed(ref this.usings, 6)!, + 7 => GetRed(ref this.members, 7)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.name, + 5 => this.externs, + 6 => this.usings, + 7 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNamespaceDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNamespaceDeclaration(this); + + public NamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, SyntaxList externs, SyntaxList usings, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || openBraceToken != this.OpenBraceToken || externs != this.Externs || usings != this.Usings || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, openBraceToken, externs, usings, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new NamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new NamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); + public new NamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); + public new NamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + public NamespaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, openBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); + public new NamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, externs, this.Usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); + public new NamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, usings, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new NamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, members, this.CloseBraceToken, this.SemicolonToken); + public NamespaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, closeBraceToken, this.SemicolonToken); + public NamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.OpenBraceToken, this.Externs, this.Usings, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new NamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new NamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); + public new NamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); + public new NamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new NamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FileScopedNamespaceDeclarationSyntax : BaseNamespaceDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private NameSyntax? name; + private SyntaxNode? externs; + private SyntaxNode? usings; + private SyntaxNode? members; + + internal FileScopedNamespaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + public override SyntaxToken NamespaceKeyword => new SyntaxToken(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).namespaceKeyword, GetChildPosition(2), GetChildIndex(2)); + + public override NameSyntax Name => GetRed(ref this.name, 3)!; + + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.FileScopedNamespaceDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + + public override SyntaxList Externs => new SyntaxList(GetRed(ref this.externs, 5)); + + public override SyntaxList Usings => new SyntaxList(GetRed(ref this.usings, 6)); + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 7)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.name, 3)!, + 5 => GetRed(ref this.externs, 5)!, + 6 => GetRed(ref this.usings, 6)!, + 7 => GetRed(ref this.members, 7)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.name, + 5 => this.externs, + 6 => this.usings, + 7 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFileScopedNamespaceDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFileScopedNamespaceDeclaration(this); + + public FileScopedNamespaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, SyntaxList externs, SyntaxList usings, SyntaxList members) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || namespaceKeyword != this.NamespaceKeyword || name != this.Name || semicolonToken != this.SemicolonToken || externs != this.Externs || usings != this.Usings || members != this.Members) + { + var newNode = SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, namespaceKeyword, name, semicolonToken, externs, usings, members); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FileScopedNamespaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new FileScopedNamespaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithNamespaceKeywordCore(SyntaxToken namespaceKeyword) => WithNamespaceKeyword(namespaceKeyword); + public new FileScopedNamespaceDeclarationSyntax WithNamespaceKeyword(SyntaxToken namespaceKeyword) => Update(this.AttributeLists, this.Modifiers, namespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithNameCore(NameSyntax name) => WithName(name); + public new FileScopedNamespaceDeclarationSyntax WithName(NameSyntax name) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, name, this.SemicolonToken, this.Externs, this.Usings, this.Members); + public FileScopedNamespaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, semicolonToken, this.Externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithExternsCore(SyntaxList externs) => WithExterns(externs); + public new FileScopedNamespaceDeclarationSyntax WithExterns(SyntaxList externs) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, externs, this.Usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithUsingsCore(SyntaxList usings) => WithUsings(usings); + public new FileScopedNamespaceDeclarationSyntax WithUsings(SyntaxList usings) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, usings, this.Members); + internal override BaseNamespaceDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new FileScopedNamespaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.NamespaceKeyword, this.Name, this.SemicolonToken, this.Externs, this.Usings, members); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FileScopedNamespaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new FileScopedNamespaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddExternsCore(params ExternAliasDirectiveSyntax[] items) => AddExterns(items); + public new FileScopedNamespaceDeclarationSyntax AddExterns(params ExternAliasDirectiveSyntax[] items) => WithExterns(this.Externs.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddUsingsCore(params UsingDirectiveSyntax[] items) => AddUsings(items); + public new FileScopedNamespaceDeclarationSyntax AddUsings(params UsingDirectiveSyntax[] items) => WithUsings(this.Usings.AddRange(items)); + internal override BaseNamespaceDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new FileScopedNamespaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// Class representing one or more attributes applied to a language construct. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AttributeListSyntax : CSharpSyntaxNode +{ + private AttributeTargetSpecifierSyntax? target; + private SyntaxNode? attributes; + + internal AttributeListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.AttributeListSyntax)this.Green).openBracketToken, Position, 0); + + /// Gets the optional construct targeted by the attribute. + public AttributeTargetSpecifierSyntax? Target => GetRed(ref this.target, 1); + + /// Gets the attribute declaration list. + public SeparatedSyntaxList Attributes + { + get + { + var red = GetRed(ref this.attributes, 2); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(2)) : default; + } + } + + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.AttributeListSyntax)this.Green).closeBracketToken, GetChildPosition(3), GetChildIndex(3)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.target, 1), + 2 => GetRed(ref this.attributes, 2)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.target, + 2 => this.attributes, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeList(this); + + public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList attributes, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || target != this.Target || attributes != this.Attributes || closeBracketToken != this.CloseBracketToken) + { + var newNode = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Target, this.Attributes, this.CloseBracketToken); + public AttributeListSyntax WithTarget(AttributeTargetSpecifierSyntax? target) => Update(this.OpenBracketToken, target, this.Attributes, this.CloseBracketToken); + public AttributeListSyntax WithAttributes(SeparatedSyntaxList attributes) => Update(this.OpenBracketToken, this.Target, attributes, this.CloseBracketToken); + public AttributeListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Target, this.Attributes, closeBracketToken); + + public AttributeListSyntax AddAttributes(params AttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); +} + +/// Class representing what language construct an attribute targets. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AttributeTargetSpecifierSyntax : CSharpSyntaxNode +{ + + internal AttributeTargetSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).identifier, Position, 0); + + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.AttributeTargetSpecifierSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + + internal override SyntaxNode? GetNodeSlot(int index) => null; + + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeTargetSpecifier(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeTargetSpecifier(this); + + public AttributeTargetSpecifierSyntax Update(SyntaxToken identifier, SyntaxToken colonToken) + { + if (identifier != this.Identifier || colonToken != this.ColonToken) + { + var newNode = SyntaxFactory.AttributeTargetSpecifier(identifier, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeTargetSpecifierSyntax WithIdentifier(SyntaxToken identifier) => Update(identifier, this.ColonToken); + public AttributeTargetSpecifierSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Identifier, colonToken); +} + +/// Attribute syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AttributeSyntax : CSharpSyntaxNode +{ + private NameSyntax? name; + private AttributeArgumentListSyntax? argumentList; + + internal AttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the name. + public NameSyntax Name => GetRedAtZero(ref this.name)!; + + public AttributeArgumentListSyntax? ArgumentList => GetRed(ref this.argumentList, 1); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.name)!, + 1 => GetRed(ref this.argumentList, 1), + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.argumentList, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttribute(this); + + public AttributeSyntax Update(NameSyntax name, AttributeArgumentListSyntax? argumentList) + { + if (name != this.Name || argumentList != this.ArgumentList) + { + var newNode = SyntaxFactory.Attribute(name, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeSyntax WithName(NameSyntax name) => Update(name, this.ArgumentList); + public AttributeSyntax WithArgumentList(AttributeArgumentListSyntax? argumentList) => Update(this.Name, argumentList); + + public AttributeSyntax AddArgumentListArguments(params AttributeArgumentSyntax[] items) + { + var argumentList = this.ArgumentList ?? SyntaxFactory.AttributeArgumentList(); + return WithArgumentList(argumentList.WithArguments(argumentList.Arguments.AddRange(items))); + } +} + +/// Attribute argument list syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AttributeArgumentListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? arguments; + + internal AttributeArgumentListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the open paren token. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).openParenToken, Position, 0); + + /// Gets the arguments syntax list. + public SeparatedSyntaxList Arguments + { + get + { + var red = GetRed(ref this.arguments, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } + + /// Gets the close paren token. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.AttributeArgumentListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.arguments, 1)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.arguments : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgumentList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgumentList(this); + + public AttributeArgumentListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList arguments, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || arguments != this.Arguments || closeParenToken != this.CloseParenToken) + { + var newNode = SyntaxFactory.AttributeArgumentList(openParenToken, arguments, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeArgumentListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Arguments, this.CloseParenToken); + public AttributeArgumentListSyntax WithArguments(SeparatedSyntaxList arguments) => Update(this.OpenParenToken, arguments, this.CloseParenToken); + public AttributeArgumentListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Arguments, closeParenToken); + + public AttributeArgumentListSyntax AddArguments(params AttributeArgumentSyntax[] items) => WithArguments(this.Arguments.AddRange(items)); +} + +/// Attribute argument syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AttributeArgumentSyntax : CSharpSyntaxNode +{ + private NameEqualsSyntax? nameEquals; + private NameColonSyntax? nameColon; + private ExpressionSyntax? expression; + + internal AttributeArgumentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public NameEqualsSyntax? NameEquals => GetRedAtZero(ref this.nameEquals); + + public NameColonSyntax? NameColon => GetRed(ref this.nameColon, 1); + + /// Gets the expression. + public ExpressionSyntax Expression => GetRed(ref this.expression, 2)!; + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.nameEquals), + 1 => GetRed(ref this.nameColon, 1), + 2 => GetRed(ref this.expression, 2)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.nameEquals, + 1 => this.nameColon, + 2 => this.expression, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAttributeArgument(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAttributeArgument(this); + + public AttributeArgumentSyntax Update(NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) + { + if (nameEquals != this.NameEquals || nameColon != this.NameColon || expression != this.Expression) + { + var newNode = SyntaxFactory.AttributeArgument(nameEquals, nameColon, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public AttributeArgumentSyntax WithNameEquals(NameEqualsSyntax? nameEquals) => Update(nameEquals, this.NameColon, this.Expression); + public AttributeArgumentSyntax WithNameColon(NameColonSyntax? nameColon) => Update(this.NameEquals, nameColon, this.Expression); + public AttributeArgumentSyntax WithExpression(ExpressionSyntax expression) => Update(this.NameEquals, this.NameColon, expression); +} + +/// Class representing an identifier name followed by an equals token. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NameEqualsSyntax : CSharpSyntaxNode +{ + private IdentifierNameSyntax? name; + + internal NameEqualsSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the identifier name. + public IdentifierNameSyntax Name => GetRedAtZero(ref this.name)!; + + public SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.NameEqualsSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameEquals(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameEquals(this); + + public NameEqualsSyntax Update(IdentifierNameSyntax name, SyntaxToken equalsToken) + { + if (name != this.Name || equalsToken != this.EqualsToken) + { + var newNode = SyntaxFactory.NameEquals(name, equalsToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public NameEqualsSyntax WithName(IdentifierNameSyntax name) => Update(name, this.EqualsToken); + public NameEqualsSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken); +} + +/// Type parameter list syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeParameterListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? parameters; + + internal TypeParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the < token. + public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).lessThanToken, Position, 0); + + /// Gets the parameter list. + public SeparatedSyntaxList Parameters + { + get + { + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; + } + } + + /// Gets the > token. + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.TypeParameterListSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterList(this); + + public TypeParameterListSyntax Update(SyntaxToken lessThanToken, SeparatedSyntaxList parameters, SyntaxToken greaterThanToken) + { + if (lessThanToken != this.LessThanToken || parameters != this.Parameters || greaterThanToken != this.GreaterThanToken) + { + var newNode = SyntaxFactory.TypeParameterList(lessThanToken, parameters, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public TypeParameterListSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Parameters, this.GreaterThanToken); + public TypeParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.LessThanToken, parameters, this.GreaterThanToken); + public TypeParameterListSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Parameters, greaterThanToken); + + public TypeParameterListSyntax AddParameters(params TypeParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} + +/// Type parameter syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeParameterSyntax : CSharpSyntaxNode +{ + private SyntaxNode? attributeLists; + + internal TypeParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the attribute declaration list. + public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public SyntaxToken VarianceKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.TypeParameterSyntax)this.Green).varianceKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.TypeParameterSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.attributeLists)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.attributeLists : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameter(this); + + public TypeParameterSyntax Update(SyntaxList attributeLists, SyntaxToken varianceKeyword, SyntaxToken identifier) + { + if (attributeLists != this.AttributeLists || varianceKeyword != this.VarianceKeyword || identifier != this.Identifier) + { + var newNode = SyntaxFactory.TypeParameter(attributeLists, varianceKeyword, identifier); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public TypeParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.VarianceKeyword, this.Identifier); + public TypeParameterSyntax WithVarianceKeyword(SyntaxToken varianceKeyword) => Update(this.AttributeLists, varianceKeyword, this.Identifier); + public TypeParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.VarianceKeyword, identifier); + + public TypeParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); +} + +/// Base class for type declaration syntax. +public abstract partial class BaseTypeDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseTypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the identifier. + public abstract SyntaxToken Identifier { get; } + public BaseTypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => WithIdentifierCore(identifier); + internal abstract BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier); + + /// Gets the base type list. + public abstract BaseListSyntax? BaseList { get; } + public BaseTypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => WithBaseListCore(baseList); + internal abstract BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList); + + public BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); + internal abstract BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items); + + /// Gets the open brace token. + public abstract SyntaxToken OpenBraceToken { get; } + public BaseTypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => WithOpenBraceTokenCore(openBraceToken); + internal abstract BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken); + + /// Gets the close brace token. + public abstract SyntaxToken CloseBraceToken { get; } + public BaseTypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => WithCloseBraceTokenCore(closeBraceToken); + internal abstract BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken); + + /// Gets the optional semicolon token. + public abstract SyntaxToken SemicolonToken { get; } + public BaseTypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); + internal abstract BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); + + public new BaseTypeDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseTypeDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseTypeDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseTypeDeclarationSyntax)WithModifiersCore(modifiers); + + public new BaseTypeDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseTypeDeclarationSyntax)AddAttributeListsCore(items); + + public new BaseTypeDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseTypeDeclarationSyntax)AddModifiersCore(items); +} + +/// Base class for type declaration syntax (class, struct, interface, record). +public abstract partial class TypeDeclarationSyntax : BaseTypeDeclarationSyntax +{ + internal TypeDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the type keyword token ("class", "struct", "interface", "record"). + public abstract SyntaxToken Keyword { get; } + public TypeDeclarationSyntax WithKeyword(SyntaxToken keyword) => WithKeywordCore(keyword); + internal abstract TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword); + + public abstract TypeParameterListSyntax? TypeParameterList { get; } + public TypeDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => WithTypeParameterListCore(typeParameterList); + internal abstract TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList); + + public TypeDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) => AddTypeParameterListParametersCore(items); + internal abstract TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items); + + public abstract ParameterListSyntax? ParameterList { get; } + public TypeDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => WithParameterListCore(parameterList); + internal abstract TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList); + + public TypeDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); + internal abstract TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); + + /// Gets the type constraint list. + public abstract SyntaxList ConstraintClauses { get; } + public TypeDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => WithConstraintClausesCore(constraintClauses); + internal abstract TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses); + + public TypeDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClausesCore(items); + internal abstract TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items); + + /// Gets the member declarations. + public abstract SyntaxList Members { get; } + public TypeDeclarationSyntax WithMembers(SyntaxList members) => WithMembersCore(members); + internal abstract TypeDeclarationSyntax WithMembersCore(SyntaxList members); + + public TypeDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => AddMembersCore(items); + internal abstract TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items); + + public new TypeDeclarationSyntax WithIdentifier(SyntaxToken identifier) => (TypeDeclarationSyntax)WithIdentifierCore(identifier); + public new TypeDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => (TypeDeclarationSyntax)WithBaseListCore(baseList); + public new TypeDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => (TypeDeclarationSyntax)WithOpenBraceTokenCore(openBraceToken); + public new TypeDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => (TypeDeclarationSyntax)WithCloseBraceTokenCore(closeBraceToken); + public new TypeDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => (TypeDeclarationSyntax)WithSemicolonTokenCore(semicolonToken); + + public new BaseTypeDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) => AddBaseListTypesCore(items); +} + +/// Class type declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ClassDeclarationSyntax : TypeDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal ClassDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the class keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ClassDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } + + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.ClassDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5), + 6 => GetRed(ref this.baseList, 6), + 7 => GetRed(ref this.constraintClauses, 7)!, + 9 => GetRed(ref this.members, 9)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 9 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassDeclaration(this); + + public ClassDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.ClassDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ClassDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ClassDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new ClassDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new ClassDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new ClassDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new ClassDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new ClassDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new ClassDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new ClassDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new ClassDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new ClassDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new ClassDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ClassDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ClassDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new ClassDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new ClassDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + { + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new ClassDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new ClassDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new ClassDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// Struct type declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal StructDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the struct keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } + + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5), + 6 => GetRed(ref this.baseList, 6), + 7 => GetRed(ref this.constraintClauses, 7)!, + 9 => GetRed(ref this.members, 9)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 9 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStructDeclaration(this); + + public StructDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new StructDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new StructDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new StructDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new StructDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new StructDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new StructDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new StructDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new StructDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new StructDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new StructDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new StructDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new StructDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new StructDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new StructDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new StructDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new StructDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + { + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new StructDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new StructDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new StructDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// Interface type declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal InterfaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + /// Gets the interface keyword token. + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); + + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); + + public override SyntaxToken CloseBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } + + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; + } + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.typeParameterList, 4), + 5 => GetRed(ref this.parameterList, 5), + 6 => GetRed(ref this.baseList, 6), + 7 => GetRed(ref this.constraintClauses, 7)!, + 9 => GetRed(ref this.members, 9)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.typeParameterList, + 5 => this.parameterList, + 6 => this.baseList, + 7 => this.constraintClauses, + 9 => this.members, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterfaceDeclaration(this); + + public InterfaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new InterfaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new InterfaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new InterfaceDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new InterfaceDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new InterfaceDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new InterfaceDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new InterfaceDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new InterfaceDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new InterfaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new InterfaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new InterfaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new InterfaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new InterfaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new InterfaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new InterfaceDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new InterfaceDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + { + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new InterfaceDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new InterfaceDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new InterfaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private BaseListSyntax? baseList; + private SyntaxNode? constraintClauses; + private SyntaxNode? members; + + internal RecordDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; + } + } + + public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + + public SyntaxToken ClassOrStructKeyword + { + get + { + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; + } + } + + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + + public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); + + public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 6); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 7); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ClassDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ClassDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new ClassDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 8)); + + public override SyntaxToken OpenBraceToken + { + get + { + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; + } + } + + public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 10)); + + public override SyntaxToken CloseBraceToken + { + get { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new ClassDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + } + + public override SyntaxToken SemicolonToken + { + get { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new ClassDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new ClassDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new ClassDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// Struct type declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class StructDeclarationSyntax : TypeDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; - - internal StructDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the struct keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - - public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.StructDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); - - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); - - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); - - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); - - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } - - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); - - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } - - public override SyntaxToken SemicolonToken + } + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var slot = ((Syntax.InternalSyntax.StructDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } - } - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5), - 6 => GetRed(ref this.baseList, 6), - 7 => GetRed(ref this.constraintClauses, 7)!, - 9 => GetRed(ref this.members, 9)!, - _ => null, - }; + 0 => GetRedAtZero(ref this.attributeLists)!, + 5 => GetRed(ref this.typeParameterList, 5), + 6 => GetRed(ref this.parameterList, 6), + 7 => GetRed(ref this.baseList, 7), + 8 => GetRed(ref this.constraintClauses, 8)!, + 10 => GetRed(ref this.members, 10)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 9 => this.members, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.baseList, + 8 => this.constraintClauses, + 10 => this.members, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitStructDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitStructDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecordDeclaration(this); - public StructDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public RecordDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.StructDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + var newNode = SyntaxFactory.RecordDeclaration(this.Kind(), attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new RecordDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new RecordDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); + public new RecordDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + public RecordDeclarationSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(this.AttributeLists, this.Modifiers, this.Keyword, classOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new RecordDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); + public new RecordDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); + public new RecordDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new RecordDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); + public new RecordDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new RecordDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); + public new RecordDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new RecordDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new RecordDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new RecordDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new RecordDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); + public new RecordDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new RecordDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + { + var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); + return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + } + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new RecordDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); + public new RecordDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); + public new RecordDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// Enum type declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private BaseListSyntax? baseList; + private SyntaxNode? members; + + internal EnumDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get + { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new StructDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new StructDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new StructDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new StructDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new StructDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new StructDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new StructDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new StructDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new StructDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new StructDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new StructDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new StructDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + /// Gets the enum keyword token. + public SyntaxToken EnumKeyword => new SyntaxToken(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new StructDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new StructDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new StructDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + + public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 4); + + public override SyntaxToken OpenBraceToken + { + get { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new StructDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + } + + /// Gets the members declaration list. + public SeparatedSyntaxList Members + { + get { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + var red = GetRed(ref this.members, 6); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(6)) : default; } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new StructDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new StructDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new StructDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// Interface type declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class InterfaceDeclarationSyntax : TypeDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; - - internal InterfaceDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the interface keyword token. - public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - - public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.InterfaceDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 4); - - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 5); - - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 6); - - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); - - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } - } - - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 9)); - - public override SyntaxToken CloseBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } - - public override SyntaxToken SemicolonToken + } + + public override SyntaxToken CloseBraceToken + { + get { - get - { - var slot = ((Syntax.InternalSyntax.InterfaceDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } - } - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.typeParameterList, 4), - 5 => GetRed(ref this.parameterList, 5), - 6 => GetRed(ref this.baseList, 6), - 7 => GetRed(ref this.constraintClauses, 7)!, - 9 => GetRed(ref this.members, 9)!, - _ => null, - }; + var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + } + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.typeParameterList, - 5 => this.parameterList, - 6 => this.baseList, - 7 => this.constraintClauses, - 9 => this.members, - _ => null, - }; + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitInterfaceDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitInterfaceDeclaration(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.baseList, 4), + 6 => GetRed(ref this.members, 6)!, + _ => null, + }; - public InterfaceDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.InterfaceDeclaration(attributeLists, modifiers, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.attributeLists, + 4 => this.baseList, + 6 => this.members, + _ => null, + }; - return this; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumDeclaration(this); + + public EnumDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new InterfaceDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new InterfaceDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new InterfaceDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new InterfaceDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new InterfaceDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new InterfaceDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new InterfaceDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new InterfaceDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new InterfaceDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new InterfaceDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new InterfaceDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new InterfaceDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EnumDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EnumDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + public EnumDeclarationSyntax WithEnumKeyword(SyntaxToken enumKeyword) => Update(this.AttributeLists, this.Modifiers, enumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); + public new EnumDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); + public new EnumDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, baseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); + public new EnumDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); + public EnumDeclarationSyntax WithMembers(SeparatedSyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); + public new EnumDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); + internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new EnumDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EnumDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EnumDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); + public new EnumDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + { + var baseList = this.BaseList ?? SyntaxFactory.BaseList(); + return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + } + public EnumDeclarationSyntax AddMembers(params EnumMemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); +} + +/// Delegate declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private SyntaxNode? constraintClauses; + + internal DelegateDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new InterfaceDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new InterfaceDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new InterfaceDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new InterfaceDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + } + + /// Gets the "delegate" keyword. + public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); + + /// Gets the return type. + public TypeSyntax ReturnType => GetRed(ref this.returnType, 3)!; + + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + + public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); + + /// Gets the parameter list. + public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; + + /// Gets the constraint clause list. + public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); + + /// Gets the semicolon token. + public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(8), GetChildIndex(8)); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.returnType, 3)!, + 5 => GetRed(ref this.typeParameterList, 5), + 6 => GetRed(ref this.parameterList, 6)!, + 7 => GetRed(ref this.constraintClauses, 7)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.returnType, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.constraintClauses, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDelegateDeclaration(this); + + public DelegateDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); + var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new InterfaceDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) + + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new DelegateDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new DelegateDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.AttributeLists, this.Modifiers, delegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.SemicolonToken); + public DelegateDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new DelegateDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new DelegateDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public DelegateDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + public DelegateDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + public DelegateDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private EqualsValueClauseSyntax? equalsValue; + + internal EnumMemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers + { + get { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new InterfaceDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new InterfaceDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class RecordDeclarationSyntax : TypeDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private BaseListSyntax? baseList; - private SyntaxNode? constraintClauses; - private SyntaxNode? members; - - internal RecordDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { + } + + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + + public EqualsValueClauseSyntax? EqualsValue => GetRed(ref this.equalsValue, 3); + + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.equalsValue, 3), + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.equalsValue, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumMemberDeclaration(this); + + public EnumMemberDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) + { + var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + return this; + } + + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EnumMemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.EqualsValue); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EnumMemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.EqualsValue); + public EnumMemberDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.EqualsValue); + public EnumMemberDeclarationSyntax WithEqualsValue(EqualsValueClauseSyntax? equalsValue) => Update(this.AttributeLists, this.Modifiers, this.Identifier, equalsValue); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EnumMemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EnumMemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); +} + +/// Base list syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BaseListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? types; + + internal BaseListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxTokenList Modifiers + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); + + /// Gets the base type references. + public SeparatedSyntaxList Types + { + get { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var red = GetRed(ref this.types, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } + + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.types, 1)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.types : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseList(this); - public override SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - - public SyntaxToken ClassOrStructKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).classOrStructKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } - } - - public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.RecordDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - - public override TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); - - public override ParameterListSyntax? ParameterList => GetRed(ref this.parameterList, 6); - - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 7); - - public override SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 8)); - - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(9), GetChildIndex(9)) : default; - } - } - - public override SyntaxList Members => new SyntaxList(GetRed(ref this.members, 10)); - - public override SyntaxToken CloseBraceToken + public BaseListSyntax Update(SyntaxToken colonToken, SeparatedSyntaxList types) + { + if (colonToken != this.ColonToken || types != this.Types) { - get - { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(11), GetChildIndex(11)) : default; - } + var newNode = SyntaxFactory.BaseList(colonToken, types); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken SemicolonToken + return this; + } + + public BaseListSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.Types); + public BaseListSyntax WithTypes(SeparatedSyntaxList types) => Update(this.ColonToken, types); + + public BaseListSyntax AddTypes(params BaseTypeSyntax[] items) => WithTypes(this.Types.AddRange(items)); +} + +/// Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. +public abstract partial class BaseTypeSyntax : CSharpSyntaxNode +{ + internal BaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public abstract TypeSyntax Type { get; } + public BaseTypeSyntax WithType(TypeSyntax type) => WithTypeCore(type); + internal abstract BaseTypeSyntax WithTypeCore(TypeSyntax type); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax +{ + private TypeSyntax? type; + + internal SimpleBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override TypeSyntax Type => GetRedAtZero(ref this.type)!; + + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleBaseType(this); + + public SimpleBaseTypeSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - get - { - var slot = ((Syntax.InternalSyntax.RecordDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(12), GetChildIndex(12)) : default; - } + var newNode = SyntaxFactory.SimpleBaseType(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 5 => GetRed(ref this.typeParameterList, 5), - 6 => GetRed(ref this.parameterList, 6), - 7 => GetRed(ref this.baseList, 7), - 8 => GetRed(ref this.constraintClauses, 8)!, - 10 => GetRed(ref this.members, 10)!, - _ => null, - }; + return this; + } + + internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new SimpleBaseTypeSyntax WithType(TypeSyntax type) => Update(type); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax +{ + private TypeSyntax? type; + private ArgumentListSyntax? argumentList; + + internal PrimaryConstructorBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public override TypeSyntax Type => GetRedAtZero(ref this.type)!; + + public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.baseList, - 8 => this.constraintClauses, - 10 => this.members, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.type)!, + 1 => GetRed(ref this.argumentList, 1)!, + _ => null, + }; + + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.type, + 1 => this.argumentList, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRecordDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRecordDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrimaryConstructorBaseType(this); - public RecordDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken classOrStructKeyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList constraintClauses, SyntaxToken openBraceToken, SyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) + { + if (type != this.Type || argumentList != this.ArgumentList) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || classOrStructKeyword != this.ClassOrStructKeyword || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || baseList != this.BaseList || constraintClauses != this.ConstraintClauses || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.RecordDeclaration(this.Kind(), attributeLists, modifiers, keyword, classOrStructKeyword, identifier, typeParameterList, parameterList, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new PrimaryConstructorBaseTypeSyntax WithType(TypeSyntax type) => Update(type, this.ArgumentList); + public PrimaryConstructorBaseTypeSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Type, argumentList); + + public PrimaryConstructorBaseTypeSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} + +/// Type parameter constraint clause. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode +{ + private IdentifierNameSyntax? name; + private SyntaxNode? constraints; - return this; + internal TypeParameterConstraintClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + public SyntaxToken WhereKeyword => new SyntaxToken(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).whereKeyword, Position, 0); + + /// Gets the identifier. + public IdentifierNameSyntax Name => GetRed(ref this.name, 1)!; + + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + + /// Gets the constraints list. + public SeparatedSyntaxList Constraints + { + get + { + var red = GetRed(ref this.constraints, 3); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; } + } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new RecordDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new RecordDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithKeywordCore(SyntaxToken keyword) => WithKeyword(keyword); - public new RecordDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - public RecordDeclarationSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(this.AttributeLists, this.Modifiers, this.Keyword, classOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new RecordDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithTypeParameterListCore(TypeParameterListSyntax? typeParameterList) => WithTypeParameterList(typeParameterList); - public new RecordDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, typeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithParameterListCore(ParameterListSyntax? parameterList) => WithParameterList(parameterList); - public new RecordDeclarationSyntax WithParameterList(ParameterListSyntax? parameterList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, parameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new RecordDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, baseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithConstraintClausesCore(SyntaxList constraintClauses) => WithConstraintClauses(constraintClauses); - public new RecordDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, constraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new RecordDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override TypeDeclarationSyntax WithMembersCore(SyntaxList members) => WithMembers(members); - public new RecordDeclarationSyntax WithMembers(SyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new RecordDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new RecordDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.ClassOrStructKeyword, this.Identifier, this.TypeParameterList, this.ParameterList, this.BaseList, this.ConstraintClauses, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 1 => GetRed(ref this.name, 1)!, + 3 => GetRed(ref this.constraints, 3)!, + _ => null, + }; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new RecordDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new RecordDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override TypeDeclarationSyntax AddTypeParameterListParametersCore(params TypeParameterSyntax[] items) => AddTypeParameterListParameters(items); - public new RecordDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - internal override TypeDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new RecordDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) + 1 => this.name, + 3 => this.constraints, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterConstraintClause(this); + + public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, SeparatedSyntaxList constraints) + { + if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) { - var parameterList = this.ParameterList ?? SyntaxFactory.ParameterList(); - return WithParameterList(parameterList.WithParameters(parameterList.Parameters.AddRange(items))); - } - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new RecordDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - internal override TypeDeclarationSyntax AddConstraintClausesCore(params TypeParameterConstraintClauseSyntax[] items) => AddConstraintClauses(items); - public new RecordDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override TypeDeclarationSyntax AddMembersCore(params MemberDeclarationSyntax[] items) => AddMembers(items); - public new RecordDeclarationSyntax AddMembers(params MemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// Enum type declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EnumDeclarationSyntax : BaseTypeDeclarationSyntax - { - private SyntaxNode? attributeLists; - private BaseListSyntax? baseList; - private SyntaxNode? members; - - internal EnumDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the enum keyword token. - public SyntaxToken EnumKeyword => new SyntaxToken(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).enumKeyword, GetChildPosition(2), GetChildIndex(2)); - - public override SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.EnumDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - - public override BaseListSyntax? BaseList => GetRed(ref this.baseList, 4); - - public override SyntaxToken OpenBraceToken - { - get - { - var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).openBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } - - /// Gets the members declaration list. - public SeparatedSyntaxList Members - { - get - { - var red = GetRed(ref this.members, 6); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(6)) : default; - } - } - - public override SyntaxToken CloseBraceToken + var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } + + return this; + } + + public TypeParameterConstraintClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Name, this.ColonToken, this.Constraints); + public TypeParameterConstraintClauseSyntax WithName(IdentifierNameSyntax name) => Update(this.WhereKeyword, name, this.ColonToken, this.Constraints); + public TypeParameterConstraintClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(this.WhereKeyword, this.Name, colonToken, this.Constraints); + public TypeParameterConstraintClauseSyntax WithConstraints(SeparatedSyntaxList constraints) => Update(this.WhereKeyword, this.Name, this.ColonToken, constraints); + + public TypeParameterConstraintClauseSyntax AddConstraints(params TypeParameterConstraintSyntax[] items) => WithConstraints(this.Constraints.AddRange(items)); +} + +/// Base type for type parameter constraint syntax. +public abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode +{ + internal TypeParameterConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} + +/// Constructor constraint syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax +{ + + internal ConstructorConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the "new" keyword. + public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).newKeyword, Position, 0); + + /// Gets the open paren keyword. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + + /// Gets the close paren keyword. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + + internal override SyntaxNode? GetNodeSlot(int index) => null; + + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorConstraint(this); + + public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + { + if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken) { - get - { - var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).closeBraceToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } + var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken + return this; + } + + public ConstructorConstraintSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenParenToken, this.CloseParenToken); + public ConstructorConstraintSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.NewKeyword, openParenToken, this.CloseParenToken); + public ConstructorConstraintSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.NewKeyword, this.OpenParenToken, closeParenToken); +} + +/// Class or struct constraint syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax +{ + + internal ClassOrStructConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } + + /// Gets the constraint keyword ("class" or "struct"). + public SyntaxToken ClassOrStructKeyword => new SyntaxToken(this, ((InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); + + /// SyntaxToken representing the question mark. + public SyntaxToken QuestionToken + { + get { - get - { - var slot = ((Syntax.InternalSyntax.EnumDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } + var slot = ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.baseList, 4), - 6 => GetRed(ref this.members, 6)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.baseList, - 6 => this.members, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassOrStructConstraint(this); - public EnumDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken openBraceToken, SeparatedSyntaxList members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) + public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken) + { + if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || enumKeyword != this.EnumKeyword || identifier != this.Identifier || baseList != this.BaseList || openBraceToken != this.OpenBraceToken || members != this.Members || closeBraceToken != this.CloseBraceToken || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EnumDeclaration(attributeLists, modifiers, enumKeyword, identifier, baseList, openBraceToken, members, closeBraceToken, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind(), classOrStructKeyword, questionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EnumDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EnumDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - public EnumDeclarationSyntax WithEnumKeyword(SyntaxToken enumKeyword) => Update(this.AttributeLists, this.Modifiers, enumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithIdentifierCore(SyntaxToken identifier) => WithIdentifier(identifier); - public new EnumDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithBaseListCore(BaseListSyntax? baseList) => WithBaseList(baseList); - public new EnumDeclarationSyntax WithBaseList(BaseListSyntax? baseList) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, baseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithOpenBraceTokenCore(SyntaxToken openBraceToken) => WithOpenBraceToken(openBraceToken); - public new EnumDeclarationSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, openBraceToken, this.Members, this.CloseBraceToken, this.SemicolonToken); - public EnumDeclarationSyntax WithMembers(SeparatedSyntaxList members) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, members, this.CloseBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithCloseBraceTokenCore(SyntaxToken closeBraceToken) => WithCloseBraceToken(closeBraceToken); - public new EnumDeclarationSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, closeBraceToken, this.SemicolonToken); - internal override BaseTypeDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new EnumDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EnumKeyword, this.Identifier, this.BaseList, this.OpenBraceToken, this.Members, this.CloseBraceToken, semicolonToken); + return this; + } - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EnumDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EnumDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseTypeDeclarationSyntax AddBaseListTypesCore(params BaseTypeSyntax[] items) => AddBaseListTypes(items); - public new EnumDeclarationSyntax AddBaseListTypes(params BaseTypeSyntax[] items) - { - var baseList = this.BaseList ?? SyntaxFactory.BaseList(); - return WithBaseList(baseList.WithTypes(baseList.Types.AddRange(items))); - } - public EnumDeclarationSyntax AddMembers(params EnumMemberDeclarationSyntax[] items) => WithMembers(this.Members.AddRange(items)); - } - - /// Delegate declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DelegateDeclarationSyntax : MemberDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private SyntaxNode? constraintClauses; - - internal DelegateDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the "delegate" keyword. - public SyntaxToken DelegateKeyword => new SyntaxToken(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).delegateKeyword, GetChildPosition(2), GetChildIndex(2)); - - /// Gets the return type. - public TypeSyntax ReturnType => GetRed(ref this.returnType, 3)!; - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - - public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); - - /// Gets the parameter list. - public ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; + public ClassOrStructConstraintSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(classOrStructKeyword, this.QuestionToken); + public ClassOrStructConstraintSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ClassOrStructKeyword, questionToken); +} - /// Gets the constraint clause list. - public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); +/// Type constraint syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax +{ + private TypeSyntax? type; - /// Gets the semicolon token. - public SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.DelegateDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(8), GetChildIndex(8)); + internal TypeConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.returnType, 3)!, - 5 => GetRed(ref this.typeParameterList, 5), - 6 => GetRed(ref this.parameterList, 6)!, - 7 => GetRed(ref this.constraintClauses, 7)!, - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.returnType, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.constraintClauses, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDelegateDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDelegateDeclaration(this); + /// Gets the type syntax. + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public DelegateDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || delegateKeyword != this.DelegateKeyword || returnType != this.ReturnType || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new DelegateDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new DelegateDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithDelegateKeyword(SyntaxToken delegateKeyword) => Update(this.AttributeLists, this.Modifiers, delegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, returnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.SemicolonToken); - public DelegateDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.DelegateKeyword, this.ReturnType, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, semicolonToken); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeConstraint(this); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new DelegateDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new DelegateDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public DelegateDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + public TypeConstraintSyntax Update(TypeSyntax type) + { + if (type != this.Type) { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + var newNode = SyntaxFactory.TypeConstraint(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public DelegateDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - public DelegateDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EnumMemberDeclarationSyntax : MemberDeclarationSyntax + public TypeConstraintSyntax WithType(TypeSyntax type) => Update(type); +} + +/// Default constraint syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax +{ + + internal DefaultConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? attributeLists; - private EqualsValueClauseSyntax? equalsValue; + } - internal EnumMemberDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the "default" keyword. + public SyntaxToken DefaultKeyword => new SyntaxToken(this, ((InternalSyntax.DefaultConstraintSyntax)this.Green).defaultKeyword, Position, 0); - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override SyntaxTokenList Modifiers + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultConstraint(this); + + public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword) + { + if (defaultKeyword != this.DefaultKeyword) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.EnumMemberDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public EqualsValueClauseSyntax? EqualsValue => GetRed(ref this.equalsValue, 3); + public DefaultConstraintSyntax WithDefaultKeyword(SyntaxToken defaultKeyword) => Update(defaultKeyword); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.equalsValue, 3), - _ => null, - }; +public abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.equalsValue, - _ => null, - }; + public abstract VariableDeclarationSyntax Declaration { get; } + public BaseFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => WithDeclarationCore(declaration); + internal abstract BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEnumMemberDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEnumMemberDeclaration(this); + public BaseFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => AddDeclarationVariablesCore(items); + internal abstract BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items); - public EnumMemberDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || equalsValue != this.EqualsValue) - { - var newNode = SyntaxFactory.EnumMemberDeclaration(attributeLists, modifiers, identifier, equalsValue); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public abstract SyntaxToken SemicolonToken { get; } + public BaseFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); + internal abstract BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); - return this; - } + public new BaseFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseFieldDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseFieldDeclarationSyntax)WithModifiersCore(modifiers); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EnumMemberDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.EqualsValue); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EnumMemberDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.EqualsValue); - public EnumMemberDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.EqualsValue); - public EnumMemberDeclarationSyntax WithEqualsValue(EqualsValueClauseSyntax? equalsValue) => Update(this.AttributeLists, this.Modifiers, this.Identifier, equalsValue); + public new BaseFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseFieldDeclarationSyntax)AddAttributeListsCore(items); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EnumMemberDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EnumMemberDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - } + public new BaseFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseFieldDeclarationSyntax)AddModifiersCore(items); +} - /// Base list syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BaseListSyntax : CSharpSyntaxNode - { - private SyntaxNode? types; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; - internal BaseListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal FieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.BaseListSyntax)this.Green).colonToken, Position, 0); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - /// Gets the base type references. - public SeparatedSyntaxList Types + public override SyntaxTokenList Modifiers + { + get { - get - { - var red = GetRed(ref this.types, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.types, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.types : null; + public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 2)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBaseList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBaseList(this); + public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.FieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); - public BaseListSyntax Update(SyntaxToken colonToken, SeparatedSyntaxList types) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (colonToken != this.ColonToken || types != this.Types) - { - var newNode = SyntaxFactory.BaseList(colonToken, types); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.declaration, 2)!, + _ => null, + }; - public BaseListSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.Types); - public BaseListSyntax WithTypes(SeparatedSyntaxList types) => Update(this.ColonToken, types); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.declaration, + _ => null, + }; - public BaseListSyntax AddTypes(params BaseTypeSyntax[] items) => WithTypes(this.Types.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFieldDeclaration(this); - /// Provides the base class from which the classes that represent base type syntax nodes are derived. This is an abstract class. - public abstract partial class BaseTypeSyntax : CSharpSyntaxNode + public FieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) { - internal BaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract TypeSyntax Type { get; } - public BaseTypeSyntax WithType(TypeSyntax type) => WithTypeCore(type); - internal abstract BaseTypeSyntax WithTypeCore(TypeSyntax type); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SimpleBaseTypeSyntax : BaseTypeSyntax + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Declaration, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new FieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); + public new FieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new FieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Declaration, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new FieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); + public new FieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private VariableDeclarationSyntax? declaration; + + internal EventFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private TypeSyntax? type; + } + + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal SimpleBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public override TypeSyntax Type => GetRedAtZero(ref this.type)!; + public SyntaxToken EventKeyword => new SyntaxToken(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSimpleBaseType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSimpleBaseType(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.declaration, 3)!, + _ => null, + }; - public SimpleBaseTypeSyntax Update(TypeSyntax type) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (type != this.Type) - { - var newNode = SyntaxFactory.SimpleBaseType(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.attributeLists, + 3 => this.declaration, + _ => null, + }; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventFieldDeclaration(this); - return this; + public EventFieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new SimpleBaseTypeSyntax WithType(TypeSyntax type) => Update(type); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PrimaryConstructorBaseTypeSyntax : BaseTypeSyntax - { - private TypeSyntax? type; - private ArgumentListSyntax? argumentList; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EventFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EventFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); + public EventFieldDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); + public new EventFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, declaration, this.SemicolonToken); + internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new EventFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Declaration, semicolonToken); - internal PrimaryConstructorBaseTypeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EventFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EventFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); + public new EventFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode +{ + private NameSyntax? name; - public override TypeSyntax Type => GetRedAtZero(ref this.type)!; + internal ExplicitInterfaceSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 1)!; + public NameSyntax Name => GetRedAtZero(ref this.name)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.type)!, - 1 => GetRed(ref this.argumentList, 1)!, - _ => null, - }; + public SyntaxToken DotToken => new SyntaxToken(this, ((InternalSyntax.ExplicitInterfaceSpecifierSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.type, - 1 => this.argumentList, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPrimaryConstructorBaseType(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPrimaryConstructorBaseType(this); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - public PrimaryConstructorBaseTypeSyntax Update(TypeSyntax type, ArgumentListSyntax argumentList) - { - if (type != this.Type || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.PrimaryConstructorBaseType(type, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExplicitInterfaceSpecifier(this); - return this; + public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken) + { + if (name != this.Name || dotToken != this.DotToken) + { + var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override BaseTypeSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new PrimaryConstructorBaseTypeSyntax WithType(TypeSyntax type) => Update(type, this.ArgumentList); - public PrimaryConstructorBaseTypeSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.Type, argumentList); - - public PrimaryConstructorBaseTypeSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); + return this; } - /// Type parameter constraint clause. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeParameterConstraintClauseSyntax : CSharpSyntaxNode + public ExplicitInterfaceSpecifierSyntax WithName(NameSyntax name) => Update(name, this.DotToken); + public ExplicitInterfaceSpecifierSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Name, dotToken); +} + +/// Base type for method declaration syntax. +public abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax +{ + internal BaseMethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private IdentifierNameSyntax? name; - private SyntaxNode? constraints; + } - internal TypeParameterConstraintClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the parameter list. + public abstract ParameterListSyntax ParameterList { get; } + public BaseMethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => WithParameterListCore(parameterList); + internal abstract BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList); - public SyntaxToken WhereKeyword => new SyntaxToken(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).whereKeyword, Position, 0); + public BaseMethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); + internal abstract BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); - /// Gets the identifier. - public IdentifierNameSyntax Name => GetRed(ref this.name, 1)!; + public abstract BlockSyntax? Body { get; } + public BaseMethodDeclarationSyntax WithBody(BlockSyntax? body) => WithBodyCore(body); + internal abstract BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body); - /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.TypeParameterConstraintClauseSyntax)this.Green).colonToken, GetChildPosition(2), GetChildIndex(2)); + public BaseMethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) => AddBodyAttributeListsCore(items); + internal abstract BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items); - /// Gets the constraints list. - public SeparatedSyntaxList Constraints - { - get - { - var red = GetRed(ref this.constraints, 3); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(3)) : default; - } - } + public BaseMethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) => AddBodyStatementsCore(items); + internal abstract BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.name, 1)!, - 3 => GetRed(ref this.constraints, 3)!, - _ => null, - }; + public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; } + public BaseMethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); + internal abstract BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.name, - 3 => this.constraints, - _ => null, - }; + /// Gets the optional semicolon token. + public abstract SyntaxToken SemicolonToken { get; } + public BaseMethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); + internal abstract BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeParameterConstraintClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeParameterConstraintClause(this); + public new BaseMethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseMethodDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BaseMethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseMethodDeclarationSyntax)WithModifiersCore(modifiers); - public TypeParameterConstraintClauseSyntax Update(SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, SeparatedSyntaxList constraints) - { - if (whereKeyword != this.WhereKeyword || name != this.Name || colonToken != this.ColonToken || constraints != this.Constraints) - { - var newNode = SyntaxFactory.TypeParameterConstraintClause(whereKeyword, name, colonToken, constraints); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public new BaseMethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseMethodDeclarationSyntax)AddAttributeListsCore(items); - return this; - } + public new BaseMethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseMethodDeclarationSyntax)AddModifiersCore(items); +} - public TypeParameterConstraintClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword) => Update(whereKeyword, this.Name, this.ColonToken, this.Constraints); - public TypeParameterConstraintClauseSyntax WithName(IdentifierNameSyntax name) => Update(this.WhereKeyword, name, this.ColonToken, this.Constraints); - public TypeParameterConstraintClauseSyntax WithColonToken(SyntaxToken colonToken) => Update(this.WhereKeyword, this.Name, colonToken, this.Constraints); - public TypeParameterConstraintClauseSyntax WithConstraints(SeparatedSyntaxList constraints) => Update(this.WhereKeyword, this.Name, this.ColonToken, constraints); +/// Method declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private TypeParameterListSyntax? typeParameterList; + private ParameterListSyntax? parameterList; + private SyntaxNode? constraintClauses; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public TypeParameterConstraintClauseSyntax AddConstraints(params TypeParameterConstraintSyntax[] items) => WithConstraints(this.Constraints.AddRange(items)); + internal MethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Base type for type parameter constraint syntax. - public abstract partial class TypeParameterConstraintSyntax : CSharpSyntaxNode + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers { - internal TypeParameterConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - /// Constructor constraint syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConstructorConstraintSyntax : TypeParameterConstraintSyntax - { + /// Gets the return type syntax. + public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - internal ConstructorConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - /// Gets the "new" keyword. - public SyntaxToken NewKeyword => new SyntaxToken(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).newKeyword, Position, 0); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.MethodDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - /// Gets the open paren keyword. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).openParenToken, GetChildPosition(1), GetChildIndex(1)); + public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); - /// Gets the close paren keyword. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ConstructorConstraintSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + /// Gets the constraint clause list. + public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override BlockSyntax? Body => GetRed(ref this.body, 8); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorConstraint(this); + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - public ConstructorConstraintSyntax Update(SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get { - if (newKeyword != this.NewKeyword || openParenToken != this.OpenParenToken || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ConstructorConstraint(newKeyword, openParenToken, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } - - public ConstructorConstraintSyntax WithNewKeyword(SyntaxToken newKeyword) => Update(newKeyword, this.OpenParenToken, this.CloseParenToken); - public ConstructorConstraintSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(this.NewKeyword, openParenToken, this.CloseParenToken); - public ConstructorConstraintSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.NewKeyword, this.OpenParenToken, closeParenToken); } - /// Class or struct constraint syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class ClassOrStructConstraintSyntax : TypeParameterConstraintSyntax - { + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 5 => GetRed(ref this.typeParameterList, 5), + 6 => GetRed(ref this.parameterList, 6)!, + 7 => GetRed(ref this.constraintClauses, 7)!, + 8 => GetRed(ref this.body, 8), + 9 => GetRed(ref this.expressionBody, 9), + _ => null, + }; - internal ClassOrStructConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 0 => this.attributeLists, + 2 => this.returnType, + 3 => this.explicitInterfaceSpecifier, + 5 => this.typeParameterList, + 6 => this.parameterList, + 7 => this.constraintClauses, + 8 => this.body, + 9 => this.expressionBody, + _ => null, + }; - /// Gets the constraint keyword ("class" or "struct"). - public SyntaxToken ClassOrStructKeyword => new SyntaxToken(this, ((InternalSyntax.ClassOrStructConstraintSyntax)this.Green).classOrStructKeyword, Position, 0); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMethodDeclaration(this); - /// SyntaxToken representing the question mark. - public SyntaxToken QuestionToken + public MethodDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - get - { - var slot = ((Syntax.InternalSyntax.ClassOrStructConstraintSyntax)this.Green).questionToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) => null; - - internal override SyntaxNode? GetCachedSlot(int index) => null; + return this; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitClassOrStructConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitClassOrStructConstraint(this); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new MethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new MethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new MethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + public MethodDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new MethodDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new MethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new MethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); - public ClassOrStructConstraintSyntax Update(SyntaxToken classOrStructKeyword, SyntaxToken questionToken) - { - if (classOrStructKeyword != this.ClassOrStructKeyword || questionToken != this.QuestionToken) - { - var newNode = SyntaxFactory.ClassOrStructConstraint(this.Kind(), classOrStructKeyword, questionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new MethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new MethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public MethodDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + { + var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); + return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new MethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + public MethodDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new MethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new MethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - return this; - } +/// Operator declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? returnType; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private ParameterListSyntax? parameterList; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public ClassOrStructConstraintSyntax WithClassOrStructKeyword(SyntaxToken classOrStructKeyword) => Update(classOrStructKeyword, this.QuestionToken); - public ClassOrStructConstraintSyntax WithQuestionToken(SyntaxToken questionToken) => Update(this.ClassOrStructKeyword, questionToken); + internal OperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Type constraint syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeConstraintSyntax : TypeParameterConstraintSyntax - { - private TypeSyntax? type; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal TypeConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the type syntax. - public TypeSyntax Type => GetRedAtZero(ref this.type)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + /// Gets the return type. + public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeConstraint(this); + /// Gets the "operator" keyword. + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); - public TypeConstraintSyntax Update(TypeSyntax type) + /// Gets the "checked" keyword. + public SyntaxToken CheckedKeyword + { + get { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypeConstraint(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } - - public TypeConstraintSyntax WithType(TypeSyntax type) => Update(type); } - /// Default constraint syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DefaultConstraintSyntax : TypeParameterConstraintSyntax - { - - internal DefaultConstraintSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the operator token. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); - /// Gets the "default" keyword. - public SyntaxToken DefaultKeyword => new SyntaxToken(this, ((InternalSyntax.DefaultConstraintSyntax)this.Green).defaultKeyword, Position, 0); + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override BlockSyntax? Body => GetRed(ref this.body, 8); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefaultConstraint(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefaultConstraint(this); + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; + } + } - public DefaultConstraintSyntax Update(SyntaxToken defaultKeyword) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (defaultKeyword != this.DefaultKeyword) - { - var newNode = SyntaxFactory.DefaultConstraint(defaultKeyword); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.returnType, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 7 => GetRed(ref this.parameterList, 7)!, + 8 => GetRed(ref this.body, 8), + 9 => GetRed(ref this.expressionBody, 9), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.returnType, + 3 => this.explicitInterfaceSpecifier, + 7 => this.parameterList, + 8 => this.body, + 9 => this.expressionBody, + _ => null, + }; - public DefaultConstraintSyntax WithDefaultKeyword(SyntaxToken defaultKeyword) => Update(defaultKeyword); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorDeclaration(this); - public abstract partial class BaseFieldDeclarationSyntax : MemberDeclarationSyntax + public OperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) { - internal BaseFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract VariableDeclarationSyntax Declaration { get; } - public BaseFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => WithDeclarationCore(declaration); - internal abstract BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration); - - public BaseFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => AddDeclarationVariablesCore(items); - internal abstract BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items); + return this; + } - public abstract SyntaxToken SemicolonToken { get; } - public BaseFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); - internal abstract BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new OperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new OperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public OperatorDeclarationSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new OperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new OperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new OperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new OperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - public new BaseFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseFieldDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseFieldDeclarationSyntax)WithModifiersCore(modifiers); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new OperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new OperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new OperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new OperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new OperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - public new BaseFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseFieldDeclarationSyntax)AddAttributeListsCore(items); +/// Conversion operator declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private TypeSyntax? type; + private ParameterListSyntax? parameterList; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public new BaseFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseFieldDeclarationSyntax)AddModifiersCore(items); + internal ConversionOperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FieldDeclarationSyntax : BaseFieldDeclarationSyntax - { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal FieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } + + /// Gets the "implicit" or "explicit" token. + public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - public override SyntaxTokenList Modifiers + /// Gets the "operator" token. + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); + + /// Gets the "checked" keyword. + public SyntaxToken CheckedKeyword + { + get { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } + } - public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 2)!; - - public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.FieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(3), GetChildIndex(3)); + /// Gets the type. + public TypeSyntax Type => GetRed(ref this.type, 6)!; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.declaration, 2)!, - _ => null, - }; + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.declaration, - _ => null, - }; + public override BlockSyntax? Body => GetRed(ref this.body, 8); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFieldDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFieldDeclaration(this); + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - public FieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Declaration, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new FieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); - public new FieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new FieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Declaration, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new FieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); - public new FieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EventFieldDeclarationSyntax : BaseFieldDeclarationSyntax - { - private SyntaxNode? attributeLists; - private VariableDeclarationSyntax? declaration; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 6 => GetRed(ref this.type, 6)!, + 7 => GetRed(ref this.parameterList, 7)!, + 8 => GetRed(ref this.body, 8), + 9 => GetRed(ref this.expressionBody, 9), + _ => null, + }; - internal EventFieldDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 0 => this.attributeLists, + 3 => this.explicitInterfaceSpecifier, + 6 => this.type, + 7 => this.parameterList, + 8 => this.body, + 9 => this.expressionBody, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorDeclaration(this); - public override SyntaxTokenList Modifiers + public ConversionOperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken EventKeyword => new SyntaxToken(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); + return this; + } - public override VariableDeclarationSyntax Declaration => GetRed(ref this.declaration, 3)!; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ConversionOperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ConversionOperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(this.AttributeLists, this.Modifiers, implicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConversionOperatorDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new ConversionOperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new ConversionOperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new ConversionOperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new ConversionOperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - public override SyntaxToken SemicolonToken => new SyntaxToken(this, ((InternalSyntax.EventFieldDeclarationSyntax)this.Green).semicolonToken, GetChildPosition(4), GetChildIndex(4)); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ConversionOperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ConversionOperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new ConversionOperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new ConversionOperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new ConversionOperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.declaration, 3)!, - _ => null, - }; +/// Constructor declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private ParameterListSyntax? parameterList; + private ConstructorInitializerSyntax? initializer; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.declaration, - _ => null, - }; + internal ConstructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventFieldDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventFieldDeclaration(this); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public EventFieldDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) + public override SyntaxTokenList Modifiers + { + get { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || declaration != this.Declaration || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, eventKeyword, declaration, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EventFieldDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EventFieldDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Declaration, this.SemicolonToken); - public EventFieldDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration) => WithDeclaration(declaration); - public new EventFieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, declaration, this.SemicolonToken); - internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new EventFieldDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Declaration, semicolonToken); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EventFieldDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EventFieldDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items) => AddDeclarationVariables(items); - public new EventFieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] items) => WithDeclaration(this.Declaration.WithVariables(this.Declaration.Variables.AddRange(items))); } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ExplicitInterfaceSpecifierSyntax : CSharpSyntaxNode - { - private NameSyntax? name; - - internal ExplicitInterfaceSpecifierSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - public NameSyntax Name => GetRedAtZero(ref this.name)!; + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - public SyntaxToken DotToken => new SyntaxToken(this, ((InternalSyntax.ExplicitInterfaceSpecifierSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); + public ConstructorInitializerSyntax? Initializer => GetRed(ref this.initializer, 4); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + public override BlockSyntax? Body => GetRed(ref this.body, 5); - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitExplicitInterfaceSpecifier(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitExplicitInterfaceSpecifier(this); + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + } + } - public ExplicitInterfaceSpecifierSyntax Update(NameSyntax name, SyntaxToken dotToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (name != this.Name || dotToken != this.DotToken) - { - var newNode = SyntaxFactory.ExplicitInterfaceSpecifier(name, dotToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.parameterList, 3)!, + 4 => GetRed(ref this.initializer, 4), + 5 => GetRed(ref this.body, 5), + 6 => GetRed(ref this.expressionBody, 6), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 3 => this.parameterList, + 4 => this.initializer, + 5 => this.body, + 6 => this.expressionBody, + _ => null, + }; - public ExplicitInterfaceSpecifierSyntax WithName(NameSyntax name) => Update(name, this.DotToken); - public ExplicitInterfaceSpecifierSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Name, dotToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorDeclaration(this); - /// Base type for method declaration syntax. - public abstract partial class BaseMethodDeclarationSyntax : MemberDeclarationSyntax + public ConstructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) { - internal BaseMethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the parameter list. - public abstract ParameterListSyntax ParameterList { get; } - public BaseMethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => WithParameterListCore(parameterList); - internal abstract BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList); - - public BaseMethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => AddParameterListParametersCore(items); - internal abstract BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items); - - public abstract BlockSyntax? Body { get; } - public BaseMethodDeclarationSyntax WithBody(BlockSyntax? body) => WithBodyCore(body); - internal abstract BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body); + return this; + } - public BaseMethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) => AddBodyAttributeListsCore(items); - internal abstract BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ConstructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ConstructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConstructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new ConstructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Identifier, parameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + public ConstructorDeclarationSyntax WithInitializer(ConstructorInitializerSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, initializer, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new ConstructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new ConstructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new ConstructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, semicolonToken); - public BaseMethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) => AddBodyStatementsCore(items); - internal abstract BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ConstructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ConstructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new ConstructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new ConstructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new ConstructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - public abstract ArrowExpressionClauseSyntax? ExpressionBody { get; } - public BaseMethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBodyCore(expressionBody); - internal abstract BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody); +/// Constructor initializer syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode +{ + private ArgumentListSyntax? argumentList; - /// Gets the optional semicolon token. - public abstract SyntaxToken SemicolonToken { get; } - public BaseMethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => WithSemicolonTokenCore(semicolonToken); - internal abstract BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken); + internal ConstructorInitializerSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public new BaseMethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BaseMethodDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BaseMethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BaseMethodDeclarationSyntax)WithModifiersCore(modifiers); + /// Gets the colon token. + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.ConstructorInitializerSyntax)this.Green).colonToken, Position, 0); - public new BaseMethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BaseMethodDeclarationSyntax)AddAttributeListsCore(items); + /// Gets the "this" or "base" keyword. + public SyntaxToken ThisOrBaseKeyword => new SyntaxToken(this, ((InternalSyntax.ConstructorInitializerSyntax)this.Green).thisOrBaseKeyword, GetChildPosition(1), GetChildIndex(1)); - public new BaseMethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BaseMethodDeclarationSyntax)AddModifiersCore(items); - } + public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 2)!; - /// Method declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class MethodDeclarationSyntax : BaseMethodDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private TypeParameterListSyntax? typeParameterList; - private ParameterListSyntax? parameterList; - private SyntaxNode? constraintClauses; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.argumentList, 2)! : null; - internal MethodDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.argumentList : null; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorInitializer(this); - public override SyntaxTokenList Modifiers + public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + { + if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.ConstructorInitializer(this.Kind(), colonToken, thisOrBaseKeyword, argumentList); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the return type syntax. - public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.MethodDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + return this; + } - public TypeParameterListSyntax? TypeParameterList => GetRed(ref this.typeParameterList, 5); + public ConstructorInitializerSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.ThisOrBaseKeyword, this.ArgumentList); + public ConstructorInitializerSyntax WithThisOrBaseKeyword(SyntaxToken thisOrBaseKeyword) => Update(this.ColonToken, thisOrBaseKeyword, this.ArgumentList); + public ConstructorInitializerSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.ColonToken, this.ThisOrBaseKeyword, argumentList); - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 6)!; + public ConstructorInitializerSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); +} - /// Gets the constraint clause list. - public SyntaxList ConstraintClauses => new SyntaxList(GetRed(ref this.constraintClauses, 7)); +/// Destructor declaration syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private ParameterListSyntax? parameterList; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - public override BlockSyntax? Body => GetRed(ref this.body, 8); + internal DestructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken + public override SyntaxTokenList Modifiers + { + get { - get - { - var slot = ((Syntax.InternalSyntax.MethodDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 5 => GetRed(ref this.typeParameterList, 5), - 6 => GetRed(ref this.parameterList, 6)!, - 7 => GetRed(ref this.constraintClauses, 7)!, - 8 => GetRed(ref this.body, 8), - 9 => GetRed(ref this.expressionBody, 9), - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.returnType, - 3 => this.explicitInterfaceSpecifier, - 5 => this.typeParameterList, - 6 => this.parameterList, - 7 => this.constraintClauses, - 8 => this.body, - 9 => this.expressionBody, - _ => null, - }; + /// Gets the tilde token. + public SyntaxToken TildeToken => new SyntaxToken(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitMethodDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitMethodDeclaration(this); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - public MethodDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || typeParameterList != this.TypeParameterList || parameterList != this.ParameterList || constraintClauses != this.ConstraintClauses || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 4)!; - return this; - } + public override BlockSyntax? Body => GetRed(ref this.body, 5); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new MethodDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new MethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, typeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new MethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, parameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - public MethodDeclarationSyntax WithConstraintClauses(SyntaxList constraintClauses) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, constraintClauses, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new MethodDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new MethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new MethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.Identifier, this.TypeParameterList, this.ParameterList, this.ConstraintClauses, this.Body, this.ExpressionBody, semicolonToken); + public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new MethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new MethodDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public MethodDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items) + /// Gets the optional semicolon token. + public override SyntaxToken SemicolonToken + { + get { - var typeParameterList = this.TypeParameterList ?? SyntaxFactory.TypeParameterList(); - return WithTypeParameterList(typeParameterList.WithParameters(typeParameterList.Parameters.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new MethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - public MethodDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items) => WithConstraintClauses(this.ConstraintClauses.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new MethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new MethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } - } - - /// Operator declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class OperatorDeclarationSyntax : BaseMethodDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? returnType; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private ParameterListSyntax? parameterList; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; - - internal OperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the return type. - public TypeSyntax ReturnType => GetRed(ref this.returnType, 2)!; - - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - - /// Gets the "operator" keyword. - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); - - /// Gets the "checked" keyword. - public SyntaxToken CheckedKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } - - /// Gets the operator token. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.OperatorDeclarationSyntax)this.Green).operatorToken, GetChildPosition(6), GetChildIndex(6)); - - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; - - public override BlockSyntax? Body => GetRed(ref this.body, 8); - - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((Syntax.InternalSyntax.OperatorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } + var slot = ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.returnType, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 7 => GetRed(ref this.parameterList, 7)!, - 8 => GetRed(ref this.body, 8), - 9 => GetRed(ref this.expressionBody, 9), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 4 => GetRed(ref this.parameterList, 4)!, + 5 => GetRed(ref this.body, 5), + 6 => GetRed(ref this.expressionBody, 6), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.returnType, - 3 => this.explicitInterfaceSpecifier, - 7 => this.parameterList, - 8 => this.body, - 9 => this.expressionBody, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 4 => this.parameterList, + 5 => this.body, + 6 => this.expressionBody, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorDeclaration(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDestructorDeclaration(this); - public OperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + public DestructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || returnType != this.ReturnType || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new OperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new OperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithReturnType(TypeSyntax returnType) => Update(this.AttributeLists, this.Modifiers, returnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public OperatorDeclarationSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new OperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new OperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new OperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new OperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ReturnType, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); + return this; + } - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new OperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new OperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new OperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new OperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new OperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } - } - - /// Conversion operator declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConversionOperatorDeclarationSyntax : BaseMethodDeclarationSyntax - { - private SyntaxNode? attributeLists; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private TypeSyntax? type; - private ParameterListSyntax? parameterList; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; - - internal ConversionOperatorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the "implicit" or "explicit" token. - public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).implicitOrExplicitKeyword, GetChildPosition(2), GetChildIndex(2)); - - public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - - /// Gets the "operator" token. - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).operatorKeyword, GetChildPosition(4), GetChildIndex(4)); - - /// Gets the "checked" keyword. - public SyntaxToken CheckedKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } - } - - /// Gets the type. - public TypeSyntax Type => GetRed(ref this.type, 6)!; - - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 7)!; - - public override BlockSyntax? Body => GetRed(ref this.body, 8); - - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 9); - - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((Syntax.InternalSyntax.ConversionOperatorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(10), GetChildIndex(10)) : default; - } - } - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 6 => GetRed(ref this.type, 6)!, - 7 => GetRed(ref this.parameterList, 7)!, - 8 => GetRed(ref this.body, 8), - 9 => GetRed(ref this.expressionBody, 9), - _ => null, - }; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new DestructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new DestructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public DestructorDeclarationSyntax WithTildeToken(SyntaxToken tildeToken) => Update(this.AttributeLists, this.Modifiers, tildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + public DestructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); + public new DestructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); + public new DestructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); + public new DestructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); + internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); + public new DestructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.explicitInterfaceSpecifier, - 6 => this.type, - 7 => this.parameterList, - 8 => this.body, - 9 => this.expressionBody, - _ => null, - }; + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new DestructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new DestructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); + public new DestructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); + public new DestructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); + public new DestructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorDeclaration(this); +/// Base type for property declaration syntax. +public abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax +{ + internal BasePropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public ConversionOperatorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken implicitOrExplicitKeyword, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// Gets the type syntax. + public abstract TypeSyntax Type { get; } + public BasePropertyDeclarationSyntax WithType(TypeSyntax type) => WithTypeCore(type); + internal abstract BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type); - return this; - } + /// Gets the optional explicit interface specifier. + public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; } + public BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifierCore(explicitInterfaceSpecifier); + internal abstract BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ConversionOperatorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ConversionOperatorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(this.AttributeLists, this.Modifiers, implicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, explicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, operatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, checkedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConversionOperatorDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, type, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new ConversionOperatorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new ConversionOperatorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new ConversionOperatorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new ConversionOperatorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.ImplicitOrExplicitKeyword, this.ExplicitInterfaceSpecifier, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); + public abstract AccessorListSyntax? AccessorList { get; } + public BasePropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => WithAccessorListCore(accessorList); + internal abstract BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ConversionOperatorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ConversionOperatorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new ConversionOperatorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new ConversionOperatorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new ConversionOperatorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } - } - - /// Constructor declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConstructorDeclarationSyntax : BaseMethodDeclarationSyntax - { - private SyntaxNode? attributeLists; - private ParameterListSyntax? parameterList; - private ConstructorInitializerSyntax? initializer; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; - - internal ConstructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ConstructorDeclarationSyntax)this.Green).identifier, GetChildPosition(2), GetChildIndex(2)); - - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 3)!; - - public ConstructorInitializerSyntax? Initializer => GetRed(ref this.initializer, 4); - - public override BlockSyntax? Body => GetRed(ref this.body, 5); - - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken - { - get - { - var slot = ((Syntax.InternalSyntax.ConstructorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } - } + public BasePropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessorsCore(items); + internal abstract BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.parameterList, 3)!, - 4 => GetRed(ref this.initializer, 4), - 5 => GetRed(ref this.body, 5), - 6 => GetRed(ref this.expressionBody, 6), - _ => null, - }; + public new BasePropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BasePropertyDeclarationSyntax)WithAttributeListsCore(attributeLists); + public new BasePropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BasePropertyDeclarationSyntax)WithModifiersCore(modifiers); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.parameterList, - 4 => this.initializer, - 5 => this.body, - 6 => this.expressionBody, - _ => null, - }; + public new BasePropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BasePropertyDeclarationSyntax)AddAttributeListsCore(items); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorDeclaration(this); + public new BasePropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BasePropertyDeclarationSyntax)AddModifiersCore(items); +} - public ConstructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || identifier != this.Identifier || parameterList != this.ParameterList || initializer != this.Initializer || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.ConstructorDeclaration(attributeLists, modifiers, identifier, parameterList, initializer, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private AccessorListSyntax? accessorList; + private ArrowExpressionClauseSyntax? expressionBody; + private EqualsValueClauseSyntax? initializer; - return this; - } + internal PropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ConstructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ConstructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConstructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new ConstructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Identifier, parameterList, this.Initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - public ConstructorDeclarationSyntax WithInitializer(ConstructorInitializerSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, initializer, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new ConstructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new ConstructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new ConstructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Identifier, this.ParameterList, this.Initializer, this.Body, this.ExpressionBody, semicolonToken); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ConstructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ConstructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new ConstructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new ConstructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new ConstructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + public override SyntaxTokenList Modifiers + { + get { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } } - /// Constructor initializer syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class ConstructorInitializerSyntax : CSharpSyntaxNode - { - private ArgumentListSyntax? argumentList; + public override TypeSyntax Type => GetRed(ref this.type, 2)!; - internal ConstructorInitializerSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - /// Gets the colon token. - public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.ConstructorInitializerSyntax)this.Green).colonToken, Position, 0); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.PropertyDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); - /// Gets the "this" or "base" keyword. - public SyntaxToken ThisOrBaseKeyword => new SyntaxToken(this, ((InternalSyntax.ConstructorInitializerSyntax)this.Green).thisOrBaseKeyword, GetChildPosition(1), GetChildIndex(1)); + public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 5); - public ArgumentListSyntax ArgumentList => GetRed(ref this.argumentList, 2)!; + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.argumentList, 2)! : null; + public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 7); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.argumentList : null; + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; + } + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConstructorInitializer(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConstructorInitializer(this); + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 5 => GetRed(ref this.accessorList, 5), + 6 => GetRed(ref this.expressionBody, 6), + 7 => GetRed(ref this.initializer, 7), + _ => null, + }; - public ConstructorInitializerSyntax Update(SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - if (colonToken != this.ColonToken || thisOrBaseKeyword != this.ThisOrBaseKeyword || argumentList != this.ArgumentList) - { - var newNode = SyntaxFactory.ConstructorInitializer(this.Kind(), colonToken, thisOrBaseKeyword, argumentList); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => this.attributeLists, + 2 => this.type, + 3 => this.explicitInterfaceSpecifier, + 5 => this.accessorList, + 6 => this.expressionBody, + 7 => this.initializer, + _ => null, + }; - return this; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyDeclaration(this); - public ConstructorInitializerSyntax WithColonToken(SyntaxToken colonToken) => Update(colonToken, this.ThisOrBaseKeyword, this.ArgumentList); - public ConstructorInitializerSyntax WithThisOrBaseKeyword(SyntaxToken thisOrBaseKeyword) => Update(this.ColonToken, thisOrBaseKeyword, this.ArgumentList); - public ConstructorInitializerSyntax WithArgumentList(ArgumentListSyntax argumentList) => Update(this.ColonToken, this.ThisOrBaseKeyword, argumentList); + public PropertyDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) + { + var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public ConstructorInitializerSyntax AddArgumentListArguments(params ArgumentSyntax[] items) => WithArgumentList(this.ArgumentList.WithArguments(this.ArgumentList.Arguments.AddRange(items))); + return this; } - /// Destructor declaration syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DestructorDeclarationSyntax : BaseMethodDeclarationSyntax - { - private SyntaxNode? attributeLists; - private ParameterListSyntax? parameterList; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new PropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new PropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new PropertyDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); + public new PropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); + public new PropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, expressionBody, this.Initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, initializer, this.SemicolonToken); + public PropertyDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, semicolonToken); - internal DestructorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new PropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new PropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); + public new PropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) + { + var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); + return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); + } +} - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); +/// The syntax for the expression body of an expression-bodied member. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode +{ + private ExpressionSyntax? expression; - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + internal ArrowExpressionClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - /// Gets the tilde token. - public SyntaxToken TildeToken => new SyntaxToken(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).tildeToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken ArrowToken => new SyntaxToken(this, ((InternalSyntax.ArrowExpressionClauseSyntax)this.Green).arrowToken, Position, 0); - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.DestructorDeclarationSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - public override ParameterListSyntax ParameterList => GetRed(ref this.parameterList, 4)!; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - public override BlockSyntax? Body => GetRed(ref this.body, 5); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; - public override ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrowExpressionClause(this); - /// Gets the optional semicolon token. - public override SyntaxToken SemicolonToken + public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression) + { + if (arrowToken != this.ArrowToken || expression != this.Expression) { - get - { - var slot = ((Syntax.InternalSyntax.DestructorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } + var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 4 => GetRed(ref this.parameterList, 4)!, - 5 => GetRed(ref this.body, 5), - 6 => GetRed(ref this.expressionBody, 6), - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 4 => this.parameterList, - 5 => this.body, - 6 => this.expressionBody, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDestructorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDestructorDeclaration(this); - - public DestructorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || tildeToken != this.TildeToken || identifier != this.Identifier || parameterList != this.ParameterList || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + return this; + } - return this; - } + public ArrowExpressionClauseSyntax WithArrowToken(SyntaxToken arrowToken) => Update(arrowToken, this.Expression); + public ArrowExpressionClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.ArrowToken, expression); +} - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new DestructorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new DestructorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public DestructorDeclarationSyntax WithTildeToken(SyntaxToken tildeToken) => Update(this.AttributeLists, this.Modifiers, tildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - public DestructorDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, identifier, this.ParameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList) => WithParameterList(parameterList); - public new DestructorDeclarationSyntax WithParameterList(ParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, parameterList, this.Body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body) => WithBody(body); - public new DestructorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, body, this.ExpressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody) => WithExpressionBody(expressionBody); - public new DestructorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, expressionBody, this.SemicolonToken); - internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken) => WithSemicolonToken(semicolonToken); - public new DestructorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.TildeToken, this.Identifier, this.ParameterList, this.Body, this.ExpressionBody, semicolonToken); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private AccessorListSyntax? accessorList; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new DestructorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new DestructorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items) => AddParameterListParameters(items); - public new DestructorDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items) => AddBodyAttributeLists(items); - public new DestructorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items) => AddBodyStatements(items); - public new DestructorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); - } + internal EventDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Base type for property declaration syntax. - public abstract partial class BasePropertyDeclarationSyntax : MemberDeclarationSyntax + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + public override SyntaxTokenList Modifiers { - internal BasePropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the type syntax. - public abstract TypeSyntax Type { get; } - public BasePropertyDeclarationSyntax WithType(TypeSyntax type) => WithTypeCore(type); - internal abstract BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type); - - /// Gets the optional explicit interface specifier. - public abstract ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier { get; } - public BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifierCore(explicitInterfaceSpecifier); - internal abstract BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier); + public SyntaxToken EventKeyword => new SyntaxToken(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); - public abstract AccessorListSyntax? AccessorList { get; } - public BasePropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => WithAccessorListCore(accessorList); - internal abstract BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList); + public override TypeSyntax Type => GetRed(ref this.type, 3)!; - public BasePropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessorsCore(items); - internal abstract BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items); + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 4); - public new BasePropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => (BasePropertyDeclarationSyntax)WithAttributeListsCore(attributeLists); - public new BasePropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => (BasePropertyDeclarationSyntax)WithModifiersCore(modifiers); + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); - public new BasePropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => (BasePropertyDeclarationSyntax)AddAttributeListsCore(items); + public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); - public new BasePropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => (BasePropertyDeclarationSyntax)AddModifiersCore(items); + public SyntaxToken SemicolonToken + { + get + { + var slot = ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; + } } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PropertyDeclarationSyntax : BasePropertyDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private AccessorListSyntax? accessorList; - private ArrowExpressionClauseSyntax? expressionBody; - private EqualsValueClauseSyntax? initializer; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.type, 3)!, + 4 => GetRed(ref this.explicitInterfaceSpecifier, 4), + 6 => GetRed(ref this.accessorList, 6), + _ => null, + }; - internal PropertyDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - } + 0 => this.attributeLists, + 3 => this.type, + 4 => this.explicitInterfaceSpecifier, + 6 => this.accessorList, + _ => null, + }; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventDeclaration(this); - public override SyntaxTokenList Modifiers + public EventDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override TypeSyntax Type => GetRed(ref this.type, 2)!; + return this; + } - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new EventDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new EventDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + public EventDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new EventDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); + public new EventDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); + public EventDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); + public new EventDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.SemicolonToken); + public EventDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, semicolonToken); - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.PropertyDeclarationSyntax)this.Green).identifier, GetChildPosition(4), GetChildIndex(4)); + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new EventDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new EventDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); + public new EventDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) + { + var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); + return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); + } +} - public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 5); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; + private BracketedParameterListSyntax? parameterList; + private AccessorListSyntax? accessorList; + private ArrowExpressionClauseSyntax? expressionBody; - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 6); + internal IndexerDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public EqualsValueClauseSyntax? Initializer => GetRed(ref this.initializer, 7); + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public SyntaxToken SemicolonToken + public override SyntaxTokenList Modifiers + { + get { - get - { - var slot = ((Syntax.InternalSyntax.PropertyDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 5 => GetRed(ref this.accessorList, 5), - 6 => GetRed(ref this.expressionBody, 6), - 7 => GetRed(ref this.initializer, 7), - _ => null, - }; + public override TypeSyntax Type => GetRed(ref this.type, 2)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - 3 => this.explicitInterfaceSpecifier, - 5 => this.accessorList, - 6 => this.expressionBody, - 7 => this.initializer, - _ => null, - }; + public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPropertyDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPropertyDeclaration(this); + public SyntaxToken ThisKeyword => new SyntaxToken(this, ((InternalSyntax.IndexerDeclarationSyntax)this.Green).thisKeyword, GetChildPosition(4), GetChildIndex(4)); - public PropertyDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || initializer != this.Initializer || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.PropertyDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// Gets the parameter list. + public BracketedParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; - return this; - } + public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new PropertyDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new PropertyDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new PropertyDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); - public new PropertyDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); - public new PropertyDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.ExpressionBody, this.Initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, expressionBody, this.Initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithInitializer(EqualsValueClauseSyntax? initializer) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, initializer, this.SemicolonToken); - public PropertyDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.ExpressionBody, this.Initializer, semicolonToken); + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 7); - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new PropertyDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new PropertyDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); - public new PropertyDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) + public SyntaxToken SemicolonToken + { + get { - var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); - return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); + var slot = ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; } } - /// The syntax for the expression body of an expression-bodied member. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ArrowExpressionClauseSyntax : CSharpSyntaxNode - { - private ExpressionSyntax? expression; - - internal ArrowExpressionClauseSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - } - - public SyntaxToken ArrowToken => new SyntaxToken(this, ((InternalSyntax.ArrowExpressionClauseSyntax)this.Green).arrowToken, Position, 0); + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2)!, + 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), + 5 => GetRed(ref this.parameterList, 5)!, + 6 => GetRed(ref this.accessorList, 6), + 7 => GetRed(ref this.expressionBody, 7), + _ => null, + }; - public ExpressionSyntax Expression => GetRed(ref this.expression, 1)!; - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.expression, 1)! : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.expression : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + 3 => this.explicitInterfaceSpecifier, + 5 => this.parameterList, + 6 => this.accessorList, + 7 => this.expressionBody, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitArrowExpressionClause(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitArrowExpressionClause(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerDeclaration(this); - public ArrowExpressionClauseSyntax Update(SyntaxToken arrowToken, ExpressionSyntax expression) + public IndexerDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { - if (arrowToken != this.ArrowToken || expression != this.Expression) - { - var newNode = SyntaxFactory.ArrowExpressionClause(arrowToken, expression); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ArrowExpressionClauseSyntax WithArrowToken(SyntaxToken arrowToken) => Update(arrowToken, this.Expression); - public ArrowExpressionClauseSyntax WithExpression(ExpressionSyntax expression) => Update(this.ArrowToken, expression); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EventDeclarationSyntax : BasePropertyDeclarationSyntax + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new IndexerDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new IndexerDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); + public new IndexerDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); + public new IndexerDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, thisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithParameterList(BracketedParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, parameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); + internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); + public new IndexerDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, accessorList, this.ExpressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, expressionBody, this.SemicolonToken); + public IndexerDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, semicolonToken); + + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new IndexerDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new IndexerDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public IndexerDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); + internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); + public new IndexerDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) { - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private AccessorListSyntax? accessorList; + var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); + return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); + } +} - internal EventDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class AccessorListSyntax : CSharpSyntaxNode +{ + private SyntaxNode? accessors; - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + internal AccessorListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.AccessorListSyntax)this.Green).openBraceToken, Position, 0); - public SyntaxToken EventKeyword => new SyntaxToken(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).eventKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxList Accessors => new SyntaxList(GetRed(ref this.accessors, 1)); - public override TypeSyntax Type => GetRed(ref this.type, 3)!; + public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.AccessorListSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 4); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.accessors, 1)! : null; - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.EventDeclarationSyntax)this.Green).identifier, GetChildPosition(5), GetChildIndex(5)); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.accessors : null; - public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorList(this); - public SyntaxToken SemicolonToken + public AccessorListSyntax Update(SyntaxToken openBraceToken, SyntaxList accessors, SyntaxToken closeBraceToken) + { + if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) { - get - { - var slot = ((Syntax.InternalSyntax.EventDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(7), GetChildIndex(7)) : default; - } + var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.type, 3)!, - 4 => GetRed(ref this.explicitInterfaceSpecifier, 4), - 6 => GetRed(ref this.accessorList, 6), - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.type, - 4 => this.explicitInterfaceSpecifier, - 6 => this.accessorList, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEventDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEventDeclaration(this); + return this; + } - public EventDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || eventKeyword != this.EventKeyword || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || identifier != this.Identifier || accessorList != this.AccessorList || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.EventDeclaration(attributeLists, modifiers, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public AccessorListSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Accessors, this.CloseBraceToken); + public AccessorListSyntax WithAccessors(SyntaxList accessors) => Update(this.OpenBraceToken, accessors, this.CloseBraceToken); + public AccessorListSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Accessors, closeBraceToken); - return this; - } + public AccessorListSyntax AddAccessors(params AccessorDeclarationSyntax[] items) => WithAccessors(this.Accessors.AddRange(items)); +} - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new EventDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new EventDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - public EventDeclarationSyntax WithEventKeyword(SyntaxToken eventKeyword) => Update(this.AttributeLists, this.Modifiers, eventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new EventDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); - public new EventDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, explicitInterfaceSpecifier, this.Identifier, this.AccessorList, this.SemicolonToken); - public EventDeclarationSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, identifier, this.AccessorList, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); - public new EventDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, accessorList, this.SemicolonToken); - public EventDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.EventKeyword, this.Type, this.ExplicitInterfaceSpecifier, this.Identifier, this.AccessorList, semicolonToken); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +/// +/// +/// +/// +public sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode +{ + private SyntaxNode? attributeLists; + private BlockSyntax? body; + private ArrowExpressionClauseSyntax? expressionBody; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new EventDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new EventDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); - public new EventDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) - { - var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); - return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); - } + internal AccessorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IndexerDeclarationSyntax : BasePropertyDeclarationSyntax + /// Gets the attribute declaration list. + public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + + /// Gets the modifier list. + public SyntaxTokenList Modifiers { - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier; - private BracketedParameterListSyntax? parameterList; - private AccessorListSyntax? accessorList; - private ArrowExpressionClauseSyntax? expressionBody; - - internal IndexerDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - public override SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - public override TypeSyntax Type => GetRed(ref this.type, 2)!; - - public override ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => GetRed(ref this.explicitInterfaceSpecifier, 3); - - public SyntaxToken ThisKeyword => new SyntaxToken(this, ((InternalSyntax.IndexerDeclarationSyntax)this.Green).thisKeyword, GetChildPosition(4), GetChildIndex(4)); + /// Gets the keyword token, or identifier if an erroneous accessor declaration. + public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); - /// Gets the parameter list. - public BracketedParameterListSyntax ParameterList => GetRed(ref this.parameterList, 5)!; - - public override AccessorListSyntax? AccessorList => GetRed(ref this.accessorList, 6); + /// Gets the optional body block which may be empty, but it is null if there are no braces. + public BlockSyntax? Body => GetRed(ref this.body, 3); - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 7); + /// Gets the optional expression body. + public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); - public SyntaxToken SemicolonToken + /// Gets the optional semicolon token. + public SyntaxToken SemicolonToken + { + get { - get - { - var slot = ((Syntax.InternalSyntax.IndexerDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(8), GetChildIndex(8)) : default; - } + var slot = ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } + } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2)!, - 3 => GetRed(ref this.explicitInterfaceSpecifier, 3), - 5 => GetRed(ref this.parameterList, 5)!, - 6 => GetRed(ref this.accessorList, 6), - 7 => GetRed(ref this.expressionBody, 7), - _ => null, - }; - - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - 3 => this.explicitInterfaceSpecifier, - 5 => this.parameterList, - 6 => this.accessorList, - 7 => this.expressionBody, - _ => null, - }; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerDeclaration(this); - - public IndexerDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || explicitInterfaceSpecifier != this.ExplicitInterfaceSpecifier || thisKeyword != this.ThisKeyword || parameterList != this.ParameterList || accessorList != this.AccessorList || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } - - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new IndexerDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new IndexerDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithTypeCore(TypeSyntax type) => WithType(type); - public new IndexerDeclarationSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithExplicitInterfaceSpecifierCore(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => WithExplicitInterfaceSpecifier(explicitInterfaceSpecifier); - public new IndexerDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier) => Update(this.AttributeLists, this.Modifiers, this.Type, explicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, thisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithParameterList(BracketedParameterListSyntax parameterList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, parameterList, this.AccessorList, this.ExpressionBody, this.SemicolonToken); - internal override BasePropertyDeclarationSyntax WithAccessorListCore(AccessorListSyntax? accessorList) => WithAccessorList(accessorList); - public new IndexerDeclarationSyntax WithAccessorList(AccessorListSyntax? accessorList) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, accessorList, this.ExpressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, expressionBody, this.SemicolonToken); - public IndexerDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Type, this.ExplicitInterfaceSpecifier, this.ThisKeyword, this.ParameterList, this.AccessorList, this.ExpressionBody, semicolonToken); + 0 => GetRedAtZero(ref this.attributeLists)!, + 3 => GetRed(ref this.body, 3), + 4 => GetRed(ref this.expressionBody, 4), + _ => null, + }; - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new IndexerDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new IndexerDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public IndexerDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items) => WithParameterList(this.ParameterList.WithParameters(this.ParameterList.Parameters.AddRange(items))); - internal override BasePropertyDeclarationSyntax AddAccessorListAccessorsCore(params AccessorDeclarationSyntax[] items) => AddAccessorListAccessors(items); - public new IndexerDeclarationSyntax AddAccessorListAccessors(params AccessorDeclarationSyntax[] items) + internal override SyntaxNode? GetCachedSlot(int index) + => index switch { - var accessorList = this.AccessorList ?? SyntaxFactory.AccessorList(); - return WithAccessorList(accessorList.WithAccessors(accessorList.Accessors.AddRange(items))); - } - } + 0 => this.attributeLists, + 3 => this.body, + 4 => this.expressionBody, + _ => null, + }; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class AccessorListSyntax : CSharpSyntaxNode - { - private SyntaxNode? accessors; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorDeclaration(this); - internal AccessorListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public AccessorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) { + var newNode = SyntaxFactory.AccessorDeclaration(this.Kind(), attributeLists, modifiers, keyword, body, expressionBody, semicolonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken OpenBraceToken => new SyntaxToken(this, ((InternalSyntax.AccessorListSyntax)this.Green).openBraceToken, Position, 0); - - public SyntaxList Accessors => new SyntaxList(GetRed(ref this.accessors, 1)); - - public SyntaxToken CloseBraceToken => new SyntaxToken(this, ((InternalSyntax.AccessorListSyntax)this.Green).closeBraceToken, GetChildPosition(2), GetChildIndex(2)); + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.accessors, 1)! : null; + public AccessorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Keyword, body, this.ExpressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, expressionBody, this.SemicolonToken); + public AccessorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, semicolonToken); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.accessors : null; + public AccessorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + public AccessorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + public AccessorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); + } + public AccessorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + { + var body = this.Body ?? SyntaxFactory.Block(); + return WithBody(body.WithStatements(body.Statements.AddRange(items))); + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorList(this); +/// Base type for parameter list syntax. +public abstract partial class BaseParameterListSyntax : CSharpSyntaxNode +{ + internal BaseParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public AccessorListSyntax Update(SyntaxToken openBraceToken, SyntaxList accessors, SyntaxToken closeBraceToken) - { - if (openBraceToken != this.OpenBraceToken || accessors != this.Accessors || closeBraceToken != this.CloseBraceToken) - { - var newNode = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// Gets the parameter list. + public abstract SeparatedSyntaxList Parameters { get; } + public BaseParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); + internal abstract BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); - return this; - } + public BaseParameterListSyntax AddParameters(params ParameterSyntax[] items) => AddParametersCore(items); + internal abstract BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items); +} - public AccessorListSyntax WithOpenBraceToken(SyntaxToken openBraceToken) => Update(openBraceToken, this.Accessors, this.CloseBraceToken); - public AccessorListSyntax WithAccessors(SyntaxList accessors) => Update(this.OpenBraceToken, accessors, this.CloseBraceToken); - public AccessorListSyntax WithCloseBraceToken(SyntaxToken closeBraceToken) => Update(this.OpenBraceToken, this.Accessors, closeBraceToken); +/// Parameter list syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParameterListSyntax : BaseParameterListSyntax +{ + private SyntaxNode? parameters; - public AccessorListSyntax AddAccessors(params AccessorDeclarationSyntax[] items) => WithAccessors(this.Accessors.AddRange(items)); + internal ParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - /// - /// - /// - /// - public sealed partial class AccessorDeclarationSyntax : CSharpSyntaxNode - { - private SyntaxNode? attributeLists; - private BlockSyntax? body; - private ArrowExpressionClauseSyntax? expressionBody; + /// Gets the open paren token. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); - internal AccessorDeclarationSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SeparatedSyntaxList Parameters + { + get { + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// Gets the attribute declaration list. - public SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - - /// Gets the modifier list. - public SyntaxTokenList Modifiers - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + /// Gets the close paren token. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - /// Gets the keyword token, or identifier if an erroneous accessor declaration. - public SyntaxToken Keyword => new SyntaxToken(this, ((InternalSyntax.AccessorDeclarationSyntax)this.Green).keyword, GetChildPosition(2), GetChildIndex(2)); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - /// Gets the optional body block which may be empty, but it is null if there are no braces. - public BlockSyntax? Body => GetRed(ref this.body, 3); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - /// Gets the optional expression body. - public ArrowExpressionClauseSyntax? ExpressionBody => GetRed(ref this.expressionBody, 4); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameterList(this); - /// Gets the optional semicolon token. - public SyntaxToken SemicolonToken + public ParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) { - get - { - var slot = ((Syntax.InternalSyntax.AccessorDeclarationSyntax)this.Green).semicolonToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } + var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 3 => GetRed(ref this.body, 3), - 4 => GetRed(ref this.expressionBody, 4), - _ => null, - }; + return this; + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 3 => this.body, - 4 => this.expressionBody, - _ => null, - }; + public ParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); + internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new ParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); + public ParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitAccessorDeclaration(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitAccessorDeclaration(this); + internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); + public new ParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} - public AccessorDeclarationSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || keyword != this.Keyword || body != this.Body || expressionBody != this.ExpressionBody || semicolonToken != this.SemicolonToken) - { - var newNode = SyntaxFactory.AccessorDeclaration(this.Kind(), attributeLists, modifiers, keyword, body, expressionBody, semicolonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } +/// Parameter list syntax with surrounding brackets. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax +{ + private SyntaxNode? parameters; - return this; - } + internal BracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public AccessorDeclarationSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Keyword, this.Body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithKeyword(SyntaxToken keyword) => Update(this.AttributeLists, this.Modifiers, keyword, this.Body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithBody(BlockSyntax? body) => Update(this.AttributeLists, this.Modifiers, this.Keyword, body, this.ExpressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, expressionBody, this.SemicolonToken); - public AccessorDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken) => Update(this.AttributeLists, this.Modifiers, this.Keyword, this.Body, this.ExpressionBody, semicolonToken); + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); - public AccessorDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - public AccessorDeclarationSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); - public AccessorDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items) - { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithAttributeLists(body.AttributeLists.AddRange(items))); - } - public AccessorDeclarationSyntax AddBodyStatements(params StatementSyntax[] items) + public override SeparatedSyntaxList Parameters + { + get { - var body = this.Body ?? SyntaxFactory.Block(); - return WithBody(body.WithStatements(body.Statements.AddRange(items))); + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } } - /// Base type for parameter list syntax. - public abstract partial class BaseParameterListSyntax : CSharpSyntaxNode - { - internal BaseParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - /// Gets the parameter list. - public abstract SeparatedSyntaxList Parameters { get; } - public BaseParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); - internal abstract BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - public BaseParameterListSyntax AddParameters(params ParameterSyntax[] items) => AddParametersCore(items); - internal abstract BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items); - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - /// Parameter list syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParameterListSyntax : BaseParameterListSyntax - { - private SyntaxNode? parameters; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedParameterList(this); - internal ParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) { + var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the open paren token. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.ParameterListSyntax)this.Green).openParenToken, Position, 0); + return this; + } - public override SeparatedSyntaxList Parameters - { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } - } + public BracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); + internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new BracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); + public BracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); - /// Gets the close paren token. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.ParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); + public new BracketedParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; +/// Base parameter syntax. +public abstract partial class BaseParameterSyntax : CSharpSyntaxNode +{ + internal BaseParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + /// Gets the attribute declaration list. + public abstract SyntaxList AttributeLists { get; } + public BaseParameterSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); + internal abstract BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameterList(this); + public BaseParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); + internal abstract BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items); - public ParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) - { - if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.ParameterList(openParenToken, parameters, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + /// Gets the modifier list. + public abstract SyntaxTokenList Modifiers { get; } + public BaseParameterSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); + internal abstract BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers); - return this; - } + public BaseParameterSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); + internal abstract BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items); - public ParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); - internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new ParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); - public ParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); + public abstract TypeSyntax? Type { get; } + public BaseParameterSyntax WithType(TypeSyntax? type) => WithTypeCore(type); + internal abstract BaseParameterSyntax WithTypeCore(TypeSyntax? type); +} - internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); - public new ParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); - } +/// Parameter syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ParameterSyntax : BaseParameterSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; + private EqualsValueClauseSyntax? @default; - /// Parameter list syntax with surrounding brackets. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BracketedParameterListSyntax : BaseParameterListSyntax + internal ParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? parameters; - - internal BracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); + /// Gets the attribute declaration list. + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - public override SeparatedSyntaxList Parameters + /// Gets the modifier list. + public override SyntaxTokenList Modifiers + { + get { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.BracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + public override TypeSyntax? Type => GetRed(ref this.type, 2); - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + /// Gets the identifier. + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ParameterSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBracketedParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBracketedParameterList(this); + public EqualsValueClauseSyntax? Default => GetRed(ref this.@default, 4); - public BracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.BracketedParameterList(openBracketToken, parameters, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2), + 4 => GetRed(ref this.@default, 4), + _ => null, + }; - public BracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); - internal override BaseParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new BracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); - public BracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + 4 => this.@default, + _ => null, + }; - internal override BaseParameterListSyntax AddParametersCore(params ParameterSyntax[] items) => AddParameters(items); - public new BracketedParameterListSyntax AddParameters(params ParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameter(this); - /// Base parameter syntax. - public abstract partial class BaseParameterSyntax : CSharpSyntaxNode + public ParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) { - internal BaseParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) { + var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - /// Gets the attribute declaration list. - public abstract SyntaxList AttributeLists { get; } - public BaseParameterSyntax WithAttributeLists(SyntaxList attributeLists) => WithAttributeListsCore(attributeLists); - internal abstract BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists); + return this; + } - public BaseParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => AddAttributeListsCore(items); - internal abstract BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items); + internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new ParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.Identifier, this.Default); + internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new ParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.Identifier, this.Default); + internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type); + public new ParameterSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type, this.Identifier, this.Default); + public ParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, identifier, this.Default); + public ParameterSyntax WithDefault(EqualsValueClauseSyntax? @default) => Update(this.AttributeLists, this.Modifiers, this.Type, this.Identifier, @default); - /// Gets the modifier list. - public abstract SyntaxTokenList Modifiers { get; } - public BaseParameterSyntax WithModifiers(SyntaxTokenList modifiers) => WithModifiersCore(modifiers); - internal abstract BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers); + internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new ParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new ParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); +} - public BaseParameterSyntax AddModifiers(params SyntaxToken[] items) => AddModifiersCore(items); - internal abstract BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items); +/// Parameter syntax. +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; - public abstract TypeSyntax? Type { get; } - public BaseParameterSyntax WithType(TypeSyntax? type) => WithTypeCore(type); - internal abstract BaseParameterSyntax WithTypeCore(TypeSyntax? type); + internal FunctionPointerParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Parameter syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ParameterSyntax : BaseParameterSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? type; - private EqualsValueClauseSyntax? @default; + /// Gets the attribute declaration list. + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal ParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + /// Gets the modifier list. + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the attribute declaration list. - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public override TypeSyntax Type => GetRed(ref this.type, 2)!; - /// Gets the modifier list. - public override SyntaxTokenList Modifiers + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - public override TypeSyntax? Type => GetRed(ref this.type, 2); - - /// Gets the identifier. - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.ParameterSyntax)this.Green).identifier, GetChildPosition(3), GetChildIndex(3)); + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2)!, + _ => null, + }; - public EqualsValueClauseSyntax? Default => GetRed(ref this.@default, 4); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + _ => null, + }; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2), - 4 => GetRed(ref this.@default, 4), - _ => null, - }; + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameter(this); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - 4 => this.@default, - _ => null, - }; + public FunctionPointerParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) + { + var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitParameter(this); + return this; + } - public ParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type, SyntaxToken identifier, EqualsValueClauseSyntax? @default) - { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type || identifier != this.Identifier || @default != this.Default) - { - var newNode = SyntaxFactory.Parameter(attributeLists, modifiers, type, identifier, @default); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new FunctionPointerParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); + internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new FunctionPointerParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); + internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type ?? throw new ArgumentNullException(nameof(type))); + public new FunctionPointerParameterSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type); - return this; - } + internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new FunctionPointerParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new FunctionPointerParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); +} - internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new ParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type, this.Identifier, this.Default); - internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new ParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type, this.Identifier, this.Default); - internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type); - public new ParameterSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type, this.Identifier, this.Default); - public ParameterSyntax WithIdentifier(SyntaxToken identifier) => Update(this.AttributeLists, this.Modifiers, this.Type, identifier, this.Default); - public ParameterSyntax WithDefault(EqualsValueClauseSyntax? @default) => Update(this.AttributeLists, this.Modifiers, this.Type, this.Identifier, @default); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax +{ + private SyntaxNode? attributeLists; + private TypeSyntax? type; - internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new ParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new ParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + internal IncompleteMemberSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// Parameter syntax. - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class FunctionPointerParameterSyntax : BaseParameterSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? type; + public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); - internal FunctionPointerParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public override SyntaxTokenList Modifiers + { + get { + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the attribute declaration list. - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); + public TypeSyntax? Type => GetRed(ref this.type, 2); - /// Gets the modifier list. - public override SyntaxTokenList Modifiers + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } - - public override TypeSyntax Type => GetRed(ref this.type, 2)!; - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2)!, - _ => null, - }; + 0 => GetRedAtZero(ref this.attributeLists)!, + 2 => GetRed(ref this.type, 2), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.attributeLists, + 2 => this.type, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitFunctionPointerParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitFunctionPointerParameter(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIncompleteMember(this); - public FunctionPointerParameterSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax type) + public IncompleteMemberSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type) + { + if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) - { - var newNode = SyntaxFactory.FunctionPointerParameter(attributeLists, modifiers, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override BaseParameterSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new FunctionPointerParameterSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); - internal override BaseParameterSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new FunctionPointerParameterSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); - internal override BaseParameterSyntax WithTypeCore(TypeSyntax? type) => WithType(type ?? throw new ArgumentNullException(nameof(type))); - public new FunctionPointerParameterSyntax WithType(TypeSyntax type) => Update(this.AttributeLists, this.Modifiers, type); - - internal override BaseParameterSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new FunctionPointerParameterSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override BaseParameterSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new FunctionPointerParameterSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IncompleteMemberSyntax : MemberDeclarationSyntax - { - private SyntaxNode? attributeLists; - private TypeSyntax? type; + internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); + public new IncompleteMemberSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); + internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); + public new IncompleteMemberSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); + public IncompleteMemberSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type); - internal IncompleteMemberSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); + public new IncompleteMemberSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); + internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); + public new IncompleteMemberSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); +} - public override SyntaxList AttributeLists => new SyntaxList(GetRed(ref this.attributeLists, 0)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax +{ + + internal SkippedTokensTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxTokenList Modifiers + public SyntaxTokenList Tokens + { + get { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var slot = this.Green.GetSlot(0); + return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; } + } - public TypeSyntax? Type => GetRed(ref this.type, 2); - - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.attributeLists)!, - 2 => GetRed(ref this.type, 2), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.attributeLists, - 2 => this.type, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIncompleteMember(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIncompleteMember(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSkippedTokensTrivia(this); - public IncompleteMemberSyntax Update(SyntaxList attributeLists, SyntaxTokenList modifiers, TypeSyntax? type) + public SkippedTokensTriviaSyntax Update(SyntaxTokenList tokens) + { + if (tokens != this.Tokens) { - if (attributeLists != this.AttributeLists || modifiers != this.Modifiers || type != this.Type) - { - var newNode = SyntaxFactory.IncompleteMember(attributeLists, modifiers, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.SkippedTokensTrivia(tokens); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList attributeLists) => WithAttributeLists(attributeLists); - public new IncompleteMemberSyntax WithAttributeLists(SyntaxList attributeLists) => Update(attributeLists, this.Modifiers, this.Type); - internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers) => WithModifiers(modifiers); - public new IncompleteMemberSyntax WithModifiers(SyntaxTokenList modifiers) => Update(this.AttributeLists, modifiers, this.Type); - public IncompleteMemberSyntax WithType(TypeSyntax? type) => Update(this.AttributeLists, this.Modifiers, type); - - internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items) => AddAttributeLists(items); - public new IncompleteMemberSyntax AddAttributeLists(params AttributeListSyntax[] items) => WithAttributeLists(this.AttributeLists.AddRange(items)); - internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items) => AddModifiers(items); - public new IncompleteMemberSyntax AddModifiers(params SyntaxToken[] items) => WithModifiers(this.Modifiers.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class SkippedTokensTriviaSyntax : StructuredTriviaSyntax - { - - internal SkippedTokensTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SkippedTokensTriviaSyntax WithTokens(SyntaxTokenList tokens) => Update(tokens); - public SyntaxTokenList Tokens - { - get - { - var slot = this.Green.GetSlot(0); - return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; - } - } + public SkippedTokensTriviaSyntax AddTokens(params SyntaxToken[] items) => WithTokens(this.Tokens.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +/// +public sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax +{ + private SyntaxNode? content; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal DocumentationCommentTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitSkippedTokensTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitSkippedTokensTrivia(this); + public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 0)); - public SkippedTokensTriviaSyntax Update(SyntaxTokenList tokens) - { - if (tokens != this.Tokens) - { - var newNode = SyntaxFactory.SkippedTokensTrivia(tokens); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken EndOfComment => new SyntaxToken(this, ((InternalSyntax.DocumentationCommentTriviaSyntax)this.Green).endOfComment, GetChildPosition(1), GetChildIndex(1)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.content)! : null; - public SkippedTokensTriviaSyntax WithTokens(SyntaxTokenList tokens) => Update(tokens); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.content : null; - public SkippedTokensTriviaSyntax AddTokens(params SyntaxToken[] items) => WithTokens(this.Tokens.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDocumentationCommentTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - /// - public sealed partial class DocumentationCommentTriviaSyntax : StructuredTriviaSyntax + public DocumentationCommentTriviaSyntax Update(SyntaxList content, SyntaxToken endOfComment) { - private SyntaxNode? content; - - internal DocumentationCommentTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (content != this.Content || endOfComment != this.EndOfComment) { + var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind(), content, endOfComment); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 0)); + return this; + } - public SyntaxToken EndOfComment => new SyntaxToken(this, ((InternalSyntax.DocumentationCommentTriviaSyntax)this.Green).endOfComment, GetChildPosition(1), GetChildIndex(1)); + public DocumentationCommentTriviaSyntax WithContent(SyntaxList content) => Update(content, this.EndOfComment); + public DocumentationCommentTriviaSyntax WithEndOfComment(SyntaxToken endOfComment) => Update(this.Content, endOfComment); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.content)! : null; + public DocumentationCommentTriviaSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); +} - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.content : null; +/// +/// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). +/// For example, the M in <see cref="M" />. +/// +public abstract partial class CrefSyntax : CSharpSyntaxNode +{ + internal CrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDocumentationCommentTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDocumentationCommentTrivia(this); +/// +/// A symbol reference that definitely refers to a type. +/// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class TypeCrefSyntax : CrefSyntax +{ + private TypeSyntax? type; - public DocumentationCommentTriviaSyntax Update(SyntaxList content, SyntaxToken endOfComment) - { - if (content != this.Content || endOfComment != this.EndOfComment) - { - var newNode = SyntaxFactory.DocumentationCommentTrivia(this.Kind(), content, endOfComment); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal TypeCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - return this; - } + public TypeSyntax Type => GetRedAtZero(ref this.type)!; - public DocumentationCommentTriviaSyntax WithContent(SyntaxList content) => Update(content, this.EndOfComment); - public DocumentationCommentTriviaSyntax WithEndOfComment(SyntaxToken endOfComment) => Update(this.Content, endOfComment); + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; - public DocumentationCommentTriviaSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; - /// - /// A symbol referenced by a cref attribute (e.g. in a <see> or <seealso> documentation comment tag). - /// For example, the M in <see cref="M" />. - /// - public abstract partial class CrefSyntax : CSharpSyntaxNode + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeCref(this); + + public TypeCrefSyntax Update(TypeSyntax type) { - internal CrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (type != this.Type) { + var newNode = SyntaxFactory.TypeCref(type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// A symbol reference that definitely refers to a type. - /// For example, "int", "A::B", "A.B", "A<T>", but not "M()" (has parameter list) or "this" (indexer). - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class TypeCrefSyntax : CrefSyntax - { - private TypeSyntax? type; + public TypeCrefSyntax WithType(TypeSyntax type) => Update(type); +} - internal TypeCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. +/// For example, cref="System.String.ToString()". +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class QualifiedCrefSyntax : CrefSyntax +{ + private TypeSyntax? container; + private MemberCrefSyntax? member; - public TypeSyntax Type => GetRedAtZero(ref this.type)!; + internal QualifiedCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.type)! : null; + public TypeSyntax Container => GetRedAtZero(ref this.container)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.type : null; + public SyntaxToken DotToken => new SyntaxToken(this, ((InternalSyntax.QualifiedCrefSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitTypeCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitTypeCref(this); + public MemberCrefSyntax Member => GetRed(ref this.member, 2)!; - public TypeCrefSyntax Update(TypeSyntax type) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (type != this.Type) - { - var newNode = SyntaxFactory.TypeCref(type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.container)!, + 2 => GetRed(ref this.member, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.container, + 2 => this.member, + _ => null, + }; - public TypeCrefSyntax WithType(TypeSyntax type) => Update(type); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedCref(this); - /// - /// A symbol reference to a type or non-type member that is qualified by an enclosing type or namespace. - /// For example, cref="System.String.ToString()". - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class QualifiedCrefSyntax : CrefSyntax + public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) { - private TypeSyntax? container; - private MemberCrefSyntax? member; - - internal QualifiedCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (container != this.Container || dotToken != this.DotToken || member != this.Member) { + var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public TypeSyntax Container => GetRedAtZero(ref this.container)!; + return this; + } + + public QualifiedCrefSyntax WithContainer(TypeSyntax container) => Update(container, this.DotToken, this.Member); + public QualifiedCrefSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Container, dotToken, this.Member); + public QualifiedCrefSyntax WithMember(MemberCrefSyntax member) => Update(this.Container, this.DotToken, member); +} - public SyntaxToken DotToken => new SyntaxToken(this, ((InternalSyntax.QualifiedCrefSyntax)this.Green).dotToken, GetChildPosition(1), GetChildIndex(1)); +/// +/// The unqualified part of a CrefSyntax. +/// For example, "ToString()" in "object.ToString()". +/// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax +/// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol +/// might be a non-type member. +/// +public abstract partial class MemberCrefSyntax : CrefSyntax +{ + internal MemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public MemberCrefSyntax Member => GetRed(ref this.member, 2)!; +/// +/// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, +/// with an optional type parameter list) and an optional parameter list. +/// For example, "M", "M<T>" or "M(int)". +/// Also, "A::B()" or "string()". +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NameMemberCrefSyntax : MemberCrefSyntax +{ + private TypeSyntax? name; + private CrefParameterListSyntax? parameters; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.container)!, - 2 => GetRed(ref this.member, 2)!, - _ => null, - }; + internal NameMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.container, - 2 => this.member, - _ => null, - }; + public TypeSyntax Name => GetRedAtZero(ref this.name)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitQualifiedCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitQualifiedCref(this); + public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); - public QualifiedCrefSyntax Update(TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (container != this.Container || dotToken != this.DotToken || member != this.Member) - { - var newNode = SyntaxFactory.QualifiedCref(container, dotToken, member); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.name)!, + 1 => GetRed(ref this.parameters, 1), + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 1 => this.parameters, + _ => null, + }; - public QualifiedCrefSyntax WithContainer(TypeSyntax container) => Update(container, this.DotToken, this.Member); - public QualifiedCrefSyntax WithDotToken(SyntaxToken dotToken) => Update(this.Container, dotToken, this.Member); - public QualifiedCrefSyntax WithMember(MemberCrefSyntax member) => Update(this.Container, this.DotToken, member); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameMemberCref(this); - /// - /// The unqualified part of a CrefSyntax. - /// For example, "ToString()" in "object.ToString()". - /// NOTE: TypeCrefSyntax, QualifiedCrefSyntax, and MemberCrefSyntax overlap. The syntax in a TypeCrefSyntax - /// will always be bound as type, so it's safer to use QualifiedCrefSyntax or MemberCrefSyntax if the symbol - /// might be a non-type member. - /// - public abstract partial class MemberCrefSyntax : CrefSyntax + public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax? parameters) { - internal MemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (name != this.Name || parameters != this.Parameters) { + var newNode = SyntaxFactory.NameMemberCref(name, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// A MemberCrefSyntax specified by a name (an identifier, predefined type keyword, or an alias-qualified name, - /// with an optional type parameter list) and an optional parameter list. - /// For example, "M", "M<T>" or "M(int)". - /// Also, "A::B()" or "string()". - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NameMemberCrefSyntax : MemberCrefSyntax + public NameMemberCrefSyntax WithName(TypeSyntax name) => Update(name, this.Parameters); + public NameMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.Name, parameters); + + public NameMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) { - private TypeSyntax? name; - private CrefParameterListSyntax? parameters; + var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); + } +} - internal NameMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// A MemberCrefSyntax specified by a this keyword and an optional parameter list. +/// For example, "this" or "this[int]". +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax +{ + private CrefBracketedParameterListSyntax? parameters; + + internal IndexerMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public TypeSyntax Name => GetRedAtZero(ref this.name)!; + public SyntaxToken ThisKeyword => new SyntaxToken(this, ((InternalSyntax.IndexerMemberCrefSyntax)this.Green).thisKeyword, Position, 0); - public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); + public CrefBracketedParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 1 => GetRed(ref this.parameters, 1), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1) : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 1 => this.parameters, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNameMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNameMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerMemberCref(this); - public NameMemberCrefSyntax Update(TypeSyntax name, CrefParameterListSyntax? parameters) + public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + { + if (thisKeyword != this.ThisKeyword || parameters != this.Parameters) { - if (name != this.Name || parameters != this.Parameters) - { - var newNode = SyntaxFactory.NameMemberCref(name, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public NameMemberCrefSyntax WithName(TypeSyntax name) => Update(name, this.Parameters); - public NameMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.Name, parameters); + return this; + } - public NameMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) - { - var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } + public IndexerMemberCrefSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(thisKeyword, this.Parameters); + public IndexerMemberCrefSyntax WithParameters(CrefBracketedParameterListSyntax? parameters) => Update(this.ThisKeyword, parameters); + + public IndexerMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + { + var parameters = this.Parameters ?? SyntaxFactory.CrefBracketedParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); } +} - /// - /// A MemberCrefSyntax specified by a this keyword and an optional parameter list. - /// For example, "this" or "this[int]". - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IndexerMemberCrefSyntax : MemberCrefSyntax +/// +/// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. +/// For example, "operator +" or "operator -[int]". +/// NOTE: the operator must be overloadable. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax +{ + private CrefParameterListSyntax? parameters; + + internal OperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private CrefBracketedParameterListSyntax? parameters; + } + + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); - internal IndexerMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SyntaxToken CheckedKeyword + { + get { + var slot = ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public SyntaxToken ThisKeyword => new SyntaxToken(this, ((InternalSyntax.IndexerMemberCrefSyntax)this.Green).thisKeyword, Position, 0); + /// Gets the operator token. + public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); - public CrefBracketedParameterListSyntax? Parameters => GetRed(ref this.parameters, 1); + public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 3); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1) : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.parameters, 3) : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.parameters : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIndexerMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIndexerMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorMemberCref(this); - public IndexerMemberCrefSyntax Update(SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) + public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + { + if (operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters) { - if (thisKeyword != this.ThisKeyword || parameters != this.Parameters) - { - var newNode = SyntaxFactory.IndexerMemberCref(thisKeyword, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, operatorToken, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public IndexerMemberCrefSyntax WithThisKeyword(SyntaxToken thisKeyword) => Update(thisKeyword, this.Parameters); - public IndexerMemberCrefSyntax WithParameters(CrefBracketedParameterListSyntax? parameters) => Update(this.ThisKeyword, parameters); + return this; + } - public IndexerMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) - { - var parameters = this.Parameters ?? SyntaxFactory.CrefBracketedParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } + public OperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.Parameters); + public OperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.Parameters); + public OperatorMemberCrefSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.Parameters); + public OperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameters); + + public OperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + { + var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); } +} - /// - /// A MemberCrefSyntax specified by an operator keyword, an operator symbol and an optional parameter list. - /// For example, "operator +" or "operator -[int]". - /// NOTE: the operator must be overloadable. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class OperatorMemberCrefSyntax : MemberCrefSyntax +/// +/// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. +/// For example, "implicit operator int" or "explicit operator MyType(int)". +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax +{ + private TypeSyntax? type; + private CrefParameterListSyntax? parameters; + + internal ConversionOperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private CrefParameterListSyntax? parameters; + } - internal OperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).implicitOrExplicitKeyword, Position, 0); - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorKeyword, Position, 0); + public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken CheckedKeyword + public SyntaxToken CheckedKeyword + { + get { - get - { - var slot = ((Syntax.InternalSyntax.OperatorMemberCrefSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } + var slot = ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } + } - /// Gets the operator token. - public SyntaxToken OperatorToken => new SyntaxToken(this, ((InternalSyntax.OperatorMemberCrefSyntax)this.Green).operatorToken, GetChildPosition(2), GetChildIndex(2)); + public TypeSyntax Type => GetRed(ref this.type, 3)!; - public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 3); + public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 4); - internal override SyntaxNode? GetNodeSlot(int index) => index == 3 ? GetRed(ref this.parameters, 3) : null; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 3 => GetRed(ref this.type, 3)!, + 4 => GetRed(ref this.parameters, 4), + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) => index == 3 ? this.parameters : null; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 3 => this.type, + 4 => this.parameters, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitOperatorMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitOperatorMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorMemberCref(this); - public OperatorMemberCrefSyntax Update(SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) + public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + { + if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameters != this.Parameters) { - if (operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || operatorToken != this.OperatorToken || parameters != this.Parameters) - { - var newNode = SyntaxFactory.OperatorMemberCref(operatorKeyword, checkedKeyword, operatorToken, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public OperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(operatorKeyword, this.CheckedKeyword, this.OperatorToken, this.Parameters); - public OperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.OperatorKeyword, checkedKeyword, this.OperatorToken, this.Parameters); - public OperatorMemberCrefSyntax WithOperatorToken(SyntaxToken operatorToken) => Update(this.OperatorKeyword, this.CheckedKeyword, operatorToken, this.Parameters); - public OperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.OperatorKeyword, this.CheckedKeyword, this.OperatorToken, parameters); + return this; + } + + public ConversionOperatorMemberCrefSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(implicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.ImplicitOrExplicitKeyword, operatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, checkedKeyword, this.Type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithType(TypeSyntax type) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, type, this.Parameters); + public ConversionOperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameters); - public OperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) - { - var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } + public ConversionOperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) + { + var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); + return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); } +} - /// - /// A MemberCrefSyntax specified by an implicit or explicit keyword, an operator keyword, a destination type, and an optional parameter list. - /// For example, "implicit operator int" or "explicit operator MyType(int)". - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ConversionOperatorMemberCrefSyntax : MemberCrefSyntax +/// +/// A list of cref parameters with surrounding punctuation. +/// Unlike regular parameters, cref parameters do not have names. +/// +public abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode +{ + internal BaseCrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private TypeSyntax? type; - private CrefParameterListSyntax? parameters; + } - internal ConversionOperatorMemberCrefSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + /// Gets the parameter list. + public abstract SeparatedSyntaxList Parameters { get; } + public BaseCrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); + internal abstract BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); + + public BaseCrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => AddParametersCore(items); + internal abstract BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items); +} + +/// +/// A parenthesized list of cref parameters. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax +{ + private SyntaxNode? parameters; - public SyntaxToken ImplicitOrExplicitKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).implicitOrExplicitKeyword, Position, 0); + internal CrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken OperatorKeyword => new SyntaxToken(this, ((InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).operatorKeyword, GetChildPosition(1), GetChildIndex(1)); + /// Gets the open paren token. + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); - public SyntaxToken CheckedKeyword + public override SeparatedSyntaxList Parameters + { + get { - get - { - var slot = ((Syntax.InternalSyntax.ConversionOperatorMemberCrefSyntax)this.Green).checkedKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - public TypeSyntax Type => GetRed(ref this.type, 3)!; - - public CrefParameterListSyntax? Parameters => GetRed(ref this.parameters, 4); + /// Gets the close paren token. + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 3 => GetRed(ref this.type, 3)!, - 4 => GetRed(ref this.parameters, 4), - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 3 => this.type, - 4 => this.parameters, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitConversionOperatorMemberCref(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitConversionOperatorMemberCref(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameterList(this); - public ConversionOperatorMemberCrefSyntax Update(SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) + public CrefParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) { - if (implicitOrExplicitKeyword != this.ImplicitOrExplicitKeyword || operatorKeyword != this.OperatorKeyword || checkedKeyword != this.CheckedKeyword || type != this.Type || parameters != this.Parameters) - { - var newNode = SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public ConversionOperatorMemberCrefSyntax WithImplicitOrExplicitKeyword(SyntaxToken implicitOrExplicitKeyword) => Update(implicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithOperatorKeyword(SyntaxToken operatorKeyword) => Update(this.ImplicitOrExplicitKeyword, operatorKeyword, this.CheckedKeyword, this.Type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithCheckedKeyword(SyntaxToken checkedKeyword) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, checkedKeyword, this.Type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithType(TypeSyntax type) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, type, this.Parameters); - public ConversionOperatorMemberCrefSyntax WithParameters(CrefParameterListSyntax? parameters) => Update(this.ImplicitOrExplicitKeyword, this.OperatorKeyword, this.CheckedKeyword, this.Type, parameters); - - public ConversionOperatorMemberCrefSyntax AddParametersParameters(params CrefParameterSyntax[] items) - { - var parameters = this.Parameters ?? SyntaxFactory.CrefParameterList(); - return WithParameters(parameters.WithParameters(parameters.Parameters.AddRange(items))); - } + return this; } - /// - /// A list of cref parameters with surrounding punctuation. - /// Unlike regular parameters, cref parameters do not have names. - /// - public abstract partial class BaseCrefParameterListSyntax : CSharpSyntaxNode - { - internal BaseCrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public CrefParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); + internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new CrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); + public CrefParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); - /// Gets the parameter list. - public abstract SeparatedSyntaxList Parameters { get; } - public BaseCrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => WithParametersCore(parameters); - internal abstract BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters); + internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); + public new CrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} - public BaseCrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => AddParametersCore(items); - internal abstract BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items); - } +/// +/// A bracketed list of cref parameters. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax +{ + private SyntaxNode? parameters; - /// - /// A parenthesized list of cref parameters. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CrefParameterListSyntax : BaseCrefParameterListSyntax + internal CrefBracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? parameters; - - internal CrefParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - /// Gets the open paren token. - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).openParenToken, Position, 0); + /// Gets the open bracket token. + public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); - public override SeparatedSyntaxList Parameters + public override SeparatedSyntaxList Parameters + { + get { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var red = GetRed(ref this.parameters, 1); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; } + } - /// Gets the close paren token. - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.CrefParameterListSyntax)this.Green).closeParenToken, GetChildPosition(2), GetChildIndex(2)); + /// Gets the close bracket token. + public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefBracketedParameterList(this); - public CrefParameterListSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList parameters, SyntaxToken closeParenToken) + public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + { + if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) { - if (openParenToken != this.OpenParenToken || parameters != this.Parameters || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.CrefParameterList(openParenToken, parameters, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public CrefParameterListSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Parameters, this.CloseParenToken); - internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new CrefParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenParenToken, parameters, this.CloseParenToken); - public CrefParameterListSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Parameters, closeParenToken); - - internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); - public new CrefParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); + return this; } - /// - /// A bracketed list of cref parameters. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CrefBracketedParameterListSyntax : BaseCrefParameterListSyntax + public CrefBracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); + internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); + public new CrefBracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); + public CrefBracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); + + internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); + public new CrefBracketedParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); +} + +/// +/// An element of a BaseCrefParameterListSyntax. +/// Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, +/// an optional readonly keyword, and a type - +/// there is no name and there are no attributes or other modifiers. +/// +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class CrefParameterSyntax : CSharpSyntaxNode +{ + private TypeSyntax? type; + + internal CrefParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private SyntaxNode? parameters; + } - internal CrefBracketedParameterListSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public SyntaxToken RefKindKeyword + { + get { + var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword; + return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; } + } - /// Gets the open bracket token. - public SyntaxToken OpenBracketToken => new SyntaxToken(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).openBracketToken, Position, 0); - - public override SeparatedSyntaxList Parameters + public SyntaxToken ReadOnlyKeyword + { + get { - get - { - var red = GetRed(ref this.parameters, 1); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(1)) : default; - } + var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - /// Gets the close bracket token. - public SyntaxToken CloseBracketToken => new SyntaxToken(this, ((InternalSyntax.CrefBracketedParameterListSyntax)this.Green).closeBracketToken, GetChildPosition(2), GetChildIndex(2)); + public TypeSyntax Type => GetRed(ref this.type, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.parameters, 1)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.parameters : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefBracketedParameterList(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefBracketedParameterList(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameter(this); - public CrefBracketedParameterListSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList parameters, SyntaxToken closeBracketToken) + public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + { + if (refKindKeyword != this.RefKindKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) { - if (openBracketToken != this.OpenBracketToken || parameters != this.Parameters || closeBracketToken != this.CloseBracketToken) - { - var newNode = SyntaxFactory.CrefBracketedParameterList(openBracketToken, parameters, closeBracketToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.CrefParameter(refKindKeyword, readOnlyKeyword, type); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public CrefBracketedParameterListSyntax WithOpenBracketToken(SyntaxToken openBracketToken) => Update(openBracketToken, this.Parameters, this.CloseBracketToken); - internal override BaseCrefParameterListSyntax WithParametersCore(SeparatedSyntaxList parameters) => WithParameters(parameters); - public new CrefBracketedParameterListSyntax WithParameters(SeparatedSyntaxList parameters) => Update(this.OpenBracketToken, parameters, this.CloseBracketToken); - public CrefBracketedParameterListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken) => Update(this.OpenBracketToken, this.Parameters, closeBracketToken); - - internal override BaseCrefParameterListSyntax AddParametersCore(params CrefParameterSyntax[] items) => AddParameters(items); - public new CrefBracketedParameterListSyntax AddParameters(params CrefParameterSyntax[] items) => WithParameters(this.Parameters.AddRange(items)); + return this; } - /// - /// An element of a BaseCrefParameterListSyntax. - /// Unlike a regular parameter, a cref parameter has only an optional ref, in, out keyword, - /// an optional readonly keyword, and a type - - /// there is no name and there are no attributes or other modifiers. - /// - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class CrefParameterSyntax : CSharpSyntaxNode - { - private TypeSyntax? type; - - internal CrefParameterSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public CrefParameterSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(refKindKeyword, this.ReadOnlyKeyword, this.Type); + public CrefParameterSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKindKeyword, readOnlyKeyword, this.Type); + public CrefParameterSyntax WithType(TypeSyntax type) => Update(this.RefKindKeyword, this.ReadOnlyKeyword, type); +} - public SyntaxToken RefKindKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).refKindKeyword; - return slot != null ? new SyntaxToken(this, slot, Position, 0) : default; - } - } +public abstract partial class XmlNodeSyntax : CSharpSyntaxNode +{ + internal XmlNodeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } +} - public SyntaxToken ReadOnlyKeyword - { - get - { - var slot = ((Syntax.InternalSyntax.CrefParameterSyntax)this.Green).readOnlyKeyword; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlElementSyntax : XmlNodeSyntax +{ + private XmlElementStartTagSyntax? startTag; + private SyntaxNode? content; + private XmlElementEndTagSyntax? endTag; - public TypeSyntax Type => GetRed(ref this.type, 2)!; + internal XmlElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.type, 2)! : null; + public XmlElementStartTagSyntax StartTag => GetRedAtZero(ref this.startTag)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.type : null; + public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitCrefParameter(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitCrefParameter(this); + public XmlElementEndTagSyntax EndTag => GetRed(ref this.endTag, 2)!; - public CrefParameterSyntax Update(SyntaxToken refKindKeyword, SyntaxToken readOnlyKeyword, TypeSyntax type) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (refKindKeyword != this.RefKindKeyword || readOnlyKeyword != this.ReadOnlyKeyword || type != this.Type) - { - var newNode = SyntaxFactory.CrefParameter(refKindKeyword, readOnlyKeyword, type); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.startTag)!, + 1 => GetRed(ref this.content, 1)!, + 2 => GetRed(ref this.endTag, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.startTag, + 1 => this.content, + 2 => this.endTag, + _ => null, + }; - public CrefParameterSyntax WithRefKindKeyword(SyntaxToken refKindKeyword) => Update(refKindKeyword, this.ReadOnlyKeyword, this.Type); - public CrefParameterSyntax WithReadOnlyKeyword(SyntaxToken readOnlyKeyword) => Update(this.RefKindKeyword, readOnlyKeyword, this.Type); - public CrefParameterSyntax WithType(TypeSyntax type) => Update(this.RefKindKeyword, this.ReadOnlyKeyword, type); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElement(this); - public abstract partial class XmlNodeSyntax : CSharpSyntaxNode + public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, SyntaxList content, XmlElementEndTagSyntax endTag) { - internal XmlNodeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) { + var newNode = SyntaxFactory.XmlElement(startTag, content, endTag); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } + + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlElementSyntax : XmlNodeSyntax - { - private XmlElementStartTagSyntax? startTag; - private SyntaxNode? content; - private XmlElementEndTagSyntax? endTag; + public XmlElementSyntax WithStartTag(XmlElementStartTagSyntax startTag) => Update(startTag, this.Content, this.EndTag); + public XmlElementSyntax WithContent(SyntaxList content) => Update(this.StartTag, content, this.EndTag); + public XmlElementSyntax WithEndTag(XmlElementEndTagSyntax endTag) => Update(this.StartTag, this.Content, endTag); - internal XmlElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public XmlElementSyntax AddStartTagAttributes(params XmlAttributeSyntax[] items) => WithStartTag(this.StartTag.WithAttributes(this.StartTag.Attributes.AddRange(items))); + public XmlElementSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); +} - public XmlElementStartTagSyntax StartTag => GetRedAtZero(ref this.startTag)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode +{ + private XmlNameSyntax? name; + private SyntaxNode? attributes; - public SyntaxList Content => new SyntaxList(GetRed(ref this.content, 1)); + internal XmlElementStartTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public XmlElementEndTagSyntax EndTag => GetRed(ref this.endTag, 2)!; + public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.XmlElementStartTagSyntax)this.Green).lessThanToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.startTag)!, - 1 => GetRed(ref this.content, 1)!, - 2 => GetRed(ref this.endTag, 2)!, - _ => null, - }; + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.startTag, - 1 => this.content, - 2 => this.endTag, - _ => null, - }; + public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElement(this); + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlElementStartTagSyntax)this.Green).greaterThanToken, GetChildPosition(3), GetChildIndex(3)); - public XmlElementSyntax Update(XmlElementStartTagSyntax startTag, SyntaxList content, XmlElementEndTagSyntax endTag) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (startTag != this.StartTag || content != this.Content || endTag != this.EndTag) - { - var newNode = SyntaxFactory.XmlElement(startTag, content, endTag); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; - } + 1 => GetRed(ref this.name, 1)!, + 2 => GetRed(ref this.attributes, 2)!, + _ => null, + }; - public XmlElementSyntax WithStartTag(XmlElementStartTagSyntax startTag) => Update(startTag, this.Content, this.EndTag); - public XmlElementSyntax WithContent(SyntaxList content) => Update(this.StartTag, content, this.EndTag); - public XmlElementSyntax WithEndTag(XmlElementEndTagSyntax endTag) => Update(this.StartTag, this.Content, endTag); + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.name, + 2 => this.attributes, + _ => null, + }; - public XmlElementSyntax AddStartTagAttributes(params XmlAttributeSyntax[] items) => WithStartTag(this.StartTag.WithAttributes(this.StartTag.Attributes.AddRange(items))); - public XmlElementSyntax AddContent(params XmlNodeSyntax[] items) => WithContent(this.Content.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementStartTag(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlElementStartTagSyntax : CSharpSyntaxNode + public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken greaterThanToken) { - private XmlNameSyntax? name; - private SyntaxNode? attributes; - - internal XmlElementStartTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) { + var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.XmlElementStartTagSyntax)this.Green).lessThanToken, Position, 0); + return this; + } - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + public XmlElementStartTagSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.GreaterThanToken); + public XmlElementStartTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.GreaterThanToken); + public XmlElementStartTagSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.GreaterThanToken); + public XmlElementStartTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, greaterThanToken); - public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); + public XmlElementStartTagSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); +} - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlElementStartTagSyntax)this.Green).greaterThanToken, GetChildPosition(3), GetChildIndex(3)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode +{ + private XmlNameSyntax? name; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.name, 1)!, - 2 => GetRed(ref this.attributes, 2)!, - _ => null, - }; + internal XmlElementEndTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.name, - 2 => this.attributes, - _ => null, - }; + public SyntaxToken LessThanSlashToken => new SyntaxToken(this, ((InternalSyntax.XmlElementEndTagSyntax)this.Green).lessThanSlashToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementStartTag(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementStartTag(this); + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public XmlElementStartTagSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken greaterThanToken) - { - if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.XmlElementStartTag(lessThanToken, name, attributes, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlElementEndTagSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; - public XmlElementStartTagSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.GreaterThanToken); - public XmlElementStartTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.GreaterThanToken); - public XmlElementStartTagSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.GreaterThanToken); - public XmlElementStartTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, greaterThanToken); + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; - public XmlElementStartTagSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementEndTag(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlElementEndTagSyntax : CSharpSyntaxNode + public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) { - private XmlNameSyntax? name; - - internal XmlElementEndTagSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken) { + var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken LessThanSlashToken => new SyntaxToken(this, ((InternalSyntax.XmlElementEndTagSyntax)this.Green).lessThanSlashToken, Position, 0); + return this; + } + + public XmlElementEndTagSyntax WithLessThanSlashToken(SyntaxToken lessThanSlashToken) => Update(lessThanSlashToken, this.Name, this.GreaterThanToken); + public XmlElementEndTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanSlashToken, name, this.GreaterThanToken); + public XmlElementEndTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanSlashToken, this.Name, greaterThanToken); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax +{ + private XmlNameSyntax? name; + private SyntaxNode? attributes; - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + internal XmlEmptyElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken GreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlElementEndTagSyntax)this.Green).greaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.XmlEmptyElementSyntax)this.Green).lessThanToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlElementEndTag(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlElementEndTag(this); + public SyntaxToken SlashGreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlEmptyElementSyntax)this.Green).slashGreaterThanToken, GetChildPosition(3), GetChildIndex(3)); - public XmlElementEndTagSyntax Update(SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (lessThanSlashToken != this.LessThanSlashToken || name != this.Name || greaterThanToken != this.GreaterThanToken) - { - var newNode = SyntaxFactory.XmlElementEndTag(lessThanSlashToken, name, greaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 1 => GetRed(ref this.name, 1)!, + 2 => GetRed(ref this.attributes, 2)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 1 => this.name, + 2 => this.attributes, + _ => null, + }; - public XmlElementEndTagSyntax WithLessThanSlashToken(SyntaxToken lessThanSlashToken) => Update(lessThanSlashToken, this.Name, this.GreaterThanToken); - public XmlElementEndTagSyntax WithName(XmlNameSyntax name) => Update(this.LessThanSlashToken, name, this.GreaterThanToken); - public XmlElementEndTagSyntax WithGreaterThanToken(SyntaxToken greaterThanToken) => Update(this.LessThanSlashToken, this.Name, greaterThanToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlEmptyElement(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlEmptyElementSyntax : XmlNodeSyntax + public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken slashGreaterThanToken) { - private XmlNameSyntax? name; - private SyntaxNode? attributes; - - internal XmlEmptyElementSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) { + var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken LessThanToken => new SyntaxToken(this, ((InternalSyntax.XmlEmptyElementSyntax)this.Green).lessThanToken, Position, 0); - - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + return this; + } - public SyntaxList Attributes => new SyntaxList(GetRed(ref this.attributes, 2)); + public XmlEmptyElementSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.SlashGreaterThanToken); + public XmlEmptyElementSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.SlashGreaterThanToken); + public XmlEmptyElementSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.SlashGreaterThanToken); + public XmlEmptyElementSyntax WithSlashGreaterThanToken(SyntaxToken slashGreaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, slashGreaterThanToken); - public SyntaxToken SlashGreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlEmptyElementSyntax)this.Green).slashGreaterThanToken, GetChildPosition(3), GetChildIndex(3)); + public XmlEmptyElementSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 1 => GetRed(ref this.name, 1)!, - 2 => GetRed(ref this.attributes, 2)!, - _ => null, - }; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlNameSyntax : CSharpSyntaxNode +{ + private XmlPrefixSyntax? prefix; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 1 => this.name, - 2 => this.attributes, - _ => null, - }; + internal XmlNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlEmptyElement(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlEmptyElement(this); + public XmlPrefixSyntax? Prefix => GetRedAtZero(ref this.prefix); - public XmlEmptyElementSyntax Update(SyntaxToken lessThanToken, XmlNameSyntax name, SyntaxList attributes, SyntaxToken slashGreaterThanToken) - { - if (lessThanToken != this.LessThanToken || name != this.Name || attributes != this.Attributes || slashGreaterThanToken != this.SlashGreaterThanToken) - { - var newNode = SyntaxFactory.XmlEmptyElement(lessThanToken, name, attributes, slashGreaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public SyntaxToken LocalName => new SyntaxToken(this, ((InternalSyntax.XmlNameSyntax)this.Green).localName, GetChildPosition(1), GetChildIndex(1)); - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.prefix) : null; - public XmlEmptyElementSyntax WithLessThanToken(SyntaxToken lessThanToken) => Update(lessThanToken, this.Name, this.Attributes, this.SlashGreaterThanToken); - public XmlEmptyElementSyntax WithName(XmlNameSyntax name) => Update(this.LessThanToken, name, this.Attributes, this.SlashGreaterThanToken); - public XmlEmptyElementSyntax WithAttributes(SyntaxList attributes) => Update(this.LessThanToken, this.Name, attributes, this.SlashGreaterThanToken); - public XmlEmptyElementSyntax WithSlashGreaterThanToken(SyntaxToken slashGreaterThanToken) => Update(this.LessThanToken, this.Name, this.Attributes, slashGreaterThanToken); + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.prefix : null; - public XmlEmptyElementSyntax AddAttributes(params XmlAttributeSyntax[] items) => WithAttributes(this.Attributes.AddRange(items)); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlName(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlNameSyntax : CSharpSyntaxNode + public XmlNameSyntax Update(XmlPrefixSyntax? prefix, SyntaxToken localName) { - private XmlPrefixSyntax? prefix; - - internal XmlNameSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (prefix != this.Prefix || localName != this.LocalName) { + var newNode = SyntaxFactory.XmlName(prefix, localName); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public XmlPrefixSyntax? Prefix => GetRedAtZero(ref this.prefix); - - public SyntaxToken LocalName => new SyntaxToken(this, ((InternalSyntax.XmlNameSyntax)this.Green).localName, GetChildPosition(1), GetChildIndex(1)); - - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.prefix) : null; - - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.prefix : null; - - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlName(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlName(this); - - public XmlNameSyntax Update(XmlPrefixSyntax? prefix, SyntaxToken localName) - { - if (prefix != this.Prefix || localName != this.LocalName) - { - var newNode = SyntaxFactory.XmlName(prefix, localName); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + return this; + } - return this; - } + public XmlNameSyntax WithPrefix(XmlPrefixSyntax? prefix) => Update(prefix, this.LocalName); + public XmlNameSyntax WithLocalName(SyntaxToken localName) => Update(this.Prefix, localName); +} - public XmlNameSyntax WithPrefix(XmlPrefixSyntax? prefix) => Update(prefix, this.LocalName); - public XmlNameSyntax WithLocalName(SyntaxToken localName) => Update(this.Prefix, localName); - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlPrefixSyntax : CSharpSyntaxNode +{ - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlPrefixSyntax : CSharpSyntaxNode + internal XmlPrefixSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { + } - internal XmlPrefixSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } - - public SyntaxToken Prefix => new SyntaxToken(this, ((InternalSyntax.XmlPrefixSyntax)this.Green).prefix, Position, 0); + public SyntaxToken Prefix => new SyntaxToken(this, ((InternalSyntax.XmlPrefixSyntax)this.Green).prefix, Position, 0); - public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.XmlPrefixSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ColonToken => new SyntaxToken(this, ((InternalSyntax.XmlPrefixSyntax)this.Green).colonToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlPrefix(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlPrefix(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlPrefix(this); - public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken) + public XmlPrefixSyntax Update(SyntaxToken prefix, SyntaxToken colonToken) + { + if (prefix != this.Prefix || colonToken != this.ColonToken) { - if (prefix != this.Prefix || colonToken != this.ColonToken) - { - var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.XmlPrefix(prefix, colonToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public XmlPrefixSyntax WithPrefix(SyntaxToken prefix) => Update(prefix, this.ColonToken); - public XmlPrefixSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Prefix, colonToken); + return this; } - public abstract partial class XmlAttributeSyntax : CSharpSyntaxNode + public XmlPrefixSyntax WithPrefix(SyntaxToken prefix) => Update(prefix, this.ColonToken); + public XmlPrefixSyntax WithColonToken(SyntaxToken colonToken) => Update(this.Prefix, colonToken); +} + +public abstract partial class XmlAttributeSyntax : CSharpSyntaxNode +{ + internal XmlAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal XmlAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - public abstract XmlNameSyntax Name { get; } - public XmlAttributeSyntax WithName(XmlNameSyntax name) => WithNameCore(name); - internal abstract XmlAttributeSyntax WithNameCore(XmlNameSyntax name); + public abstract XmlNameSyntax Name { get; } + public XmlAttributeSyntax WithName(XmlNameSyntax name) => WithNameCore(name); + internal abstract XmlAttributeSyntax WithNameCore(XmlNameSyntax name); - public abstract SyntaxToken EqualsToken { get; } - public XmlAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => WithEqualsTokenCore(equalsToken); - internal abstract XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken); + public abstract SyntaxToken EqualsToken { get; } + public XmlAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => WithEqualsTokenCore(equalsToken); + internal abstract XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken); - public abstract SyntaxToken StartQuoteToken { get; } - public XmlAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => WithStartQuoteTokenCore(startQuoteToken); - internal abstract XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken); + public abstract SyntaxToken StartQuoteToken { get; } + public XmlAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => WithStartQuoteTokenCore(startQuoteToken); + internal abstract XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken); - public abstract SyntaxToken EndQuoteToken { get; } - public XmlAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => WithEndQuoteTokenCore(endQuoteToken); - internal abstract XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken); - } + public abstract SyntaxToken EndQuoteToken { get; } + public XmlAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => WithEndQuoteTokenCore(endQuoteToken); + internal abstract XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken); +} - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax - { - private XmlNameSyntax? name; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlTextAttributeSyntax : XmlAttributeSyntax +{ + private XmlNameSyntax? name; - internal XmlTextAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal XmlTextAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; + public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxTokenList TextTokens + public SyntaxTokenList TextTokens + { + get { - get - { - var slot = this.Green.GetSlot(3); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } + var slot = this.Green.GetSlot(3); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } + } - public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlTextAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 0 ? GetRedAtZero(ref this.name)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 0 ? this.name : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlTextAttribute(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlTextAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlTextAttribute(this); - public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, SyntaxTokenList textTokens, SyntaxToken endQuoteToken) + public XmlTextAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, SyntaxTokenList textTokens, SyntaxToken endQuoteToken) + { + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || textTokens != this.TextTokens || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.XmlTextAttribute(name, equalsToken, startQuoteToken, textTokens, endQuoteToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); - public new XmlTextAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); - public new XmlTextAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); - internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); - public new XmlTextAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.TextTokens, this.EndQuoteToken); - public XmlTextAttributeSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, textTokens, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); - public new XmlTextAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, endQuoteToken); - - public XmlTextAttributeSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax - { - private XmlNameSyntax? name; - private CrefSyntax? cref; - - internal XmlCrefAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); + public new XmlTextAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); + public new XmlTextAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.TextTokens, this.EndQuoteToken); + internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); + public new XmlTextAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.TextTokens, this.EndQuoteToken); + public XmlTextAttributeSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, textTokens, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); + public new XmlTextAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.TextTokens, endQuoteToken); - public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; + public XmlTextAttributeSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); +} - public override SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlCrefAttributeSyntax : XmlAttributeSyntax +{ + private XmlNameSyntax? name; + private CrefSyntax? cref; - public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + internal XmlCrefAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public CrefSyntax Cref => GetRed(ref this.cref, 3)!; + public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 3 => GetRed(ref this.cref, 3)!, - _ => null, - }; + public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 3 => this.cref, - _ => null, - }; + public CrefSyntax Cref => GetRed(ref this.cref, 3)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCrefAttribute(this); + public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlCrefAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); - public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.name)!, + 3 => GetRed(ref this.cref, 3)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 3 => this.cref, + _ => null, + }; - internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); - public new XmlCrefAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); - public new XmlCrefAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); - internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); - public new XmlCrefAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Cref, this.EndQuoteToken); - public XmlCrefAttributeSyntax WithCref(CrefSyntax cref) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, cref, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); - public new XmlCrefAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Cref, endQuoteToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCrefAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCrefAttribute(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax + public XmlCrefAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) { - private XmlNameSyntax? name; - private IdentifierNameSyntax? identifier; - - internal XmlNameAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || cref != this.Cref || endQuoteToken != this.EndQuoteToken) { + var newNode = SyntaxFactory.XmlCrefAttribute(name, equalsToken, startQuoteToken, cref, endQuoteToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; + return this; + } + + internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); + public new XmlCrefAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); + public new XmlCrefAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Cref, this.EndQuoteToken); + internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); + public new XmlCrefAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Cref, this.EndQuoteToken); + public XmlCrefAttributeSyntax WithCref(CrefSyntax cref) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, cref, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); + public new XmlCrefAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Cref, endQuoteToken); +} - public override SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlNameAttributeSyntax : XmlAttributeSyntax +{ + private XmlNameSyntax? name; + private IdentifierNameSyntax? identifier; - public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); + internal XmlNameAttributeSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public IdentifierNameSyntax Identifier => GetRed(ref this.identifier, 3)!; + public override XmlNameSyntax Name => GetRedAtZero(ref this.name)!; - public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EqualsToken => new SyntaxToken(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).equalsToken, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 0 => GetRedAtZero(ref this.name)!, - 3 => GetRed(ref this.identifier, 3)!, - _ => null, - }; + public override SyntaxToken StartQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).startQuoteToken, GetChildPosition(2), GetChildIndex(2)); - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 0 => this.name, - 3 => this.identifier, - _ => null, - }; + public IdentifierNameSyntax Identifier => GetRed(ref this.identifier, 3)!; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlNameAttribute(this); + public override SyntaxToken EndQuoteToken => new SyntaxToken(this, ((InternalSyntax.XmlNameAttributeSyntax)this.Green).endQuoteToken, GetChildPosition(4), GetChildIndex(4)); - public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) + internal override SyntaxNode? GetNodeSlot(int index) + => index switch { - if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken) - { - var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + 0 => GetRedAtZero(ref this.name)!, + 3 => GetRed(ref this.identifier, 3)!, + _ => null, + }; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 0 => this.name, + 3 => this.identifier, + _ => null, + }; - internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); - public new XmlNameAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); - public new XmlNameAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); - internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); - public new XmlNameAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Identifier, this.EndQuoteToken); - public XmlNameAttributeSyntax WithIdentifier(IdentifierNameSyntax identifier) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, identifier, this.EndQuoteToken); - internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); - public new XmlNameAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Identifier, endQuoteToken); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlNameAttribute(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlNameAttribute(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlTextSyntax : XmlNodeSyntax + public XmlNameAttributeSyntax Update(XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) { - - internal XmlTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (name != this.Name || equalsToken != this.EqualsToken || startQuoteToken != this.StartQuoteToken || identifier != this.Identifier || endQuoteToken != this.EndQuoteToken) { + var newNode = SyntaxFactory.XmlNameAttribute(name, equalsToken, startQuoteToken, identifier, endQuoteToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(0); - return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; - } - } + return this; + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override XmlAttributeSyntax WithNameCore(XmlNameSyntax name) => WithName(name); + public new XmlNameAttributeSyntax WithName(XmlNameSyntax name) => Update(name, this.EqualsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEqualsTokenCore(SyntaxToken equalsToken) => WithEqualsToken(equalsToken); + public new XmlNameAttributeSyntax WithEqualsToken(SyntaxToken equalsToken) => Update(this.Name, equalsToken, this.StartQuoteToken, this.Identifier, this.EndQuoteToken); + internal override XmlAttributeSyntax WithStartQuoteTokenCore(SyntaxToken startQuoteToken) => WithStartQuoteToken(startQuoteToken); + public new XmlNameAttributeSyntax WithStartQuoteToken(SyntaxToken startQuoteToken) => Update(this.Name, this.EqualsToken, startQuoteToken, this.Identifier, this.EndQuoteToken); + public XmlNameAttributeSyntax WithIdentifier(IdentifierNameSyntax identifier) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, identifier, this.EndQuoteToken); + internal override XmlAttributeSyntax WithEndQuoteTokenCore(SyntaxToken endQuoteToken) => WithEndQuoteToken(endQuoteToken); + public new XmlNameAttributeSyntax WithEndQuoteToken(SyntaxToken endQuoteToken) => Update(this.Name, this.EqualsToken, this.StartQuoteToken, this.Identifier, endQuoteToken); +} - internal override SyntaxNode? GetCachedSlot(int index) => null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlTextSyntax : XmlNodeSyntax +{ - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlText(this); + internal XmlTextSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public XmlTextSyntax Update(SyntaxTokenList textTokens) + public SyntaxTokenList TextTokens + { + get { - if (textTokens != this.TextTokens) - { - var newNode = SyntaxFactory.XmlText(textTokens); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(0); + return slot != null ? new SyntaxTokenList(this, slot, Position, 0) : default; } + } - public XmlTextSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(textTokens); + internal override SyntaxNode? GetNodeSlot(int index) => null; - public XmlTextSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlText(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlText(this); - internal XmlCDataSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public XmlTextSyntax Update(SyntaxTokenList textTokens) + { + if (textTokens != this.TextTokens) { + var newNode = SyntaxFactory.XmlText(textTokens); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken StartCDataToken => new SyntaxToken(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); + return this; + } - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public XmlTextSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(textTokens); - public SyntaxToken EndCDataToken => new SyntaxToken(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); + public XmlTextSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlCDataSectionSyntax : XmlNodeSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal XmlCDataSectionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCDataSection(this); + public SyntaxToken StartCDataToken => new SyntaxToken(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).startCDataToken, Position, 0); - public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, SyntaxTokenList textTokens, SyntaxToken endCDataToken) + public SyntaxTokenList TextTokens + { + get { - if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) - { - var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public XmlCDataSectionSyntax WithStartCDataToken(SyntaxToken startCDataToken) => Update(startCDataToken, this.TextTokens, this.EndCDataToken); - public XmlCDataSectionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartCDataToken, textTokens, this.EndCDataToken); - public XmlCDataSectionSyntax WithEndCDataToken(SyntaxToken endCDataToken) => Update(this.StartCDataToken, this.TextTokens, endCDataToken); + public SyntaxToken EndCDataToken => new SyntaxToken(this, ((InternalSyntax.XmlCDataSectionSyntax)this.Green).endCDataToken, GetChildPosition(2), GetChildIndex(2)); - public XmlCDataSectionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax - { - private XmlNameSyntax? name; + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlCDataSection(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlCDataSection(this); - internal XmlProcessingInstructionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public XmlCDataSectionSyntax Update(SyntaxToken startCDataToken, SyntaxTokenList textTokens, SyntaxToken endCDataToken) + { + if (startCDataToken != this.StartCDataToken || textTokens != this.TextTokens || endCDataToken != this.EndCDataToken) { + var newNode = SyntaxFactory.XmlCDataSection(startCDataToken, textTokens, endCDataToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken StartProcessingInstructionToken => new SyntaxToken(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).startProcessingInstructionToken, Position, 0); + return this; + } - public XmlNameSyntax Name => GetRed(ref this.name, 1)!; + public XmlCDataSectionSyntax WithStartCDataToken(SyntaxToken startCDataToken) => Update(startCDataToken, this.TextTokens, this.EndCDataToken); + public XmlCDataSectionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartCDataToken, textTokens, this.EndCDataToken); + public XmlCDataSectionSyntax WithEndCDataToken(SyntaxToken endCDataToken) => Update(this.StartCDataToken, this.TextTokens, endCDataToken); - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(2); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; - } - } + public XmlCDataSectionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); +} - public SyntaxToken EndProcessingInstructionToken => new SyntaxToken(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlProcessingInstructionSyntax : XmlNodeSyntax +{ + private XmlNameSyntax? name; - internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; + internal XmlProcessingInstructionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + public SyntaxToken StartProcessingInstructionToken => new SyntaxToken(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).startProcessingInstructionToken, Position, 0); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlProcessingInstruction(this); + public XmlNameSyntax Name => GetRed(ref this.name, 1)!; - public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, SyntaxTokenList textTokens, SyntaxToken endProcessingInstructionToken) + public SyntaxTokenList TextTokens + { + get { - if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) - { - var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(2); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(2), GetChildIndex(2)) : default; } + } - public XmlProcessingInstructionSyntax WithStartProcessingInstructionToken(SyntaxToken startProcessingInstructionToken) => Update(startProcessingInstructionToken, this.Name, this.TextTokens, this.EndProcessingInstructionToken); - public XmlProcessingInstructionSyntax WithName(XmlNameSyntax name) => Update(this.StartProcessingInstructionToken, name, this.TextTokens, this.EndProcessingInstructionToken); - public XmlProcessingInstructionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartProcessingInstructionToken, this.Name, textTokens, this.EndProcessingInstructionToken); - public XmlProcessingInstructionSyntax WithEndProcessingInstructionToken(SyntaxToken endProcessingInstructionToken) => Update(this.StartProcessingInstructionToken, this.Name, this.TextTokens, endProcessingInstructionToken); + public SyntaxToken EndProcessingInstructionToken => new SyntaxToken(this, ((InternalSyntax.XmlProcessingInstructionSyntax)this.Green).endProcessingInstructionToken, GetChildPosition(3), GetChildIndex(3)); - public XmlProcessingInstructionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 1 ? GetRed(ref this.name, 1)! : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class XmlCommentSyntax : XmlNodeSyntax - { + internal override SyntaxNode? GetCachedSlot(int index) => index == 1 ? this.name : null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlProcessingInstruction(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlProcessingInstruction(this); - internal XmlCommentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public XmlProcessingInstructionSyntax Update(SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, SyntaxTokenList textTokens, SyntaxToken endProcessingInstructionToken) + { + if (startProcessingInstructionToken != this.StartProcessingInstructionToken || name != this.Name || textTokens != this.TextTokens || endProcessingInstructionToken != this.EndProcessingInstructionToken) { + var newNode = SyntaxFactory.XmlProcessingInstruction(startProcessingInstructionToken, name, textTokens, endProcessingInstructionToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public SyntaxToken LessThanExclamationMinusMinusToken => new SyntaxToken(this, ((InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); + return this; + } - public SyntaxTokenList TextTokens - { - get - { - var slot = this.Green.GetSlot(1); - return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; - } - } + public XmlProcessingInstructionSyntax WithStartProcessingInstructionToken(SyntaxToken startProcessingInstructionToken) => Update(startProcessingInstructionToken, this.Name, this.TextTokens, this.EndProcessingInstructionToken); + public XmlProcessingInstructionSyntax WithName(XmlNameSyntax name) => Update(this.StartProcessingInstructionToken, name, this.TextTokens, this.EndProcessingInstructionToken); + public XmlProcessingInstructionSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.StartProcessingInstructionToken, this.Name, textTokens, this.EndProcessingInstructionToken); + public XmlProcessingInstructionSyntax WithEndProcessingInstructionToken(SyntaxToken endProcessingInstructionToken) => Update(this.StartProcessingInstructionToken, this.Name, this.TextTokens, endProcessingInstructionToken); - public SyntaxToken MinusMinusGreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); + public XmlProcessingInstructionSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); +} - internal override SyntaxNode? GetNodeSlot(int index) => null; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class XmlCommentSyntax : XmlNodeSyntax +{ - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal XmlCommentSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlComment(this); + public SyntaxToken LessThanExclamationMinusMinusToken => new SyntaxToken(this, ((InternalSyntax.XmlCommentSyntax)this.Green).lessThanExclamationMinusMinusToken, Position, 0); - public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, SyntaxTokenList textTokens, SyntaxToken minusMinusGreaterThanToken) + public SyntaxTokenList TextTokens + { + get { - if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) - { - var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var slot = this.Green.GetSlot(1); + return slot != null ? new SyntaxTokenList(this, slot, GetChildPosition(1), GetChildIndex(1)) : default; } + } - public XmlCommentSyntax WithLessThanExclamationMinusMinusToken(SyntaxToken lessThanExclamationMinusMinusToken) => Update(lessThanExclamationMinusMinusToken, this.TextTokens, this.MinusMinusGreaterThanToken); - public XmlCommentSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.LessThanExclamationMinusMinusToken, textTokens, this.MinusMinusGreaterThanToken); - public XmlCommentSyntax WithMinusMinusGreaterThanToken(SyntaxToken minusMinusGreaterThanToken) => Update(this.LessThanExclamationMinusMinusToken, this.TextTokens, minusMinusGreaterThanToken); + public SyntaxToken MinusMinusGreaterThanToken => new SyntaxToken(this, ((InternalSyntax.XmlCommentSyntax)this.Green).minusMinusGreaterThanToken, GetChildPosition(2), GetChildIndex(2)); - public XmlCommentSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); - } + internal override SyntaxNode? GetNodeSlot(int index) => null; + + internal override SyntaxNode? GetCachedSlot(int index) => null; + + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitXmlComment(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitXmlComment(this); - public abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax + public XmlCommentSyntax Update(SyntaxToken lessThanExclamationMinusMinusToken, SyntaxTokenList textTokens, SyntaxToken minusMinusGreaterThanToken) { - internal DirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (lessThanExclamationMinusMinusToken != this.LessThanExclamationMinusMinusToken || textTokens != this.TextTokens || minusMinusGreaterThanToken != this.MinusMinusGreaterThanToken) { + var newNode = SyntaxFactory.XmlComment(lessThanExclamationMinusMinusToken, textTokens, minusMinusGreaterThanToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxToken HashToken { get; } - public DirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => WithHashTokenCore(hashToken); - internal abstract DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken); + return this; + } - public abstract SyntaxToken EndOfDirectiveToken { get; } - public DirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveTokenCore(endOfDirectiveToken); - internal abstract DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken); + public XmlCommentSyntax WithLessThanExclamationMinusMinusToken(SyntaxToken lessThanExclamationMinusMinusToken) => Update(lessThanExclamationMinusMinusToken, this.TextTokens, this.MinusMinusGreaterThanToken); + public XmlCommentSyntax WithTextTokens(SyntaxTokenList textTokens) => Update(this.LessThanExclamationMinusMinusToken, textTokens, this.MinusMinusGreaterThanToken); + public XmlCommentSyntax WithMinusMinusGreaterThanToken(SyntaxToken minusMinusGreaterThanToken) => Update(this.LessThanExclamationMinusMinusToken, this.TextTokens, minusMinusGreaterThanToken); - public abstract bool IsActive { get; } - } + public XmlCommentSyntax AddTextTokens(params SyntaxToken[] items) => WithTextTokens(this.TextTokens.AddRange(items)); +} - public abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax +public abstract partial class DirectiveTriviaSyntax : StructuredTriviaSyntax +{ + internal DirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal BranchingDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - public abstract bool BranchTaken { get; } + public abstract SyntaxToken HashToken { get; } + public DirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => WithHashTokenCore(hashToken); + internal abstract DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken); - public new BranchingDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (BranchingDirectiveTriviaSyntax)WithHashTokenCore(hashToken); - public new BranchingDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (BranchingDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); - } + public abstract SyntaxToken EndOfDirectiveToken { get; } + public DirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveTokenCore(endOfDirectiveToken); + internal abstract DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken); - public abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax + public abstract bool IsActive { get; } +} + +public abstract partial class BranchingDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal BranchingDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - internal ConditionalDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + } - public abstract ExpressionSyntax Condition { get; } - public ConditionalDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => WithConditionCore(condition); - internal abstract ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition); + public abstract bool BranchTaken { get; } - public abstract bool ConditionValue { get; } - } + public new BranchingDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (BranchingDirectiveTriviaSyntax)WithHashTokenCore(hashToken); + public new BranchingDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (BranchingDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); +} - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax +public abstract partial class ConditionalDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax +{ + internal ConditionalDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) { - private ExpressionSyntax? condition; + } - internal IfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public abstract ExpressionSyntax Condition { get; } + public ConditionalDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => WithConditionCore(condition); + internal abstract ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition); - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public abstract bool ConditionValue { get; } +} - public SyntaxToken IfKeyword => new SyntaxToken(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class IfDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax +{ + private ExpressionSyntax? condition; - public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; + internal IfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override bool IsActive => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).IsActive; + public SyntaxToken IfKeyword => new SyntaxToken(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ifKeyword, GetChildPosition(1), GetChildIndex(1)); - public override bool BranchTaken => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).BranchTaken; + public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; - public override bool ConditionValue => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ConditionValue; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; + public override bool IsActive => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; + public override bool BranchTaken => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).BranchTaken; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfDirectiveTrivia(this); + public override bool ConditionValue => ((InternalSyntax.IfDirectiveTriviaSyntax)this.Green).ConditionValue; - public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { - if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new IfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.HashToken, ifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); - public new IfDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.IfKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new IfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.IfKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); - public IfDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitIfDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitIfDirectiveTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax + public IfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) { - private ExpressionSyntax? condition; - - internal ElifDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || ifKeyword != this.IfKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.IfDirectiveTrivia(hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken ElifKeyword => new SyntaxToken(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).elifKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new IfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithIfKeyword(SyntaxToken ifKeyword) => Update(this.HashToken, ifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); + public new IfDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.IfKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new IfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.IfKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); + public IfDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.IfKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); +} - public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ElifDirectiveTriviaSyntax : ConditionalDirectiveTriviaSyntax +{ + private ExpressionSyntax? condition; - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + internal ElifDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override bool BranchTaken => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).BranchTaken; + public SyntaxToken ElifKeyword => new SyntaxToken(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).elifKeyword, GetChildPosition(1), GetChildIndex(1)); - public override bool ConditionValue => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).ConditionValue; + public override ExpressionSyntax Condition => GetRed(ref this.condition, 2)!; - internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; + public override bool IsActive => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).IsActive; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElifDirectiveTrivia(this); + public override bool BranchTaken => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).BranchTaken; - public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) - { - if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool ConditionValue => ((InternalSyntax.ElifDirectiveTriviaSyntax)this.Green).ConditionValue; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => index == 2 ? GetRed(ref this.condition, 2)! : null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ElifDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithElifKeyword(SyntaxToken elifKeyword) => Update(this.HashToken, elifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); - public new ElifDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.ElifKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ElifDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElifKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); - public ElifDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); - } + internal override SyntaxNode? GetCachedSlot(int index) => index == 2 ? this.condition : null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElifDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElifDirectiveTrivia(this); - internal ElseDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public ElifDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) + { + if (hashToken != this.HashToken || elifKeyword != this.ElifKeyword || condition != this.Condition || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.ElifDirectiveTrivia(hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken ElseKeyword => new SyntaxToken(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).elseKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ElifDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithElifKeyword(SyntaxToken elifKeyword) => Update(this.HashToken, elifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override ConditionalDirectiveTriviaSyntax WithConditionCore(ExpressionSyntax condition) => WithCondition(condition); + public new ElifDirectiveTriviaSyntax WithCondition(ExpressionSyntax condition) => Update(this.HashToken, this.ElifKeyword, condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ElifDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElifKeyword, this.Condition, endOfDirectiveToken, this.IsActive, this.BranchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, isActive, this.BranchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, branchTaken, this.ConditionValue); + public ElifDirectiveTriviaSyntax WithConditionValue(bool conditionValue) => Update(this.HashToken, this.ElifKeyword, this.Condition, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken, conditionValue); +} - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ElseDirectiveTriviaSyntax : BranchingDirectiveTriviaSyntax +{ - public override bool IsActive => ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).IsActive; + internal ElseDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool BranchTaken => ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).BranchTaken; + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken ElseKeyword => new SyntaxToken(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).elseKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseDirectiveTrivia(this); + public override bool IsActive => ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).IsActive; - public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) - { - if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool BranchTaken => ((InternalSyntax.ElseDirectiveTriviaSyntax)this.Green).BranchTaken; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ElseDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); - public ElseDirectiveTriviaSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(this.HashToken, elseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ElseDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElseKeyword, endOfDirectiveToken, this.IsActive, this.BranchTaken); - public ElseDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, isActive, this.BranchTaken); - public ElseDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, branchTaken); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitElseDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitElseDirectiveTrivia(this); - internal EndIfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public ElseDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) + { + if (hashToken != this.HashToken || elseKeyword != this.ElseKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.ElseDirectiveTrivia(hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } + + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ElseDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); + public ElseDirectiveTriviaSyntax WithElseKeyword(SyntaxToken elseKeyword) => Update(this.HashToken, elseKeyword, this.EndOfDirectiveToken, this.IsActive, this.BranchTaken); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ElseDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ElseKeyword, endOfDirectiveToken, this.IsActive, this.BranchTaken); + public ElseDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, isActive, this.BranchTaken); + public ElseDirectiveTriviaSyntax WithBranchTaken(bool branchTaken) => Update(this.HashToken, this.ElseKeyword, this.EndOfDirectiveToken, this.IsActive, branchTaken); +} - public SyntaxToken EndIfKeyword => new SyntaxToken(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endIfKeyword, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EndIfDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal EndIfDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken EndIfKeyword => new SyntaxToken(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endIfKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndIfDirectiveTrivia(this); + public override bool IsActive => ((InternalSyntax.EndIfDirectiveTriviaSyntax)this.Green).IsActive; - public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new EndIfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndIfKeyword, this.EndOfDirectiveToken, this.IsActive); - public EndIfDirectiveTriviaSyntax WithEndIfKeyword(SyntaxToken endIfKeyword) => Update(this.HashToken, endIfKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new EndIfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndIfKeyword, endOfDirectiveToken, this.IsActive); - public EndIfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndIfKeyword, this.EndOfDirectiveToken, isActive); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndIfDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndIfDirectiveTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax + public EndIfDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) { - - internal RegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || endIfKeyword != this.EndIfKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.EndIfDirectiveTrivia(hashToken, endIfKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } + + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new EndIfDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndIfKeyword, this.EndOfDirectiveToken, this.IsActive); + public EndIfDirectiveTriviaSyntax WithEndIfKeyword(SyntaxToken endIfKeyword) => Update(this.HashToken, endIfKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new EndIfDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndIfKeyword, endOfDirectiveToken, this.IsActive); + public EndIfDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndIfKeyword, this.EndOfDirectiveToken, isActive); +} - public SyntaxToken RegionKeyword => new SyntaxToken(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).regionKeyword, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class RegionDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal RegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken RegionKeyword => new SyntaxToken(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).regionKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRegionDirectiveTrivia(this); + public override bool IsActive => ((InternalSyntax.RegionDirectiveTriviaSyntax)this.Green).IsActive; - public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new RegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.RegionKeyword, this.EndOfDirectiveToken, this.IsActive); - public RegionDirectiveTriviaSyntax WithRegionKeyword(SyntaxToken regionKeyword) => Update(this.HashToken, regionKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new RegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.RegionKeyword, endOfDirectiveToken, this.IsActive); - public RegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.RegionKeyword, this.EndOfDirectiveToken, isActive); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitRegionDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitRegionDirectiveTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax + public RegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) { - - internal EndRegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || regionKeyword != this.RegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.RegionDirectiveTrivia(hashToken, regionKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken EndRegionKeyword => new SyntaxToken(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endRegionKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new RegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.RegionKeyword, this.EndOfDirectiveToken, this.IsActive); + public RegionDirectiveTriviaSyntax WithRegionKeyword(SyntaxToken regionKeyword) => Update(this.HashToken, regionKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new RegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.RegionKeyword, endOfDirectiveToken, this.IsActive); + public RegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.RegionKeyword, this.EndOfDirectiveToken, isActive); +} - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class EndRegionDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override bool IsActive => ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).IsActive; + internal EndRegionDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken EndRegionKeyword => new SyntaxToken(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endRegionKeyword, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndRegionDirectiveTrivia(this); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool IsActive => ((InternalSyntax.EndRegionDirectiveTriviaSyntax)this.Green).IsActive; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new EndRegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, this.IsActive); - public EndRegionDirectiveTriviaSyntax WithEndRegionKeyword(SyntaxToken endRegionKeyword) => Update(this.HashToken, endRegionKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new EndRegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndRegionKeyword, endOfDirectiveToken, this.IsActive); - public EndRegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, isActive); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitEndRegionDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitEndRegionDirectiveTrivia(this); - internal ErrorDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public EndRegionDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || endRegionKeyword != this.EndRegionKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.EndRegionDirectiveTrivia(hashToken, endRegionKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken ErrorKeyword => new SyntaxToken(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).errorKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new EndRegionDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, this.IsActive); + public EndRegionDirectiveTriviaSyntax WithEndRegionKeyword(SyntaxToken endRegionKeyword) => Update(this.HashToken, endRegionKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new EndRegionDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.EndRegionKeyword, endOfDirectiveToken, this.IsActive); + public EndRegionDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.EndRegionKeyword, this.EndOfDirectiveToken, isActive); +} - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ErrorDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override bool IsActive => ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).IsActive; + internal ErrorDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken ErrorKeyword => new SyntaxToken(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).errorKeyword, GetChildPosition(1), GetChildIndex(1)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitErrorDirectiveTrivia(this); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool IsActive => ((InternalSyntax.ErrorDirectiveTriviaSyntax)this.Green).IsActive; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ErrorDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ErrorKeyword, this.EndOfDirectiveToken, this.IsActive); - public ErrorDirectiveTriviaSyntax WithErrorKeyword(SyntaxToken errorKeyword) => Update(this.HashToken, errorKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ErrorDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ErrorKeyword, endOfDirectiveToken, this.IsActive); - public ErrorDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ErrorKeyword, this.EndOfDirectiveToken, isActive); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitErrorDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitErrorDirectiveTrivia(this); - internal WarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public ErrorDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || errorKeyword != this.ErrorKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.ErrorDirectiveTrivia(hashToken, errorKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } + + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ErrorDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ErrorKeyword, this.EndOfDirectiveToken, this.IsActive); + public ErrorDirectiveTriviaSyntax WithErrorKeyword(SyntaxToken errorKeyword) => Update(this.HashToken, errorKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ErrorDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ErrorKeyword, endOfDirectiveToken, this.IsActive); + public ErrorDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ErrorKeyword, this.EndOfDirectiveToken, isActive); +} - public SyntaxToken WarningKeyword => new SyntaxToken(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class WarningDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal WarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken WarningKeyword => new SyntaxToken(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWarningDirectiveTrivia(this); + public override bool IsActive => ((InternalSyntax.WarningDirectiveTriviaSyntax)this.Green).IsActive; - public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new WarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.WarningKeyword, this.EndOfDirectiveToken, this.IsActive); - public WarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, warningKeyword, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new WarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.WarningKeyword, endOfDirectiveToken, this.IsActive); - public WarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.WarningKeyword, this.EndOfDirectiveToken, isActive); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitWarningDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitWarningDirectiveTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax + public WarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) { - - internal BadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || warningKeyword != this.WarningKeyword || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.WarningDirectiveTrivia(hashToken, warningKeyword, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } + + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new WarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.WarningKeyword, this.EndOfDirectiveToken, this.IsActive); + public WarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, warningKeyword, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new WarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.WarningKeyword, endOfDirectiveToken, this.IsActive); + public WarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.WarningKeyword, this.EndOfDirectiveToken, isActive); +} - public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class BadDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + internal BadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken Identifier => new SyntaxToken(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).identifier, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBadDirectiveTrivia(this); + public override bool IsActive => ((InternalSyntax.BadDirectiveTriviaSyntax)this.Green).IsActive; - public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - return this; - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new BadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.Identifier, this.EndOfDirectiveToken, this.IsActive); - public BadDirectiveTriviaSyntax WithIdentifier(SyntaxToken identifier) => Update(this.HashToken, identifier, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new BadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.Identifier, endOfDirectiveToken, this.IsActive); - public BadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.Identifier, this.EndOfDirectiveToken, isActive); - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitBadDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitBadDirectiveTrivia(this); - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax + public BadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) { - - internal DefineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || identifier != this.Identifier || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.BadDirectiveTrivia(hashToken, identifier, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken DefineKeyword => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).defineKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new BadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.Identifier, this.EndOfDirectiveToken, this.IsActive); + public BadDirectiveTriviaSyntax WithIdentifier(SyntaxToken identifier) => Update(this.HashToken, identifier, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new BadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.Identifier, endOfDirectiveToken, this.IsActive); + public BadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.Identifier, this.EndOfDirectiveToken, isActive); +} - public SyntaxToken Name => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class DefineDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + internal DefineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken DefineKeyword => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).defineKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken Name => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefineDirectiveTrivia(this); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool IsActive => ((InternalSyntax.DefineDirectiveTriviaSyntax)this.Green).IsActive; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new DefineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public DefineDirectiveTriviaSyntax WithDefineKeyword(SyntaxToken defineKeyword) => Update(this.HashToken, defineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public DefineDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.DefineKeyword, name, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new DefineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.DefineKeyword, this.Name, endOfDirectiveToken, this.IsActive); - public DefineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, isActive); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitDefineDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitDefineDirectiveTrivia(this); - internal UndefDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + public DefineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || defineKeyword != this.DefineKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.DefineDirectiveTrivia(hashToken, defineKeyword, name, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + return this; + } - public SyntaxToken UndefKeyword => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).undefKeyword, GetChildPosition(1), GetChildIndex(1)); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new DefineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public DefineDirectiveTriviaSyntax WithDefineKeyword(SyntaxToken defineKeyword) => Update(this.HashToken, defineKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public DefineDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.DefineKeyword, name, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new DefineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.DefineKeyword, this.Name, endOfDirectiveToken, this.IsActive); + public DefineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.DefineKeyword, this.Name, this.EndOfDirectiveToken, isActive); +} - public SyntaxToken Name => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class UndefDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + internal UndefDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override bool IsActive => ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public SyntaxToken UndefKeyword => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).undefKeyword, GetChildPosition(1), GetChildIndex(1)); - internal override SyntaxNode? GetCachedSlot(int index) => null; + public SyntaxToken Name => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).name, GetChildPosition(2), GetChildIndex(2)); - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUndefDirectiveTrivia(this); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override bool IsActive => ((InternalSyntax.UndefDirectiveTriviaSyntax)this.Green).IsActive; - return this; - } + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new UndefDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public UndefDirectiveTriviaSyntax WithUndefKeyword(SyntaxToken undefKeyword) => Update(this.HashToken, undefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); - public UndefDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.UndefKeyword, name, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new UndefDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.UndefKeyword, this.Name, endOfDirectiveToken, this.IsActive); - public UndefDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, isActive); - } + internal override SyntaxNode? GetCachedSlot(int index) => null; - public abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitUndefDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitUndefDirectiveTrivia(this); + + public UndefDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) { - internal LineOrSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) + if (hashToken != this.HashToken || undefKeyword != this.UndefKeyword || name != this.Name || endOfDirectiveToken != this.EndOfDirectiveToken) { + var newNode = SyntaxFactory.UndefDirectiveTrivia(hashToken, undefKeyword, name, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public abstract SyntaxToken LineKeyword { get; } - public LineOrSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => WithLineKeywordCore(lineKeyword); - internal abstract LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword); + return this; + } - public abstract SyntaxToken File { get; } - public LineOrSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => WithFileCore(file); - internal abstract LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file); + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new UndefDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public UndefDirectiveTriviaSyntax WithUndefKeyword(SyntaxToken undefKeyword) => Update(this.HashToken, undefKeyword, this.Name, this.EndOfDirectiveToken, this.IsActive); + public UndefDirectiveTriviaSyntax WithName(SyntaxToken name) => Update(this.HashToken, this.UndefKeyword, name, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new UndefDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.UndefKeyword, this.Name, endOfDirectiveToken, this.IsActive); + public UndefDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.UndefKeyword, this.Name, this.EndOfDirectiveToken, isActive); +} - public new LineOrSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (LineOrSpanDirectiveTriviaSyntax)WithHashTokenCore(hashToken); - public new LineOrSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (LineOrSpanDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); +public abstract partial class LineOrSpanDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + internal LineOrSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax - { + public abstract SyntaxToken LineKeyword { get; } + public LineOrSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => WithLineKeywordCore(lineKeyword); + internal abstract LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword); - internal LineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public abstract SyntaxToken File { get; } + public LineOrSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => WithFileCore(file); + internal abstract LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file); + + public new LineOrSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => (LineOrSpanDirectiveTriviaSyntax)WithHashTokenCore(hashToken); + public new LineOrSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => (LineOrSpanDirectiveTriviaSyntax)WithEndOfDirectiveTokenCore(endOfDirectiveToken); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LineDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax +{ + + internal LineDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public override SyntaxToken LineKeyword => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken LineKeyword => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken Line => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken Line => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).line, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken File + public override SyntaxToken File + { + get { - get - { - var slot = ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } + var slot = ((Syntax.InternalSyntax.LineDirectiveTriviaSyntax)this.Green).file; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } + } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); - public override bool IsActive => ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.LineDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectiveTrivia(this); - public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + public LineDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || line != this.Line || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.LineDirectiveTrivia(hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new LineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); - public new LineDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineDirectiveTriviaSyntax WithLine(SyntaxToken line) => Update(this.HashToken, this.LineKeyword, line, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); - public new LineDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Line, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new LineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, endOfDirectiveToken, this.IsActive); - public LineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new LineDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); + public new LineDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Line, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineDirectiveTriviaSyntax WithLine(SyntaxToken line) => Update(this.HashToken, this.LineKeyword, line, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); + public new LineDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Line, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new LineDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, endOfDirectiveToken, this.IsActive); + public LineDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Line, this.File, this.EndOfDirectiveToken, isActive); +} - internal LineDirectivePositionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LineDirectivePositionSyntax : CSharpSyntaxNode +{ + + internal LineDirectivePositionSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).openParenToken, Position, 0); + public SyntaxToken OpenParenToken => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).openParenToken, Position, 0); - public SyntaxToken Line => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).line, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken Line => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).line, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken CommaToken => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).commaToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken CommaToken => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).commaToken, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken Character => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).character, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken Character => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).character, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken CloseParenToken => new SyntaxToken(this, ((InternalSyntax.LineDirectivePositionSyntax)this.Green).closeParenToken, GetChildPosition(4), GetChildIndex(4)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectivePosition(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineDirectivePosition(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineDirectivePosition(this); - public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + public LineDirectivePositionSyntax Update(SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) + { + if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken) { - if (openParenToken != this.OpenParenToken || line != this.Line || commaToken != this.CommaToken || character != this.Character || closeParenToken != this.CloseParenToken) - { - var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.LineDirectivePosition(openParenToken, line, commaToken, character, closeParenToken); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - public LineDirectivePositionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Line, this.CommaToken, this.Character, this.CloseParenToken); - public LineDirectivePositionSyntax WithLine(SyntaxToken line) => Update(this.OpenParenToken, line, this.CommaToken, this.Character, this.CloseParenToken); - public LineDirectivePositionSyntax WithCommaToken(SyntaxToken commaToken) => Update(this.OpenParenToken, this.Line, commaToken, this.Character, this.CloseParenToken); - public LineDirectivePositionSyntax WithCharacter(SyntaxToken character) => Update(this.OpenParenToken, this.Line, this.CommaToken, character, this.CloseParenToken); - public LineDirectivePositionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Line, this.CommaToken, this.Character, closeParenToken); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax - { - private LineDirectivePositionSyntax? start; - private LineDirectivePositionSyntax? end; + public LineDirectivePositionSyntax WithOpenParenToken(SyntaxToken openParenToken) => Update(openParenToken, this.Line, this.CommaToken, this.Character, this.CloseParenToken); + public LineDirectivePositionSyntax WithLine(SyntaxToken line) => Update(this.OpenParenToken, line, this.CommaToken, this.Character, this.CloseParenToken); + public LineDirectivePositionSyntax WithCommaToken(SyntaxToken commaToken) => Update(this.OpenParenToken, this.Line, commaToken, this.Character, this.CloseParenToken); + public LineDirectivePositionSyntax WithCharacter(SyntaxToken character) => Update(this.OpenParenToken, this.Line, this.CommaToken, character, this.CloseParenToken); + public LineDirectivePositionSyntax WithCloseParenToken(SyntaxToken closeParenToken) => Update(this.OpenParenToken, this.Line, this.CommaToken, this.Character, closeParenToken); +} - internal LineSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LineSpanDirectiveTriviaSyntax : LineOrSpanDirectiveTriviaSyntax +{ + private LineDirectivePositionSyntax? start; + private LineDirectivePositionSyntax? end; - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal LineSpanDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken LineKeyword => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public LineDirectivePositionSyntax Start => GetRed(ref this.start, 2)!; + public override SyntaxToken LineKeyword => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).lineKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken MinusToken => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).minusToken, GetChildPosition(3), GetChildIndex(3)); + public LineDirectivePositionSyntax Start => GetRed(ref this.start, 2)!; - public LineDirectivePositionSyntax End => GetRed(ref this.end, 4)!; + public SyntaxToken MinusToken => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).minusToken, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken CharacterOffset + public LineDirectivePositionSyntax End => GetRed(ref this.end, 4)!; + + public SyntaxToken CharacterOffset + { + get { - get - { - var slot = ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; - } + var slot = ((Syntax.InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).characterOffset; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(5), GetChildIndex(5)) : default; } + } - public override SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); + public override SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).file, GetChildPosition(6), GetChildIndex(6)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(7), GetChildIndex(7)); - public override bool IsActive => ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.LineSpanDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) - => index switch - { - 2 => GetRed(ref this.start, 2)!, - 4 => GetRed(ref this.end, 4)!, - _ => null, - }; + internal override SyntaxNode? GetNodeSlot(int index) + => index switch + { + 2 => GetRed(ref this.start, 2)!, + 4 => GetRed(ref this.end, 4)!, + _ => null, + }; - internal override SyntaxNode? GetCachedSlot(int index) - => index switch - { - 2 => this.start, - 4 => this.end, - _ => null, - }; + internal override SyntaxNode? GetCachedSlot(int index) + => index switch + { + 2 => this.start, + 4 => this.end, + _ => null, + }; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineSpanDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLineSpanDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLineSpanDirectiveTrivia(this); - public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + public LineSpanDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || lineKeyword != this.LineKeyword || start != this.Start || minusToken != this.MinusToken || end != this.End || characterOffset != this.CharacterOffset || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.LineSpanDirectiveTrivia(hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new LineSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); - public new LineSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithStart(LineDirectivePositionSyntax start) => Update(this.HashToken, this.LineKeyword, start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithMinusToken(SyntaxToken minusToken) => Update(this.HashToken, this.LineKeyword, this.Start, minusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithEnd(LineDirectivePositionSyntax end) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, end, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithCharacterOffset(SyntaxToken characterOffset) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, characterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); - internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); - public new LineSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new LineSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, endOfDirectiveToken, this.IsActive); - public LineSpanDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax - { - private SyntaxNode? errorCodes; + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new LineSpanDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithLineKeywordCore(SyntaxToken lineKeyword) => WithLineKeyword(lineKeyword); + public new LineSpanDirectiveTriviaSyntax WithLineKeyword(SyntaxToken lineKeyword) => Update(this.HashToken, lineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithStart(LineDirectivePositionSyntax start) => Update(this.HashToken, this.LineKeyword, start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithMinusToken(SyntaxToken minusToken) => Update(this.HashToken, this.LineKeyword, this.Start, minusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithEnd(LineDirectivePositionSyntax end) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, end, this.CharacterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithCharacterOffset(SyntaxToken characterOffset) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, characterOffset, this.File, this.EndOfDirectiveToken, this.IsActive); + internal override LineOrSpanDirectiveTriviaSyntax WithFileCore(SyntaxToken file) => WithFile(file); + public new LineSpanDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new LineSpanDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, endOfDirectiveToken, this.IsActive); + public LineSpanDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LineKeyword, this.Start, this.MinusToken, this.End, this.CharacterOffset, this.File, this.EndOfDirectiveToken, isActive); +} - internal PragmaWarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PragmaWarningDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + private SyntaxNode? errorCodes; + + internal PragmaWarningDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken WarningKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken WarningKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).warningKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken DisableOrRestoreKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken DisableOrRestoreKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).disableOrRestoreKeyword, GetChildPosition(3), GetChildIndex(3)); - public SeparatedSyntaxList ErrorCodes + public SeparatedSyntaxList ErrorCodes + { + get { - get - { - var red = GetRed(ref this.errorCodes, 4); - return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; - } + var red = GetRed(ref this.errorCodes, 4); + return red != null ? new SeparatedSyntaxList(red, GetChildIndex(4)) : default; } + } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(5), GetChildIndex(5)); - public override bool IsActive => ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.PragmaWarningDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.errorCodes, 4)! : null; + internal override SyntaxNode? GetNodeSlot(int index) => index == 4 ? GetRed(ref this.errorCodes, 4)! : null; - internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.errorCodes : null; + internal override SyntaxNode? GetCachedSlot(int index) => index == 4 ? this.errorCodes : null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaWarningDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaWarningDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaWarningDirectiveTrivia(this); - public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + public PragmaWarningDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, SeparatedSyntaxList errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || warningKeyword != this.WarningKeyword || disableOrRestoreKeyword != this.DisableOrRestoreKeyword || errorCodes != this.ErrorCodes || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.PragmaWarningDirectiveTrivia(hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new PragmaWarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, this.PragmaKeyword, warningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithDisableOrRestoreKeyword(SyntaxToken disableOrRestoreKeyword) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, disableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithErrorCodes(SeparatedSyntaxList errorCodes) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, errorCodes, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new PragmaWarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, endOfDirectiveToken, this.IsActive); - public PragmaWarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, isActive); - - public PragmaWarningDirectiveTriviaSyntax AddErrorCodes(params ExpressionSyntax[] items) => WithErrorCodes(this.ErrorCodes.AddRange(items)); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new PragmaWarningDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithWarningKeyword(SyntaxToken warningKeyword) => Update(this.HashToken, this.PragmaKeyword, warningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithDisableOrRestoreKeyword(SyntaxToken disableOrRestoreKeyword) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, disableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithErrorCodes(SeparatedSyntaxList errorCodes) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, errorCodes, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new PragmaWarningDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, endOfDirectiveToken, this.IsActive); + public PragmaWarningDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.WarningKeyword, this.DisableOrRestoreKeyword, this.ErrorCodes, this.EndOfDirectiveToken, isActive); - internal PragmaChecksumDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } + public PragmaWarningDirectiveTriviaSyntax AddErrorCodes(params ExpressionSyntax[] items) => WithErrorCodes(this.ErrorCodes.AddRange(items)); +} + +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class PragmaChecksumDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal PragmaChecksumDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ChecksumKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).checksumKeyword, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken PragmaKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).pragmaKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).file, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken ChecksumKeyword => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).checksumKeyword, GetChildPosition(2), GetChildIndex(2)); - public SyntaxToken Guid => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).guid, GetChildPosition(4), GetChildIndex(4)); + public SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).file, GetChildPosition(3), GetChildIndex(3)); - public SyntaxToken Bytes => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).bytes, GetChildPosition(5), GetChildIndex(5)); + public SyntaxToken Guid => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).guid, GetChildPosition(4), GetChildIndex(4)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); + public SyntaxToken Bytes => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).bytes, GetChildPosition(5), GetChildIndex(5)); - public override bool IsActive => ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(6), GetChildIndex(6)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override bool IsActive => ((InternalSyntax.PragmaChecksumDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaChecksumDirectiveTrivia(this); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitPragmaChecksumDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitPragmaChecksumDirectiveTrivia(this); - return this; + public PragmaChecksumDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || pragmaKeyword != this.PragmaKeyword || checksumKeyword != this.ChecksumKeyword || file != this.File || guid != this.Guid || bytes != this.Bytes || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.PragmaChecksumDirectiveTrivia(hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new PragmaChecksumDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithChecksumKeyword(SyntaxToken checksumKeyword) => Update(this.HashToken, this.PragmaKeyword, checksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, file, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithGuid(SyntaxToken guid) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithBytes(SyntaxToken bytes) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, bytes, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new PragmaChecksumDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, endOfDirectiveToken, this.IsActive); - public PragmaChecksumDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new PragmaChecksumDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithPragmaKeyword(SyntaxToken pragmaKeyword) => Update(this.HashToken, pragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithChecksumKeyword(SyntaxToken checksumKeyword) => Update(this.HashToken, this.PragmaKeyword, checksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, file, this.Guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithGuid(SyntaxToken guid) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, guid, this.Bytes, this.EndOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithBytes(SyntaxToken bytes) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, bytes, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new PragmaChecksumDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, endOfDirectiveToken, this.IsActive); + public PragmaChecksumDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.PragmaKeyword, this.ChecksumKeyword, this.File, this.Guid, this.Bytes, this.EndOfDirectiveToken, isActive); +} - internal ReferenceDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ReferenceDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + + internal ReferenceDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ReferenceKeyword => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).referenceKeyword, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ReferenceKeyword => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).referenceKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - public override bool IsActive => ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.ReferenceDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReferenceDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitReferenceDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitReferenceDirectiveTrivia(this); - public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + public ReferenceDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || referenceKeyword != this.ReferenceKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ReferenceDirectiveTrivia(hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ReferenceDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public ReferenceDirectiveTriviaSyntax WithReferenceKeyword(SyntaxToken referenceKeyword) => Update(this.HashToken, referenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public ReferenceDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.ReferenceKeyword, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ReferenceDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ReferenceKeyword, this.File, endOfDirectiveToken, this.IsActive); - public ReferenceDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ReferenceDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public ReferenceDirectiveTriviaSyntax WithReferenceKeyword(SyntaxToken referenceKeyword) => Update(this.HashToken, referenceKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public ReferenceDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.ReferenceKeyword, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ReferenceDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ReferenceKeyword, this.File, endOfDirectiveToken, this.IsActive); + public ReferenceDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ReferenceKeyword, this.File, this.EndOfDirectiveToken, isActive); +} - internal LoadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class LoadDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal LoadDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken LoadKeyword => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).loadKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken LoadKeyword => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).loadKeyword, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); + public SyntaxToken File => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).file, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).IsActive; + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(3), GetChildIndex(3)); - internal override SyntaxNode? GetNodeSlot(int index) => null; + public override bool IsActive => ((InternalSyntax.LoadDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLoadDirectiveTrivia(this); + internal override SyntaxNode? GetCachedSlot(int index) => null; - public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) - { - if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitLoadDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitLoadDirectiveTrivia(this); - return this; + public LoadDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || loadKeyword != this.LoadKeyword || file != this.File || endOfDirectiveToken != this.EndOfDirectiveToken) + { + var newNode = SyntaxFactory.LoadDirectiveTrivia(hashToken, loadKeyword, file, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new LoadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public LoadDirectiveTriviaSyntax WithLoadKeyword(SyntaxToken loadKeyword) => Update(this.HashToken, loadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); - public LoadDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LoadKeyword, file, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new LoadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LoadKeyword, this.File, endOfDirectiveToken, this.IsActive); - public LoadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new LoadDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public LoadDirectiveTriviaSyntax WithLoadKeyword(SyntaxToken loadKeyword) => Update(this.HashToken, loadKeyword, this.File, this.EndOfDirectiveToken, this.IsActive); + public LoadDirectiveTriviaSyntax WithFile(SyntaxToken file) => Update(this.HashToken, this.LoadKeyword, file, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new LoadDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.LoadKeyword, this.File, endOfDirectiveToken, this.IsActive); + public LoadDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.LoadKeyword, this.File, this.EndOfDirectiveToken, isActive); +} - internal ShebangDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class ShebangDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ + + internal ShebangDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken ExclamationToken => new SyntaxToken(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).exclamationToken, GetChildPosition(1), GetChildIndex(1)); + public SyntaxToken ExclamationToken => new SyntaxToken(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).exclamationToken, GetChildPosition(1), GetChildIndex(1)); - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(2), GetChildIndex(2)); - public override bool IsActive => ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.ShebangDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitShebangDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitShebangDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitShebangDirectiveTrivia(this); - public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + public ShebangDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || exclamationToken != this.ExclamationToken || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.ShebangDirectiveTrivia(hashToken, exclamationToken, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new ShebangDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ExclamationToken, this.EndOfDirectiveToken, this.IsActive); - public ShebangDirectiveTriviaSyntax WithExclamationToken(SyntaxToken exclamationToken) => Update(this.HashToken, exclamationToken, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new ShebangDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ExclamationToken, endOfDirectiveToken, this.IsActive); - public ShebangDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ExclamationToken, this.EndOfDirectiveToken, isActive); + return this; } - /// - /// This node is associated with the following syntax kinds: - /// - /// - /// - /// - public sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax - { + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new ShebangDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.ExclamationToken, this.EndOfDirectiveToken, this.IsActive); + public ShebangDirectiveTriviaSyntax WithExclamationToken(SyntaxToken exclamationToken) => Update(this.HashToken, exclamationToken, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new ShebangDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.ExclamationToken, endOfDirectiveToken, this.IsActive); + public ShebangDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.ExclamationToken, this.EndOfDirectiveToken, isActive); +} - internal NullableDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) - : base(green, parent, position) - { - } +/// +/// This node is associated with the following syntax kinds: +/// +/// +/// +/// +public sealed partial class NullableDirectiveTriviaSyntax : DirectiveTriviaSyntax +{ - public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); + internal NullableDirectiveTriviaSyntax(InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position) + : base(green, parent, position) + { + } - public SyntaxToken NullableKeyword => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).nullableKeyword, GetChildPosition(1), GetChildIndex(1)); + public override SyntaxToken HashToken => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).hashToken, Position, 0); - public SyntaxToken SettingToken => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); + public SyntaxToken NullableKeyword => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).nullableKeyword, GetChildPosition(1), GetChildIndex(1)); - public SyntaxToken TargetToken + public SyntaxToken SettingToken => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).settingToken, GetChildPosition(2), GetChildIndex(2)); + + public SyntaxToken TargetToken + { + get { - get - { - var slot = ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken; - return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; - } + var slot = ((Syntax.InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).targetToken; + return slot != null ? new SyntaxToken(this, slot, GetChildPosition(3), GetChildIndex(3)) : default; } + } - public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); + public override SyntaxToken EndOfDirectiveToken => new SyntaxToken(this, ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).endOfDirectiveToken, GetChildPosition(4), GetChildIndex(4)); - public override bool IsActive => ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).IsActive; + public override bool IsActive => ((InternalSyntax.NullableDirectiveTriviaSyntax)this.Green).IsActive; - internal override SyntaxNode? GetNodeSlot(int index) => null; + internal override SyntaxNode? GetNodeSlot(int index) => null; - internal override SyntaxNode? GetCachedSlot(int index) => null; + internal override SyntaxNode? GetCachedSlot(int index) => null; - public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); - public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableDirectiveTrivia(this); + public override void Accept(CSharpSyntaxVisitor visitor) => visitor.VisitNullableDirectiveTrivia(this); + public override TResult? Accept(CSharpSyntaxVisitor visitor) where TResult : default => visitor.VisitNullableDirectiveTrivia(this); - public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + public NullableDirectiveTriviaSyntax Update(SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken targetToken, SyntaxToken endOfDirectiveToken, bool isActive) + { + if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken) { - if (hashToken != this.HashToken || nullableKeyword != this.NullableKeyword || settingToken != this.SettingToken || targetToken != this.TargetToken || endOfDirectiveToken != this.EndOfDirectiveToken) - { - var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); - var annotations = GetAnnotations(); - return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; - } - - return this; + var newNode = SyntaxFactory.NullableDirectiveTrivia(hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive); + var annotations = GetAnnotations(); + return annotations?.Length > 0 ? newNode.WithAnnotations(annotations) : newNode; } - internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); - public new NullableDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithNullableKeyword(SyntaxToken nullableKeyword) => Update(this.HashToken, nullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithSettingToken(SyntaxToken settingToken) => Update(this.HashToken, this.NullableKeyword, settingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithTargetToken(SyntaxToken targetToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, targetToken, this.EndOfDirectiveToken, this.IsActive); - internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); - public new NullableDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, endOfDirectiveToken, this.IsActive); - public NullableDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, isActive); + return this; } + + internal override DirectiveTriviaSyntax WithHashTokenCore(SyntaxToken hashToken) => WithHashToken(hashToken); + public new NullableDirectiveTriviaSyntax WithHashToken(SyntaxToken hashToken) => Update(hashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithNullableKeyword(SyntaxToken nullableKeyword) => Update(this.HashToken, nullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithSettingToken(SyntaxToken settingToken) => Update(this.HashToken, this.NullableKeyword, settingToken, this.TargetToken, this.EndOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithTargetToken(SyntaxToken targetToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, targetToken, this.EndOfDirectiveToken, this.IsActive); + internal override DirectiveTriviaSyntax WithEndOfDirectiveTokenCore(SyntaxToken endOfDirectiveToken) => WithEndOfDirectiveToken(endOfDirectiveToken); + public new NullableDirectiveTriviaSyntax WithEndOfDirectiveToken(SyntaxToken endOfDirectiveToken) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, endOfDirectiveToken, this.IsActive); + public NullableDirectiveTriviaSyntax WithIsActive(bool isActive) => Update(this.HashToken, this.NullableKeyword, this.SettingToken, this.TargetToken, this.EndOfDirectiveToken, isActive); } diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index c574af5949eb7..7f05d6743aa7d 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -45,38 +45,30 @@ private void WriteInternal() { WriteFileHeader(); - WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax"); - OpenBlock(); - WriteLine(); + WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;"); this.WriteGreenTypes(); this.WriteGreenVisitors(); this.WriteGreenRewriter(); this.WriteContextualGreenFactories(); this.WriteStaticGreenFactories(); - CloseBlock(); } private void WriteSyntax() { WriteFileHeader(); - WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax"); - OpenBlock(); - WriteLine(); + WriteLine("namespace Microsoft.CodeAnalysis.CSharp.Syntax;"); this.WriteRedTypes(); - CloseBlock(); } private void WriteMain() { WriteFileHeader(); - WriteLine("namespace Microsoft.CodeAnalysis.CSharp"); - OpenBlock(); + WriteLine("namespace Microsoft.CodeAnalysis.CSharp;"); WriteLine("using System.Diagnostics.CodeAnalysis;"); WriteLine("using Microsoft.CodeAnalysis.CSharp.Syntax;"); this.WriteRedVisitors(); this.WriteRedRewriter(); this.WriteRedFactories(); - CloseBlock(); } private void WriteGreenTypes() From 92bca08b0e3c1bc8a198599f2f48e688fc397ddb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:37:08 +0000 Subject: [PATCH 124/141] Update dependencies from https://github.com/dotnet/arcade build 20231212.2 (#71247) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 12 ++++++------ global.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9fbdd8f8178a1..9a985a756f7d2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -43,14 +43,14 @@ - + https://github.com/dotnet/arcade - 0a0217fe0cdd3654105d1c46be4e43eeae9c163e + 1f6c5acef9bdf9d4bf1eded044eeec0d7d19560d - + https://github.com/dotnet/arcade - 0a0217fe0cdd3654105d1c46be4e43eeae9c163e + 1f6c5acef9bdf9d4bf1eded044eeec0d7d19560d https://github.com/dotnet/symreader @@ -65,9 +65,9 @@ https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - 0a0217fe0cdd3654105d1c46be4e43eeae9c163e + 1f6c5acef9bdf9d4bf1eded044eeec0d7d19560d https://github.com/dotnet/roslyn-analyzers diff --git a/global.json b/global.json index cadadc5e5a480..e0acd019d7140 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "xcopy-msbuild": "17.8.1-2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23611.2", - "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23611.2" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23612.2", + "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23612.2" } } From a5c8991ef2068908e0ec8f6720a1779aa161ec9e Mon Sep 17 00:00:00 2001 From: Ankita Khera <40616383+akhera99@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:07:44 -0800 Subject: [PATCH 125/141] Fix Crash in AbstractChangeImplementationCodeRefactoringProvider (#70647) * fix crash * feedback * add test --- ...geImplementationCodeRefactoringProvider.cs | 7 ++-- .../ImplementImplicitlyTests.cs | 21 ++++++++++++ .../ImplementInterfaceTests.cs | 32 +++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementationCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementationCodeRefactoringProvider.cs index 7e433f05ebefd..8376c56026019 100644 --- a/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementationCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementationCodeRefactoringProvider.cs @@ -70,9 +70,12 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex // member. Interface member names are the expected names that people expect to see // (like "GetEnumerator"), instead of the auto-generated names that the compiler makes // like: "System.IEnumerable.GetEnumerator" - directlyImplementedMembers.AddRange(member, member.ExplicitOrImplicitInterfaceImplementations()); + var implementations = member.ExplicitOrImplicitInterfaceImplementations(); + if (implementations.IsEmpty) + return; - var firstImplName = member.ExplicitOrImplicitInterfaceImplementations().First().Name; + directlyImplementedMembers.AddRange(member, implementations); + var firstImplName = implementations.First().Name; var codeAction = CodeAction.Create( string.Format(Implement_0, firstImplName), cancellationToken => ChangeImplementationAsync(project, directlyImplementedMembers, cancellationToken), diff --git a/src/Features/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs b/src/Features/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs index 96967c23845a9..8ec9591b47694 100644 --- a/src/Features/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs +++ b/src/Features/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.CSharp.ImplementInterface; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings; using Microsoft.CodeAnalysis.Test.Utilities; +using Microsoft.CodeAnalysis.Testing; using Roslyn.Test.Utilities; using Xunit; @@ -262,5 +263,25 @@ public readonly void Goo1() { } } """); } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/70232")] + public async Task TestMissingWhenAlreadyContainingImpl() + { + await TestMissingAsync( + """ + interface I + { + event System.EventHandler Click; + } + + class C : I + { + event System.EventHandler I.Click { add { } remove { } } + + event System.EventHandler [||]I.Click + + } + """); + } } } diff --git a/src/Features/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs b/src/Features/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs index 7730710e7f033..da46a65964069 100644 --- a/src/Features/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs +++ b/src/Features/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs @@ -11871,5 +11871,37 @@ IEnumerator IEnumerable.GetEnumerator() """, }.RunAsync(); } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/70232")] + public async Task TestMissingWhenAlreadyContainingImpl() + { + var code = + """ + interface I + { + event System.EventHandler Click; + } + + class C : I + { + event System.EventHandler I.Click { add { } remove { } } + + event System.EventHandler I.Click + + } + """; + await new VerifyCS.Test + { + TestCode = code, + FixedCode = code, + //LanguageVersion = LanguageVersion.CSharp12, + ExpectedDiagnostics = + { + DiagnosticResult.CompilerError("CS8646").WithSpan(6, 7, 6, 8), + DiagnosticResult.CompilerError("CS0071").WithSpan(10, 32, 10, 33), + DiagnosticResult.CompilerError("CS0102").WithSpan(10, 33, 10, 38) + } + }.RunAsync(); + } } } From 93677976e310e7f910f289e962566485cbabf8f3 Mon Sep 17 00:00:00 2001 From: Ankita Khera <40616383+akhera99@users.noreply.github.com> Date: Wed, 13 Dec 2023 13:22:39 -0800 Subject: [PATCH 126/141] Fix Code Actions not applied when LSP editor is enabled (#71077) * wip * need to figure out why preview is trying to show * remove commented out code * fix tests * Update SearchGraphQueryTests_NavigateTo.vb --- .../AbstractLanguageServerProtocolTests.cs | 2 +- .../Handler/CodeActions/CodeActionHelpers.cs | 55 +++++++++---------- .../CodeActions/CodeActionResolveData.cs | 11 ++-- .../CodeActions/CodeActionsTests.cs | 13 +++-- .../CodeActions/RunCodeActionsTests.cs | 3 +- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs index f953c92a686fe..23f5f5a45b2ec 100644 --- a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs +++ b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs @@ -299,7 +299,7 @@ protected static LSP.TextEdit GenerateTextEdit(string newText, int startLine, in } }; - private protected static CodeActionResolveData CreateCodeActionResolveData(string uniqueIdentifier, LSP.Location location, string[]? codeActionPath = null, IEnumerable? customTags = null) + private protected static CodeActionResolveData CreateCodeActionResolveData(string uniqueIdentifier, LSP.Location location, string[] codeActionPath, IEnumerable? customTags = null) => new(uniqueIdentifier, customTags.ToImmutableArrayOrEmpty(), location.Range, CreateTextDocumentIdentifier(location.Uri), fixAllFlavors: null, nestedCodeActions: null, codeActionPath: codeActionPath); private protected Task CreateTestLspServerAsync(string markup, bool mutatingLspWorkspace, LSP.ClientCapabilities clientCapabilities, bool callInitialized = true) diff --git a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs index 053ed84ff5fe4..714c6b76df78d 100644 --- a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs +++ b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionHelpers.cs @@ -60,6 +60,7 @@ internal static class CodeActionHelpers { if (!IsCodeActionNotSupportedByLSP(suggestedAction)) { + using var _1 = ArrayBuilder.GetInstance(out var codeActionPathList); codeActions.Add(GenerateVSCodeAction( request, documentText, suggestedAction: suggestedAction, @@ -67,6 +68,7 @@ internal static class CodeActionHelpers setPriority: set.Priority, applicableRange: set.ApplicableToSpan.HasValue ? ProtocolConversions.TextSpanToRange(set.ApplicableToSpan.Value, documentText) : null, currentSetNumber: currentSetNumber, + codeActionPathList: codeActionPathList, currentHighestSetNumber: ref currentHighestSetNumber)); } } @@ -111,25 +113,25 @@ private static LSP.CodeAction[] GenerateCodeActions( var diagnosticsForFix = GetApplicableDiagnostics(request.Context, suggestedAction); using var _ = ArrayBuilder.GetInstance(out var builder); - using var _1 = ArrayBuilder.GetInstance(out var codeActionPath); - var nestedCodeActions = CollectNestedActions(request, codeActionKind, diagnosticsForFix, suggestedAction, codeActionPath, isTopLevelCodeAction: true); + using var _1 = ArrayBuilder.GetInstance(out var codeActionPathList); + var nestedCodeActions = CollectNestedActions(request, codeActionKind, diagnosticsForFix, suggestedAction, codeActionPathList, isTopLevelCodeAction: true); Command? nestedCodeActionCommand = null; var title = codeAction.Title; - var codeActionPathList = codeActionPath.ToArray(); + var codeActionPath = codeActionPathList.ToArray(); if (nestedCodeActions.Any()) { nestedCodeActionCommand = new LSP.Command { CommandIdentifier = CodeActionsHandler.RunNestedCodeActionCommandName, Title = title, - Arguments = [new CodeActionResolveData(title, codeAction.CustomTags, request.Range, request.TextDocument, null, nestedCodeActions: nestedCodeActions, codeActionPathList)] + Arguments = [new CodeActionResolveData(title, codeAction.CustomTags, request.Range, request.TextDocument, codeActionPath, fixAllFlavors: null, nestedCodeActions: nestedCodeActions)] }; } AddLSPCodeActions(builder, codeAction, request, codeActionKind, diagnosticsForFix, nestedCodeActionCommand, - nestedCodeActions, codeActionPathList, suggestedAction); + nestedCodeActions, codeActionPath, suggestedAction); return builder.ToArray(); } @@ -139,20 +141,20 @@ private static LSP.CodeAction[] GenerateCodeActions( LSP.CodeActionKind codeActionKind, LSP.Diagnostic[]? diagnosticsForFix, IUnifiedSuggestedAction suggestedAction, - ArrayBuilder codeActionPath, + ArrayBuilder codeActionPathList, bool isTopLevelCodeAction = false) { var codeAction = suggestedAction.OriginalCodeAction; using var _1 = ArrayBuilder.GetInstance(out var nestedCodeActions); - codeActionPath.Add(codeAction.Title); + codeActionPathList.Add(codeAction.Title); if (suggestedAction is UnifiedSuggestedActionWithNestedActions unifiedSuggestedActions) { foreach (var actionSet in unifiedSuggestedActions.NestedActionSets) { foreach (var action in actionSet.Actions) { - nestedCodeActions.AddRange(CollectNestedActions(request, codeActionKind, diagnosticsForFix, action, codeActionPath)); + nestedCodeActions.AddRange(CollectNestedActions(request, codeActionKind, diagnosticsForFix, action, codeActionPathList)); } } } @@ -160,9 +162,9 @@ private static LSP.CodeAction[] GenerateCodeActions( { if (!isTopLevelCodeAction) { - var codeActionPathList = codeActionPath.ToArray(); + var codeActionPath = codeActionPathList.ToArray(); AddLSPCodeActions(nestedCodeActions, codeAction, request, codeActionKind, diagnosticsForFix, - nestedCodeActionCommand: null, nestedCodeActions: null, codeActionPathList, suggestedAction); + nestedCodeActionCommand: null, nestedCodeActions: null, codeActionPath, suggestedAction); } } @@ -177,7 +179,7 @@ private static void AddLSPCodeActions( LSP.Diagnostic[]? diagnosticsForFix, Command? nestedCodeActionCommand, ImmutableArray? nestedCodeActions, - string[] codeActionPathList, + string[] codeActionPath, IUnifiedSuggestedAction suggestedAction) { var title = codeAction.Title; @@ -190,7 +192,7 @@ private static void AddLSPCodeActions( Kind = codeActionKind, Diagnostics = diagnosticsForFix, Command = nestedCodeActionCommand, - Data = new CodeActionResolveData(title, codeAction.CustomTags, request.Range, request.TextDocument, fixAllFlavors: null, nestedCodeActions, codeActionPathList) + Data = new CodeActionResolveData(title, codeAction.CustomTags, request.Range, request.TextDocument, codeActionPath, fixAllFlavors: null, nestedCodeActions) }); if (suggestedAction is UnifiedCodeFixSuggestedAction unifiedCodeFixSuggestedAction && unifiedCodeFixSuggestedAction.FixAllFlavors is not null) @@ -201,7 +203,7 @@ private static void AddLSPCodeActions( { CommandIdentifier = CodeActionsHandler.RunFixAllCodeActionCommandName, Title = fixAllTitle, - Arguments = [new CodeActionResolveData(fixAllTitle, codeAction.CustomTags, request.Range, request.TextDocument, fixAllFlavors.ToArray(), nestedCodeActions: null, codeActionPathList)] + Arguments = [new CodeActionResolveData(fixAllTitle, codeAction.CustomTags, request.Range, request.TextDocument, codeActionPath, fixAllFlavors.ToArray(), nestedCodeActions: null)] }; builder.Add(new LSP.CodeAction @@ -210,7 +212,7 @@ private static void AddLSPCodeActions( Command = command, Kind = codeActionKind, Diagnostics = diagnosticsForFix, - Data = new CodeActionResolveData(fixAllTitle, codeAction.CustomTags, request.Range, request.TextDocument, fixAllFlavors.ToArray(), nestedCodeActions: null, codeActionPathList) + Data = new CodeActionResolveData(fixAllTitle, codeAction.CustomTags, request.Range, request.TextDocument, codeActionPath, fixAllFlavors.ToArray(), nestedCodeActions: null) }); } } @@ -222,22 +224,14 @@ private static VSInternalCodeAction GenerateVSCodeAction( CodeActionPriority setPriority, LSP.Range? applicableRange, int currentSetNumber, - ref int currentHighestSetNumber, - string currentTitle = "") + ArrayBuilder codeActionPathList, + ref int currentHighestSetNumber) { - if (!string.IsNullOrEmpty(currentTitle)) - { - // Adding a delimiter for nested code actions, e.g. 'Suppress or Configure issues|Suppress IDEXXXX|in Source' - currentTitle += '|'; - } - var codeAction = suggestedAction.OriginalCodeAction; - currentTitle += codeAction.Title; var diagnosticsForFix = GetApplicableDiagnostics(request.Context, suggestedAction); - - // Nested code actions' unique identifiers consist of: parent code action unique identifier + '|' + title of code action - var nestedActions = GenerateNestedVSCodeActions(request, documentText, suggestedAction, codeActionKind, ref currentHighestSetNumber, currentTitle); + var nestedActions = GenerateNestedVSCodeActions(request, documentText, suggestedAction, codeActionKind, ref currentHighestSetNumber, codeActionPathList); + var codeActionPath = codeActionPathList.ToArray(); return new VSInternalCodeAction { @@ -248,7 +242,7 @@ private static VSInternalCodeAction GenerateVSCodeAction( Priority = UnifiedSuggestedActionSetPriorityToPriorityLevel(setPriority), Group = $"Roslyn{currentSetNumber}", ApplicableRange = applicableRange, - Data = new CodeActionResolveData(currentTitle, codeAction.CustomTags, request.Range, request.TextDocument, fixAllFlavors: null, nestedCodeActions: null, codeActionPath: null) + Data = new CodeActionResolveData(codeAction.Title, codeAction.CustomTags, request.Range, request.TextDocument, fixAllFlavors: null, nestedCodeActions: null, codeActionPath: codeActionPath) }; static VSInternalCodeAction[] GenerateNestedVSCodeActions( @@ -257,8 +251,11 @@ static VSInternalCodeAction[] GenerateNestedVSCodeActions( IUnifiedSuggestedAction suggestedAction, CodeActionKind codeActionKind, ref int currentHighestSetNumber, - string currentTitle) + ArrayBuilder codeActionPath) { + var codeAction = suggestedAction.OriginalCodeAction; + codeActionPath.Add(codeAction.Title); + if (suggestedAction is not UnifiedSuggestedActionWithNestedActions suggestedActionWithNestedActions) { return Array.Empty(); @@ -275,7 +272,7 @@ static VSInternalCodeAction[] GenerateNestedVSCodeActions( request, documentText, nestedSuggestedAction, codeActionKind, nestedActionSet.Priority, applicableRange: nestedActionSet.ApplicableToSpan.HasValue ? ProtocolConversions.TextSpanToRange(nestedActionSet.ApplicableToSpan.Value, documentText) : null, - nestedSetNumber, ref currentHighestSetNumber, currentTitle)); + nestedSetNumber, codeActionPath, ref currentHighestSetNumber)); } } diff --git a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveData.cs b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveData.cs index 04543377061b8..11d17d007dbb3 100644 --- a/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveData.cs +++ b/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveData.cs @@ -32,31 +32,30 @@ internal class CodeActionResolveData public LSP.TextDocumentIdentifier TextDocument { get; } + public string[] CodeActionPath { get; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string[]? FixAllFlavors { get; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public ImmutableArray? NestedCodeActions { get; } - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public string[]? CodeActionPath { get; } - public CodeActionResolveData( string uniqueIdentifier, ImmutableArray customTags, LSP.Range range, LSP.TextDocumentIdentifier textDocument, + string[] codeActionPath, string[]? fixAllFlavors, - ImmutableArray? nestedCodeActions, - string[]? codeActionPath) + ImmutableArray? nestedCodeActions) { UniqueIdentifier = uniqueIdentifier; CustomTags = customTags; Range = range; TextDocument = textDocument; + CodeActionPath = codeActionPath; FixAllFlavors = fixAllFlavors; NestedCodeActions = nestedCodeActions; - CodeActionPath = codeActionPath; } } } diff --git a/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs index 7058eebfc3dd2..5ceb1320728be 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs @@ -37,6 +37,7 @@ void M() """; await using var testLspServer = await CreateTestLspServerAsync(markup, mutatingLspWorkspace, initializationOptions: new InitializationOptions() { ClientCapabilities = new VSInternalClientCapabilities { SupportsVisualStudioExtensions = true } }); + var titlePath = new[] { CSharpAnalyzersResources.Use_implicit_type }; var caretLocation = testLspServer.GetLocations("caret").Single(); var expected = CreateCodeAction( title: CSharpAnalyzersResources.Use_implicit_type, @@ -45,6 +46,7 @@ void M() data: CreateCodeActionResolveData( CSharpAnalyzersResources.Use_implicit_type, caretLocation, + codeActionPath: titlePath, customTags: new[] { PredefinedCodeRefactoringProviderNames.UseImplicitType }), priority: VSInternalPriorityLevel.Low, groupName: "Roslyn2", @@ -73,13 +75,15 @@ void M() await using var testLspServer = await CreateTestLspServerAsync(markup, mutatingLspWorkspace, CapabilitiesWithVSExtensions); var caretLocation = testLspServer.GetLocations("caret").Single(); + var titlePath = new[] { FeaturesResources.Introduce_constant, string.Format(FeaturesResources.Introduce_constant_for_0, "1") }; var expected = CreateCodeAction( title: string.Format(FeaturesResources.Introduce_constant_for_0, "1"), kind: CodeActionKind.Refactor, children: Array.Empty(), data: CreateCodeActionResolveData( - FeaturesResources.Introduce_constant + '|' + string.Format(FeaturesResources.Introduce_constant_for_0, "1"), - caretLocation), + string.Format(FeaturesResources.Introduce_constant_for_0, "1"), + caretLocation, + codeActionPath: titlePath), priority: VSInternalPriorityLevel.Normal, groupName: "Roslyn3", applicableRange: new LSP.Range { Start = new Position { Line = 4, Character = 12 }, End = new Position { Line = 4, Character = 12 } }, @@ -87,10 +91,9 @@ void M() var results = await RunGetCodeActionsAsync(testLspServer, CreateCodeActionParams(caretLocation)); - var topLevelAction = Assert.Single(results.Where(action => action.Title == FeaturesResources.Introduce_constant)); - var expectedChildActionTitle = FeaturesResources.Introduce_constant + '|' + string.Format(FeaturesResources.Introduce_constant_for_0, "1"); + var topLevelAction = Assert.Single(results.Where(action => action.Title == titlePath[0])); var introduceConstant = topLevelAction.Children.FirstOrDefault( - r => ((JObject)r.Data!).ToObject()!.UniqueIdentifier == expectedChildActionTitle); + r => ((JObject)r.Data!).ToObject()!.UniqueIdentifier == titlePath[1]); AssertJsonEquals(expected, introduceConstant); } diff --git a/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/RunCodeActionsTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/RunCodeActionsTests.cs index 6dae255d51d07..3798eef6a2245 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/RunCodeActionsTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/RunCodeActionsTests.cs @@ -50,7 +50,8 @@ class B Uri = caretLocation.Uri }; - var commandArgument = new CodeActionResolveData(string.Format(FeaturesResources.Move_type_to_0, "B.cs"), customTags: ImmutableArray.Empty, caretLocation.Range, documentId, fixAllFlavors: null, nestedCodeActions: null, codeActionPath: null); + var titlePath = new[] { string.Format(FeaturesResources.Move_type_to_0, "B.cs") }; + var commandArgument = new CodeActionResolveData(string.Format(FeaturesResources.Move_type_to_0, "B.cs"), customTags: ImmutableArray.Empty, caretLocation.Range, documentId, fixAllFlavors: null, nestedCodeActions: null, codeActionPath: titlePath); var results = await ExecuteRunCodeActionCommandAsync(testLspServer, commandArgument); From 79c2dc7a1ff0ee1945f95e0827ba08218950e68d Mon Sep 17 00:00:00 2001 From: Julien Couvreur Date: Wed, 13 Dec 2023 16:02:28 -0800 Subject: [PATCH 127/141] Update status/details on implicit indexers in object initializers (#71164) --- docs/Language Feature Status.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Language Feature Status.md b/docs/Language Feature Status.md index 541426db236d1..165de2c1cb506 100644 --- a/docs/Language Feature Status.md +++ b/docs/Language Feature Status.md @@ -17,7 +17,7 @@ efforts behind them. | [Roles/Extensions](https://github.com/dotnet/csharplang/issues/5497) | [roles](https://github.com/dotnet/roslyn/tree/features/roles) | [In Progress](https://github.com/dotnet/roslyn/issues/66722) | [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs), [jjonescz](https://github.com/jjonescz) | | [MadsTorgersen](https://github.com/MadsTorgersen) | | [Escape character](https://github.com/dotnet/csharplang/issues/7400) | N/A | [In Progress](https://github.com/dotnet/roslyn/pull/70497) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [jcouv](https://github.com/jcouv), [RikkiGibson](https://github.com/RikkiGibson) | | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | | [Method group natural type improvements](https://github.com/dotnet/csharplang/blob/main/proposals/method-group-natural-type-improvements.md) | main | In Progress | [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs), [cston](https://github.com/cston) | | [jcouv](https://github.com/jcouv) | -| Implicit indexer access in object initializers | main | Merged into 17.9p3 | [jcouv](https://github.com/jcouv) | | | | +| Implicit indexer access in object initializers | main | [Merged into 17.9p3](https://github.com/dotnet/roslyn/pull/70649) | [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs), [cston](https://github.com/cston) | | | # C# 12.0 From 81adf9c299489c0b443e2a41dddc960b6bdc88c3 Mon Sep 17 00:00:00 2001 From: Gen Lu Date: Wed, 13 Dec 2023 17:13:36 -0800 Subject: [PATCH 128/141] Update NuGet-packages.md --- docs/wiki/NuGet-packages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/wiki/NuGet-packages.md b/docs/wiki/NuGet-packages.md index 44296c77aaa20..1b7e30f981fb6 100644 --- a/docs/wiki/NuGet-packages.md +++ b/docs/wiki/NuGet-packages.md @@ -46,7 +46,7 @@ Below are the versions of the language available in the NuGet packages. Remember - Version `4.5` includes C# 11.0 (Visual Studio 2022 version 17.5, .NET 7) - Version `4.6` includes C# 11.0 (Visual Studio 2022 version 17.6, .NET 7) - Version `4.7` includes C# 11.0 (Visual Studio 2022 version 17.7, .NET 7) -- Version `4.8` includes C# 12.0 (Visual Studio 2022 version 17.8, .NET 7) +- Version `4.8` includes C# 12.0 (Visual Studio 2022 version 17.8, .NET 8) See the [history of C# language features](https://github.com/dotnet/csharplang/blob/main/Language-Version-History.md) for more details. From 01173c5ae735625ac079e08414359ff0e8ea19b6 Mon Sep 17 00:00:00 2001 From: Gen Lu Date: Wed, 13 Dec 2023 17:57:01 -0800 Subject: [PATCH 129/141] Pass in helixApiAccessToken when available (#71235) Pass in helixApiAccessToken when available --- eng/pipelines/test-unix-job.yml | 7 +++++-- eng/pipelines/test-windows-job.yml | 5 ++++- src/Tools/Source/RunTests/TestRunner.cs | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/test-unix-job.yml b/eng/pipelines/test-unix-job.yml index a7eb2dc72fb9c..5778e8a05d136 100644 --- a/eng/pipelines/test-unix-job.yml +++ b/eng/pipelines/test-unix-job.yml @@ -47,8 +47,11 @@ jobs: - task: ShellScript@2 inputs: - scriptPath: ./eng/build.sh - args: --ci --helix --configuration ${{ parameters.configuration }} --helixQueueName ${{ parameters.helixQueueName }} ${{ parameters.testArguments }} + scriptPath: ./eng/build.sh + ${{ if ne(variables['System.TeamProject'], 'public') }}: + args: --ci --helix --configuration ${{ parameters.configuration }} --helixQueueName ${{ parameters.helixQueueName }} --helixApiAccessToken ${{ parameters.helixApiAccessToken }} ${{ parameters.testArguments }} + ${{ else }}: + args: --ci --helix --configuration ${{ parameters.configuration }} --helixQueueName ${{ parameters.helixQueueName }} ${{ parameters.testArguments }} displayName: Test env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) diff --git a/eng/pipelines/test-windows-job.yml b/eng/pipelines/test-windows-job.yml index 4cec724dbcf6f..d3344018df83a 100644 --- a/eng/pipelines/test-windows-job.yml +++ b/eng/pipelines/test-windows-job.yml @@ -49,7 +49,10 @@ jobs: displayName: Run Unit Tests inputs: filePath: eng/build.ps1 - arguments: -ci -helix -configuration ${{ parameters.configuration }} -helixQueueName ${{ parameters.helixQueueName }} ${{ parameters.testArguments }} -collectDumps + ${{ if ne(variables['System.TeamProject'], 'public') }}: + arguments: -ci -helix -configuration ${{ parameters.configuration }} -helixQueueName ${{ parameters.helixQueueName }} -helixApiAccessToken ${{ parameters.helixApiAccessToken }} ${{ parameters.testArguments }} -collectDumps + ${{ else }}: + arguments: -ci -helix -configuration ${{ parameters.configuration }} -helixQueueName ${{ parameters.helixQueueName }} ${{ parameters.testArguments }} -collectDumps env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) diff --git a/src/Tools/Source/RunTests/TestRunner.cs b/src/Tools/Source/RunTests/TestRunner.cs index fb31f5d43f696..cedf33d604544 100644 --- a/src/Tools/Source/RunTests/TestRunner.cs +++ b/src/Tools/Source/RunTests/TestRunner.cs @@ -72,7 +72,7 @@ internal async Task RunAllOnHelixAsync(ImmutableArray Date: Thu, 14 Dec 2023 11:11:50 +0530 Subject: [PATCH 130/141] Do not report separate diagnostics just for fading Fixes #71234 Instead use `DiagnosticHelper.CreateWithLocationTags` API to encode fading locations within the primary diagnostic itself --- ...keDelegateWithConditionalAccessAnalyzer.cs | 54 +++++++-------- ...eCollectionExpressionDiagnosticAnalyzer.cs | 25 ++----- ...ionExpressionForArrayDiagnosticAnalyzer.cs | 23 +++---- ...nExpressionForBuilderDiagnosticAnalyzer.cs | 46 +++++-------- ...onExpressionForCreateDiagnosticAnalyzer.cs | 26 +++---- ...pressionForStackAllocDiagnosticAnalyzer.cs | 46 +++++-------- ...CollectionInitializerDiagnosticAnalyzer.cs | 69 +++++++------------ 7 files changed, 109 insertions(+), 180 deletions(-) diff --git a/src/Analyzers/CSharp/Analyzers/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessAnalyzer.cs index 7269a32ae167a..5d52246a68d3d 100644 --- a/src/Analyzers/CSharp/Analyzers/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessAnalyzer.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; @@ -23,12 +24,13 @@ internal static class Constants } [DiagnosticAnalyzer(LanguageNames.CSharp)] - internal class InvokeDelegateWithConditionalAccessAnalyzer : AbstractBuiltInCodeStyleDiagnosticAnalyzer + internal class InvokeDelegateWithConditionalAccessAnalyzer : AbstractBuiltInUnnecessaryCodeStyleDiagnosticAnalyzer { public InvokeDelegateWithConditionalAccessAnalyzer() : base(IDEDiagnosticIds.InvokeDelegateWithConditionalAccessId, EnforceOnBuildValues.InvokeDelegateWithConditionalAccess, CSharpCodeStyleOptions.PreferConditionalDelegateCall, + fadingOption: null, new LocalizableResourceString(nameof(CSharpAnalyzersResources.Delegate_invocation_can_be_simplified), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources))) { } @@ -170,42 +172,40 @@ private void ReportDiagnostics( ImmutableArray additionalLocations, string kind) { - var tree = syntaxContext.Node.SyntaxTree; - + var location = expressionStatement.GetLocation(); + var fadingLocations = GetLocationsToFade(); var properties = ImmutableDictionary.Empty.Add( Constants.Kind, kind); - var previousToken = expressionStatement.GetFirstToken().GetPreviousToken(); - var nextToken = expressionStatement.GetLastToken().GetNextToken(); - - // Fade out the code up to the expression statement. - var fadeLocation = Location.Create(tree, TextSpan.FromBounds(firstStatement.SpanStart, previousToken.Span.End)); syntaxContext.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( Descriptor, - fadeLocation, - NotificationOption2.ForSeverity(Descriptor.DefaultSeverity), + location, + notificationOption, additionalLocations, - additionalUnnecessaryLocations: ImmutableArray.Create(fadeLocation), + fadingLocations, properties)); - // Put a diagnostic with the appropriate severity on the expression-statement itself. - syntaxContext.ReportDiagnostic(DiagnosticHelper.Create( - Descriptor, - expressionStatement.GetLocation(), - notificationOption, - additionalLocations, properties)); + return; - // If the if-statement extends past the expression statement, then fade out the rest. - if (nextToken.Span.Start < ifStatement.Span.End) + ImmutableArray GetLocationsToFade() { - fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End)); - syntaxContext.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( - Descriptor, - fadeLocation, - NotificationOption2.ForSeverity(Descriptor.DefaultSeverity), - additionalLocations, - additionalUnnecessaryLocations: ImmutableArray.Create(fadeLocation), - properties)); + var tree = syntaxContext.Node.SyntaxTree; + var previousToken = expressionStatement.GetFirstToken().GetPreviousToken(); + var nextToken = expressionStatement.GetLastToken().GetNextToken(); + + // Fade out the code up to the expression statement. + using var _ = ArrayBuilder.GetInstance(out var fadingLocations); + fadingLocations.Add( + Location.Create(tree, TextSpan.FromBounds(firstStatement.SpanStart, previousToken.Span.End))); + + // If the if-statement extends past the expression statement, then fade out the rest. + if (nextToken.Span.Start < ifStatement.Span.End) + { + fadingLocations.Add( + Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End))); + } + + return fadingLocations.ToImmutable(); } } diff --git a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer.cs index 14d7286a729ae..2dc28a69e4de5 100644 --- a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer.cs @@ -16,31 +16,16 @@ namespace Microsoft.CodeAnalysis.CSharp.UseCollectionExpression; /// Base type for all analyzers that offer to update code to use a collection-expression. /// internal abstract class AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer - : AbstractBuiltInCodeStyleDiagnosticAnalyzer + : AbstractBuiltInUnnecessaryCodeStyleDiagnosticAnalyzer { - protected new readonly DiagnosticDescriptor Descriptor; - protected readonly DiagnosticDescriptor UnnecessaryCodeDescriptor; - protected AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer(string diagnosticId, EnforceOnBuild enforceOnBuild) - : base(ImmutableDictionary.Empty - // Ugly hack. We need to create a descriptor to pass to our base *and* assign to one of our fields. - // The conditional pattern form lets us do that. - .Add(CreateDescriptor(diagnosticId, enforceOnBuild, isUnnecessary: false) is var descriptor ? descriptor : null, CodeStyleOptions2.PreferCollectionExpression) - .Add(CreateDescriptor(diagnosticId, enforceOnBuild, isUnnecessary: true) is var unnecessaryCodeDescriptor ? unnecessaryCodeDescriptor : null, CodeStyleOptions2.PreferCollectionExpression)) + : base(diagnosticId, enforceOnBuild, CodeStyleOptions2.PreferCollectionExpression, + fadingOption: null, + title: new LocalizableResourceString(nameof(AnalyzersResources.Simplify_collection_initialization), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), + messageFormat: new LocalizableResourceString(nameof(AnalyzersResources.Collection_initialization_can_be_simplified), AnalyzersResources.ResourceManager, typeof(AnalyzersResources))) { - Descriptor = descriptor; - UnnecessaryCodeDescriptor = unnecessaryCodeDescriptor; } - private static DiagnosticDescriptor CreateDescriptor(string diagnosticId, EnforceOnBuild enforceOnBuild, bool isUnnecessary) - => CreateDescriptorWithId( - diagnosticId, - enforceOnBuild, - hasAnyCodeStyleOption: true, - new LocalizableResourceString(nameof(AnalyzersResources.Simplify_collection_initialization), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), - new LocalizableResourceString(nameof(AnalyzersResources.Collection_initialization_can_be_simplified), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), - isUnnecessary: isUnnecessary); - protected abstract void InitializeWorker(CodeBlockStartAnalysisContext context, INamedTypeSymbol? expressionType); protected virtual bool IsSupported(Compilation compilation) diff --git a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs index 888682c4bde60..0dc5c3afb05e9 100644 --- a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs @@ -162,15 +162,9 @@ private void AnalyzeArrayInitializerExpression(SyntaxNodeAnalysisContext context private void ReportArrayCreationDiagnostics(SyntaxNodeAnalysisContext context, SyntaxTree syntaxTree, CodeStyleOption2 option, ExpressionSyntax expression) { - var locations = ImmutableArray.Create(expression.GetLocation()); - context.ReportDiagnostic(DiagnosticHelper.Create( - Descriptor, - expression.GetFirstToken().GetLocation(), - option.Notification, - additionalLocations: locations, - properties: null)); - - var additionalUnnecessaryLocations = ImmutableArray.Create( + var location = expression.GetFirstToken().GetLocation(); + var additionalLocations = ImmutableArray.Create(expression.GetLocation()); + var fadingLocations = ImmutableArray.Create( syntaxTree.GetLocation(TextSpan.FromBounds( expression.SpanStart, expression is ArrayCreationExpressionSyntax arrayCreationExpression @@ -178,10 +172,11 @@ expression is ArrayCreationExpressionSyntax arrayCreationExpression : ((ImplicitArrayCreationExpressionSyntax)expression).CloseBracketToken.Span.End))); context.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( - UnnecessaryCodeDescriptor, - additionalUnnecessaryLocations[0], - NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity), - additionalLocations: locations, - additionalUnnecessaryLocations: additionalUnnecessaryLocations)); + Descriptor, + location, + option.Notification, + additionalLocations, + fadingLocations, + properties: null)); } } diff --git a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs index 2bcf1776c0ece..5236549fb63a8 100644 --- a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs @@ -50,47 +50,33 @@ private void AnalyzeInvocationExpression( if (AnalyzeInvocation(semanticModel, invocationExpression, expressionType, cancellationToken) is not { } analysisResult) return; - var locations = ImmutableArray.Create(invocationExpression.GetLocation()); - context.ReportDiagnostic(DiagnosticHelper.Create( + var location = analysisResult.DiagnosticLocation; + var additionalLocations = ImmutableArray.Create(invocationExpression.GetLocation()); + var fadingLocations = GetLocationsToFade(analysisResult); + + context.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( Descriptor, - analysisResult.DiagnosticLocation, + location, option.Notification, - additionalLocations: locations, + additionalLocations, + fadingLocations, properties: null)); - - FadeOutCode(context, analysisResult, locations); } - private void FadeOutCode(SyntaxNodeAnalysisContext context, AnalysisResult analysisResult, ImmutableArray locations) + private static ImmutableArray GetLocationsToFade(AnalysisResult analysisResult) { - var additionalUnnecessaryLocations = ImmutableArray.Create( - analysisResult.LocalDeclarationStatement.GetLocation()); - - context.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( - UnnecessaryCodeDescriptor, - additionalUnnecessaryLocations[0], - NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity), - additionalLocations: locations, - additionalUnnecessaryLocations: additionalUnnecessaryLocations, - properties: null)); + using var _ = ArrayBuilder.GetInstance(out var fadingLocations); + fadingLocations.Add(analysisResult.LocalDeclarationStatement.GetLocation()); foreach (var statementMatch in analysisResult.Matches) { - additionalUnnecessaryLocations = UseCollectionInitializerHelpers.GetLocationsToFade( + var locations = UseCollectionInitializerHelpers.GetLocationsToFade( CSharpSyntaxFacts.Instance, statementMatch); - if (additionalUnnecessaryLocations.IsDefaultOrEmpty) - continue; - - // Report the diagnostic at the first unnecessary location. This is the location where the code fix - // will be offered. - context.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( - UnnecessaryCodeDescriptor, - additionalUnnecessaryLocations[0], - NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity), - additionalLocations: locations, - additionalUnnecessaryLocations: additionalUnnecessaryLocations, - properties: null)); + if (!locations.IsDefaultOrEmpty) + fadingLocations.AddRange(locations); } + + return fadingLocations.ToImmutable(); } public static AnalysisResult? AnalyzeInvocation( diff --git a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs index 235d668bb2c9b..3f43032c5a69f 100644 --- a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs @@ -49,28 +49,22 @@ private void AnalyzeInvocationExpression(SyntaxNodeAnalysisContext context, INam if (!CanReplaceWithCollectionExpression(semanticModel, invocationExpression, expressionType, skipVerificationForReplacedNode: true, cancellationToken)) return; - var locations = ImmutableArray.Create(invocationExpression.GetLocation()); - var properties = unwrapArgument ? s_unwrapArgumentProperties : null; - - context.ReportDiagnostic(DiagnosticHelper.Create( - Descriptor, - memberAccess.Name.Identifier.GetLocation(), - option.Notification, - additionalLocations: locations, - properties)); - - var additionalUnnecessaryLocations = ImmutableArray.Create( + var location = memberAccess.Name.Identifier.GetLocation(); + var additionalLocations = ImmutableArray.Create(invocationExpression.GetLocation()); + var fadingLocations = ImmutableArray.Create( syntaxTree.GetLocation(TextSpan.FromBounds( invocationExpression.SpanStart, invocationExpression.ArgumentList.OpenParenToken.Span.End)), invocationExpression.ArgumentList.CloseParenToken.GetLocation()); + var properties = unwrapArgument ? s_unwrapArgumentProperties : null; + context.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( - UnnecessaryCodeDescriptor, - additionalUnnecessaryLocations[0], - NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity), - additionalLocations: locations, - additionalUnnecessaryLocations: additionalUnnecessaryLocations, + Descriptor, + location, + option.Notification, + additionalLocations, + fadingLocations, properties)); } } diff --git a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs index 41a40a7488706..63945cf9d7153 100644 --- a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs @@ -52,25 +52,20 @@ private void AnalyzeImplicitStackAllocExpression(SyntaxNodeAnalysisContext conte return; } - var locations = ImmutableArray.Create(expression.GetLocation()); - context.ReportDiagnostic(DiagnosticHelper.Create( - Descriptor, - expression.GetFirstToken().GetLocation(), - option.Notification, - additionalLocations: locations, - properties: null)); - - var additionalUnnecessaryLocations = ImmutableArray.Create( + var location = expression.GetFirstToken().GetLocation(); + var additionalLocations = ImmutableArray.Create(expression.GetLocation()); + var fadingLocations = ImmutableArray.Create( syntaxTree.GetLocation(TextSpan.FromBounds( expression.SpanStart, expression.CloseBracketToken.Span.End))); context.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( - UnnecessaryCodeDescriptor, - additionalUnnecessaryLocations[0], - NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity), - additionalLocations: locations, - additionalUnnecessaryLocations: additionalUnnecessaryLocations)); + Descriptor, + location, + option.Notification, + additionalLocations, + fadingLocations, + properties: null)); } private void AnalyzeExplicitStackAllocExpression(SyntaxNodeAnalysisContext context, INamedTypeSymbol? expressionType) @@ -89,25 +84,20 @@ private void AnalyzeExplicitStackAllocExpression(SyntaxNodeAnalysisContext conte if (matches.IsDefault) return; - var locations = ImmutableArray.Create(expression.GetLocation()); - context.ReportDiagnostic(DiagnosticHelper.Create( - Descriptor, - expression.GetFirstToken().GetLocation(), - option.Notification, - additionalLocations: locations, - properties: null)); - - var additionalUnnecessaryLocations = ImmutableArray.Create( + var location = expression.GetFirstToken().GetLocation(); + var additionalLocations = ImmutableArray.Create(expression.GetLocation()); + var fadingLocations = ImmutableArray.Create( syntaxTree.GetLocation(TextSpan.FromBounds( expression.SpanStart, expression.Type.Span.End))); context.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( - UnnecessaryCodeDescriptor, - additionalUnnecessaryLocations[0], - NotificationOption2.ForSeverity(UnnecessaryCodeDescriptor.DefaultSeverity), - additionalLocations: locations, - additionalUnnecessaryLocations: additionalUnnecessaryLocations)); + Descriptor, + location, + option.Notification, + additionalLocations, + fadingLocations, + properties: null)); } public static ImmutableArray> TryGetMatches( diff --git a/src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractUseCollectionInitializerDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractUseCollectionInitializerDiagnosticAnalyzer.cs index c195cfbc27826..279e88c541693 100644 --- a/src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractUseCollectionInitializerDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractUseCollectionInitializerDiagnosticAnalyzer.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.LanguageService; using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Collections; using Microsoft.CodeAnalysis.Shared.Extensions; @@ -40,7 +41,7 @@ internal abstract partial class AbstractUseCollectionInitializerDiagnosticAnalyz TLocalDeclarationStatementSyntax, TVariableDeclaratorSyntax, TAnalyzer> - : AbstractBuiltInCodeStyleDiagnosticAnalyzer + : AbstractBuiltInUnnecessaryCodeStyleDiagnosticAnalyzer where TSyntaxKind : struct where TExpressionSyntax : SyntaxNode where TStatementSyntax : SyntaxNode @@ -65,26 +66,14 @@ internal abstract partial class AbstractUseCollectionInitializerDiagnosticAnalyz public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SemanticSpanAnalysis; - private static readonly DiagnosticDescriptor s_descriptor = CreateDescriptorWithId( - IDEDiagnosticIds.UseCollectionInitializerDiagnosticId, - EnforceOnBuildValues.UseCollectionInitializer, - hasAnyCodeStyleOption: true, - new LocalizableResourceString(nameof(AnalyzersResources.Simplify_collection_initialization), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), - new LocalizableResourceString(nameof(AnalyzersResources.Collection_initialization_can_be_simplified), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), - isUnnecessary: false); - - private static readonly DiagnosticDescriptor s_unnecessaryCodeDescriptor = CreateDescriptorWithId( - IDEDiagnosticIds.UseCollectionInitializerDiagnosticId, - EnforceOnBuildValues.UseCollectionInitializer, - hasAnyCodeStyleOption: true, - new LocalizableResourceString(nameof(AnalyzersResources.Simplify_collection_initialization), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), - new LocalizableResourceString(nameof(AnalyzersResources.Collection_initialization_can_be_simplified), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), - isUnnecessary: true); - protected AbstractUseCollectionInitializerDiagnosticAnalyzer() - : base(ImmutableDictionary.Empty - .Add(s_descriptor, CodeStyleOptions2.PreferCollectionInitializer) - .Add(s_unnecessaryCodeDescriptor, CodeStyleOptions2.PreferCollectionInitializer)) + : base( + IDEDiagnosticIds.UseCollectionInitializerDiagnosticId, + EnforceOnBuildValues.UseCollectionInitializer, + CodeStyleOptions2.PreferCollectionInitializer, + fadingOption: null, + title: new LocalizableResourceString(nameof(AnalyzersResources.Simplify_collection_initialization), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), + messageFormat: new LocalizableResourceString(nameof(AnalyzersResources.Collection_initialization_can_be_simplified), AnalyzersResources.ResourceManager, typeof(AnalyzersResources))) { } @@ -186,19 +175,20 @@ private void AnalyzeNode( if (syntaxFacts.ContainsInterleavedDirective(nodes, cancellationToken)) return; - var locations = ImmutableArray.Create(objectCreationExpression.GetLocation()); + var location = objectCreationExpression.GetFirstToken().GetLocation(); + var additionalLocations = ImmutableArray.Create(objectCreationExpression.GetLocation()); + var fadingLocations = GetLocationsToFade(matches); var option = shouldUseCollectionExpression ? preferExpressionOption : preferInitializerOption; var properties = shouldUseCollectionExpression ? UseCollectionInitializerHelpers.UseCollectionExpressionProperties : null; - context.ReportDiagnostic(DiagnosticHelper.Create( - s_descriptor, - objectCreationExpression.GetFirstToken().GetLocation(), + context.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( + Descriptor, + location, option.Notification, - additionalLocations: locations, + additionalLocations, + fadingLocations, properties)); - FadeOutCode(context, matches, locations, properties); - return; (ImmutableArray> matches, bool shouldUseCollectionExpression)? GetCollectionInitializerMatches() @@ -241,30 +231,19 @@ private void AnalyzeNode( } } - private void FadeOutCode( - SyntaxNodeAnalysisContext context, - ImmutableArray> matches, - ImmutableArray locations, - ImmutableDictionary? properties) + private ImmutableArray GetLocationsToFade(ImmutableArray> matches) { var syntaxFacts = this.SyntaxFacts; + using var _ = ArrayBuilder.GetInstance(out var fadingLocations); foreach (var match in matches) { - var additionalUnnecessaryLocations = UseCollectionInitializerHelpers.GetLocationsToFade( + var locations = UseCollectionInitializerHelpers.GetLocationsToFade( syntaxFacts, match); - if (additionalUnnecessaryLocations.IsDefaultOrEmpty) - continue; - - // Report the diagnostic at the first unnecessary location. This is the location where the code fix - // will be offered. - context.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( - s_unnecessaryCodeDescriptor, - additionalUnnecessaryLocations[0], - NotificationOption2.ForSeverity(s_unnecessaryCodeDescriptor.DefaultSeverity), - additionalLocations: locations, - additionalUnnecessaryLocations: additionalUnnecessaryLocations, - properties)); + if (!locations.IsDefaultOrEmpty) + fadingLocations.AddRange(locations); } + + return fadingLocations.ToImmutable(); } } From 2e27d8dec8ce3abd45c747fff1c93ca6705c3b6e Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 14 Dec 2023 13:47:55 +0530 Subject: [PATCH 131/141] Fix FixAll test failures We should no longer be skipping diagnostics with Unnecessary custom tag from FixAll operation --- .../InvokeDelegateWithConditionalAccessCodeFixProvider.cs | 5 ----- .../CSharpUseCollectionExpressionForEmptyCodeFixProvider.cs | 3 --- .../UseThrowExpression/UseThrowExpressionCodeFixProvider.cs | 3 --- ...ssionForNullableTernaryConditionalCheckCodeFixProvider.cs | 3 --- ...sceExpressionForTernaryConditionalCheckCodeFixProvider.cs | 3 --- .../AbstractUseNullPropagationCodeFixProvider.cs | 3 --- .../CodeFixes/ForkingSyntaxEditorBasedCodeFixProvider.cs | 4 ---- 7 files changed, 24 deletions(-) diff --git a/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs index d39fcd8698a8b..a65ddc32b57fc 100644 --- a/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs @@ -33,11 +33,6 @@ public InvokeDelegateWithConditionalAccessCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.InvokeDelegateWithConditionalAccessId); - // Filter out the diagnostics we created for the faded out code. We don't want - // to try to fix those as well as the normal diagnostics we created. - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) - => !diagnostic.Properties.ContainsKey(WellKnownDiagnosticTags.Unnecessary); - public override Task RegisterCodeFixesAsync(CodeFixContext context) { RegisterCodeFix(context, CSharpAnalyzersResources.Simplify_delegate_invocation, nameof(CSharpAnalyzersResources.Simplify_delegate_invocation)); diff --git a/src/Analyzers/CSharp/CodeFixes/UseCollectionExpression/CSharpUseCollectionExpressionForEmptyCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseCollectionExpression/CSharpUseCollectionExpressionForEmptyCodeFixProvider.cs index 3a96e082c0c30..725312f4af43f 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseCollectionExpression/CSharpUseCollectionExpressionForEmptyCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseCollectionExpression/CSharpUseCollectionExpressionForEmptyCodeFixProvider.cs @@ -34,9 +34,6 @@ public CSharpUseCollectionExpressionForEmptyCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseCollectionExpressionForEmptyDiagnosticId); - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) - => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); - public override Task RegisterCodeFixesAsync(CodeFixContext context) { RegisterCodeFix(context, CSharpCodeFixesResources.Use_collection_expression, IDEDiagnosticIds.UseCollectionExpressionForEmptyDiagnosticId); diff --git a/src/Analyzers/CSharp/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs index 1ddcbd5708559..92a4279319416 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs @@ -33,9 +33,6 @@ public UseThrowExpressionCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseThrowExpressionDiagnosticId); - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) - => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); - public override Task RegisterCodeFixesAsync(CodeFixContext context) { RegisterCodeFix(context, AnalyzersResources.Use_throw_expression, nameof(AnalyzersResources.Use_throw_expression)); diff --git a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs index eccfcc0e2598b..6fcbbc9fb0c94 100644 --- a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs @@ -25,9 +25,6 @@ internal class UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixPro public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticId); - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) - => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); - public override Task RegisterCodeFixesAsync(CodeFixContext context) { RegisterCodeFix(context, AnalyzersResources.Use_coalesce_expression, nameof(AnalyzersResources.Use_coalesce_expression)); diff --git a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs index 21ac3e66d2640..af549c364208e 100644 --- a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs @@ -26,9 +26,6 @@ internal class UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseCoalesceExpressionForTernaryConditionalCheckDiagnosticId); - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) - => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); - public override Task RegisterCodeFixesAsync(CodeFixContext context) { RegisterCodeFix(context, AnalyzersResources.Use_coalesce_expression, nameof(AnalyzersResources.Use_coalesce_expression)); diff --git a/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs index 4bb65d0e6fc7e..ca319faf0ee53 100644 --- a/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs @@ -56,9 +56,6 @@ internal abstract class AbstractUseNullPropagationCodeFixProvider< public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseNullPropagationDiagnosticId); - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) - => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); - public override Task RegisterCodeFixesAsync(CodeFixContext context) { RegisterCodeFix(context, AnalyzersResources.Use_null_propagation, nameof(AnalyzersResources.Use_null_propagation)); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/ForkingSyntaxEditorBasedCodeFixProvider.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/ForkingSyntaxEditorBasedCodeFixProvider.cs index 7efa68191bf83..c862967ebcf9b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/ForkingSyntaxEditorBasedCodeFixProvider.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/ForkingSyntaxEditorBasedCodeFixProvider.cs @@ -51,10 +51,6 @@ protected abstract Task FixAsync( ImmutableDictionary properties, CancellationToken cancellationToken); - protected sealed override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) - // Never try to fix the secondary diagnostics that were produced just to fade out code. - => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); - public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { RegisterCodeFix(context, _title, _equivalenceKey); From 00aeb8e47d979fbfdb8f6f11e0b2a9d5a6f6cf07 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 14 Dec 2023 15:28:07 +0530 Subject: [PATCH 132/141] Fix UseCollectionExpressionTests --- .../UseCollectionExpressionForArrayTests.cs | 190 +++++++++--------- .../UseCollectionExpressionForBuilderTests.cs | 96 ++++----- .../UseCollectionExpressionForCreateTests.cs | 68 ++++--- ...eCollectionExpressionForStackAllocTests.cs | 58 +++--- 4 files changed, 207 insertions(+), 205 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForArrayTests.cs b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForArrayTests.cs index 59817dad68720..e6b052d43c1f1 100644 --- a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForArrayTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForArrayTests.cs @@ -214,7 +214,7 @@ public async Task TestWithCompatibleExplicitArrays1() TestCode = """ class C { - object[] i = [|[|new|] object[]|] { "" }; + object[] i = [|new|] object[] { "" }; } """, FixedCode = """ @@ -235,7 +235,7 @@ public async Task TestWithCompatibleExplicitArrays2() TestCode = """ class C { - object[] i = [|[|new|] object[]|] + object[] i = [|new|] object[] { "" }; @@ -262,7 +262,7 @@ public async Task TestWithCompatibleExplicitArrays_Empty() TestCode = """ class C { - object[] i = [|[|new|] object[]|] { }; + object[] i = [|new|] object[] { }; } """, FixedCode = """ @@ -283,7 +283,7 @@ public async Task TestWithCompatibleExplicitArrays_TrailingComma() TestCode = """ class C { - object[] i = [|[|new|] object[]|] { "", }; + object[] i = [|new|] object[] { "", }; } """, FixedCode = """ @@ -304,7 +304,7 @@ public async Task TestWithExplicitArray_ExplicitSize() TestCode = """ class C { - string[] i = [|[|new|] string[1]|] { "" }; + string[] i = [|new|] string[1] { "" }; } """, FixedCode = """ @@ -385,7 +385,7 @@ public async Task TestWithCompatibleImplicitArrays1() TestCode = """ class C { - string[] i = [|[|new|][]|] { "" }; + string[] i = [|new|][] { "" }; } """, FixedCode = """ @@ -406,7 +406,7 @@ public async Task TestWithCompatibleImplicitArrays2() TestCode = """ class C { - string[] i = [|[|new|][]|] + string[] i = [|new|][] { "" }; @@ -448,7 +448,7 @@ public async Task TestWithCompatibleImplicitArrays_TrailingComma() TestCode = """ class C { - string[] i = [|[|new|][]|] { "", }; + string[] i = [|new|][] { "", }; } """, FixedCode = """ @@ -566,7 +566,7 @@ public async Task TestTargetTypedToField() TestCode = """ class C { - private int[] X = [|[|new|] int[]|] { 1 }; + private int[] X = [|new|] int[] { 1 }; } """, FixedCode = """ @@ -587,7 +587,7 @@ public async Task TestTargetTypedToProperty() TestCode = """ class C { - private int[] X { get; } = [|[|new|] int[]|] { 1 }; + private int[] X { get; } = [|new|] int[] { 1 }; } """, FixedCode = """ @@ -610,7 +610,7 @@ class C { void M() { - var c = (int[])[|[|new|] int[]|] { 1 }; + var c = (int[])[|new|] int[] { 1 }; } } """, @@ -711,7 +711,7 @@ class C { void M(int[] x) { - var c = true ? [|[|new|] int[]|] { 1 } : x; + var c = true ? [|new|] int[] { 1 } : x; } } """, @@ -738,7 +738,7 @@ class C { void M(int[] x) { - var c = true ? x : [|[|new|] int[]|] { 1 }; + var c = true ? x : [|new|] int[] { 1 }; } } """, @@ -765,7 +765,7 @@ class C { void M(int[] x) { - int[] c = true ? null : [|[|new|] int[]|] { 1 }; + int[] c = true ? null : [|new|] int[] { 1 }; } } """, @@ -810,7 +810,7 @@ class C { void M(int[] x, bool b) { - var c = b switch { true => x, false => [|[|new|] int[]|] { 1 } }; + var c = b switch { true => x, false => [|new|] int[] { 1 } }; } } """, @@ -837,7 +837,7 @@ class C { void M(int[] x, bool b) { - var c = b switch { false => [|[|new|] int[]|] { 1 }, true => x }; + var c = b switch { false => [|new|] int[] { 1 }, true => x }; } } """, @@ -864,7 +864,7 @@ class C { void M(int[] x, bool b) { - int[] c = b switch { false => [|[|new|] int[]|] { 1 }, true => null }; + int[] c = b switch { false => [|new|] int[] { 1 }, true => null }; } } """, @@ -927,7 +927,7 @@ class C { void M(int[] x, bool b) { - var c = new[] { [|[|new|][]|] { 1, 2, 3 }, x }; + var c = new[] { [|new|][] { 1, 2, 3 }, x }; } } """, @@ -954,7 +954,7 @@ class C { void M(int[] x, bool b) { - var c = new[] { x, [|[|new|][]|] { 1, 2, 3 } }; + var c = new[] { x, [|new|][] { 1, 2, 3 } }; } } """, @@ -999,7 +999,7 @@ class C { void M(int[] x, bool b) { - int[][] c = [|[|new|][]|] { new[] { 1, 2, 3 } }; + int[][] c = [|new|][] { new[] { 1, 2, 3 } }; } } """, @@ -1017,9 +1017,7 @@ void M(int[] x, bool b) ExpectedDiagnostics = { // /0/Test0.cs(5,22): info IDE0300: Collection initialization can be simplified - VerifyCS.Diagnostic().WithSpan(5, 22, 5, 25).WithSpan(5, 22, 5, 39).WithSeverity(DiagnosticSeverity.Info), - // /0/Test0.cs(5,22): hidden IDE0300: Collection initialization can be simplified - VerifyCS.Diagnostic().WithSpan(5, 22, 5, 27).WithSpan(5, 22, 5, 39).WithSpan(5, 22, 5, 27).WithSeverity(DiagnosticSeverity.Hidden), + VerifyCS.Diagnostic().WithSpan(5, 22, 5, 25).WithSpan(5, 22, 5, 39).WithSpan(5, 22, 5, 27).WithSeverity(DiagnosticSeverity.Info) } }, LanguageVersion = LanguageVersion.CSharp12, @@ -1037,7 +1035,7 @@ class C { void M() { - X([|[|new|] int[]|] { 1, 2, 3 }); + X([|new|] int[] { 1, 2, 3 }); } void X(int[] x) { } @@ -1086,7 +1084,7 @@ public async Task TestTargetTypedAttributeArgument1() await new VerifyCS.Test { TestCode = """ - [X([|[|new|] int[]|] { 1, 2, 3 })] + [X([|new|] int[] { 1, 2, 3 })] class C { } @@ -1121,7 +1119,7 @@ class C { int[] M() { - return [|[|new|] int[]|] { 1, 2, 3 }; + return [|new|] int[] { 1, 2, 3 }; } } """, @@ -1148,7 +1146,7 @@ class C { void M(int[] x) { - x = [|[|new|] int[]|] { 1, 2, 3 }; + x = [|new|] int[] { 1, 2, 3 }; } } """, @@ -1179,7 +1177,7 @@ void M() { var v = new C { - X = [|[|new|] int[]|] { 1, 2, 3 }, + X = [|new|] int[] { 1, 2, 3 }, }; } } @@ -1212,7 +1210,7 @@ class C { void M(int[] x) { - var y = x ?? [|[|new|] int[]|] { 1, 2, 3 }; + var y = x ?? [|new|] int[] { 1, 2, 3 }; } } """, @@ -1460,7 +1458,7 @@ public async Task TestInitializerFormatting1_Explicit() TestCode = """ class C { - int[] i = [|[|new|] int[]|] { 1, 2, 3 }; + int[] i = [|new|] int[] { 1, 2, 3 }; } """, FixedCode = """ @@ -1482,7 +1480,7 @@ public async Task TestInitializerFormatting2_Explicit() class C { int[] i = - [|[|new|] int[]|] { 1, 2, 3 }; + [|new|] int[] { 1, 2, 3 }; } """, FixedCode = """ @@ -1504,7 +1502,7 @@ public async Task TestInitializerFormatting3_Explicit() TestCode = """ class C { - int[] i = [|[|new|] int[]|] { + int[] i = [|new|] int[] { 1, 2, 3 }; } @@ -1529,7 +1527,7 @@ public async Task TestInitializerFormatting4_Explicit() TestCode = """ class C { - int[] i = [|[|new|] int[]|] + int[] i = [|new|] int[] { 1, 2, 3 }; @@ -1557,7 +1555,7 @@ public async Task TestInitializerFormatting5_Explicit() class C { int[] i = - [|[|new|] int[]|] + [|new|] int[] { 1, 2, 3 }; @@ -1585,7 +1583,7 @@ public async Task TestInitializerFormatting6_Explicit() class C { int[] i = - [|[|new|] int[]|] { + [|new|] int[] { 1, 2, 3 }; } @@ -1612,7 +1610,7 @@ public async Task TestInitializerFormatting7_Explicit() class C { int[] i = - [|[|new|] int[]|] + [|new|] int[] { 1, 2, 3 }; @@ -1640,7 +1638,7 @@ public async Task TestInitializerFormatting8_Explicit() class C { int[] i = - [|[|new|] int[]|] { + [|new|] int[] { 1, 2, 3 }; } @@ -1666,7 +1664,7 @@ public async Task TestInitializerFormatting9_Explicit() TestCode = """ class C { - int[] i = [|[|new|] int[]|] { + int[] i = [|new|] int[] { 1, 2, 3 }; } @@ -1693,7 +1691,7 @@ class C { int[] i = - [|[|new|] int[]|] + [|new|] int[] { 1, 2, 3 }; @@ -1721,7 +1719,7 @@ public async Task TestInitializerFormatting1_Implicit() TestCode = """ class C { - int[] i = [|[|new|][]|] { 1, 2, 3 }; + int[] i = [|new|][] { 1, 2, 3 }; } """, FixedCode = """ @@ -1743,7 +1741,7 @@ public async Task TestInitializerFormatting2_Implicit() class C { int[] i = - [|[|new|][]|] { 1, 2, 3 }; + [|new|][] { 1, 2, 3 }; } """, FixedCode = """ @@ -1765,7 +1763,7 @@ public async Task TestInitializerFormatting3_Implicit() TestCode = """ class C { - int[] i = [|[|new|][]|] { + int[] i = [|new|][] { 1, 2, 3 }; } @@ -1790,7 +1788,7 @@ public async Task TestInitializerFormatting4_Implicit() TestCode = """ class C { - int[] i = [|[|new|][]|] + int[] i = [|new|][] { 1, 2, 3 }; @@ -1818,7 +1816,7 @@ public async Task TestInitializerFormatting5_Implicit() class C { int[] i = - [|[|new|][]|] + [|new|][] { 1, 2, 3 }; @@ -1846,7 +1844,7 @@ public async Task TestInitializerFormatting6_Implicit() class C { int[] i = - [|[|new|][]|] { + [|new|][] { 1, 2, 3 }; } @@ -1873,7 +1871,7 @@ public async Task TestInitializerFormatting7_Implicit() class C { int[] i = - [|[|new|][]|] + [|new|][] { 1, 2, 3 }; @@ -1901,7 +1899,7 @@ public async Task TestInitializerFormatting8_Implicit() class C { int[] i = - [|[|new|][]|] { + [|new|][] { 1, 2, 3 }; } @@ -1927,7 +1925,7 @@ public async Task TestInitializerFormatting9_Implicit() TestCode = """ class C { - int[] i = [|[|new|][]|] { + int[] i = [|new|][] { 1, 2, 3 }; } @@ -1954,7 +1952,7 @@ class C { int[] i = - [|[|new|][]|] + [|new|][] { 1, 2, 3 }; @@ -1992,11 +1990,11 @@ class WellKnownDiagnosticTags class C { private static readonly string s_enforceOnBuildNeverTag; - private static readonly string[] s_microsoftCustomTags = [|[|new|] string[]|] { WellKnownDiagnosticTags.Telemetry }; - private static readonly string[] s_editAndContinueCustomTags = [|[|new|] string[]|] { WellKnownDiagnosticTags.EditAndContinue, WellKnownDiagnosticTags.Telemetry, WellKnownDiagnosticTags.NotConfigurable, s_enforceOnBuildNeverTag }; - private static readonly string[] s_unnecessaryCustomTags = [|[|new|] string[]|] { WellKnownDiagnosticTags.Unnecessary, WellKnownDiagnosticTags.Telemetry }; - private static readonly string[] s_notConfigurableCustomTags = [|[|new|] string[]|] { WellKnownDiagnosticTags.NotConfigurable, s_enforceOnBuildNeverTag, WellKnownDiagnosticTags.Telemetry }; - private static readonly string[] s_unnecessaryAndNotConfigurableCustomTags = [|[|new|] string[]|] { WellKnownDiagnosticTags.Unnecessary, WellKnownDiagnosticTags.NotConfigurable, s_enforceOnBuildNeverTag, WellKnownDiagnosticTags.Telemetry }; + private static readonly string[] s_microsoftCustomTags = [|new|] string[] { WellKnownDiagnosticTags.Telemetry }; + private static readonly string[] s_editAndContinueCustomTags = [|new|] string[] { WellKnownDiagnosticTags.EditAndContinue, WellKnownDiagnosticTags.Telemetry, WellKnownDiagnosticTags.NotConfigurable, s_enforceOnBuildNeverTag }; + private static readonly string[] s_unnecessaryCustomTags = [|new|] string[] { WellKnownDiagnosticTags.Unnecessary, WellKnownDiagnosticTags.Telemetry }; + private static readonly string[] s_notConfigurableCustomTags = [|new|] string[] { WellKnownDiagnosticTags.NotConfigurable, s_enforceOnBuildNeverTag, WellKnownDiagnosticTags.Telemetry }; + private static readonly string[] s_unnecessaryAndNotConfigurableCustomTags = [|new|] string[] { WellKnownDiagnosticTags.Unnecessary, WellKnownDiagnosticTags.NotConfigurable, s_enforceOnBuildNeverTag, WellKnownDiagnosticTags.Telemetry }; } } """, @@ -2037,7 +2035,7 @@ class C { void M(int i, int j) { - int[] r = [|[|new|] int[1]|]; + int[] r = [|new|] int[1]; r[0] = 1 + 2; } @@ -2074,7 +2072,7 @@ class C { void M(int i, int j) { - int[] r = [|[|new|] int[2]|]; + int[] r = [|new|] int[2]; r[0] = 1 + 2; r[1] = 3 + @@ -2115,7 +2113,7 @@ class C { void M() { - int[] r = [|[|new|] int[0]|]; + int[] r = [|new|] int[0]; } } """, @@ -2362,7 +2360,7 @@ class C { void M(int i, int j) { - int[] r = [|[|new|] int[1]|]; + int[] r = [|new|] int[1]; r[0] = i; } } @@ -2394,7 +2392,7 @@ class C { void M(int i, int j) { - int[] r = [|[|new|] int[1]|]; + int[] r = [|new|] int[1]; r[0] = i; r[0] = j; } @@ -2428,7 +2426,7 @@ class C { void M(int i, int j) { - int[] r = [|[|new|] int[2]|]; + int[] r = [|new|] int[2]; r[0] = i; r[1] = j; } @@ -2462,7 +2460,7 @@ class C void M(int i, int j) { const int v = 1; - int[] r = [|[|new|] int[2]|]; + int[] r = [|new|] int[2]; r[0] = i; r[v] = j; } @@ -2566,7 +2564,7 @@ class C { void M(int i, int j) { - int[][] r = [|[|new|] int[2][]|]; + int[][] r = [|new|] int[2][]; r[0] = null; r[1] = null; } @@ -2599,9 +2597,9 @@ class C { void M(int i, int j) { - int[][] r = [|[|new|] int[2][]|]; - r[0] = [|[|new|][]|] { 1 }; - r[1] = [|[|new|] int[]|] { 2 }; + int[][] r = [|new|] int[2][]; + r[0] = [|new|][] { 1 }; + r[1] = [|new|] int[] { 2 }; } } """, @@ -2632,11 +2630,11 @@ class C { void M(int i, int j) { - int[][] r = [|[|new|] int[2][]|]; + int[][] r = [|new|] int[2][]; // Leading - r[0] = [|[|new|][]|] { 1 }; // Trailing - r[1] = [|[|new|] int[]|] { 2 }; + r[0] = [|new|][] { 1 }; // Trailing + r[1] = [|new|] int[] { 2 }; } } """, @@ -2672,14 +2670,14 @@ class C { void M(int i, int j) { - int[][] r = [|[|new|] int[2][]|]; + int[][] r = [|new|] int[2][]; - r[0] = [|[|new|][]|] + r[0] = [|new|][] { // Leading 1 // Trailing }; - r[1] = [|[|new|] int[]|] { 2 }; + r[1] = [|new|] int[] { 2 }; } } """, @@ -2786,10 +2784,10 @@ public async Task TestWithDifferentNewLines(string endOfLine) public static readonly IEnumerable EmptyOrConstantsOnly = new object[][] { - new [] { "[|[|new|] int[0]|]", "[]" }, - new [] { "[|[|new|] int[]|] { }", "[]" }, - new [] { "[|[|new|] int[]|] { 1, 2, 3 }", "[1, 2, 3]" }, - new [] { "[|[|new|][]|] { 1, 2, 3 }", "[1, 2, 3]" }, + new [] { "[|new|] int[0]", "[]" }, + new [] { "[|new|] int[] { }", "[]" }, + new [] { "[|new|] int[] { 1, 2, 3 }", "[1, 2, 3]" }, + new [] { "[|new|][] { 1, 2, 3 }", "[1, 2, 3]" }, }; [Theory, MemberData(nameof(EmptyOrConstantsOnly))] @@ -3101,7 +3099,7 @@ class C { void M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; } } """, @@ -3137,7 +3135,7 @@ class C { void M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; ReadOnlySpan t; } } @@ -3177,7 +3175,7 @@ class C ReadOnlySpan M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; ReadOnlySpan t = globalArray; return t; } @@ -3219,7 +3217,7 @@ class C { void M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; ReadOnlySpan t = s; } } @@ -3257,7 +3255,7 @@ class C { void M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; X(s); } @@ -3299,7 +3297,7 @@ class C { ReadOnlySpan M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; return X(s); } @@ -3341,7 +3339,7 @@ class C { void M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; s.Slice(0, 1); } } @@ -3379,7 +3377,7 @@ class C { string M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; return s.ToString(); } } @@ -3417,7 +3415,7 @@ class C { ReadOnlySpan M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; return X(s.Slice(0, 1)); } @@ -3459,7 +3457,7 @@ class C { ReadOnlySpan M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; return X(s[0..1]); } @@ -3501,7 +3499,7 @@ class C { int M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; return s[0]; } } @@ -3539,7 +3537,7 @@ class C { int M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; return s.Length; } } @@ -3577,7 +3575,7 @@ class C { int M(int i) { - ReadOnlySpan s = [|[|new|][]|] { i }; + ReadOnlySpan s = [|new|][] { i }; return nameof(s).Length; } } @@ -3958,7 +3956,7 @@ class C { ReadOnlySpan M(int i) { - ReadOnlySpan span = [|[|new|][]|] { i }; + ReadOnlySpan span = [|new|][] { i }; X(span, out var v); return v; } @@ -4002,7 +4000,7 @@ class C { void M(int i) { - ReadOnlySpan span = [|[|new|][]|] { i }; + ReadOnlySpan span = [|new|][] { i }; X(span, out var v); } @@ -4044,7 +4042,7 @@ class C { ReadOnlySpan M(int i) { - ReadOnlySpan span = [|[|new|][]|] { i }; + ReadOnlySpan span = [|new|][] { i }; X(span, out var v); return v.Slice(0, 1); } @@ -4084,7 +4082,7 @@ class C { void M(bool b) { - var v = b ? [|[|new|][]|] { "a" } : [|[|new|][]|] { "b" }; + var v = b ? [|new|][] { "a" } : [|new|][] { "b" }; } } """, @@ -4121,7 +4119,7 @@ class C { void M(bool b) { - var v = b ? [|[|new|] string[]|] { "a" } : [|[|new|] string[]|] { "b" }; + var v = b ? [|new|] string[] { "a" } : [|new|] string[] { "b" }; } } """, @@ -4184,7 +4182,7 @@ class C { void M() { - Func f = () => [|[|new|] int[]|] { 1, 2, 3 }; + Func f = () => [|new|] int[] { 1, 2, 3 }; } } """, @@ -4264,7 +4262,7 @@ class C { (int A, int B)[] M() { - return [|[|new|][]|] { (A: 1, 2) }; + return [|new|][] { (A: 1, 2) }; } } """, @@ -4342,7 +4340,7 @@ class C { void M(bool b) { - object falsePositive = new[] { [|[|new|][]|] { 1 }, [|[|new|][]|] { 1 } }; + object falsePositive = new[] { [|new|][] { 1 }, [|new|][] { 1 } }; } } """, diff --git a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForBuilderTests.cs b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForBuilderTests.cs index 6875f996a24e6..0a078cedd53c6 100644 --- a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForBuilderTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForBuilderTests.cs @@ -58,9 +58,9 @@ public void Clear() { } public static readonly IEnumerable SuccessCreationPatterns = new[] { - new[] {"[|var builder = ImmutableArray.[|CreateBuilder|]();|]" }, - new[] {"[|var builder = ArrayBuilder.[|GetInstance|]();|]" }, - new[] {"[|using var _ = ArrayBuilder.[|GetInstance|](out var builder);|]" }, + new[] {"var builder = ImmutableArray.[|CreateBuilder|]();" }, + new[] {"var builder = ArrayBuilder.[|GetInstance|]();" }, + new[] {"using var _ = ArrayBuilder.[|GetInstance|](out var builder);" }, }; [Theory, MemberData(nameof(FailureCreationPatterns))] @@ -122,7 +122,7 @@ class C ImmutableArray M() { {{pattern}} - [|builder.Add(|]0); + builder.Add(0); return builder.ToImmutable(); } } @@ -156,7 +156,7 @@ class C void M() { {{pattern}} - [|builder.Add(|]0); + builder.Add(0); var v = (ImmutableArray)builder.ToImmutable(); } } @@ -214,7 +214,7 @@ class C void M() { {{pattern}} - [|builder.Add(|]0); + builder.Add(0); Goo(builder.ToImmutable()); } @@ -251,8 +251,8 @@ class C { void M() { - [|var builder = ImmutableArray.[|CreateBuilder|](1);|] - [|builder.Add(|]0); + var builder = ImmutableArray.[|CreateBuilder|](1); + builder.Add(0); Goo(builder.ToImmutable()); } @@ -289,8 +289,8 @@ class C { void M() { - [|var builder = ArrayBuilder.[|GetInstance|](1);|] - [|builder.Add(|]0); + var builder = ArrayBuilder.[|GetInstance|](1); + builder.Add(0); Goo(builder.ToImmutable()); } @@ -327,8 +327,8 @@ class C { void M() { - [|using var _ = ArrayBuilder.[|GetInstance|](1, out var builder);|] - [|builder.Add(|]0); + using var _ = ArrayBuilder.[|GetInstance|](1, out var builder); + builder.Add(0); Goo(builder.ToImmutable()); } @@ -416,8 +416,8 @@ class C void M(int[] x) { {{pattern}} - [|builder.Add(|]0); - [|foreach (var y in |]x) + builder.Add(0); + foreach (var y in x) builder.Add(y); Goo(builder.ToImmutable()); @@ -457,8 +457,8 @@ class C void M(int[] x) { {{pattern}} - [|builder.Add(|]0); - [|foreach (var y in |]x) + builder.Add(0); + foreach (var y in x) { builder.Add(y); } @@ -560,12 +560,12 @@ class C void M(int[] x, int[] y) { {{pattern}} - [|builder.Add(|]0); - [|foreach (var z in |]x) + builder.Add(0); + foreach (var z in x) { builder.Add(z); } - [|foreach (var z in |]y) + foreach (var z in y) { builder.Add(z); } @@ -607,12 +607,12 @@ class C void M(int[] x, int[] y) { {{pattern}} - [|foreach (var z in |]x) + foreach (var z in x) { builder.Add(z); } - [|builder.Add(|]0); - [|foreach (var z in |]y) + builder.Add(0); + foreach (var z in y) { builder.Add(z); } @@ -654,15 +654,15 @@ class C void M(int[] x, int[] y) { {{pattern}} - [|foreach (var z in |]x) + foreach (var z in x) { builder.Add(z); } - [|foreach (var z in |]y) + foreach (var z in y) { builder.Add(z); } - [|builder.Add(|]0); + builder.Add(0); Goo(builder.ToImmutable()); } @@ -871,7 +871,7 @@ class C void M(int[] x) { {{pattern}} - [|builder.AddRange(|]x); + builder.AddRange(x); Goo(builder.ToImmutable()); } @@ -909,7 +909,7 @@ class C void M(int[] x) { {{pattern}} - [|builder.AddRange(|]1); + builder.AddRange(1); Goo(builder.ToImmutable()); } @@ -947,7 +947,7 @@ class C void M(int[] x) { {{pattern}} - [|builder.AddRange(|]1, 2, 3); + builder.AddRange(1, 2, 3); Goo(builder.ToImmutable()); } @@ -1009,8 +1009,8 @@ class C { void M() { - [|var builder = ImmutableArray.[|CreateBuilder|](1);|] - [|builder.Add(|]0); + var builder = ImmutableArray.[|CreateBuilder|](1); + builder.Add(0); Goo(builder.MoveToImmutable()); } @@ -1047,8 +1047,8 @@ class C { void M() { - [|var builder = ArrayBuilder.[|GetInstance|]();|] - [|builder.Add(|]0); + var builder = ArrayBuilder.[|GetInstance|](); + builder.Add(0); Goo(builder.ToImmutableAndFree()); } @@ -1085,8 +1085,8 @@ class C { void M() { - [|var builder = ArrayBuilder.[|GetInstance|]();|] - [|builder.Add(|]0); + var builder = ArrayBuilder.[|GetInstance|](); + builder.Add(0); Goo(builder.ToImmutableAndClear()); } @@ -1124,7 +1124,7 @@ class C void M() { {{pattern}} - [|builder.Add(|]0); + builder.Add(0); Goo(builder.ToArray()); } @@ -1216,7 +1216,7 @@ ImmutableArray M() {{pattern}} // Leading - [|builder.Add(|]0); // Trailing + builder.Add(0); // Trailing return builder.ToImmutable(); } } @@ -1254,7 +1254,7 @@ class C ImmutableArray M() { {{pattern}} - [|builder.Add(|]1 + + builder.Add(1 + 2); return builder.ToImmutable(); } @@ -1293,9 +1293,9 @@ class C ImmutableArray M() { {{pattern}} - [|builder.Add(|]1 + + builder.Add(1 + 2); - [|builder.Add(|]3 + + builder.Add(3 + 4); return builder.ToImmutable(); } @@ -1355,7 +1355,7 @@ public async Task TestGlobalStatement1(string pattern) using System.Collections.Immutable; {{pattern}} - [|builder.Add(|]0); + builder.Add(0); ImmutableArray array = builder.ToImmutable(); """ + s_arrayBuilderApi, FixedCode = """ @@ -1381,10 +1381,10 @@ public async Task TestGlobalStatement2(string pattern) using System.Collections.Immutable; {{pattern}} - [|builder.Add(|]0); - [|builder.Add(|]1 + + builder.Add(0); + builder.Add(1 + 2); - [|builder.Add(|]3 + + builder.Add(3 + 4); ImmutableArray array = builder.ToImmutable(); """ + s_arrayBuilderApi, @@ -1422,8 +1422,8 @@ class C ImmutableArray> M() { var builder1 = ImmutableArray.CreateBuilder>(); - [|var builder2 = ImmutableArray.[|CreateBuilder|]();|] - [|builder2.Add(|]0); + var builder2 = ImmutableArray.[|CreateBuilder|](); + builder2.Add(0); builder1.Add(builder2.ToImmutable()); return builder1.ToImmutable(); } @@ -1442,6 +1442,7 @@ ImmutableArray> M() """ + s_arrayBuilderApi, LanguageVersion = LanguageVersion.CSharp12, ReferenceAssemblies = ReferenceAssemblies.Net.Net80, + NumberOfIncrementalIterations = 2, NumberOfFixAllIterations = 2, }.RunAsync(); } @@ -1461,8 +1462,8 @@ class C ImmutableArray> M() { var builder1 = ImmutableArray.CreateBuilder>(); - [|var builder2 = ImmutableArray.[|CreateBuilder|]();|] - [|builder2.Add(|]0); + var builder2 = ImmutableArray.[|CreateBuilder|](); + builder2.Add(0); builder1.Add(builder2.ToImmutable()); return builder1.ToImmutable(); } @@ -1481,6 +1482,7 @@ ImmutableArray> M() """ + s_arrayBuilderApi).ReplaceLineEndings(endOfLine), LanguageVersion = LanguageVersion.CSharp12, ReferenceAssemblies = ReferenceAssemblies.Net.Net80, + NumberOfIncrementalIterations = 2, NumberOfFixAllIterations = 2, }.RunAsync(); } diff --git a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForCreateTests.cs b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForCreateTests.cs index ee334f8a8b2b6..6107530c3000b 100644 --- a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForCreateTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForCreateTests.cs @@ -87,7 +87,7 @@ public async Task TestInCSharp12_Net70() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]1, 2, 3); + MyCollection i = MyCollection.[|Create|](1, 2, 3); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -109,7 +109,7 @@ public async Task TestEmpty() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]); + MyCollection i = MyCollection.[|Create|](); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -133,7 +133,7 @@ class C { void M() { - var i = (MyCollection)[|MyCollection.[|Create|](|]); + var i = (MyCollection)MyCollection.[|Create|](); } } """ + s_collectionBuilderApi + s_basicCollectionApi, @@ -180,7 +180,7 @@ public async Task TestOneElement() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]1); + MyCollection i = MyCollection.[|Create|](1); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -202,7 +202,7 @@ public async Task TestTwoElements() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]1, 2); + MyCollection i = MyCollection.[|Create|](1, 2); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -224,7 +224,7 @@ public async Task TestThreeElements() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]1, 2, 3); + MyCollection i = MyCollection.[|Create|](1, 2, 3); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -246,7 +246,7 @@ public async Task TestFourElements() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]1, 2, 3, 4); + MyCollection i = MyCollection.[|Create|](1, 2, 3, 4); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -268,7 +268,7 @@ public async Task TestParamsWithMultipleElements() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]1, 2, 3, 4, 5); + MyCollection i = MyCollection.[|Create|](1, 2, 3, 4, 5); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -306,7 +306,7 @@ public async Task TestParamsWithExplicitArrayArgument2() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]new int[] { }); + MyCollection i = MyCollection.[|Create|](new int[] { }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -328,7 +328,7 @@ public async Task TestParamsWithExplicitArrayArgument3() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]new int[] { 1, 2, 3 }); + MyCollection i = MyCollection.[|Create|](new int[] { 1, 2, 3 }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -350,7 +350,7 @@ public async Task TestParamsWithImplicitArrayArgument1() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]new[] { 1, 2, 3 }); + MyCollection i = MyCollection.[|Create|](new[] { 1, 2, 3 }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -404,7 +404,7 @@ public async Task TestReadOnlySpan_ExplicitStackAlloc_Net80_1() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]stackalloc int[] { }); + MyCollection i = MyCollection.[|Create|](stackalloc int[] { }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -426,7 +426,7 @@ public async Task TestReadOnlySpan_ExplicitStackAlloc_Net80_2() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]stackalloc int[] { 1, 2, 3 }); + MyCollection i = MyCollection.[|Create|](stackalloc int[] { 1, 2, 3 }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -448,7 +448,7 @@ public async Task TestReadOnlySpan_ImplicitStackAlloc_Net80_1() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]stackalloc[] { 1, 2, 3 }); + MyCollection i = MyCollection.[|Create|](stackalloc[] { 1, 2, 3 }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -523,7 +523,7 @@ public async Task TestCreateRange_ExplicitArray2() TestCode = """ class C { - MyCollection i = [|MyCollection.[|CreateRange|](|]new int[] { }); + MyCollection i = MyCollection.[|CreateRange|](new int[] { }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -545,7 +545,7 @@ public async Task TestCreateRange_ExplicitArray3() TestCode = """ class C { - MyCollection i = [|MyCollection.[|CreateRange|](|]new int[] { 1, 2, 3 }); + MyCollection i = MyCollection.[|CreateRange|](new int[] { 1, 2, 3 }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -567,7 +567,7 @@ public async Task TestCreateRange_ImplicitArray1() TestCode = """ class C { - MyCollection i = [|MyCollection.[|CreateRange|](|]new[] { 1, 2, 3 }); + MyCollection i = MyCollection.[|CreateRange|](new[] { 1, 2, 3 }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -627,7 +627,7 @@ public async Task TestCreateRange_NewObjectWithoutArgument() class C { - MyCollection i = [|MyCollection.[|CreateRange|](|]new List()); + MyCollection i = MyCollection.[|CreateRange|](new List()); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -653,7 +653,7 @@ public async Task TestCreateRange_NewObjectWithInitializer1() class C { - MyCollection i = [|MyCollection.[|CreateRange|](|]new List { }); + MyCollection i = MyCollection.[|CreateRange|](new List { }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -679,7 +679,7 @@ public async Task TestCreateRange_NewObjectWithInitializer2() class C { - MyCollection i = [|MyCollection.[|CreateRange|](|]new List() { }); + MyCollection i = MyCollection.[|CreateRange|](new List() { }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -705,7 +705,7 @@ public async Task TestCreateRange_NewObjectWithInitializer3() class C { - MyCollection i = [|MyCollection.[|CreateRange|](|]new List { 1, 2, 3 }); + MyCollection i = MyCollection.[|CreateRange|](new List { 1, 2, 3 }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -731,7 +731,7 @@ public async Task TestCreateRange_NewObjectWithInitializer4() class C { - MyCollection i = [|MyCollection.[|CreateRange|](|]new List { 1, 2, 3 }); + MyCollection i = MyCollection.[|CreateRange|](new List { 1, 2, 3 }); } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -792,7 +792,7 @@ public async Task TestTrivia1() TestCode = """ class C { - MyCollection i = /*leading*/ [|MyCollection.[|Create|](|]1) /*trailing*/; + MyCollection i = /*leading*/ MyCollection.[|Create|](1) /*trailing*/; } """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ @@ -814,7 +814,7 @@ public async Task TestMultiLine1() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]1 + + MyCollection i = MyCollection.[|Create|](1 + 2); } """ + s_collectionBuilderApi + s_basicCollectionApi, @@ -838,7 +838,7 @@ public async Task TestMultiLine2() TestCode = """ class C { - MyCollection i = [|MyCollection.[|Create|](|]1 + + MyCollection i = MyCollection.[|Create|](1 + 2, 3 + 4); @@ -896,7 +896,7 @@ class C { void M() { - ImmutableArray v = [|ImmutableArray.[|Create|](|]1, 2, 3); + ImmutableArray v = ImmutableArray.[|Create|](1, 2, 3); } } """, @@ -952,7 +952,7 @@ class C { void M() { - ImmutableList v = [|ImmutableList.[|Create|](|]1, 2, 3); + ImmutableList v = ImmutableList.[|Create|](1, 2, 3); } } """, @@ -979,7 +979,7 @@ public async Task TestGlobalStatement1() await new VerifyCS.Test { TestCode = """ - MyCollection i = [|MyCollection.[|Create|](|]); + MyCollection i = MyCollection.[|Create|](); """ + s_collectionBuilderApi + s_basicCollectionApi, FixedCode = """ MyCollection i = []; @@ -999,7 +999,7 @@ public async Task TestGlobalStatement2() await new VerifyCS.Test { TestCode = """ - MyCollection i = [|MyCollection.[|Create|](|]1 + + MyCollection i = MyCollection.[|Create|](1 + 2, 3 + 4); """ + s_collectionBuilderApi + s_basicCollectionApi, @@ -1034,7 +1034,7 @@ class C { void M() { - ImmutableArray> v = [|ImmutableArray.[|Create|](|]ImmutableArray.Create(1, 2, 3)); + ImmutableArray> v = ImmutableArray.[|Create|](ImmutableArray.Create(1, 2, 3)); } } """, @@ -1052,6 +1052,7 @@ void M() """, LanguageVersion = LanguageVersion.CSharp12, ReferenceAssemblies = ReferenceAssemblies.Net.Net80, + NumberOfIncrementalIterations = 2, NumberOfFixAllIterations = 2, }.RunAsync(); } @@ -1071,7 +1072,7 @@ class C { void M() { - ImmutableArray> v = [|ImmutableArray.[|Create|](|]ImmutableArray.Create(1, 2, 3)); + ImmutableArray> v = ImmutableArray.[|Create|](ImmutableArray.Create(1, 2, 3)); } } """.ReplaceLineEndings(endOfLine), @@ -1089,6 +1090,7 @@ void M() """.ReplaceLineEndings(endOfLine), LanguageVersion = LanguageVersion.CSharp12, ReferenceAssemblies = ReferenceAssemblies.Net.Net80, + NumberOfIncrementalIterations = 2, NumberOfFixAllIterations = 2, }.RunAsync(); } @@ -1109,7 +1111,7 @@ class C { void M() { - Func> f = () => [|ImmutableArray.[|Create|](|]1, 2, 3); + Func> f = () => ImmutableArray.[|Create|](1, 2, 3); } } """, @@ -1196,7 +1198,7 @@ class C { ImmutableArray<(int A, int B)> M() { - return [|ImmutableArray.[|Create|](|](A: 1, 2)); + return ImmutableArray.[|Create|]((A: 1, 2)); } } """, diff --git a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForStackAllocTests.cs b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForStackAllocTests.cs index 208437f6edf7c..be87d31b23ae4 100644 --- a/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForStackAllocTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCollectionExpression/UseCollectionExpressionForStackAllocTests.cs @@ -115,7 +115,7 @@ class C { void M() { - ReadOnlySpan x = [|[|stackalloc|] int[]|] { 1, 2, 3 }; + ReadOnlySpan x = [|stackalloc|] int[] { 1, 2, 3 }; } } """, @@ -147,7 +147,7 @@ class C { void M() { - ReadOnlySpan x = [|[|stackalloc|][]|] { 1, 2, 3 }; + ReadOnlySpan x = [|stackalloc|][] { 1, 2, 3 }; } } """, @@ -179,7 +179,7 @@ class C { void M() { - Span x = [|[|stackalloc|] int[]|] { 1, 2, 3 }; + Span x = [|stackalloc|] int[] { 1, 2, 3 }; } } """, @@ -211,7 +211,7 @@ class C { void M() { - Span x = [|[|stackalloc|][]|] { 1, 2, 3 }; + Span x = [|stackalloc|][] { 1, 2, 3 }; } } """, @@ -328,7 +328,7 @@ class C void M() { const int size = 1; - ReadOnlySpan x = [|[|stackalloc|] int[size]|] { 2 }; + ReadOnlySpan x = [|stackalloc|] int[size] { 2 }; } } """, @@ -445,7 +445,7 @@ class C { void M() { - Goo([|[|stackalloc|] int[]|] { 1, 2, 3 }); + Goo([|stackalloc|] int[] { 1, 2, 3 }); } void Goo(ReadOnlySpan span) { } @@ -481,7 +481,7 @@ class C { void M() { - Goo([|[|stackalloc|][]|] { 1, 2, 3 }); + Goo([|stackalloc|][] { 1, 2, 3 }); } void Goo(ReadOnlySpan span) { } @@ -517,7 +517,7 @@ class C { void M() { - ReadOnlySpan r = [|[|stackalloc|] int[]|] { }; + ReadOnlySpan r = [|stackalloc|] int[] { }; } } """, @@ -549,7 +549,7 @@ class C { void M() { - var r = (ReadOnlySpan)[|[|stackalloc|] int[]|] { }; + var r = (ReadOnlySpan)[|stackalloc|] int[] { }; } } """, @@ -603,7 +603,7 @@ class C { void M() { - ReadOnlySpan r = [|[|stackalloc|] int[0]|] { }; + ReadOnlySpan r = [|stackalloc|] int[0] { }; } } """, @@ -656,7 +656,7 @@ class C { void M() { - ReadOnlySpan r = [|[|stackalloc|] int[0]|]; + ReadOnlySpan r = [|stackalloc|] int[0]; } } """, @@ -914,7 +914,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[1]|]; + Span r = [|stackalloc|] int[1]; r[0] = i; } } @@ -947,7 +947,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[1]|]; + Span r = [|stackalloc|] int[1]; r[0] = i; r[0] = j; } @@ -982,7 +982,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[2]|]; + Span r = [|stackalloc|] int[2]; r[0] = i; r[1] = j; } @@ -1017,7 +1017,7 @@ class C void M(int i, int j) { const int v = 1; - Span r = [|[|stackalloc|] int[2]|]; + Span r = [|stackalloc|] int[2]; r[0] = i; r[v] = j; } @@ -1125,7 +1125,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[2]|]; + Span r = [|stackalloc|] int[2]; // Leading r[0] = i; r[1] = j; // Trailing @@ -1165,7 +1165,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[2]|]; + Span r = [|stackalloc|] int[2]; r[0] = i; // Trailing // Leading r[1] = j; @@ -1205,7 +1205,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[]|] + Span r = [|stackalloc|] int[] { 1, 2 }; @@ -1243,7 +1243,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[]|] + Span r = [|stackalloc|] int[] { 1, 2 @@ -1283,7 +1283,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[]|] { + Span r = [|stackalloc|] int[] { 1, 2 }; } @@ -1319,7 +1319,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[]|] { + Span r = [|stackalloc|] int[] { 1, 2 }; @@ -1357,7 +1357,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|][]|] + Span r = [|stackalloc|][] { 1, 2 }; @@ -1395,7 +1395,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|][]|] + Span r = [|stackalloc|][] { 1, 2 @@ -1435,7 +1435,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|][]|] { + Span r = [|stackalloc|][] { 1, 2 }; } @@ -1471,7 +1471,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|][]|] { + Span r = [|stackalloc|][] { 1, 2 }; @@ -1509,7 +1509,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[1]|]; + Span r = [|stackalloc|] int[1]; r[0] = 1 + 2; } @@ -1547,7 +1547,7 @@ class C { void M(int i, int j) { - Span r = [|[|stackalloc|] int[2]|]; + Span r = [|stackalloc|] int[2]; r[0] = 1 + 2; r[1] = 3 + @@ -1585,7 +1585,7 @@ public async Task TestGlobalStatement1() TestCode = """ using System; - ReadOnlySpan x = [|[|stackalloc|] int[]|] { 1, 2, 3 }; + ReadOnlySpan x = [|stackalloc|] int[] { 1, 2, 3 }; """, FixedCode = """ using System; @@ -1609,7 +1609,7 @@ public async Task TestGlobalStatement2() TestCode = """ using System; - Span r = [|[|stackalloc|] int[2]|]; + Span r = [|stackalloc|] int[2]; r[0] = 1 + 2; r[1] = 3 + From b7ab7b60340947390c433348560adb2662821857 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 14 Dec 2023 15:39:36 +0530 Subject: [PATCH 133/141] Fix UseCollectionInitializerTests --- .../UseCollectionInitializerTests.cs | 70 ++--- ...onInitializerTests_CollectionExpression.cs | 278 +++++++++--------- 2 files changed, 174 insertions(+), 174 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests.cs b/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests.cs index e118706ef5eba..45aafdb9245de 100644 --- a/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests.cs +++ b/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests.cs @@ -65,7 +65,7 @@ class C void M() { var c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); } } """, @@ -125,7 +125,7 @@ class C void M(int[] x) { var c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); c.AddRange(x); } } @@ -159,7 +159,7 @@ class C void M(int[] x) { var c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); foreach (var v in x) c.Add(v); } @@ -195,7 +195,7 @@ class C void M(bool b) { var c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) c.Add(2); } @@ -231,7 +231,7 @@ class C void M(bool b) { var c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) c.Add(2); else @@ -271,7 +271,7 @@ class C void M(bool b) { var c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) { c.Add(2); @@ -527,7 +527,7 @@ class C void M() { var c = [|new|] List(); - [|c.Add(|]0); + c.Add(0); c[1] = 2; } } @@ -560,8 +560,8 @@ class C void M() { var c = [|new|] List(); - [|c.Add(|]1); - [|c.Add(|]2); + c.Add(1); + c.Add(2); throw new System.Exception(); c.Add(3); c.Add(4); @@ -660,7 +660,7 @@ class C void M() { var c = [|new|] List(1); - [|c.Add(|]1); + c.Add(1); } } """, @@ -693,7 +693,7 @@ void M() { List c = null; c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); } } """, @@ -752,8 +752,8 @@ class C void M(List[] array) { array[0] = [|new|] List(); - [|array[0].Add(|]1); - [|array[0].Add(|]2); + array[0].Add(1); + array[0].Add(2); } } """, @@ -807,7 +807,7 @@ void M() { 1 }; - [|c.Add(|]1); + c.Add(1); } } """, @@ -843,7 +843,7 @@ void M() { 1, }; - [|c.Add(|]1); + c.Add(1); } } """, @@ -876,11 +876,11 @@ class C void M(List[] array) { array[0] = [|new|] List(); - [|array[0].Add(|]1); - [|array[0].Add(|]2); + array[0].Add(1); + array[0].Add(2); array[1] = [|new|] List(); - [|array[1].Add(|]3); - [|array[1].Add(|]4); + array[1].Add(3); + array[1].Add(4); } } """, @@ -921,9 +921,9 @@ void M() { var list1 = [|new|] Bar(() => { var list2 = [|new|] List(); - [|list2.Add(|]2); + list2.Add(2); }); - [|list1.Add(|]1); + list1.Add(1); } } @@ -982,9 +982,9 @@ class C void M() { var list1 = [|new|] List(); - [|list1.Add(|]() => { + list1.Add(() => { var list2 = [|new|] List(); - [|list2.Add(|]2); + list2.Add(2); }); } } @@ -1044,8 +1044,8 @@ class C void M() { var c = [|new|] List(); - [|c.Add(|]1); // Goo - [|c.Add(|]2); // Bar + c.Add(1); // Goo + c.Add(2); // Bar } } """, @@ -1079,10 +1079,10 @@ void M() var c = [|new|] List(); // Goo - [|c.Add(|]1); + c.Add(1); // Bar - [|c.Add(|]2); + c.Add(2); } } """, @@ -1117,8 +1117,8 @@ class C void M() { var c = [|new|] Dictionary(); - [|c.Add(|]1, "x"); - [|c.Add(|]2, "y"); + c.Add(1, "x"); + c.Add(2, "y"); } } """, @@ -1154,7 +1154,7 @@ public static void Bar() var items = new List(); var values = [|new|] List(); // Collection initialization can be simplified - [|values.Add(|]item); + values.Add(item); values.AddRange(items); } } @@ -1396,7 +1396,7 @@ public void M() { #if true var items = [|new|] List(); - [|items.Add(|]1); + items.Add(1); #endif } } @@ -1432,7 +1432,7 @@ public void M() { int lastItem; var list = [|new|] List(); - [|list.Add(|]lastItem = 5); + list.Add(lastItem = 5); } } """, @@ -1466,7 +1466,7 @@ public void M() { int lastItem = 0; var list = [|new|] List(); - [|list.Add(|]lastItem += 5); + list.Add(lastItem += 5); } } """, @@ -1499,7 +1499,7 @@ class MyClass public void Main() { var list = [|new|] List(); - [|list.Add(|]1); + list.Add(1); int horse = 1; } @@ -1653,7 +1653,7 @@ await TestInRegularAndScriptAsync( using System.Collections.Generic; var list = [|new|] List(); - [|list.Add(|]1); + list.Add(1); """, """ using System.Collections.Generic; diff --git a/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests_CollectionExpression.cs b/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests_CollectionExpression.cs index 0a160e3d3490a..33dd6a0918e3e 100644 --- a/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests_CollectionExpression.cs +++ b/src/Analyzers/CSharp/Tests/UseCollectionInitializer/UseCollectionInitializerTests_CollectionExpression.cs @@ -48,7 +48,7 @@ class C void M() { var c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); } } """, @@ -97,7 +97,7 @@ class C void M() { var c = [|new|] List(new[] { 1, 2, 3 }); - [|c.Add(|]1); + c.Add(1); } } """, @@ -346,7 +346,7 @@ class C void M() { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); } } """, @@ -375,7 +375,7 @@ class C void M(bool b) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) c.Add(2); } @@ -406,7 +406,7 @@ class C void M(bool b) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) c.Add(2); else @@ -439,7 +439,7 @@ class C void M(bool b) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) { c.Add(2); @@ -472,7 +472,7 @@ class C void M(bool b) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) { c.Add(2); @@ -509,7 +509,7 @@ class C void M(bool b) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) { c.Add(2); @@ -548,7 +548,7 @@ class C void M(bool b) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) { c.Add(2); @@ -595,7 +595,7 @@ class C void M(bool b) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) { } @@ -630,7 +630,7 @@ class C void M(bool b) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); if (b) { c.Add(2); @@ -673,7 +673,7 @@ class C void M() { IList c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); } } """, @@ -705,8 +705,8 @@ class C void M(int[] x) { List c = [|new|] List(); - [|c.Add(|]1); - [|foreach (var v in |]x) + c.Add(1); + foreach (var v in x) c.Add(v); } } @@ -736,8 +736,8 @@ class C void M(int[] x) { List c = [|new|] List(); - [|c.Add(|]1); - [|foreach (var v in |]x) + c.Add(1); + foreach (var v in x) { c.Add(v); } @@ -769,7 +769,7 @@ class C void M(int[] x) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); foreach (var v in x) { c.Add(0); @@ -806,7 +806,7 @@ class C void M(int[] x, int z) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); foreach (var v in x) { c.Add(z); @@ -843,10 +843,10 @@ class C void M(int[] x, int[] y) { List c = [|new|] List(); - [|c.Add(|]1); - [|foreach (var v in |]x) + c.Add(1); + foreach (var v in x) c.Add(v); - [|foreach (var v in |]y) + foreach (var v in y) c.Add(v); } } @@ -876,10 +876,10 @@ class C void M(int[] x, int[] y) { List c = [|new|] List(); - [|foreach (var v in |]x) + foreach (var v in x) c.Add(v); - [|c.Add(|]1); - [|foreach (var v in |]y) + c.Add(1); + foreach (var v in y) c.Add(v); } } @@ -909,11 +909,11 @@ class C void M(int[] x, int[] y) { List c = [|new|] List(); - [|foreach (var v in |]x) + foreach (var v in x) c.Add(v); - [|foreach (var v in |]y) + foreach (var v in y) c.Add(v); - [|c.Add(|]1); + c.Add(1); } } """, @@ -942,7 +942,7 @@ class C async void M(IAsyncEnumerable x) { List c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); await foreach (var v in x) c.Add(v); } @@ -975,8 +975,8 @@ class C void M(int[] x) { List c = [|new|] List(); - [|c.Add(|]1); - [|c.AddRange(|]x); + c.Add(1); + c.AddRange(x); } } """, @@ -1005,10 +1005,10 @@ class C void M(int[] x, int[] y) { List c = [|new|] List(); - [|c.Add(|]1); - [|foreach (var v in |]x) + c.Add(1); + foreach (var v in x) c.Add(v); - [|c.AddRange(|]y); + c.AddRange(y); } } """, @@ -1270,7 +1270,7 @@ class C void M() { List c = [|new|] List(); - [|c.Add(|]0); + c.Add(0); c[1] = 2; } } @@ -1300,8 +1300,8 @@ class C void M() { List c = [|new|] List(); - [|c.Add(|]1); - [|c.Add(|]2); + c.Add(1); + c.Add(2); throw new System.Exception(); c.Add(3); c.Add(4); @@ -1378,7 +1378,7 @@ class C void M() { List c = [|new|] List(1); - [|c.Add(|]1); + c.Add(1); } } """, @@ -1408,7 +1408,7 @@ void M() { List c = null; c = [|new|] List(); - [|c.Add(|]1); + c.Add(1); } } """, @@ -1464,8 +1464,8 @@ class C void M(List[] array) { array[0] = [|new|] List(); - [|array[0].Add(|]1); - [|array[0].Add(|]2); + array[0].Add(1); + array[0].Add(2); } } """, @@ -1527,7 +1527,7 @@ void M() { 1 }; - [|c.Add(|]2); + c.Add(2); } } """, @@ -1562,7 +1562,7 @@ void M() { 1 }; - [|c.Add(|]2); + c.Add(2); } } """, @@ -1597,7 +1597,7 @@ void M() { 1, }; - [|c.Add(|]2); + c.Add(2); } } """, @@ -1632,7 +1632,7 @@ void M(int[] x) { 1 }; - [|foreach (var y in |]x) + foreach (var y in x) c.Add(y); } } @@ -1665,11 +1665,11 @@ class C void M(List[] array) { array[0] = [|new|] List(); - [|array[0].Add(|]1); - [|array[0].Add(|]2); + array[0].Add(1); + array[0].Add(2); array[1] = [|new|] List(); - [|array[1].Add(|]3); - [|array[1].Add(|]4); + array[1].Add(3); + array[1].Add(4); } } """, @@ -1702,9 +1702,9 @@ void M() { Bar list1 = [|new|] Bar(() => { List list2 = [|new|] List(); - [|list2.Add(|]2); + list2.Add(2); }); - [|list1.Add(|]1); + list1.Add(1); } } @@ -1760,9 +1760,9 @@ class C void M() { List list1 = [|new|] List(); - [|list1.Add(|]() => { + list1.Add(() => { List list2 = [|new|] List(); - [|list2.Add(|]2); + list2.Add(2); }); } } @@ -1818,8 +1818,8 @@ class C void M() { List c = [|new|] List(); - [|c.Add(|]1); // Goo - [|c.Add(|]2); // Bar + c.Add(1); // Goo + c.Add(2); // Bar } } """, @@ -1851,11 +1851,11 @@ void M(int[] x, int[] y) { List c = [|new|] List(); // Goo - [|foreach (var v in |]x) + foreach (var v in x) c.Add(v); // Bar - [|foreach (var v in |]y) + foreach (var v in y) c.Add(v); } } @@ -1891,12 +1891,12 @@ void M(int[] x, int[] y) List c = [|new|] List(); // Goo // Bar - [|foreach (var v in |]x) + foreach (var v in x) c.Add(v); // Baz // Quux - [|foreach (var v in |]y) + foreach (var v in y) c.Add(v); } } @@ -2033,10 +2033,10 @@ void M() List c = [|new|] List(); // Goo - [|c.Add(|]1); + c.Add(1); // Bar - [|c.Add(|]2); + c.Add(2); } } """, @@ -2070,8 +2070,8 @@ class C void M() { Dictionary c = [|new|] Dictionary(); - [|c.Add(|]1, "x"); - [|c.Add(|]2, "y"); + c.Add(1, "x"); + c.Add(2, "y"); } } """, @@ -2107,7 +2107,7 @@ public static void Bar() var items = new List(); List values = [|new|] List(); // Collection initialization can be simplified - [|values.Add(|]item); + values.Add(item); values.Remove(item); } } @@ -2385,7 +2385,7 @@ public void M() { #if true List items = [|new|] List(); - [|items.Add(|]1); + items.Add(1); #endif } } @@ -2418,7 +2418,7 @@ public void M() { int lastItem; List list = [|new|] List(); - [|list.Add(|]lastItem = 5); + list.Add(lastItem = 5); } } """, @@ -2449,7 +2449,7 @@ public void M() { int lastItem = 0; List list = [|new|] List(); - [|list.Add(|]lastItem += 5); + list.Add(lastItem += 5); } } """, @@ -2479,7 +2479,7 @@ class MyClass public void Main() { List list = [|new|] List(); - [|list.Add(|]1); + list.Add(1); int horse = 1; } @@ -2630,7 +2630,7 @@ await TestInRegularAndScriptAsync( using System.Collections.Generic; List list = [|new|] List(); - [|list.Add(|]1); + list.Add(1); """, """ using System.Collections.Generic; @@ -3387,7 +3387,7 @@ class C void M() { List c = [|new|] List() { 1, 2 }; - [|c.Add(|]3); + c.Add(3); } } """, @@ -3417,7 +3417,7 @@ void M() { List c = [|new|] List() { 1, 2 }; - [|c.Add(|]3); + c.Add(3); } } """, @@ -3449,7 +3449,7 @@ void M() 1, 2 }; - [|c.Add(|]3); + c.Add(3); } } """, @@ -3483,7 +3483,7 @@ void M() { List c = [|new|] List() { 1, 2 }; - [|c.Add(|]3); + c.Add(3); } } """, @@ -3515,7 +3515,7 @@ void M() List c = [|new|] List() { 1, 2 }; - [|c.Add(|]3); + c.Add(3); } } """, @@ -3550,7 +3550,7 @@ void M() 1, 2, }; - [|c.Add(|]3); + c.Add(3); } } """, @@ -3588,7 +3588,7 @@ void M() 1, 2, }; - [|c.Add(|]3); + c.Add(3); } } """, @@ -3625,7 +3625,7 @@ void M() 1, 2 }; - [|c.Add(|]3); + c.Add(3); } } """, @@ -3661,7 +3661,7 @@ void M() { 1, 2 }; - [|c.Add(|]3); + c.Add(3); } } """, @@ -3696,7 +3696,7 @@ void M() { 1, 2, }; - [|c.Add(|]3); + c.Add(3); } } """, @@ -3728,7 +3728,7 @@ class C void M() { List c = [|new|] List() { 1, 2 }; - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -3764,7 +3764,7 @@ void M() { List c = [|new|] List() { 1, 2 }; - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -3802,7 +3802,7 @@ void M() 1, 2 }; - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -3838,7 +3838,7 @@ void M() { List c = [|new|] List() { 1, 2 }; - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -3875,7 +3875,7 @@ void M() List c = [|new|] List() { 1, 2 }; - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -3915,7 +3915,7 @@ void M() 1, 2, }; - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -3955,7 +3955,7 @@ void M() 1, 2, }; - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -3994,7 +3994,7 @@ void M() 1, 2 }; - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -4031,7 +4031,7 @@ void M() List c = [|new|] List() { 1, 2 }; - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -4067,7 +4067,7 @@ void M() List c = [|new|] List() { 1, 2, }; - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -4101,7 +4101,7 @@ class C void M() { List c = [|new|] List(); - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -4135,9 +4135,9 @@ class C void M() { List c = [|new|] List(); - [|c.Add(|]1 + + c.Add(1 + 2); - [|c.Add(|]3 + + c.Add(3 + 4); } } @@ -4283,7 +4283,7 @@ class C void M() { List c = [|new|] List(1); - [|c.Add(|]0); + c.Add(0); } } """, @@ -4312,7 +4312,7 @@ class C void M() { List c = [|new|] List(0); - [|c.Add(|]1); + c.Add(1); } } """, @@ -4344,8 +4344,8 @@ class C void M(int[] x) { List c = [|new|] List(1 + x.Length); - [|c.Add(|]0); - [|c.AddRange(|]x); + c.Add(0); + c.AddRange(x); } } """, @@ -4374,8 +4374,8 @@ class C void M(int[] x) { List c = [|new|] List(x.Length + 1); - [|c.Add(|]0); - [|c.AddRange(|]x); + c.Add(0); + c.AddRange(x); } } """, @@ -4404,9 +4404,9 @@ class C void M(int[] x) { List c = [|new|] List(2 + x.Length); - [|c.Add(|]0); - [|c.AddRange(|]x); - [|c.Add(|]1); + c.Add(0); + c.AddRange(x); + c.Add(1); } } """, @@ -4435,10 +4435,10 @@ class C void M(int[] x, int[] y) { List c = [|new|] List(2 + x.Length + y.Length); - [|c.Add(|]0); - [|c.AddRange(|]x); - [|c.AddRange(|]y); - [|c.Add(|]1); + c.Add(0); + c.AddRange(x); + c.AddRange(y); + c.Add(1); } } """, @@ -4467,10 +4467,10 @@ class C void M(int[] x, int[] y) { List c = [|new|] List(x.Length + y.Length + 2); - [|c.Add(|]0); - [|c.AddRange(|]x); - [|c.AddRange(|]y); - [|c.Add(|]1); + c.Add(0); + c.AddRange(x); + c.AddRange(y); + c.Add(1); } } """, @@ -4499,10 +4499,10 @@ class C void M(int[] x, IList y) { List c = [|new|] List(x.Length + y.Count + 2); - [|c.Add(|]0); - [|c.AddRange(|]x); - [|c.AddRange(|]y); - [|c.Add(|]1); + c.Add(0); + c.AddRange(x); + c.AddRange(y); + c.Add(1); } } """, @@ -4532,10 +4532,10 @@ class C void M(int[] x, IEnumerable y) { List c = [|new|] List(x.Length + y.Count() + 2); - [|c.Add(|]0); - [|c.AddRange(|]x); - [|c.AddRange(|]y); - [|c.Add(|]1); + c.Add(0); + c.AddRange(x); + c.AddRange(y); + c.Add(1); } } """, @@ -4566,8 +4566,8 @@ class C void M(int[] x, IEnumerable y) { List c = [|new|] List(x.Length + y.Count() + 2) { 0, 1 }; - [|c.AddRange(|]x); - [|c.AddRange(|]y); + c.AddRange(x); + c.AddRange(y); } } """, @@ -4597,8 +4597,8 @@ class C void M(int[] x) { List c = [|new|] List(1 + x.Length); - [|c.Add(|]1); - [|foreach (var v in |]x) + c.Add(1); + foreach (var v in x) c.Add(v); } } @@ -4629,10 +4629,10 @@ class C void M(int[] x, IEnumerable y) { List c = [|new|] List(1 + x.Length + y.Count() + 1); - [|c.Add(|]0); - [|c.AddRange(|]x); - [|c.AddRange(|]y); - [|c.Add(|]1); + c.Add(0); + c.AddRange(x); + c.AddRange(y); + c.Add(1); } } """, @@ -4663,7 +4663,7 @@ class C void M(int[] x, IEnumerable y) { List c = [|new|] List(1 + x.Length + y.Count()); - [|c.Add(|]0); + c.Add(0); c.AddRange(x); c.AddRange(y); c.Add(1); @@ -4702,7 +4702,7 @@ class C void M(int[] x, IEnumerable y) { List c = [|new|] List(1 - x.Length); - [|c.Add(|]0); + c.Add(0); c.AddRange(x); } } @@ -4736,7 +4736,7 @@ class C void M(int[] x, IEnumerable y) { List c = [|new|] List(1); - [|c.Add(|]0); + c.Add(0); c.AddRange(x); } } @@ -4770,7 +4770,7 @@ class C void M(int[] x, int[] y) { List c = [|new|] List(1 + x.Length + y.Length); - [|c.Add(|]0); + c.Add(0); c.AddRange(x); } } @@ -4804,7 +4804,7 @@ class C void M(int[] x, int[] y) { List c = [|new|] List(x); - [|c.Add(|]0); + c.Add(0); c.AddRange(y); } } @@ -4839,9 +4839,9 @@ class C void M(int[] x, IEnumerable y) { List c = [|new|] List(x.Length + y.Count() + 2) { 0 }; - [|c.Add(|]1); - [|c.AddRange(|]x); - [|c.AddRange(|]y); + c.Add(1); + c.AddRange(x); + c.AddRange(y); } } """, @@ -4872,7 +4872,7 @@ class C void M(int[] x, IEnumerable y) { List c = [|new|] List(1 + y.Count()); - [|c.Add(|]0); + c.Add(0); c.AddRange(x); } } @@ -4907,10 +4907,10 @@ class C void M(int[] x, IList y) { List c = [|new|] List(x.Length + x.Length + 2); - [|c.Add(|]0); - [|c.AddRange(|]x); - [|c.AddRange(|]x); - [|c.Add(|]1); + c.Add(0); + c.AddRange(x); + c.AddRange(x); + c.Add(1); } } """, @@ -4939,7 +4939,7 @@ class C void M(int[] x, IList y) { List c = [|new|] List(x.Length + 2); - [|c.Add(|]0); + c.Add(0); c.AddRange(x); c.AddRange(x); c.Add(1); @@ -4977,7 +4977,7 @@ class C void M(int[] x, IList y) { List c = [|new|] List(x.Length + x.Length + x.Length + 2); - [|c.Add(|]0); + c.Add(0); c.AddRange(x); c.AddRange(x); c.Add(1); From 356063450ae1c73aa3fe894472e7decb4b7528a4 Mon Sep 17 00:00:00 2001 From: AlekseyTs Date: Thu, 14 Dec 2023 06:05:03 -0800 Subject: [PATCH 134/141] Fix null ref exception in Symbol.CanBeReferencedByName for VB (#71253) Fixes #71115. --- .../Analysis/FlowAnalysis/DataFlowPass.vb | 6 + .../VisualBasic/Portable/Symbols/Symbol.vb | 6 +- .../Emit/CodeGen/CodeGenRefReturnTests.vb | 178 ++++++++++++++++++ 3 files changed, 188 insertions(+), 2 deletions(-) diff --git a/src/Compilers/VisualBasic/Portable/Analysis/FlowAnalysis/DataFlowPass.vb b/src/Compilers/VisualBasic/Portable/Analysis/FlowAnalysis/DataFlowPass.vb index 59997714be17e..6438b888d7d88 100644 --- a/src/Compilers/VisualBasic/Portable/Analysis/FlowAnalysis/DataFlowPass.vb +++ b/src/Compilers/VisualBasic/Portable/Analysis/FlowAnalysis/DataFlowPass.vb @@ -1022,6 +1022,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Case BoundKind.Local Dim local As LocalSymbol = DirectCast(node, BoundLocal).LocalSymbol + + If local.IsCompilerGenerated AndAlso Not Me.ProcessCompilerGeneratedLocals Then + ' For consistency with Assign behavior, which does not process compiler generated temporary locals. + Return True + End If + If local.DeclarationKind <> LocalDeclarationKind.AmbiguousLocals Then unassignedSlot = VariableSlot(local) diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Symbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Symbol.vb index 4b57e06fd523d..cac4cfd3bedd2 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Symbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Symbol.vb @@ -589,8 +589,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Public ReadOnly Property CanBeReferencedByName As Boolean Get Select Case Me.Kind - Case SymbolKind.Local, - SymbolKind.Label, + Case SymbolKind.Local + Return If(Me.Name?.Length, 0) > 0 + + Case SymbolKind.Label, SymbolKind.Alias ' Can't be imported, but might have syntax errors in which case we use an empty name: Return Me.Name.Length > 0 diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenRefReturnTests.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenRefReturnTests.vb index 237f366ee1cf6..38f7db79e94ac 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenRefReturnTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenRefReturnTests.vb @@ -3593,6 +3593,184 @@ End Module", verifier.VerifyDiagnostics() End Sub + + + Public Sub With_RegionAnalysisRefIndexer() + Dim comp1 = CreateCSharpCompilation( +"public class C +{ + private T _p; + public ref T this[int i] + { + get { return ref _p; } + } +}") + comp1.VerifyDiagnostics() + Dim comp2 = CreateVisualBasicCompilation( + Nothing, +" +Public Class LocalDeclConversionError + Private Structure SomeStruct + Dim SomeField As Integer + Dim Text As String + End Structure + + Dim lst As New C(Of SomeStruct) + + Sub S() + Dim s As String + + With lst(0) + .SomeField = 5 + s = .Text + End With + End Sub +End Class +", + referencedCompilations:={comp1}, + compilationOptions:=TestOptions.DebugDll) + + comp2.AssertTheseEmitDiagnostics() + + Dim tree = comp2.SyntaxTrees(0) + Dim model = comp2.GetSemanticModel(tree) + Dim syntax = tree.GetRoot().DescendantNodes().OfType(Of Syntax.MethodBlockBaseSyntax).Single() + + Dim methodFlow = model.AnalyzeDataFlow(syntax.Statements.First(), syntax.Statements.Last()) + Assert.True(methodFlow.Succeeded) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.ReadInside)) + Assert.Equal("[s]", GetSymbolNamesJoined(methodFlow.AlwaysAssigned)) + Assert.Equal(Nothing, GetSymbolNamesJoined(methodFlow.Captured)) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.DataFlowsIn)) + Assert.Equal(Nothing, GetSymbolNamesJoined(methodFlow.DataFlowsOut)) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.DefinitelyAssignedOnEntry)) + Assert.Equal("[Me], [s]", GetSymbolNamesJoined(methodFlow.DefinitelyAssignedOnExit)) + Assert.Equal(Nothing, GetSymbolNamesJoined(methodFlow.ReadOutside)) + Assert.Equal("[s]", GetSymbolNamesJoined(methodFlow.VariablesDeclared)) + Assert.Equal("[s]", GetSymbolNamesJoined(methodFlow.WrittenInside)) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.WrittenOutside)) + End Sub + + + + Public Sub With_RegionAnalysisRefProperty() + Dim comp1 = CreateCSharpCompilation( +"public class C +{ + private T _p; + public ref T P + { + get { return ref _p; } + } +}") + comp1.VerifyDiagnostics() + Dim comp2 = CreateVisualBasicCompilation( + Nothing, +" +Public Class LocalDeclConversionError + Private Structure SomeStruct + Dim SomeField As Integer + Dim Text As String + End Structure + + Dim lst As New C(Of SomeStruct) + + Sub S() + Dim s As String + + With lst.P + .SomeField = 5 + s = .Text + End With + End Sub +End Class +", + referencedCompilations:={comp1}, + compilationOptions:=TestOptions.DebugDll) + + comp2.AssertTheseEmitDiagnostics() + + Dim tree = comp2.SyntaxTrees(0) + Dim model = comp2.GetSemanticModel(tree) + Dim syntax = tree.GetRoot().DescendantNodes().OfType(Of Syntax.MethodBlockBaseSyntax).Single() + + Dim methodFlow = model.AnalyzeDataFlow(syntax.Statements.First(), syntax.Statements.Last()) + Assert.True(methodFlow.Succeeded) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.ReadInside)) + Assert.Equal("[s]", GetSymbolNamesJoined(methodFlow.AlwaysAssigned)) + Assert.Equal(Nothing, GetSymbolNamesJoined(methodFlow.Captured)) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.DataFlowsIn)) + Assert.Equal(Nothing, GetSymbolNamesJoined(methodFlow.DataFlowsOut)) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.DefinitelyAssignedOnEntry)) + Assert.Equal("[Me], [s]", GetSymbolNamesJoined(methodFlow.DefinitelyAssignedOnExit)) + Assert.Equal(Nothing, GetSymbolNamesJoined(methodFlow.ReadOutside)) + Assert.Equal("[s]", GetSymbolNamesJoined(methodFlow.VariablesDeclared)) + Assert.Equal("[s]", GetSymbolNamesJoined(methodFlow.WrittenInside)) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.WrittenOutside)) + End Sub + + + + Public Sub With_RegionAnalysisRefMethod() + Dim comp1 = CreateCSharpCompilation( +"public class C +{ + private T _p; + public ref T GetP() + { + return ref _p; + } +}") + comp1.VerifyDiagnostics() + Dim comp2 = CreateVisualBasicCompilation( + Nothing, +" +Public Class LocalDeclConversionError + Private Structure SomeStruct + Dim SomeField As Integer + Dim Text As String + End Structure + + Dim lst As New C(Of SomeStruct) + + Sub S() + Dim s As String + + With lst.GetP() + .SomeField = 5 + s = .Text + End With + End Sub +End Class +", + referencedCompilations:={comp1}, + compilationOptions:=TestOptions.DebugDll) + + comp2.AssertTheseEmitDiagnostics() + + Dim tree = comp2.SyntaxTrees(0) + Dim model = comp2.GetSemanticModel(tree) + Dim syntax = tree.GetRoot().DescendantNodes().OfType(Of Syntax.MethodBlockBaseSyntax).Single() + + Dim methodFlow = model.AnalyzeDataFlow(syntax.Statements.First(), syntax.Statements.Last()) + Assert.True(methodFlow.Succeeded) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.ReadInside)) + Assert.Equal("[s]", GetSymbolNamesJoined(methodFlow.AlwaysAssigned)) + Assert.Equal(Nothing, GetSymbolNamesJoined(methodFlow.Captured)) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.DataFlowsIn)) + Assert.Equal(Nothing, GetSymbolNamesJoined(methodFlow.DataFlowsOut)) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.DefinitelyAssignedOnEntry)) + Assert.Equal("[Me], [s]", GetSymbolNamesJoined(methodFlow.DefinitelyAssignedOnExit)) + Assert.Equal(Nothing, GetSymbolNamesJoined(methodFlow.ReadOutside)) + Assert.Equal("[s]", GetSymbolNamesJoined(methodFlow.VariablesDeclared)) + Assert.Equal("[s]", GetSymbolNamesJoined(methodFlow.WrittenInside)) + Assert.Equal("[Me]", GetSymbolNamesJoined(methodFlow.WrittenOutside)) + End Sub + + Protected Shared Function GetSymbolNamesJoined(Of T As ISymbol)(symbols As IEnumerable(Of T)) As String + Return If(Not symbols.IsEmpty(), String.Join(", ", symbols.Select(Function(symbol) "[" + symbol.Name + "]")), Nothing) + End Function + End Class End Namespace From bed73a947a6ba71ef7fdcc5670372a69ed7c8319 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 14 Dec 2023 19:46:31 +0530 Subject: [PATCH 135/141] Fix more tests that expected diagnostic for fading location --- ...nvokeDelegateWithConditionalAccessTests.cs | 202 ++++-------------- ...eWithConditionalAccessTests_FixAllTests.cs | 146 +------------ 2 files changed, 40 insertions(+), 308 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests.cs b/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests.cs index c73e8ccd6c7c0..457fa1c2a131d 100644 --- a/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests.cs +++ b/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests.cs @@ -34,44 +34,12 @@ class C { System.Action a; - void Goo() - { - [||]var v = a; - if (v != null) - { - v(); - } - } - } - """, - """ - class C - { - System.Action a; - - void Goo() - { - a?.Invoke(); - } - } - """); - } - - [Fact] - public async Task TestOnIf() - { - await TestInRegularAndScript1Async( - """ - class C - { - System.Action a; - void Goo() { var v = a; - [||]if (v != null) + if (v != null) { - v(); + [||]v(); } } } @@ -153,10 +121,10 @@ class C void Goo() { - [||]var v = a; + var v = a; if (null != v) { - v(); + [||]v(); } } } @@ -185,9 +153,9 @@ class C void Goo() { - [||]var v = a; + var v = a; if (null != v) - v(); + [||]v(); } } """, @@ -216,10 +184,10 @@ class C void Goo() { bool b = true; - [||]var v = b ? a : null; + var v = b ? a : null; if (v != null) { - v(); + [||]v(); } } } @@ -299,9 +267,9 @@ class C void Goo() { var v = a, x = a; - [||]if (v != null) + if (v != null) { - v(); + [||]v(); } } } @@ -364,9 +332,9 @@ class C void Goo() { var v = a; - [||]if (v != null) + if (v != null) { - v(); + [||]v(); } v = null; @@ -402,9 +370,9 @@ class C void M() { - [||]if (this.E != null) + if (this.E != null) { - this.E(this, EventArgs.Empty); + [||]this.E(this, EventArgs.Empty); } } } @@ -475,9 +443,9 @@ void M() if (true != true) { } - else [||]if (this.E != null) + else if (this.E != null) { - this.E(this, EventArgs.Empty); + [||]this.E(this, EventArgs.Empty); } } } @@ -503,45 +471,6 @@ void M() """); } - [Fact] - public async Task TestInElseClause2() - { - await TestInRegularAndScript1Async( - """ - using System; - - class C - { - public event EventHandler E; - - void M() - { - if (true != true) - { - } - else [||]if (this.E != null) - this.E(this, EventArgs.Empty); - } - } - """, - """ - using System; - - class C - { - public event EventHandler E; - - void M() - { - if (true != true) - { - } - else this.E?.Invoke(this, EventArgs.Empty); - } - } - """); - } - [Fact] public async Task TestTrivia1() { @@ -553,10 +482,10 @@ class C void Goo() { // Comment - [||]var v = a; + var v = a; if (v != null) { - v(); // Comment2 + [||]v(); // Comment2 } } } @@ -585,9 +514,9 @@ class C void Goo() { // Comment - [||]if (a != null) + if (a != null) { - a(); // Comment2 + [||]a(); // Comment2 } } } @@ -616,8 +545,8 @@ class C void Goo() { // Comment - [||]var v = a; - if (v != null) { v(); /* 123 */ } // trails + var v = a; + if (v != null) { [||]v(); /* 123 */ } // trails System.Console.WriteLine(); } } @@ -646,7 +575,7 @@ class C System.Action a; void Goo() { - [||]if (a != null) { a(); /* 123 */ } // trails + if (a != null) { [||]a(); /* 123 */ } // trails System.Console.WriteLine(); } } @@ -664,41 +593,6 @@ void Goo() """); } - /// - /// tests locations where the fix is offered. - /// - [Fact] - public async Task TestFixOfferedOnIf() - { - await TestInRegularAndScript1Async( - """ - class C - { - System.Action a; - - void Goo() - { - var v = a; - [||]if (v != null) - { - v(); - } - } - } - """, - """ - class C - { - System.Action a; - - void Goo() - { - a?.Invoke(); - } - } - """); - } - /// /// tests locations where the fix is offered. /// @@ -743,24 +637,6 @@ class C { System.Action a; - void Goo() - { - [||]var v = a; - v?.Invoke(); - } - } - """); - } - - [Fact] - public async Task TestMissingOnConditionalInvocation2() - { - await TestMissingInRegularAndScriptAsync( - """ - class C - { - System.Action a; - void Goo() { var v = a; @@ -872,9 +748,9 @@ void Goo() { var v = a; int x; - [||]if (v != null) + if (v != null) { - v(); + [||]v(); } } } @@ -906,9 +782,9 @@ class C int Goo() { var v = a; - [||]if (v != null) + if (v != null) { - return v(); + [||]return v(); } } } @@ -927,9 +803,9 @@ class C void Goo() { Action v = () => {}; - [||]if (v != null) + if (v != null) { - v(); + [||]v(); } } } @@ -960,9 +836,9 @@ class C void Goo() { Action v = (() => {}); - [||]if (v != null) + if (v != null) { - v(); + [||]v(); } } } @@ -993,9 +869,9 @@ class C void Goo() { Action v = delegate {}; - [||]if (v != null) + if (v != null) { - v(); + [||]v(); } } } @@ -1026,9 +902,9 @@ class C void Goo() { Action v = Console.WriteLine; - [||]if (v != null) + if (v != null) { - v(); + [||]v(); } } } @@ -1058,8 +934,8 @@ class C { void M() { - [||]if (Event != null) - Event.Invoke(this, EventArgs.Empty); + if (Event != null) + [||]Event.Invoke(this, EventArgs.Empty); } event EventHandler Event; @@ -1091,10 +967,10 @@ class C void Goo() { - [||]var v = a; + var v = a; if (v != null) { - v.Invoke(); + [||]v.Invoke(); } } } diff --git a/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests_FixAllTests.cs index 5079cc29cec89..c81e8d548a473 100644 --- a/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests_FixAllTests.cs +++ b/src/Analyzers/CSharp/Tests/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessTests_FixAllTests.cs @@ -21,78 +21,6 @@ await TestInRegularAndScriptAsync( { System.Action a; - void Goo() - { - {|FixAllInDocument:var|} v = a; - if (v != null) - { - v(); - } - - var x = a; - if (x != null) - { - x(); - } - } -}", -@"class C -{ - System.Action a; - - void Goo() - { - a?.Invoke(); - - a?.Invoke(); - } -}"); - } - - [Fact] - public async Task TestFixAllInDocument2() - { - await TestInRegularAndScriptAsync( -@"class C -{ - System.Action a; - - void Goo() - { - var v = a; - {|FixAllInDocument:if|} (v != null) - { - v(); - } - - var x = a; - if (x != null) - { - x(); - } - } -}", -@"class C -{ - System.Action a; - - void Goo() - { - a?.Invoke(); - - a?.Invoke(); - } -}"); - } - - [Fact] - public async Task TestFixAllInDocument3() - { - await TestInRegularAndScriptAsync( -@"class C -{ - System.Action a; - void Goo() { var v = a; @@ -122,79 +50,7 @@ void Goo() } [Fact] - public async Task TestFixAllInDocument4() - { - await TestInRegularAndScriptAsync( -@"class C -{ - System.Action a; - - void Goo() - { - var v = a; - if (v != null) - { - v(); - } - - {|FixAllInDocument:var|} x = a; - if (x != null) - { - x(); - } - } -}", -@"class C -{ - System.Action a; - - void Goo() - { - a?.Invoke(); - - a?.Invoke(); - } -}"); - } - - [Fact] - public async Task TestFixAllInDocument5() - { - await TestInRegularAndScriptAsync( -@"class C -{ - System.Action a; - - void Goo() - { - var v = a; - if (v != null) - { - v(); - } - - var x = a; - {|FixAllInDocument:if|} (x != null) - { - x(); - } - } -}", -@"class C -{ - System.Action a; - - void Goo() - { - a?.Invoke(); - - a?.Invoke(); - } -}"); - } - - [Fact] - public async Task TestFixAllInDocument6() + public async Task TestFixAllInDocument2() { await TestInRegularAndScriptAsync( @"class C From d9a22c3015709f05bdd82b43bbb87f759da7a7d0 Mon Sep 17 00:00:00 2001 From: Collin Alpert Date: Thu, 14 Dec 2023 15:21:42 +0100 Subject: [PATCH 136/141] Add GetDeclaredSymbol overload for LocalFunctionStatementSyntax (#71169) Fixes #71028 --- .../CSharp/Portable/CSharpExtensions.cs | 11 ++++++++++ .../CSharp/Portable/PublicAPI.Unshipped.txt | 1 + .../Semantic/Semantics/LocalFunctionTests.cs | 21 +++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/src/Compilers/CSharp/Portable/CSharpExtensions.cs b/src/Compilers/CSharp/Portable/CSharpExtensions.cs index 85950e99e3b91..dc954a88f0886 100644 --- a/src/Compilers/CSharp/Portable/CSharpExtensions.cs +++ b/src/Compilers/CSharp/Portable/CSharpExtensions.cs @@ -1619,6 +1619,17 @@ public static Conversion ClassifyConversion(this SemanticModel? semanticModel, i var csmodel = semanticModel as CSharpSemanticModel; return csmodel?.GetDeclaredSymbol(node, cancellationToken); } + + /// + /// Given a local function declaration syntax, get the corresponding symbol. + /// +#pragma warning disable RS0026 + public static IMethodSymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, LocalFunctionStatementSyntax node, CancellationToken cancellationToken = default(CancellationToken)) +#pragma warning restore RS0026 + { + var csmodel = semanticModel as CSharpSemanticModel; + return csmodel?.GetDeclaredSymbol(node, cancellationToken); + } #endregion } } diff --git a/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt b/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt index 98b285b768cf9..1f9cdf19375ac 100644 --- a/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt @@ -3,5 +3,6 @@ Microsoft.CodeAnalysis.CSharp.Conversion.IsCollectionExpression.get -> bool Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.ReadOnlyKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken refKindKeyword, Microsoft.CodeAnalysis.SyntaxToken readOnlyKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.WithReadOnlyKeyword(Microsoft.CodeAnalysis.SyntaxToken readOnlyKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! +static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax! node, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.IMethodSymbol? static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetElementConversion(this Microsoft.CodeAnalysis.Operations.ISpreadOperation! spread) -> Microsoft.CodeAnalysis.CSharp.Conversion static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CrefParameter(Microsoft.CodeAnalysis.SyntaxToken refKindKeyword, Microsoft.CodeAnalysis.SyntaxToken readOnlyKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! \ No newline at end of file diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs index c06b8ee60ce3e..02f1144c8d2d4 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs @@ -10278,5 +10278,26 @@ async Task M1() Diagnostic(ErrorCode.ERR_UseDefViolation, "a").WithArguments("a").WithLocation(11, 27) ); } + + [Fact] + public void TestLocalFunctionDeclaration() + { + var compilation = CreateCompilation(""" + class Test + { + void M() + { + int LocalFunc(string s) {} + } + } + """); + var tree = compilation.SyntaxTrees[0]; + var semanticModel = compilation.GetSemanticModel(tree); + var root = tree.GetCompilationUnitRoot(); + var localFunction = root.DescendantNodes().OfType().Single(); + IMethodSymbol methodSymbol = semanticModel.GetDeclaredSymbol(localFunction); + + Assert.Equal("System.Int32 LocalFunc(System.String s)", methodSymbol.ToTestDisplayString()); + } } } From 5249865bc562b64333ae80de6ccb47e7881b7840 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:39:13 +0000 Subject: [PATCH 137/141] Update dependencies from https://github.com/dotnet/arcade build 20231213.3 (#71259) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 12 ++++++------ eng/common/templates/job/source-index-stage1.yml | 10 +++++----- eng/common/tools.ps1 | 5 ----- eng/common/tools.sh | 5 ----- global.json | 4 ++-- 5 files changed, 13 insertions(+), 23 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9a985a756f7d2..db0caaed53eb0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -43,14 +43,14 @@ - + https://github.com/dotnet/arcade - 1f6c5acef9bdf9d4bf1eded044eeec0d7d19560d + b6349a217d7e2f6b5c1831702f8beef5c171da3f - + https://github.com/dotnet/arcade - 1f6c5acef9bdf9d4bf1eded044eeec0d7d19560d + b6349a217d7e2f6b5c1831702f8beef5c171da3f https://github.com/dotnet/symreader @@ -65,9 +65,9 @@ https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - 1f6c5acef9bdf9d4bf1eded044eeec0d7d19560d + b6349a217d7e2f6b5c1831702f8beef5c171da3f https://github.com/dotnet/roslyn-analyzers diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml index b98202aa02d82..795233662623d 100644 --- a/eng/common/templates/job/source-index-stage1.yml +++ b/eng/common/templates/job/source-index-stage1.yml @@ -1,6 +1,6 @@ parameters: runAsPublic: false - sourceIndexPackageVersion: 1.0.1-20230228.2 + sourceIndexPackageVersion: 1.0.1-20231213.4 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" preSteps: [] @@ -30,20 +30,20 @@ jobs: pool: ${{ if eq(variables['System.TeamProject'], 'public') }}: name: $(DncEngPublicBuildPool) - demands: ImageOverride -equals windows.vs2019.amd64.open + demands: ImageOverride -equals windows.vs2022.amd64.open ${{ if eq(variables['System.TeamProject'], 'internal') }}: name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals windows.vs2019.amd64 + demands: ImageOverride -equals windows.vs2022.amd64 steps: - ${{ each preStep in parameters.preSteps }}: - ${{ preStep }} - task: UseDotNet@2 - displayName: Use .NET Core SDK 6 + displayName: Use .NET 8 SDK inputs: packageType: sdk - version: 6.0.x + version: 8.0.x installationPath: $(Agent.TempDirectory)/dotnet workingDirectory: $(Agent.TempDirectory) diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 162dee2b9363c..540393a6634bf 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -165,11 +165,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 } - # Source Build uses DotNetCoreSdkDir variable - if ($env:DotNetCoreSdkDir -ne $null) { - $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir - } - # Find the first path on %PATH% that contains the dotnet.exe if ($useInstalledDotNetCli -and (-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -eq $null)) { $dotnetExecutable = GetExecutableFileName 'dotnet' diff --git a/eng/common/tools.sh b/eng/common/tools.sh index e98daf50c6b67..9e979ac16f62f 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -123,11 +123,6 @@ function InitializeDotNetCli { # so it doesn't output warnings to the console. export LTTNG_HOME="$HOME" - # Source Build uses DotNetCoreSdkDir variable - if [[ -n "${DotNetCoreSdkDir:-}" ]]; then - export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" - fi - # Find the first path on $PATH that contains the dotnet.exe if [[ "$use_installed_dotnet_cli" == true && $global_json_has_runtimes == false && -z "${DOTNET_INSTALL_DIR:-}" ]]; then local dotnet_path=`command -v dotnet` diff --git a/global.json b/global.json index e0acd019d7140..34712b49879b9 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "xcopy-msbuild": "17.8.1-2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23612.2", - "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23612.2" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23613.3", + "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23613.3" } } From 3a2080970808a44ed0bfbdfa756bee7f6a9b9652 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 14 Dec 2023 22:16:06 +0530 Subject: [PATCH 138/141] Add check for EffectiveAnalysisLevelStyle in code style targets Fixes #71260 Regressed with #71173 --- src/CodeStyle/Tools/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CodeStyle/Tools/Program.cs b/src/CodeStyle/Tools/Program.cs index 789e1df5c7d80..94cc39d53899c 100644 --- a/src/CodeStyle/Tools/Program.cs +++ b/src/CodeStyle/Tools/Program.cs @@ -260,7 +260,7 @@ and an implied numerical option (such as '4') --> + ('$(AnalysisLevelStyle)' != '$(AnalysisLevel)' or '$(AnalysisModeStyle)' != '$(AnalysisMode)' or ('$(EffectiveAnalysisLevelStyle)' != '' and $([MSBuild]::VersionGreaterThanOrEquals('$(EffectiveAnalysisLevelStyle)', '9.0'))))"> From 127d059b6bf5db6956ddef97c2d3012f44183ba6 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Thu, 14 Dec 2023 12:29:17 -0600 Subject: [PATCH 139/141] Update MSBuild ref dependency (#71069) --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 89f47dede0d32..bba99f1fb9478 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -32,7 +32,7 @@ 17.8.9-preview 17.8.36711 - 16.10.0 + 17.3.2 17.5.0